@necrolab/dashboard 0.5.35 → 0.5.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/api.js +24 -25
- package/eslint.config.js +30 -31
- package/package.json +57 -36
- package/postcss.config.js +5 -5
- package/vite.config.js +20 -4
- package/.eslintrc.js +0 -24
- package/.prettierrc +0 -36
package/backend/api.js
CHANGED
|
@@ -28,21 +28,23 @@ const CONSOLE_BATCH_MAX_MESSAGES = 120;
|
|
|
28
28
|
const app = express();
|
|
29
29
|
const auth = new authSystem();
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
const alowedCors = {
|
|
31
|
+
const allowedCors = {
|
|
33
32
|
origin: ["*"]
|
|
34
33
|
};
|
|
35
|
-
app.use(cors(
|
|
36
|
-
// enable express-websocket
|
|
34
|
+
app.use(cors(allowedCors));
|
|
37
35
|
enableWs(app);
|
|
38
36
|
|
|
39
37
|
app.use((error, req, res, next) => {
|
|
40
38
|
logger.Error("Error Handling Middleware called");
|
|
41
|
-
logger.Error("Path:
|
|
42
|
-
|
|
39
|
+
logger.Error("Path:", req.path);
|
|
40
|
+
logger.Error("Error:", error.message || error);
|
|
41
|
+
|
|
42
|
+
res.status(error.status || 500).json({
|
|
43
|
+
error: error.message || "Internal server error",
|
|
44
|
+
path: req.path
|
|
45
|
+
});
|
|
43
46
|
});
|
|
44
47
|
|
|
45
|
-
// serve static vue files
|
|
46
48
|
app.use(
|
|
47
49
|
express.static(path.join(__dirname, "../dist"), {
|
|
48
50
|
setHeaders: (res) => {
|
|
@@ -51,15 +53,9 @@ app.use(
|
|
|
51
53
|
})
|
|
52
54
|
);
|
|
53
55
|
|
|
54
|
-
// parse JSON
|
|
55
56
|
app.use(express.json());
|
|
56
|
-
// send and parse cookies
|
|
57
57
|
app.use(cookieParser());
|
|
58
58
|
|
|
59
|
-
// =======
|
|
60
|
-
// Config
|
|
61
|
-
// =======
|
|
62
|
-
|
|
63
59
|
const port = process.env.PORT || 8081;
|
|
64
60
|
const filesThatCanBeEdited = ["configs.json"];
|
|
65
61
|
|
|
@@ -78,7 +74,6 @@ global.refreshTaskOnFrontEnd = (task) => {
|
|
|
78
74
|
let wsClients = [];
|
|
79
75
|
|
|
80
76
|
const sendObject = (ws, batch) => {
|
|
81
|
-
// if object is too large, use msgpack encoding
|
|
82
77
|
const asString = JSON.stringify(batch);
|
|
83
78
|
if (asString.length > 1 && !Bot.Settings.DebugMode) return ws.send(encode(batch));
|
|
84
79
|
else return ws.send(asString);
|
|
@@ -203,11 +198,13 @@ app.post("/api/login", async (req, res) => {
|
|
|
203
198
|
const user = req.body.name;
|
|
204
199
|
const authResult = auth.loginToAccount(user, pwd);
|
|
205
200
|
if (authResult.token) {
|
|
206
|
-
return res
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
201
|
+
return res
|
|
202
|
+
.cookie("auth", authResult.token, {
|
|
203
|
+
httpOnly: false,
|
|
204
|
+
sameSite: "lax",
|
|
205
|
+
path: "/"
|
|
206
|
+
})
|
|
207
|
+
.send(authResult);
|
|
211
208
|
} else {
|
|
212
209
|
return res.send(authResult);
|
|
213
210
|
}
|
|
@@ -216,12 +213,14 @@ app.post("/api/login", async (req, res) => {
|
|
|
216
213
|
app.post("/api/logout", async (req, res) => {
|
|
217
214
|
const token = req.cookies.auth;
|
|
218
215
|
const result = auth.invalidateAuthToken(token);
|
|
219
|
-
return res
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
return res
|
|
217
|
+
.cookie("auth", "", {
|
|
218
|
+
httpOnly: false,
|
|
219
|
+
sameSite: "lax",
|
|
220
|
+
path: "/",
|
|
221
|
+
maxAge: 0
|
|
222
|
+
})
|
|
223
|
+
.send(result);
|
|
225
224
|
});
|
|
226
225
|
|
|
227
226
|
// ===== File editing =====
|
package/eslint.config.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import { defineConfig, globalIgnores } from "eslint/config";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
import vue from "eslint-plugin-vue";
|
|
4
1
|
import js from "@eslint/js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { dirname } from "node:path";
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const compat = new FlatCompat({
|
|
11
|
-
baseDirectory: __dirname,
|
|
12
|
-
recommendedConfig: js.configs.recommended,
|
|
13
|
-
allConfig: js.configs.all
|
|
14
|
-
});
|
|
2
|
+
import pluginVue from "eslint-plugin-vue";
|
|
3
|
+
import globals from "globals";
|
|
15
4
|
|
|
16
|
-
export default
|
|
17
|
-
|
|
5
|
+
export default [
|
|
6
|
+
js.configs.recommended,
|
|
7
|
+
...pluginVue.configs["flat/essential"],
|
|
18
8
|
{
|
|
19
9
|
languageOptions: {
|
|
10
|
+
ecmaVersion: "latest",
|
|
11
|
+
sourceType: "module",
|
|
20
12
|
globals: {
|
|
21
13
|
...globals.browser,
|
|
22
14
|
...globals.node,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
parserOptions: {}
|
|
31
|
-
},
|
|
32
|
-
plugins: {
|
|
33
|
-
vue
|
|
15
|
+
...globals.es2021,
|
|
16
|
+
Bot: "readonly",
|
|
17
|
+
refreshTaskOnFrontEnd: "readonly",
|
|
18
|
+
pushWSUpdate: "readonly",
|
|
19
|
+
__APP_VERSION__: "readonly",
|
|
20
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: "readonly"
|
|
21
|
+
}
|
|
34
22
|
},
|
|
35
23
|
rules: {
|
|
36
|
-
"html.validate.scripts": 0,
|
|
37
|
-
"html.validate.styles": 0,
|
|
38
24
|
"vue/multi-word-component-names": "off",
|
|
25
|
+
"vue/no-reserved-component-names": "off",
|
|
39
26
|
"no-unused-vars": [
|
|
40
27
|
"warn",
|
|
41
|
-
{
|
|
28
|
+
{
|
|
29
|
+
argsIgnorePattern: "^_",
|
|
30
|
+
varsIgnorePattern: "^_"
|
|
31
|
+
}
|
|
42
32
|
]
|
|
43
33
|
}
|
|
44
34
|
},
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
{
|
|
36
|
+
ignores: [
|
|
37
|
+
"**/node_modules/**",
|
|
38
|
+
"**/dist/**",
|
|
39
|
+
"**/build/**",
|
|
40
|
+
"**/.vite/**",
|
|
41
|
+
"src/registerServiceWorker.js",
|
|
42
|
+
"src/libs/panzoom.js"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
];
|
package/package.json
CHANGED
|
@@ -1,65 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necrolab/dashboard",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "node scripts/build.mjs",
|
|
7
6
|
"dev": "node dev-server.js",
|
|
8
|
-
"
|
|
9
|
-
"expose": "node dev-server.js",
|
|
10
|
-
"postinstall": "node postinstall.js",
|
|
7
|
+
"build": "node scripts/build.mjs",
|
|
11
8
|
"preview": "vite preview",
|
|
12
|
-
"lint": "
|
|
9
|
+
"lint": "eslint src/ --fix",
|
|
10
|
+
"lint:check": "eslint src/",
|
|
11
|
+
"format": "prettier --write \"src/**/*.{js,vue,css,scss,html}\"",
|
|
12
|
+
"format:check": "prettier --check \"src/**/*.{js,vue,css,scss,html}\"",
|
|
13
|
+
"type-check": "vue-tsc --noEmit",
|
|
13
14
|
"release": "npm version patch && npm i && npm publish",
|
|
14
|
-
"release:minor": "npm version minor && npm i && npm publish"
|
|
15
|
+
"release:minor": "npm version minor && npm i && npm publish",
|
|
16
|
+
"release:major": "npm version major && npm i && npm publish",
|
|
17
|
+
"postinstall": "node postinstall.js"
|
|
15
18
|
},
|
|
16
19
|
"dependencies": {
|
|
17
|
-
"@msgpack/msgpack": "^3.
|
|
18
|
-
"@
|
|
19
|
-
"@vueuse/core": "^11.3.0",
|
|
20
|
-
"autoprefixer": "^10.4.21",
|
|
21
|
-
"caniuse-lite": "^1.0.30001692",
|
|
20
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
21
|
+
"@vueuse/core": "^14.2.1",
|
|
22
22
|
"cookie-parser": "^1.4.7",
|
|
23
|
-
"cors": "^2.8.
|
|
24
|
-
"express": "^
|
|
23
|
+
"cors": "^2.8.6",
|
|
24
|
+
"express": "^5.2.1",
|
|
25
25
|
"express-ws": "^5.0.2",
|
|
26
|
-
"ipaddr.js": "^2.
|
|
27
|
-
"pinia": "^
|
|
28
|
-
"postcss": "^8.4.49",
|
|
29
|
-
"prettier": "^3.5.3",
|
|
30
|
-
"prettier-plugin-tailwindcss": "^0.6.12",
|
|
26
|
+
"ipaddr.js": "^2.3.0",
|
|
27
|
+
"pinia": "^3.0.4",
|
|
31
28
|
"register-service-worker": "^1.7.2",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"vue": "^3.5.14",
|
|
36
|
-
"vue-router": "^4.5.0",
|
|
37
|
-
"vue-smoothie": "^1.2.0",
|
|
29
|
+
"vite": "^7.3.1",
|
|
30
|
+
"vue": "^3.5.28",
|
|
31
|
+
"vue-router": "^5.0.2",
|
|
38
32
|
"vue-virtual-scroller": "^2.0.0-beta.8",
|
|
39
|
-
"vue3-toastify": "^0.
|
|
33
|
+
"vue3-toastify": "^0.2.8",
|
|
40
34
|
"vuedraggable": "^4.1.0",
|
|
41
35
|
"websocket-heartbeat-js": "^1.1.3",
|
|
42
36
|
"workbox-build": "^7.3.0"
|
|
43
37
|
},
|
|
44
|
-
"main": "index.js",
|
|
45
38
|
"devDependencies": {
|
|
46
|
-
"@eslint/
|
|
47
|
-
"@
|
|
48
|
-
"
|
|
49
|
-
"eslint
|
|
50
|
-
"
|
|
39
|
+
"@eslint/js": "^10.0.1",
|
|
40
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
41
|
+
"autoprefixer": "^10.4.24",
|
|
42
|
+
"eslint": "^10.0.0",
|
|
43
|
+
"eslint-plugin-vue": "^10.8.0",
|
|
44
|
+
"globals": "^17.3.0",
|
|
45
|
+
"prettier": "^3.8.1",
|
|
46
|
+
"prettier-plugin-tailwindcss": "^0.7.2",
|
|
47
|
+
"sass": "^1.97.3",
|
|
48
|
+
"tailwindcss": "^3.4.19"
|
|
51
49
|
},
|
|
52
50
|
"overrides": {
|
|
53
51
|
"glob": "^11.0.0",
|
|
54
52
|
"braces": "^3.0.3",
|
|
55
53
|
"micromatch": "^4.0.8",
|
|
56
|
-
"postcss": "^8.
|
|
54
|
+
"postcss": "^8.5.6",
|
|
57
55
|
"cookie-parser": "^1.4.7",
|
|
58
|
-
"express": "^
|
|
56
|
+
"express": "^5.2.1",
|
|
59
57
|
"body-parser": "^1.20.3",
|
|
60
58
|
"whatwg-url": "^14.0.0",
|
|
61
|
-
"ws": "^8.
|
|
62
|
-
"path-to-regexp": "^
|
|
59
|
+
"ws": "^8.18.0",
|
|
60
|
+
"path-to-regexp": "^8.2.0",
|
|
63
61
|
"tmp": "^0.2.3"
|
|
62
|
+
},
|
|
63
|
+
"prettier": {
|
|
64
|
+
"tabWidth": 4,
|
|
65
|
+
"useTabs": false,
|
|
66
|
+
"semi": true,
|
|
67
|
+
"singleQuote": false,
|
|
68
|
+
"trailingComma": "none",
|
|
69
|
+
"bracketSpacing": true,
|
|
70
|
+
"arrowParens": "always",
|
|
71
|
+
"printWidth": 120,
|
|
72
|
+
"endOfLine": "lf",
|
|
73
|
+
"vueIndentScriptAndStyle": false,
|
|
74
|
+
"htmlWhitespaceSensitivity": "ignore",
|
|
75
|
+
"bracketSameLine": true,
|
|
76
|
+
"singleAttributePerLine": false,
|
|
77
|
+
"plugins": [
|
|
78
|
+
"prettier-plugin-tailwindcss"
|
|
79
|
+
],
|
|
80
|
+
"tailwindConfig": "./tailwind.config.js"
|
|
81
|
+
},
|
|
82
|
+
"engines": {
|
|
83
|
+
"node": ">=18.0.0",
|
|
84
|
+
"npm": ">=9.0.0"
|
|
64
85
|
}
|
|
65
86
|
}
|
package/postcss.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
2
|
+
plugins: {
|
|
3
|
+
tailwindcss: {},
|
|
4
|
+
autoprefixer: {}
|
|
5
|
+
}
|
|
6
|
+
};
|
package/vite.config.js
CHANGED
|
@@ -14,18 +14,34 @@ export default defineConfig({
|
|
|
14
14
|
manualChunks: {
|
|
15
15
|
vue: ["vue", "vue-router", "pinia"],
|
|
16
16
|
ui: ["@vueuse/core", "vue-virtual-scroller"],
|
|
17
|
-
utils: ["@msgpack/msgpack", "websocket-heartbeat-js"]
|
|
18
|
-
|
|
17
|
+
utils: ["@msgpack/msgpack", "websocket-heartbeat-js"],
|
|
18
|
+
toastify: ["vue3-toastify"]
|
|
19
|
+
},
|
|
20
|
+
chunkFileNames: "assets/[name]-[hash].js",
|
|
21
|
+
entryFileNames: "assets/[name]-[hash].js",
|
|
22
|
+
assetFileNames: "assets/[name]-[hash][extname]"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
21
25
|
target: "esnext",
|
|
22
26
|
cssCodeSplit: true,
|
|
27
|
+
cssMinify: "esbuild",
|
|
23
28
|
sourcemap: false,
|
|
24
29
|
minify: "esbuild",
|
|
25
|
-
emptyOutDir: false
|
|
30
|
+
emptyOutDir: false,
|
|
31
|
+
chunkSizeWarningLimit: 1000,
|
|
32
|
+
reportCompressedSize: true
|
|
26
33
|
},
|
|
27
34
|
optimizeDeps: {
|
|
28
|
-
include: [
|
|
35
|
+
include: [
|
|
36
|
+
"vue",
|
|
37
|
+
"vue-router",
|
|
38
|
+
"pinia",
|
|
39
|
+
"@vueuse/core",
|
|
40
|
+
"vue3-toastify",
|
|
41
|
+
"vue-virtual-scroller",
|
|
42
|
+
"vuedraggable"
|
|
43
|
+
],
|
|
44
|
+
exclude: ["@msgpack/msgpack"]
|
|
29
45
|
},
|
|
30
46
|
define: {
|
|
31
47
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
package/.eslintrc.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
browser: true,
|
|
4
|
-
es2021: true,
|
|
5
|
-
node: true
|
|
6
|
-
},
|
|
7
|
-
extends: ["eslint:recommended", "plugin:vue/vue3-essential"],
|
|
8
|
-
overrides: [],
|
|
9
|
-
parserOptions: {
|
|
10
|
-
ecmaVersion: "latest",
|
|
11
|
-
sourceType: "module"
|
|
12
|
-
},
|
|
13
|
-
plugins: ["vue"],
|
|
14
|
-
rules: {
|
|
15
|
-
"html.validate.scripts": 0,
|
|
16
|
-
"html.validate.styles": 0
|
|
17
|
-
},
|
|
18
|
-
ignorePatterns: ["src/registerServiceWorker.js", "src/libs/panzoom.js", "**/**.vue"],
|
|
19
|
-
globals: {
|
|
20
|
-
Bot: true,
|
|
21
|
-
refreshTaskOnFrontEnd: true,
|
|
22
|
-
pushWSUpdate: true
|
|
23
|
-
}
|
|
24
|
-
};
|
package/.prettierrc
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"tabWidth": 4,
|
|
3
|
-
"useTabs": false,
|
|
4
|
-
"semi": true,
|
|
5
|
-
"singleQuote": false,
|
|
6
|
-
"trailingComma": "none",
|
|
7
|
-
"bracketSpacing": true,
|
|
8
|
-
"arrowParens": "always",
|
|
9
|
-
"printWidth": 120,
|
|
10
|
-
"vueIndentScriptAndStyle": false,
|
|
11
|
-
"htmlWhitespaceSensitivity": "ignore",
|
|
12
|
-
"bracketSameLine": true,
|
|
13
|
-
"singleAttributePerLine": false,
|
|
14
|
-
"endOfLine": "lf",
|
|
15
|
-
"overrides": [
|
|
16
|
-
{
|
|
17
|
-
"files": "*.vue",
|
|
18
|
-
"options": {
|
|
19
|
-
"vueIndentScriptAndStyle": false,
|
|
20
|
-
"htmlWhitespaceSensitivity": "ignore",
|
|
21
|
-
"singleAttributePerLine": false,
|
|
22
|
-
"bracketSameLine": true,
|
|
23
|
-
"printWidth": 120,
|
|
24
|
-
"tabWidth": 4,
|
|
25
|
-
"useTabs": false,
|
|
26
|
-
"semi": true,
|
|
27
|
-
"singleQuote": false,
|
|
28
|
-
"trailingComma": "none",
|
|
29
|
-
"bracketSpacing": true,
|
|
30
|
-
"arrowParens": "always"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"plugins": ["prettier-plugin-tailwindcss"],
|
|
35
|
-
"tailwindConfig": "./tailwind.config.js"
|
|
36
|
-
}
|