Initial commit
This commit is contained in:
commit
fa06c402e6
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
.env
|
||||||
|
config.json
|
||||||
|
.vsls.json
|
20
.prettierrc.json
Normal file
20
.prettierrc.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"tabWidth": 8,
|
||||||
|
"useTabs": true,
|
||||||
|
"arrowParens": "always",
|
||||||
|
|
||||||
|
"bracketSameLine": true,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"embeddedLanguageFormatting": "auto",
|
||||||
|
"endOfLine": "lf",
|
||||||
|
"htmlWhitespaceSensitivity": "css",
|
||||||
|
"insertPragma": false,
|
||||||
|
"jsxSingleQuote": false,
|
||||||
|
"printWidth": 225,
|
||||||
|
"proseWrap": "preserve",
|
||||||
|
"quoteProps": "as-needed",
|
||||||
|
"requirePragma": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
18
README.MD
Normal file
18
README.MD
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# ATAS
|
||||||
|
ATAS - Automatisches Telefon Alamierungs System
|
||||||
|
|
||||||
|
## Serving static files from node_modules
|
||||||
|
Files from explicit dirs inside `node_modules` will be served below `/libs`.
|
||||||
|
|
||||||
|
## Serving static files from /static
|
||||||
|
Files from the `/static` folder will be served below `/static`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Funktionen:
|
||||||
|
- Mehrere Alarmketten
|
||||||
|
- Konfigurierbare Zeit zwischen eskalierung
|
||||||
|
- Alarm MP3
|
||||||
|
- Erklärung MP3
|
||||||
|
- Quittierung MP3
|
||||||
|
- Verabschiedung MP3
|
18457
docs/index.html
Normal file
18457
docs/index.html
Normal file
File diff suppressed because one or more lines are too long
61
docs/schema.dbml
Normal file
61
docs/schema.dbml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
//// ------------------------------------------------------
|
||||||
|
//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
|
||||||
|
//// ------------------------------------------------------
|
||||||
|
|
||||||
|
Project "AssetFlow" {
|
||||||
|
database_type: ''
|
||||||
|
Note: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
Table AlarmContacts {
|
||||||
|
id Int [pk, increment]
|
||||||
|
name String [not null]
|
||||||
|
phone String [unique, not null]
|
||||||
|
comment String
|
||||||
|
Prios Priorities [not null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Table Priorities {
|
||||||
|
id Int [pk, increment]
|
||||||
|
Contact AlarmContacts [not null]
|
||||||
|
contactId Int [not null]
|
||||||
|
priority Int [not null]
|
||||||
|
actionplan ActionPlan [not null]
|
||||||
|
actionplanId Int [not null]
|
||||||
|
|
||||||
|
indexes {
|
||||||
|
(priority, actionplanId) [unique]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Table ActionPlan {
|
||||||
|
id Int [pk, increment]
|
||||||
|
name String [not null]
|
||||||
|
comment String
|
||||||
|
prio Priorities [not null]
|
||||||
|
content Content [not null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Table Content {
|
||||||
|
id Int [pk, increment]
|
||||||
|
type contentType [not null]
|
||||||
|
name String [not null]
|
||||||
|
filename String [not null]
|
||||||
|
actionplan ActionPlan [not null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Table ActionPlanToContent {
|
||||||
|
contentId Int [ref: > Content.id]
|
||||||
|
actionplanId Int [ref: > ActionPlan.id]
|
||||||
|
}
|
||||||
|
|
||||||
|
Enum contentType {
|
||||||
|
voice_alarm
|
||||||
|
voice_explainer
|
||||||
|
voice_acknowledgement
|
||||||
|
voice_ending
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref: Priorities.contactId > AlarmContacts.id
|
||||||
|
|
||||||
|
Ref: Priorities.actionplanId > ActionPlan.id
|
1
docs/styles/main.css
Normal file
1
docs/styles/main.css
Normal file
File diff suppressed because one or more lines are too long
6500
package-lock.json
generated
Normal file
6500
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
54
package.json
Normal file
54
package.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"name": "atas",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"prestart": "npm run build",
|
||||||
|
"start": "node .",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"author": "[Project-Name-Here]",
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"description": "ATAS - Automatisches Telefon Alamierungs System",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.project-name-here.de/Project-Name-Here/atas"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"asterisk"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/cors": "^2.8.17",
|
||||||
|
"@types/express": "^5.0.0",
|
||||||
|
"@types/express-fileupload": "^1.5.1",
|
||||||
|
"@types/express-session": "^1.18.1",
|
||||||
|
"@types/lodash": "^4.17.14",
|
||||||
|
"@types/node": "^22.10.5",
|
||||||
|
"@types/passport": "^1.0.17",
|
||||||
|
"@types/passport-local": "^1.0.38",
|
||||||
|
"@types/signale": "^1.4.7",
|
||||||
|
"eslint": "^9.18.0",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"prisma": "^6.2.1",
|
||||||
|
"prisma-dbml-generator": "^0.12.0",
|
||||||
|
"prisma-docs-generator": "^0.8.0",
|
||||||
|
"tsx": "^4.19.2",
|
||||||
|
"typescript": "^5.7.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@prisma/client": "^6.2.1",
|
||||||
|
"bulma": "^1.0.3",
|
||||||
|
"eta": "^3.5.0",
|
||||||
|
"express": "^4.21.2",
|
||||||
|
"express-fileupload": "^1.5.1",
|
||||||
|
"express-session": "^1.18.1",
|
||||||
|
"jquery": "^3.7.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"passport": "^0.7.0",
|
||||||
|
"passport-local": "^1.0.0",
|
||||||
|
"signale": "^1.4.0",
|
||||||
|
"tslog": "^4.9.3"
|
||||||
|
}
|
||||||
|
}
|
100
prisma/schema.prisma
Normal file
100
prisma/schema.prisma
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
// This is your Prisma schema file,
|
||||||
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||||
|
|
||||||
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||||
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||||
|
|
||||||
|
generator client {
|
||||||
|
provider = "prisma-client-js"
|
||||||
|
}
|
||||||
|
|
||||||
|
datasource db {
|
||||||
|
provider = "mysql"
|
||||||
|
url = env("DATABASE_URL")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// https://github.com/pantharshit00/prisma-docs-generator
|
||||||
|
generator docs {
|
||||||
|
provider = "node node_modules/prisma-docs-generator"
|
||||||
|
output = "../docs"
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/notiz-dev/prisma-dbml-generator
|
||||||
|
// Viewer: https://dbdiagram.io/d
|
||||||
|
generator dbml {
|
||||||
|
provider = "prisma-dbml-generator"
|
||||||
|
output = "../docs"
|
||||||
|
outputName = "schema.dbml"
|
||||||
|
projectName = "AssetFlow"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum contentType {
|
||||||
|
voice_alarm
|
||||||
|
voice_explainer
|
||||||
|
voice_acknowledgement
|
||||||
|
voice_ending
|
||||||
|
}
|
||||||
|
|
||||||
|
enum alertType {
|
||||||
|
generic
|
||||||
|
fire
|
||||||
|
fault
|
||||||
|
intrusion
|
||||||
|
clear
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
model AlarmContacts {
|
||||||
|
id Int @id @unique @default(autoincrement())
|
||||||
|
name String
|
||||||
|
phone String @unique
|
||||||
|
comment String?
|
||||||
|
Prios Priorities[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model Priorities {
|
||||||
|
id Int @id @unique @default(autoincrement())
|
||||||
|
Contact AlarmContacts @relation(fields: [contactId], references: [id])
|
||||||
|
contactId Int
|
||||||
|
priority Int
|
||||||
|
actionplan ActionPlan @relation(fields: [actionplanId], references: [id])
|
||||||
|
actionplanId Int
|
||||||
|
|
||||||
|
@@unique([priority, actionplanId]) // TODO: Does this work with sqlite???
|
||||||
|
}
|
||||||
|
|
||||||
|
model ActionPlan {
|
||||||
|
id Int @id @unique @default(autoincrement())
|
||||||
|
name String
|
||||||
|
comment String?
|
||||||
|
prio Priorities[]
|
||||||
|
content Content[] // aka. all voice files
|
||||||
|
Alerts Alerts[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model Content {
|
||||||
|
id Int @id @unique @default(autoincrement())
|
||||||
|
type contentType
|
||||||
|
name String
|
||||||
|
filename String
|
||||||
|
actionplan ActionPlan[]
|
||||||
|
}
|
||||||
|
|
||||||
|
model Alerts {
|
||||||
|
id Int @id @unique @default(autoincrement())
|
||||||
|
type alertType
|
||||||
|
message String?
|
||||||
|
actionplan ActionPlan? @relation(fields: [actionplanId], references: [id])
|
||||||
|
actionplanId Int?
|
||||||
|
// TODO: TBD
|
||||||
|
// Quelle: BMA / EMA
|
||||||
|
// Date
|
||||||
|
// Date (Clear) ???
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://spacecdn.de/file/bma_stoe_v1.mp3
|
||||||
|
// https://spacecdn.de/file/quittiert_v1.mp3
|
||||||
|
// https://spacecdn.de/file/angenehmen_tag_v1.mp3
|
||||||
|
// https://spacecdn.de/file/erklaerung_v1.mp3
|
33
src/handlers/config.ts
Normal file
33
src/handlers/config.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import ConfigManager from '../libs/configManager.js';
|
||||||
|
import __path from "./path.js";
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
|
||||||
|
// Create a new config instance.
|
||||||
|
const config = new ConfigManager(__path + '/config.json', true, {
|
||||||
|
db_connection_string: 'mysql://USER:PASSWORD@HOST:3306/DATABASE',
|
||||||
|
http_listen_address: '0.0.0.0',
|
||||||
|
http_port: 3000,
|
||||||
|
debug: true,
|
||||||
|
auth: {
|
||||||
|
cookie_secret: 'gen',
|
||||||
|
cookie_secure: true,
|
||||||
|
local: {
|
||||||
|
active: true,
|
||||||
|
users: {}
|
||||||
|
},
|
||||||
|
oidc: {
|
||||||
|
active: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// If no local User exists, create the default with a generated password
|
||||||
|
if (_.isEqual(config.global.auth.local.users, {})) {
|
||||||
|
config.global.auth.local.users = {
|
||||||
|
'administrator': 'gen',
|
||||||
|
};
|
||||||
|
config.save_config();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config;
|
12
src/handlers/db.ts
Normal file
12
src/handlers/db.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { PrismaClient } from '@prisma/client'; // Database
|
||||||
|
import config from "./config.js";
|
||||||
|
|
||||||
|
// TODO: Add errorhandling with some sort of message.
|
||||||
|
export const prisma = new PrismaClient({
|
||||||
|
datasources: {
|
||||||
|
db: {
|
||||||
|
url: config.global.db_connection_string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
34
src/handlers/log.ts
Normal file
34
src/handlers/log.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { Logger } from "tslog";
|
||||||
|
|
||||||
|
const loggerConfig: any = {
|
||||||
|
type: "pretty", // pretty, json, hidden
|
||||||
|
name: "Core",
|
||||||
|
hideLogPositionForProduction: true,
|
||||||
|
prettyLogTemplate: "{{dateIsoStr}} {{logLevelName}} {{nameWithDelimiterPrefix}} "
|
||||||
|
}
|
||||||
|
|
||||||
|
const coreLogger = new Logger(loggerConfig);
|
||||||
|
export const log = {
|
||||||
|
core: coreLogger,
|
||||||
|
db: coreLogger.getSubLogger({ name: "DB" }),
|
||||||
|
web: coreLogger.getSubLogger({ name: "WEB" }),
|
||||||
|
auth: coreLogger.getSubLogger({ name: "AUTH" }),
|
||||||
|
helper: coreLogger.getSubLogger({ name: "HELPER" }),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// log.core.silly("Hello from core");
|
||||||
|
// log.core.trace("Hello from core");
|
||||||
|
// log.core.debug("Hello from core");
|
||||||
|
// log.core.info("Hello from core");
|
||||||
|
// log.core.warn("Hello from core");
|
||||||
|
// log.core.error("Hello from core");
|
||||||
|
// log.db.silly("Hello from db");
|
||||||
|
// log.db.trace("Hello from db");
|
||||||
|
// log.web.debug("Hello from db");
|
||||||
|
// log.auth.info("Hello from db");
|
||||||
|
// log.helper.warn("Hello from db");
|
||||||
|
// log.db.error("Hello from db");
|
||||||
|
// log.core.fatal(new Error("I am a pretty Error with a stacktrace."));
|
||||||
|
|
||||||
|
export default log;
|
4
src/handlers/path.ts
Normal file
4
src/handlers/path.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Return the app directory as an absolute path
|
||||||
|
const __path = process.argv[1];
|
||||||
|
|
||||||
|
export default __path;
|
84
src/index.ts
Normal file
84
src/index.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// MARK: Imports
|
||||||
|
import path from 'node:path';
|
||||||
|
import __path from "./handlers/path.js";
|
||||||
|
import log from "./handlers/log.js";
|
||||||
|
import config from './handlers/config.js';
|
||||||
|
|
||||||
|
// Express & more
|
||||||
|
import express from 'express';
|
||||||
|
import cors from 'cors'
|
||||||
|
import session from 'express-session';
|
||||||
|
import fileUpload from 'express-fileupload';
|
||||||
|
import bodyParser, { Options } from 'body-parser';
|
||||||
|
import { Eta } from "eta";
|
||||||
|
import passport from 'passport';
|
||||||
|
|
||||||
|
import routes from './routes/index.js';
|
||||||
|
|
||||||
|
log.core.trace("Running from path: " + __path);
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: Express
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
// TODO: Version check need to be rewritten.
|
||||||
|
//app.locals.versionRevLong = require('child_process').execSync('git rev-parse HEAD').toString().trim();
|
||||||
|
//app.locals.versionRev = require('child_process').execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
|
//app.locals.versionRevLatest = require('child_process').execSync('git ls-remote --refs -q').toString().trim().split('\t')[0];
|
||||||
|
app.locals.versionRev = '0';
|
||||||
|
app.locals.versionRevLong = '0';
|
||||||
|
app.locals.versionRevLatest = '0';
|
||||||
|
|
||||||
|
if (app.locals.versionRevLong === app.locals.versionRevLatest) {
|
||||||
|
log.core.info(`Running Latest Version (${app.locals.versionRevLong})`);
|
||||||
|
} else {
|
||||||
|
log.core.info(`Running Version: ${app.locals.versionRevLong} (Latest: ${app.locals.versionRevLatest})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ETA Init
|
||||||
|
const eta = new Eta({ views: path.join(__path, "views") })
|
||||||
|
app.engine("eta", buildEtaEngine())
|
||||||
|
app.set("view engine", "eta")
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: Express Middleware & Config
|
||||||
|
app.set('x-powered-by', false);
|
||||||
|
|
||||||
|
app.use(fileUpload());
|
||||||
|
//app.use(cors());
|
||||||
|
app.use(bodyParser.urlencoded({ extended: false }));
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
// Session store
|
||||||
|
// TODO: Move secret to config -> Autogenerate.
|
||||||
|
app.use(
|
||||||
|
session({
|
||||||
|
secret: config.global.auth.cookie_secret,
|
||||||
|
resave: false,
|
||||||
|
saveUninitialized: false,
|
||||||
|
cookie: { secure: config.global.auth.cookie_secure }
|
||||||
|
})
|
||||||
|
);
|
||||||
|
app.use(passport.authenticate('session'));
|
||||||
|
app.use(routes);
|
||||||
|
|
||||||
|
|
||||||
|
app.listen(config.global.http_port, config.global.http_listen_address, () => {
|
||||||
|
log.web.info(`Listening at http://${config.global.http_listen_address}:${config.global.http_port}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: Helper Functions
|
||||||
|
function buildEtaEngine() {
|
||||||
|
return (path:string, opts:Options, callback: CallableFunction) => {
|
||||||
|
try {
|
||||||
|
const fileContent = eta.readFile(path);
|
||||||
|
const renderedTemplate = eta.renderString(fileContent, opts);
|
||||||
|
callback(null, renderedTemplate);
|
||||||
|
} catch (error) {
|
||||||
|
callback(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
140
src/libs/configManager.ts
Normal file
140
src/libs/configManager.ts
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
import fs from 'node:fs';
|
||||||
|
import _ from 'lodash';
|
||||||
|
import { randomUUID, randomBytes } from 'crypto';
|
||||||
|
|
||||||
|
export type configObject = Record<any, any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is responsible to save/edit config files.
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @class config
|
||||||
|
* @typedef {config}
|
||||||
|
*/
|
||||||
|
export default class config {
|
||||||
|
#configPath: string;
|
||||||
|
//global = {[key: string] : string}
|
||||||
|
global: configObject;
|
||||||
|
replaceSecrets: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance of config.
|
||||||
|
*
|
||||||
|
* @constructor
|
||||||
|
* @param {string} configPath Path to config file.
|
||||||
|
* @param {object} configPreset Default config object with default values.
|
||||||
|
*/
|
||||||
|
constructor(configPath: string, replaceSecrets: boolean, configPreset: object) {
|
||||||
|
this.#configPath = configPath;
|
||||||
|
this.global = configPreset;
|
||||||
|
this.replaceSecrets = replaceSecrets;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Read config
|
||||||
|
const data = fs.readFileSync(this.#configPath, 'utf8');
|
||||||
|
|
||||||
|
// Extend config with missing parameters from configPreset.
|
||||||
|
this.global = _.defaultsDeep(JSON.parse(data), this.global);
|
||||||
|
// Save config.
|
||||||
|
this.save_config();
|
||||||
|
} catch (err: any) {
|
||||||
|
// If file does not exist, create it.
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
console.log(`Config file does not exist. Creating it at ${this.#configPath} now.`);
|
||||||
|
this.save_config();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.error(`Could not read config file at ${this.#configPath} due to: ${err}`);
|
||||||
|
// Exit process.
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the jsonified config object to the config file.
|
||||||
|
*/
|
||||||
|
save_config() {
|
||||||
|
try {
|
||||||
|
// If enabled replace tokens defines as "gen" with random token
|
||||||
|
if (this.replaceSecrets) {
|
||||||
|
// Replace tokens with value "gen"
|
||||||
|
this.generate_secrets(this.global, 'gen')
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(this.#configPath, JSON.stringify(this.global, null, 8));
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Could not write config file at ${this.#configPath} due to: ${err}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(`Successfully written config file to ${this.#configPath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces each item matching the value of placeholder with a random UUID.
|
||||||
|
* Thanks to https://stackoverflow.com/questions/8085004/iterate-through-nested-javascript-objects
|
||||||
|
* @param {configObject} obj
|
||||||
|
*/
|
||||||
|
generate_secrets(obj: configObject, placeholder: string) {
|
||||||
|
const stack = [obj];
|
||||||
|
while (stack?.length > 0) {
|
||||||
|
const currentObj:any = stack.pop();
|
||||||
|
Object.keys(currentObj).forEach((key) => {
|
||||||
|
|
||||||
|
if (currentObj[key] === placeholder) {
|
||||||
|
console.log('Generating secret: ' + key);
|
||||||
|
currentObj[key] = randomBytes(48).toString('base64').replace(/\W/g, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof currentObj[key] === 'object' && currentObj[key] !== null) {
|
||||||
|
stack.push(currentObj[key]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
**** Example ****
|
||||||
|
|
||||||
|
import ConfigHandlerNG from './assets/configHandlerNG.js';
|
||||||
|
|
||||||
|
// Create a new config instance.
|
||||||
|
export const config = new ConfigHandler(__path + '/config.json', true, {
|
||||||
|
test1: 't1',
|
||||||
|
test2: 't2',
|
||||||
|
test3: 'gen',
|
||||||
|
test4: 't4',
|
||||||
|
test5: 'gen',
|
||||||
|
testObj: {
|
||||||
|
local: {
|
||||||
|
active: true,
|
||||||
|
users: {
|
||||||
|
user1: 'gen',
|
||||||
|
user2: 'gen',
|
||||||
|
user3: 'gen',
|
||||||
|
user4: 'gen',
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
oidc: {
|
||||||
|
active: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Base Config:');
|
||||||
|
console.log(config.global);
|
||||||
|
|
||||||
|
console.log('Add some new key to config and call save_config().');
|
||||||
|
config.global.NewKey = 'ThisIsANewKey!'
|
||||||
|
config.save_config()
|
||||||
|
|
||||||
|
console.log('This will add a new key with value gen, but gen gets replaced with a random UUID when save_config() is called.');
|
||||||
|
config.global.someSecret = 'gen'
|
||||||
|
config.save_config() // global.someSecret is getting replaced with some random UUID since it was set to 'gen'.
|
||||||
|
|
||||||
|
console.log('Complete Config:');
|
||||||
|
console.log(config.global);
|
||||||
|
*/
|
25
src/middlewares/auth.mw.ts
Normal file
25
src/middlewares/auth.mw.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export function checkAuthentication(req: any, res: any, next: Function) {
|
||||||
|
|
||||||
|
next(); // FIXME: Auth bypass!!!
|
||||||
|
return; // FIXME: Auth bypass!!!
|
||||||
|
|
||||||
|
if (req.isAuthenticated()) {
|
||||||
|
//req.isAuthenticated() will return true if user is logged in
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
res.redirect('/auth/login');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// const checkIsInRole = (...roles) => (req, res, next) => {
|
||||||
|
// if (!req.user) {
|
||||||
|
// return res.redirect('/login')
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const hasRole = roles.find(role => req.user.role === role)
|
||||||
|
// if (!hasRole) {
|
||||||
|
// return res.redirect('/login')
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return next()
|
||||||
|
// }
|
11
src/routes/api/index.ts
Normal file
11
src/routes/api/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import express from 'express';
|
||||||
|
|
||||||
|
// Route imports
|
||||||
|
import v1_routes from './v1/index.js';
|
||||||
|
|
||||||
|
// Router base is '/api'
|
||||||
|
const Router = express.Router({ strict: false });
|
||||||
|
|
||||||
|
Router.use('/v1', v1_routes);
|
||||||
|
|
||||||
|
export default Router;
|
40
src/routes/api/v1/index.ts
Normal file
40
src/routes/api/v1/index.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import passport from 'passport';
|
||||||
|
|
||||||
|
// Route imports
|
||||||
|
import testRoute from './test.js';
|
||||||
|
//import itemRoute from './items.js';
|
||||||
|
//import categoryRoute from './categories.js';
|
||||||
|
//import storageUnitRoute from './storageUnits.js';
|
||||||
|
//import storageLocationRoute from './storageLocations.js';
|
||||||
|
//import contactInfo from './contactInfo.js';
|
||||||
|
//import versionRoute from './version.js'
|
||||||
|
|
||||||
|
//import search_routes from './search/index.js';
|
||||||
|
|
||||||
|
// Router base is '/api/v1'
|
||||||
|
const Router = express.Router({ strict: false });
|
||||||
|
|
||||||
|
// All empty strings are null values.
|
||||||
|
Router.use('*', function (req, res, next) {
|
||||||
|
for (let key in req.body) {
|
||||||
|
if (req.body[key] === '') {
|
||||||
|
req.body[key] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
//Router.route('/items').get(itemRoute.get).post(itemRoute.post).patch(itemRoute.patch).delete(itemRoute.del);
|
||||||
|
//Router.route('/categories').get(categoryRoute.get).post(categoryRoute.post).patch(categoryRoute.patch).delete(categoryRoute.del);
|
||||||
|
// TODO: Migrate routes to lowercase.
|
||||||
|
//Router.route('/storageUnits').get(storageUnitRoute.get).post(storageUnitRoute.post).patch(storageUnitRoute.patch).delete(storageUnitRoute.del);
|
||||||
|
//Router.route('/storageLocations').get(storageLocationRoute.get).post(storageLocationRoute.post).patch(storageLocationRoute.patch).delete(storageLocationRoute.del);
|
||||||
|
//Router.route('/contactInfo').get(contactInfo.get).post(contactInfo.post).patch(contactInfo.patch).delete(contactInfo.del);
|
||||||
|
|
||||||
|
//Router.route('/version').get(versionRoute.get);
|
||||||
|
//Router.use('/search', search_routes);
|
||||||
|
|
||||||
|
Router.route('/test').get(testRoute.get);
|
||||||
|
|
||||||
|
export default Router;
|
7
src/routes/api/v1/test.ts
Normal file
7
src/routes/api/v1/test.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import express, { Request, Response } from 'express';
|
||||||
|
|
||||||
|
function get(req: Request, res: Response) {
|
||||||
|
res.status(200).send('API v1 Test successful!');
|
||||||
|
};
|
||||||
|
|
||||||
|
export default { get };
|
7
src/routes/frontend/dashboard.ts
Normal file
7
src/routes/frontend/dashboard.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import express, { Request, Response } from 'express';
|
||||||
|
|
||||||
|
function get(req: Request, res: Response) {
|
||||||
|
res.render("index", { message: "Hello world from eta!" })
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { get };
|
24
src/routes/frontend/index.ts
Normal file
24
src/routes/frontend/index.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import express from 'express';
|
||||||
|
|
||||||
|
// Route imports
|
||||||
|
// import skuRoute from './:id.js';
|
||||||
|
// import skuRouteDash from './itemInfo.js'
|
||||||
|
// import testRoute from './test.js';
|
||||||
|
import dashboardRoute from './dashboard.js';
|
||||||
|
// import itemsRoute from './items.js';
|
||||||
|
// import manage_routes from './manage/index.js';
|
||||||
|
|
||||||
|
// Router base is '/'
|
||||||
|
const Router = express.Router({ strict: false });
|
||||||
|
|
||||||
|
// Router.route('/test').get(testRoute.get);
|
||||||
|
// Router.route('/items').get(itemsRoute.get);
|
||||||
|
|
||||||
|
// Router.route('/:id(\\w{8})').get(skuRoute.get);
|
||||||
|
// Router.route('/s/:id').get(skuRouteDash.get);
|
||||||
|
|
||||||
|
// Router.use('/manage', manage_routes);
|
||||||
|
|
||||||
|
Router.route('/').get(dashboardRoute.get);
|
||||||
|
|
||||||
|
export default Router;
|
37
src/routes/index.ts
Normal file
37
src/routes/index.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import path from 'node:path';
|
||||||
|
import __path from "../handlers/path.js";
|
||||||
|
import log from "../handlers/log.js";
|
||||||
|
|
||||||
|
// Middleware Imports
|
||||||
|
import { checkAuthentication } from '../middlewares/auth.mw.js'
|
||||||
|
|
||||||
|
// Route imports
|
||||||
|
import frontend_routes from './frontend/index.js';
|
||||||
|
import api_routes from './api/index.js';
|
||||||
|
//import auth_routes from './auth/index.js';
|
||||||
|
|
||||||
|
const Router = express.Router({ strict: false });
|
||||||
|
|
||||||
|
// static / libs routes
|
||||||
|
Router.use('/static', express.static(__path + '/static'));
|
||||||
|
Router.use('/libs/bulma', express.static(path.join(__path, 'node_modules', 'bulma', 'css'))); // http://192.168.221.10:3000/libs/bulma/bulma.css
|
||||||
|
Router.use('/libs/jquery', express.static(path.join(__path, 'node_modules', 'jquery', 'dist')));
|
||||||
|
|
||||||
|
// Other routers
|
||||||
|
Router.use('/api', checkAuthentication, api_routes);
|
||||||
|
//Router.use('/auth', auth_routes);
|
||||||
|
Router.use('/', checkAuthentication, frontend_routes);
|
||||||
|
|
||||||
|
|
||||||
|
// Default route.
|
||||||
|
Router.all('*', function (req, res) {
|
||||||
|
// TODO: Respond based on content-type (with req.is('application/json'))
|
||||||
|
if (req.is('application/json')) {
|
||||||
|
res.status(404).json({ errorcode: 'NOT_FOUND', error: 'Not Found!' });
|
||||||
|
} else {
|
||||||
|
res.status(404).render('errors/404', { url: req.originalUrl });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Router;
|
3
static/main.css
Normal file
3
static/main.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
body {
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
1
static/test.js
Normal file
1
static/test.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
console.log('test.js');
|
117
tsconfig.json
Normal file
117
tsconfig.json
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "nodenext", /* Specify what module code is generated. */
|
||||||
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
|
"moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
"paths": {
|
||||||
|
"*": [
|
||||||
|
"./node_modules/*"
|
||||||
|
]
|
||||||
|
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||||
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||||
|
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
||||||
|
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
||||||
|
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
||||||
|
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
||||||
|
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
||||||
|
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
||||||
|
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||||
|
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
||||||
|
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
"sourceRoot": "src", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
||||||
|
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
"noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "dist"],
|
||||||
|
}
|
26
views/errors/404.eta
Normal file
26
views/errors/404.eta
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>404</title>
|
||||||
|
<link rel="stylesheet" href="/libs/bulma/bulma.min.css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<section class="hero is-fullheight">
|
||||||
|
<div class="hero-body has-text-centered">
|
||||||
|
<div class="container">
|
||||||
|
<div class="box">
|
||||||
|
<h1>404</h1>
|
||||||
|
<h2>An error occured</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
75
views/index.eta
Normal file
75
views/index.eta
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<%~ include("partials/base_head.eta", {"title": "Dashboard"}) %>
|
||||||
|
<%~ include("partials/nav.eta") %>
|
||||||
|
|
||||||
|
<section class="hero is-primary">
|
||||||
|
<div class="hero-body">
|
||||||
|
<p class="title" data-tK="start-hero-header-welcome">Willkommen</p>
|
||||||
|
<p class="subtitle" data-tK="start-hero-header-subtitle-default">Alles gut!</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="section">
|
||||||
|
<h1 class="title" data-tK="start-sysinfo-header">Systeminformationen</h1>
|
||||||
|
<nav class="level">
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="heading">Aktionspläne</p>
|
||||||
|
<p class="title">π</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="heading">Alarmkonakte</p>
|
||||||
|
<p class="title">5</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="heading">Alarme in den letzten 24h</p>
|
||||||
|
<p class="title">Keine</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="level-item has-text-centered">
|
||||||
|
<div>
|
||||||
|
<p class="heading">Metrik 4</p>
|
||||||
|
<p class="title">Dreieck</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section">
|
||||||
|
<h1 class="title" data-tK="start-recent-header">Letze Alarme</h1>
|
||||||
|
<table class="table is-striped is-fullwidth">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><abbr title="Position">Pos</abbr></th>
|
||||||
|
<th>Alarmierungszeit</th>
|
||||||
|
<th><abbr title="Quitierungszeit">Quit.zeit</abbr></th>
|
||||||
|
<th>Quelle</th>
|
||||||
|
<th><abbr title="Niveau">Niv.</abbr></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="is-danger">
|
||||||
|
<th>1</th>
|
||||||
|
<td>1.1.2025 12:00</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>BMA</td>
|
||||||
|
<td>Brandmeldung</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr class="is-warning">
|
||||||
|
<th>1</th>
|
||||||
|
<td>1.1.2025 10:00</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>EMA</td>
|
||||||
|
<td>Störung</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<h2><%= it.message %></h2>
|
||||||
|
|
||||||
|
<%~ include("partials/footer.eta") %>
|
||||||
|
<%~ include("partials/base_foot.eta") %>
|
2
views/partials/base_foot.eta
Normal file
2
views/partials/base_foot.eta
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
</body>
|
||||||
|
</html>
|
19
views/partials/base_head.eta
Normal file
19
views/partials/base_head.eta
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<title>ATAS - <%= it.title %></title>
|
||||||
|
<meta name="author" content="[Project-Name-Here]"/>
|
||||||
|
|
||||||
|
<link rel="icon" href="/logo/Design_icon.svg" type="image/svg+xml" />
|
||||||
|
|
||||||
|
<script src="/libs/jquery/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/libs/bulma/bulma.min.css">
|
||||||
|
<link rel="stylesheet" href="/static/main.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- The body and html tag need to be left open! -->
|
9
views/partials/footer.eta
Normal file
9
views/partials/footer.eta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<footer class="footer">
|
||||||
|
<div class="content has-text-centered">
|
||||||
|
<p>
|
||||||
|
<strong>ATAS</strong> by <a href="https://tgd.fyi">Meee</a>.The source code is not licensed
|
||||||
|
<a href="https://opensource.org/license/mit">MIT</a>. The website content is licensed
|
||||||
|
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0//">CC BY NC SA 4.0</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
45
views/partials/nav.eta
Normal file
45
views/partials/nav.eta
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="navbar-brand">
|
||||||
|
<a class="navbar-item" href="https://bulma.io">
|
||||||
|
<svg width="640" height="160" viewBox="0 0 640 160" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M170 132.571V27.5908C170 25.5451 170.915 23.93 172.746 22.7456C174.576 21.5612 176.729 20.969 179.206 20.969H210.377C232.019 20.969 242.84 30.4441 242.84 49.3943C242.84 62.5303 238.264 71.0902 229.112 75.074C234.603 77.2275 238.748 80.2692 241.548 84.1992C244.347 88.1292 245.747 93.8627 245.747 101.4V104.791C245.747 116.743 242.84 125.437 237.026 130.875C231.211 136.312 223.351 139.031 213.445 139.031H179.206C176.514 139.031 174.307 138.385 172.584 137.093C170.861 135.801 170 134.293 170 132.571ZM190.834 120.619H209.085C219.529 120.619 224.751 114.751 224.751 103.015V100.431C224.751 94.401 223.432 90.0404 220.794 87.3486C218.156 84.6568 214.253 83.3109 209.085 83.3109H190.834V120.619ZM190.834 66.8371H208.923C213.122 66.8371 216.326 65.5989 218.533 63.1225C220.74 60.646 221.844 57.2544 221.844 52.9475C221.844 48.7483 220.686 45.4374 218.371 43.0148C216.057 40.5922 212.853 39.3809 208.762 39.3809H190.834V66.8371ZM260.283 103.015V27.4293C260.283 25.2759 261.306 23.6608 263.351 22.5841C265.397 21.5074 267.873 20.969 270.781 20.969C273.688 20.969 276.164 21.5074 278.21 22.5841C280.256 23.6608 281.279 25.2759 281.279 27.4293V103.015C281.279 115.397 287.2 121.588 299.044 121.588C310.888 121.588 316.81 115.397 316.81 103.015V27.4293C316.81 25.2759 317.833 23.6608 319.879 22.5841C321.925 21.5074 324.401 20.969 327.308 20.969C330.215 20.969 332.692 21.5074 334.738 22.5841C336.783 23.6608 337.806 25.2759 337.806 27.4293V103.015C337.806 115.72 334.28 125.061 327.227 131.036C320.175 137.012 310.781 140 299.044 140C287.308 140 277.914 137.039 270.861 131.117C263.809 125.195 260.283 115.828 260.283 103.015ZM356.703 132.409V27.4293C356.703 25.2759 357.725 23.6608 359.771 22.5841C361.817 21.5074 364.293 20.969 367.201 20.969C370.108 20.969 372.584 21.5074 374.63 22.5841C376.676 23.6608 377.699 25.2759 377.699 27.4293V120.619H417.106C419.044 120.619 420.579 121.534 421.709 123.365C422.84 125.195 423.405 127.349 423.405 129.825C423.405 132.301 422.84 134.455 421.709 136.285C420.579 138.116 419.044 139.031 417.106 139.031H365.908C363.432 139.031 361.279 138.439 359.448 137.254C357.618 136.07 356.703 134.455 356.703 132.409ZM434.872 132.409V31.467C434.872 27.9138 435.868 25.2759 437.86 23.5532C439.852 21.8304 442.355 20.969 445.37 20.969C449.354 20.969 452.423 21.6689 454.576 23.0686C456.729 24.4684 459.098 27.4832 461.682 32.1131L481.548 68.2907L501.413 32.1131C503.997 27.4832 506.393 24.4684 508.6 23.0686C510.808 21.6689 513.903 20.969 517.887 20.969C520.902 20.969 523.405 21.8304 525.397 23.5532C527.389 25.2759 528.385 27.9138 528.385 31.467V132.409C528.385 134.455 527.335 136.07 525.236 137.254C523.136 138.439 520.686 139.031 517.887 139.031C514.98 139.031 512.503 138.439 510.458 137.254C508.412 136.07 507.389 134.455 507.389 132.409V62.961L488.493 96.5545C486.985 99.354 484.616 100.754 481.386 100.754C478.264 100.754 475.949 99.354 474.441 96.5545L455.868 61.6689V132.409C455.868 134.455 454.818 136.07 452.719 137.254C450.619 138.439 448.17 139.031 445.37 139.031C442.463 139.031 439.987 138.439 437.941 137.254C435.895 136.07 434.872 134.455 434.872 132.409ZM539.529 130.31C539.529 130.094 539.637 129.556 539.852 128.694L571.023 27.1063C571.669 24.8452 573.257 23.0956 575.787 21.8573C578.318 20.6191 581.198 20 584.428 20C587.658 20 590.565 20.6191 593.149 21.8573C595.734 23.0956 597.349 24.8452 597.995 27.1063L629.166 128.694C629.381 129.556 629.489 130.094 629.489 130.31C629.489 132.678 628.035 134.724 625.128 136.447C622.221 138.17 619.26 139.031 616.245 139.031C612.261 139.031 609.892 137.631 609.139 134.832L603.001 113.351H566.016L559.879 134.832C559.125 137.631 556.756 139.031 552.773 139.031C549.65 139.031 546.662 138.197 543.809 136.528C540.956 134.859 539.529 132.786 539.529 130.31ZM570.377 96.8775H598.479L584.428 47.2948L570.377 96.8775Z" fill="black" class="bd-svg-black" />
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 110L10 40L50 0L100 50L70 80L110 120L50 160L0 110Z" fill="#00D1B2"/>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="navbarBasicExample" class="navbar-menu">
|
||||||
|
<div class="navbar-start">
|
||||||
|
<a class="navbar-item">Home</a>
|
||||||
|
<a class="navbar-item">Documentation</a>
|
||||||
|
<div class="navbar-item has-dropdown is-hoverable">
|
||||||
|
<a class="navbar-link">More</a>
|
||||||
|
<div class="navbar-dropdown">
|
||||||
|
<a class="navbar-item">About</a>
|
||||||
|
<a class="navbar-item is-selected">Jobs</a>
|
||||||
|
<a class="navbar-item">Contact</a>
|
||||||
|
<hr class="navbar-divider">
|
||||||
|
<a class="navbar-item">Report an issue</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-end">
|
||||||
|
<div class="navbar-item">
|
||||||
|
<div class="buttons">
|
||||||
|
<a class="button is-primary">
|
||||||
|
<strong>Sign up</strong>
|
||||||
|
</a>
|
||||||
|
<a class="button is-light">Log in</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
Loading…
Reference in New Issue
Block a user