ysk-omni 1.0.4 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -4,6 +4,50 @@ Newest first. Every version from 1.0.0 is grouped by category. `README.md` shows
4
4
 
5
5
  Entries come from git history, tags, and GitHub Releases.
6
6
 
7
+ ## 1.0.6 — 2026-11-01
8
+
9
+ ### Security
10
+
11
+ - CI (`.github/workflows/ci.yml`) runs the test job on Node 24 instead of Node 20. Node 20 is end of life (final release 20.20.2) and has no fix for CVE-2026-111497 (Brotli out-of-bounds write). The release workflow already publishes on Node 24. Package `engines` stay `>=20`.
12
+ - Production hosts should run Node ≥22.23.4, ≥24.22.1, or ≥26.12.1. As of 2026-11-01 the current builds on those lines are 22.23.4, 24.22.2, and 26.13.0.
13
+
14
+ ### Dependency upgrades
15
+
16
+ - `typescript-eslint` 8.72.0 → 8.72.1, including the matching `@typescript-eslint/*` packages. Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
17
+
18
+ ### Internal/CI
19
+
20
+ - Bump the package version to 1.0.6, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.6.
21
+ - Getting started, operations, and development docs (English and 中文) record the Node 24 CI job and the production Node floor.
22
+ - Type the Admin `formatApiError` fallback body as the error object so `npm run typecheck:admin` accepts `details.feature`, `details.flag`, and `details.reason`. Runtime behavior is unchanged.
23
+
24
+ GitHub Release: https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.6
25
+ Compare: https://github.com/yanshekki/ysk-omni/compare/v1.0.5...v1.0.6
26
+
27
+ ## 1.0.5 — 2026-10-25
28
+
29
+ ### Security
30
+
31
+ - Upgrade `multer` 1.4.5-lts to 2.5.0 to fix CVE-2026-77078 (High multipart field-name DoS) and later 2.x multipart fixes through 2.5.0, including CVE-2026-113872. Upload routes still use `memoryStorage`. Multer limit errors now return 413 / 400 instead of 500.
32
+ - Pin transitive `body-parser` 1.20.9 (CVE-2026-111181 / GHSA-27r3-jxmh-p828) with an npm `overrides` entry so `express.json` and `urlencoded` get the patched parser.
33
+ - Upgrade `vite` 6.4.4 → 6.4.5 (GHSA-8g5g-mxqh-grgj). The advisory applies to the Admin Vite **dev** server; production serves the built static Admin bundle.
34
+ - Production hosts should run a Node.js build from the 2026-10-21 security releases (22.23.4, 24.22.1, 26.12.1, or current patched LTS) for CVE-2026-111497 and related runtime fixes. Package `engines` stay `>=20`.
35
+
36
+ ### Dependency upgrades
37
+
38
+ - `multer` 1.4.5-lts.2 → 2.5.0
39
+ - `@types/multer` 1.4.13 → 2.3.0
40
+ - `body-parser` 1.20.8 → 1.20.9 (override)
41
+ - `vite` 6.4.4 → 6.4.5
42
+ - `typescript-eslint` 8.71.1 → 8.72.0
43
+
44
+ ### Internal/CI
45
+
46
+ - Bump the package version to 1.0.5, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.5.
47
+
48
+ GitHub Release: https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.5
49
+ Compare: https://github.com/yanshekki/ysk-omni/compare/v1.0.4...v1.0.5
50
+
7
51
  ## 1.0.4 — 2026-10-11
8
52
 
9
53
  ### Security
package/CHANGELOG.zh.md CHANGED
@@ -4,6 +4,50 @@
4
4
 
5
5
  條目來自 git 歷史、標籤與 GitHub Release。
6
6
 
7
+ ## 1.0.6 — 2026-11-01
8
+
9
+ ### 安全
10
+
11
+ - CI(`.github/workflows/ci.yml`)改在 Node 24 上跑測試,不再使用 Node 20。Node 20 已結束支援(最後版本 20.20.2),沒有 CVE-2026-111497(Brotli 越界寫入)的修補。發佈工作流程本來已在 Node 24 上發佈。套件 `engines` 維持 `>=20`。
12
+ - 生產主機應使用 Node ≥22.23.4、≥24.22.1 或 ≥26.12.1。截至 2026-11-01,這些線上的現行版本是 22.23.4、24.22.2 與 26.13.0。
13
+
14
+ ### 依賴升級
15
+
16
+ - `typescript-eslint` 8.72.0 → 8.72.1,連同對應的 `@typescript-eslint/*`。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
17
+
18
+ ### 內部/CI
19
+
20
+ - 將套件版本升至 1.0.6、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.6。
21
+ - 快速開始、維運與開發文件(英文與中文)記錄 CI 使用 Node 24,以及生產環境的 Node 下限。
22
+ - 將 Admin `formatApiError` 的後備錯誤本體標成錯誤物件,讓 `npm run typecheck:admin` 接受 `details.feature`、`details.flag` 與 `details.reason`。執行時期行為不變。
23
+
24
+ GitHub Release:https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.6
25
+ 比較:https://github.com/yanshekki/ysk-omni/compare/v1.0.5...v1.0.6
26
+
27
+ ## 1.0.5 — 2026-10-25
28
+
29
+ ### 安全
30
+
31
+ - 將 `multer` 由 1.4.5-lts 升至 2.5.0,修復 CVE-2026-77078(高危 multipart 欄位名拒絕服務)以及 2.x 至 2.5.0 的後續 multipart 修補,包括 CVE-2026-113872。上傳路由仍用 `memoryStorage`。Multer 上限錯誤改回 413/400,不再當 500。
32
+ - 以 npm `overrides` 釘選傳遞依賴 `body-parser` 1.20.9(CVE-2026-111181/GHSA-27r3-jxmh-p828),讓 `express.json` 與 `urlencoded` 用上已修補的解析器。
33
+ - 將 `vite` 由 6.4.4 升至 6.4.5(GHSA-8g5g-mxqh-grgj)。該公告只影響 Admin Vite **開發**伺服器;生產環境提供已建置的靜態 Admin。
34
+ - 生產主機應使用 2026-10-21 Node.js 安全版本(22.23.4、24.22.1、26.12.1,或現行已修補 LTS),以覆蓋 CVE-2026-111497 等執行時期修補。套件 `engines` 維持 `>=20`。
35
+
36
+ ### 依賴升級
37
+
38
+ - `multer` 1.4.5-lts.2 → 2.5.0
39
+ - `@types/multer` 1.4.13 → 2.3.0
40
+ - `body-parser` 1.20.8 → 1.20.9(override)
41
+ - `vite` 6.4.4 → 6.4.5
42
+ - `typescript-eslint` 8.71.1 → 8.72.0
43
+
44
+ ### 內部/CI
45
+
46
+ - 將套件版本升至 1.0.5、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.5。
47
+
48
+ GitHub Release:https://github.com/yanshekki/ysk-omni/releases/tag/v1.0.5
49
+ 比較:https://github.com/yanshekki/ysk-omni/compare/v1.0.4...v1.0.5
50
+
7
51
  ## 1.0.4 — 2026-10-11
8
52
 
9
53
  ### 安全
package/README-ZH.md CHANGED
@@ -34,6 +34,44 @@ curl -sS http://127.0.0.1:3850/v1/models \
34
34
 
35
35
  ## 更新日誌
36
36
 
37
+ ### 1.0.6 — 2026-11-01
38
+
39
+ ### 安全
40
+
41
+ - CI(`.github/workflows/ci.yml`)改在 Node 24 上跑測試,不再使用 Node 20。Node 20 已結束支援(最後版本 20.20.2),沒有 CVE-2026-111497(Brotli 越界寫入)的修補。發佈工作流程本來已在 Node 24 上發佈。套件 `engines` 維持 `>=20`。
42
+ - 生產主機應使用 Node ≥22.23.4、≥24.22.1 或 ≥26.12.1。截至 2026-11-01,這些線上的現行版本是 22.23.4、24.22.2 與 26.13.0。
43
+
44
+ ### 依賴升級
45
+
46
+ - `typescript-eslint` 8.72.0 → 8.72.1,連同對應的 `@typescript-eslint/*`。其餘直接依賴在 lockfile 已是主版本內的最新版,沒有改動。
47
+
48
+ ### 內部/CI
49
+
50
+ - 將套件版本升至 1.0.6、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.6。
51
+ - 快速開始、維運與開發文件(英文與中文)記錄 CI 使用 Node 24,以及生產環境的 Node 下限。
52
+ - 將 Admin `formatApiError` 的後備錯誤本體標成錯誤物件,讓 `npm run typecheck:admin` 接受 `details.feature`、`details.flag` 與 `details.reason`。執行時期行為不變。
53
+
54
+ ### 1.0.5 — 2026-10-25
55
+
56
+ ### 安全
57
+
58
+ - 將 `multer` 由 1.4.5-lts 升至 2.5.0,修復 CVE-2026-77078(高危 multipart 欄位名拒絕服務)以及 2.x 至 2.5.0 的後續 multipart 修補,包括 CVE-2026-113872。上傳路由仍用 `memoryStorage`。Multer 上限錯誤改回 413/400,不再當 500。
59
+ - 以 npm `overrides` 釘選傳遞依賴 `body-parser` 1.20.9(CVE-2026-111181/GHSA-27r3-jxmh-p828),讓 `express.json` 與 `urlencoded` 用上已修補的解析器。
60
+ - 將 `vite` 由 6.4.4 升至 6.4.5(GHSA-8g5g-mxqh-grgj)。該公告只影響 Admin Vite **開發**伺服器;生產環境提供已建置的靜態 Admin。
61
+ - 生產主機應使用 2026-10-21 Node.js 安全版本(22.23.4、24.22.1、26.12.1,或現行已修補 LTS),以覆蓋 CVE-2026-111497 等執行時期修補。套件 `engines` 維持 `>=20`。
62
+
63
+ ### 依賴升級
64
+
65
+ - `multer` 1.4.5-lts.2 → 2.5.0
66
+ - `@types/multer` 1.4.13 → 2.3.0
67
+ - `body-parser` 1.20.8 → 1.20.9(override)
68
+ - `vite` 6.4.4 → 6.4.5
69
+ - `typescript-eslint` 8.71.1 → 8.72.0
70
+
71
+ ### 內部/CI
72
+
73
+ - 將套件版本升至 1.0.5、更新 Admin fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.5。
74
+
37
75
  ### 1.0.4 — 2026-10-11
38
76
 
39
77
  ### 安全
@@ -58,33 +96,6 @@ curl -sS http://127.0.0.1:3850/v1/models \
58
96
  - Prisma CLI 版本釘選與 `prisma`/`@prisma/client` 6.19.3 同步。
59
97
  - 在 `typescript-eslint` 升級後通過 lint(case 區塊作用域、多餘自我賦值、generator `yield`、Admin ESLint glob)。
60
98
 
61
- ### 1.0.3 — 2026-10-05
62
-
63
- ### 安全
64
-
65
- - 由 GitHub Actions 以 npm Trusted Publishing(OIDC)發佈 `ysk-omni`,並附上 provenance 來源證明。發佈工作流程不使用 npm token。
66
-
67
- ### 內部/CI
68
-
69
- - `.github/workflows/release.yml` 在版本標籤上執行測試;若套件庫尚未有該版本才發佈,然後以 `npm view ysk-omni@<version>` 核對,並建立一個 GitHub Release。
70
- - `README.md` 與 `README-ZH.md` 只列出最近三個版本,並按類別分組。`CHANGELOG.md` 與 `CHANGELOG.zh.md` 保留由 1.0.0 起的每個版本。
71
- - 開發文件記錄這條更新日誌規則。
72
- - CI 與發佈工作流程改用在 Node 24 上執行的 GitHub Actions(`actions/checkout@v7`、`actions/setup-node@v7`、`softprops/action-gh-release@v3`)。發佈工作使用 Node 24。
73
-
74
- ### 1.0.2 — 2026-09-28
75
-
76
- ### 改進
77
-
78
- - 完成其餘 Admin 字串的八種語言翻譯(`683a52f`)
79
- - 將 Admin 字串 600–799 譯成八種語言(`8f77c6e`)
80
- - 將 Admin 字串 400–599 譯成八種語言(`03c1bc3`)
81
- - 將 Admin 字串 200–399 譯成八種語言(`dfebb9e`)
82
- - 將首 200 條 Admin 字串譯成八種語言(`e891f6d`)
83
-
84
- ### 內部/CI
85
-
86
- - 將套件版本升至 1.0.2、更新測試 fixtures,並重建 Admin bundle,讓側欄顯示 v1.0.2(`03b3b1b`)
87
-
88
99
  完整更新日誌:[CHANGELOG.zh.md](./CHANGELOG.zh.md)。
89
100
 
90
101
  ## 授權
package/README.md CHANGED
@@ -34,6 +34,44 @@ Full CLI, API, Admin, Catalog, Runtimes, keys, and operations: **[Documentation]
34
34
 
35
35
  ## Changelog
36
36
 
37
+ ### 1.0.6 — 2026-11-01
38
+
39
+ ### Security
40
+
41
+ - CI (`.github/workflows/ci.yml`) runs the test job on Node 24 instead of Node 20. Node 20 is end of life (final release 20.20.2) and has no fix for CVE-2026-111497 (Brotli out-of-bounds write). The release workflow already publishes on Node 24. Package `engines` stay `>=20`.
42
+ - Production hosts should run Node ≥22.23.4, ≥24.22.1, or ≥26.12.1. As of 2026-11-01 the current builds on those lines are 22.23.4, 24.22.2, and 26.13.0.
43
+
44
+ ### Dependency upgrades
45
+
46
+ - `typescript-eslint` 8.72.0 → 8.72.1, including the matching `@typescript-eslint/*` packages. Other direct dependencies were already at the latest within-major version in the lockfile and were not changed.
47
+
48
+ ### Internal/CI
49
+
50
+ - Bump the package version to 1.0.6, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.6.
51
+ - Getting started, operations, and development docs (English and 中文) record the Node 24 CI job and the production Node floor.
52
+ - Type the Admin `formatApiError` fallback body as the error object so `npm run typecheck:admin` accepts `details.feature`, `details.flag`, and `details.reason`. Runtime behavior is unchanged.
53
+
54
+ ### 1.0.5 — 2026-10-25
55
+
56
+ ### Security
57
+
58
+ - Upgrade `multer` 1.4.5-lts to 2.5.0 to fix CVE-2026-77078 (High multipart field-name DoS) and later 2.x multipart fixes through 2.5.0, including CVE-2026-113872. Upload routes still use `memoryStorage`. Multer limit errors now return 413 / 400 instead of 500.
59
+ - Pin transitive `body-parser` 1.20.9 (CVE-2026-111181 / GHSA-27r3-jxmh-p828) with an npm `overrides` entry so `express.json` and `urlencoded` get the patched parser.
60
+ - Upgrade `vite` 6.4.4 → 6.4.5 (GHSA-8g5g-mxqh-grgj). The advisory applies to the Admin Vite **dev** server; production serves the built static Admin bundle.
61
+ - Production hosts should run a Node.js build from the 2026-10-21 security releases (22.23.4, 24.22.1, 26.12.1, or current patched LTS) for CVE-2026-111497 and related runtime fixes. Package `engines` stay `>=20`.
62
+
63
+ ### Dependency upgrades
64
+
65
+ - `multer` 1.4.5-lts.2 → 2.5.0
66
+ - `@types/multer` 1.4.13 → 2.3.0
67
+ - `body-parser` 1.20.8 → 1.20.9 (override)
68
+ - `vite` 6.4.4 → 6.4.5
69
+ - `typescript-eslint` 8.71.1 → 8.72.0
70
+
71
+ ### Internal/CI
72
+
73
+ - Bump the package version to 1.0.5, update Admin fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.5.
74
+
37
75
  ### 1.0.4 — 2026-10-11
38
76
 
39
77
  ### Security
@@ -58,33 +96,6 @@ Full CLI, API, Admin, Catalog, Runtimes, keys, and operations: **[Documentation]
58
96
  - Keep Prisma CLI version pins in lockstep with `prisma` / `@prisma/client` 6.19.3.
59
97
  - Clear the lint gate after the `typescript-eslint` bump (case-block scope, unused self-assign, generator `yield`, Admin ESLint glob).
60
98
 
61
- ### 1.0.3 — 2026-10-05
62
-
63
- ### Security
64
-
65
- - Publish `ysk-omni` from GitHub Actions with npm Trusted Publishing (OIDC) and a provenance attestation. The release workflow does not use an npm token.
66
-
67
- ### Internal/CI
68
-
69
- - `.github/workflows/release.yml` runs the test suite on a version tag, publishes that version when it is not already on the registry, checks `npm view ysk-omni@<version>`, and creates one GitHub Release.
70
- - `README.md` and `README-ZH.md` list only the latest three versions, grouped by category. `CHANGELOG.md` and `CHANGELOG.zh.md` keep every version from 1.0.0.
71
- - Development docs record this changelog rule.
72
- - CI and the release workflow use GitHub Actions on the Node 24 runtime (`actions/checkout@v7`, `actions/setup-node@v7`, `softprops/action-gh-release@v3`). The publish job runs on Node 24.
73
-
74
- ### 1.0.2 — 2026-09-28
75
-
76
- ### Improvements
77
-
78
- - Finish remaining Admin strings for eight languages (`683a52f`)
79
- - Translate Admin strings 600–799 into eight languages (`8f77c6e`)
80
- - Translate Admin strings 400–599 into eight languages (`03c1bc3`)
81
- - Translate Admin strings 200–399 into eight languages (`dfebb9e`)
82
- - Translate first 200 Admin strings into eight languages (`e891f6d`)
83
-
84
- ### Internal/CI
85
-
86
- - Bump the package version, update fixtures, and rebuild the Admin bundle so the sidebar shows v1.0.2 (`03b3b1b`)
87
-
88
99
  Full changelog: [CHANGELOG.md](./CHANGELOG.md).
89
100
 
90
101
  ## License
@@ -1 +1 @@
1
- {"version":3,"file":"error.middleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/error.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAY/D,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAEtF;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,YAAY,GAClB,IAAI,CAuCN"}
1
+ {"version":3,"file":"error.middleware.d.ts","sourceRoot":"","sources":["../../src/middlewares/error.middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyB/D,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAEtF;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,YAAY,GAClB,IAAI,CAwCN"}
@@ -1,10 +1,26 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.notFoundHandler = notFoundHandler;
4
7
  exports.errorMiddleware = errorMiddleware;
8
+ const multer_1 = __importDefault(require("multer"));
9
+ const env_1 = require("../config/env");
5
10
  const http_exception_1 = require("../exceptions/http.exception");
6
11
  const exception_factory_1 = require("../exceptions/exception.factory");
7
12
  const logger_1 = require("../utils/logger");
13
+ function toHttpException(err) {
14
+ if (err instanceof http_exception_1.HttpException)
15
+ return err;
16
+ if (err instanceof multer_1.default.MulterError) {
17
+ if (err.code === 'LIMIT_FILE_SIZE') {
18
+ return exception_factory_1.ExceptionFactory.documentTooLarge(env_1.env.UPLOAD_MAX_BYTES);
19
+ }
20
+ return exception_factory_1.ExceptionFactory.validation(err.message);
21
+ }
22
+ return undefined;
23
+ }
8
24
  function requestPath(req) {
9
25
  return req.originalUrl || req.url || req.path || '';
10
26
  }
@@ -19,24 +35,25 @@ function errorMiddleware(err, req, res, _next) {
19
35
  res.status(httpErr.statusCode).json((0, http_exception_1.toProtocolErrorBody)(httpErr, path));
20
36
  return;
21
37
  }
22
- if (err instanceof http_exception_1.HttpException) {
23
- if (err.statusCode >= 500) {
24
- logger_1.logger.error({ err, requestId: req.requestId, path: req.path }, err.message);
38
+ const httpErr = toHttpException(err);
39
+ if (httpErr) {
40
+ if (httpErr.statusCode >= 500) {
41
+ logger_1.logger.error({ err, requestId: req.requestId, path: req.path }, httpErr.message);
25
42
  }
26
43
  else {
27
- logger_1.logger.warn({ code: err.code, requestId: req.requestId, path: req.path }, err.message);
44
+ logger_1.logger.warn({ code: httpErr.code, requestId: req.requestId, path: req.path }, httpErr.message);
28
45
  }
29
46
  if (res.headersSent) {
30
47
  return;
31
48
  }
32
- res.status(err.statusCode).json((0, http_exception_1.toProtocolErrorBody)(err, path));
49
+ res.status(httpErr.statusCode).json((0, http_exception_1.toProtocolErrorBody)(httpErr, path));
33
50
  return;
34
51
  }
35
52
  logger_1.logger.error({ err, requestId: req.requestId, path: req.path }, 'Unhandled error');
36
53
  if (res.headersSent) {
37
54
  return;
38
55
  }
39
- const httpErr = exception_factory_1.ExceptionFactory.internal();
40
- res.status(httpErr.statusCode).json((0, http_exception_1.toProtocolErrorBody)(httpErr, path));
56
+ const fallback = exception_factory_1.ExceptionFactory.internal();
57
+ res.status(fallback.statusCode).json((0, http_exception_1.toProtocolErrorBody)(fallback, path));
41
58
  }
42
59
  //# sourceMappingURL=error.middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.middleware.js","sourceRoot":"","sources":["../../src/middlewares/error.middleware.ts"],"names":[],"mappings":";;AAYA,0CAEC;AAED,0CA4CC;AA3DD,iEAGsC;AACtC,uEAAmE;AACnE,4CAAyC;AAEzC,SAAS,WAAW,CAAC,GAAY;IAC/B,OAAO,GAAG,CAAC,WAAW,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;AACtD,CAAC;AAED,SAAgB,eAAe,CAAC,GAAY,EAAE,IAAc,EAAE,IAAkB;IAC9E,IAAI,CAAC,oCAAgB,CAAC,QAAQ,CAAC,SAAS,GAAG,CAAC,MAA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AAC,CAAC;QACxE,OAAO;IACT,CAAC;IAED,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,iBAAiB,CAAC,CAAC;IAEnF,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,MAAM,QAAQ,GAAG,oCAAgB,CAAC,QAAQ,EAAE,CAAC;IAC7C,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAA,oCAAmB,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC"}
@@ -52,6 +52,8 @@ Live media (optional): `OMNI_LIVE_TINY=1` or `OMNI_LIVE_BEST=1` plus `OMNI_LIVE_
52
52
 
53
53
  Push an annotated tag `vX.Y.Z` whose version matches `package.json` `"version"`. [`.github/workflows/release.yml`](../../.github/workflows/release.yml) — that filename, with no GitHub environment — runs the tests, then publishes to npm with Trusted Publishing. Authentication is GitHub Actions OIDC (`id-token: write`), and the publish includes a provenance attestation. Do not add an npm token (`NPM_TOKEN`, `NODE_AUTH_TOKEN`, or registry auth). If that version is already on the registry, the workflow skips publish, then runs `npm view ysk-omni@<version>` and creates or updates one GitHub Release.
54
54
 
55
+ CI ([`.github/workflows/ci.yml`](../../.github/workflows/ci.yml)) installs Node 24 and runs the same build and test steps. Node 20 is end of life and is not used in CI. Package `engines` stay `>=20`; production should use the patched Node builds in [Operations](operations.md).
56
+
55
57
  Changelog rule:
56
58
 
57
59
  - [`CHANGELOG.md`](../../CHANGELOG.md) and [`CHANGELOG.zh.md`](../../CHANGELOG.zh.md) record every version from 1.0.0, newest first.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Requirements
4
4
 
5
- - Node.js 20 or later
5
+ - Node.js 20 or later (`engines`). Node 20 is end of life and has no fix for CVE-2026-111497. Production should run Node ≥22.23.4, ≥24.22.1, or ≥26.12.1. See [Operations](operations.md).
6
6
  - Text GGUF: `llama-server` on `PATH`, or `OMNI_LLAMA_SERVER`
7
7
  - Text safetensors: `vLLM` (`OMNI_VLLM`)
8
8
  - Image / speech / video: an OpenAI-shaped HTTP worker (see [Media](media.md))
@@ -11,6 +11,12 @@ curl -sS http://127.0.0.1:3850/ready
11
11
 
12
12
  `/ready` checks SQLite and whether `llama-server` is on PATH.
13
13
 
14
+ ## Node.js runtime
15
+
16
+ The package `engines` field is Node.js 20 or later. Node 20 is end of life (final release 20.20.2) and has no fix for the Brotli out-of-bounds write (CVE-2026-111497). Production hosts should run at least **22.23.4**, **24.22.1**, or **26.12.1**. As of 2026-11-01 the current builds on those lines are 22.23.4, 24.22.2, and 26.13.0.
17
+
18
+ GitHub Actions CI (`.github/workflows/ci.yml`) runs the suite on Node 24. The release workflow publishes on Node 24 as well.
19
+
14
20
  ## Process manager
15
21
 
16
22
  ```bash
@@ -52,6 +52,8 @@ npm run test:registry
52
52
 
53
53
  推送附註標籤 `vX.Y.Z`,版本須與 `package.json` 的 `"version"` 相同。[`.github/workflows/release.yml`](../../.github/workflows/release.yml) 的檔名必須是這個,而且不要設定 GitHub environment。該工作流程先跑測試,再以 Trusted Publishing 發佈到 npm。認證只用 GitHub Actions OIDC(`id-token: write`),發佈附帶 provenance 來源證明。不要加入 npm token(`NPM_TOKEN`、`NODE_AUTH_TOKEN` 或套件庫認證)。若套件庫已有該版本,工作流程會略過發佈,然後執行 `npm view ysk-omni@<version>`,並建立或更新一個 GitHub Release。
54
54
 
55
+ CI([`.github/workflows/ci.yml`](../../.github/workflows/ci.yml))安裝 Node 24,並執行相同的建置與測試。Node 20 已結束支援,CI 不再使用。套件 `engines` 維持 `>=20`;生產環境應使用[維運](operations.md)列出的已修補 Node 版本。
56
+
55
57
  更新日誌規則:
56
58
 
57
59
  - [`CHANGELOG.md`](../../CHANGELOG.md) 與 [`CHANGELOG.zh.md`](../../CHANGELOG.zh.md) 記錄由 1.0.0 起的每個版本,最新的在最前。
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 前置要求
4
4
 
5
- - Node.js 20 或以上
5
+ - Node.js 20 或以上(`engines`)。Node 20 已結束支援,沒有 CVE-2026-111497 的修補。生產環境應使用 Node ≥22.23.4、≥24.22.1 或 ≥26.12.1。見[維運](operations.md)。
6
6
  - 文字 GGUF:`PATH` 上的 `llama-server`,或 `OMNI_LLAMA_SERVER`
7
7
  - 文字 safetensors:`vLLM`(`OMNI_VLLM`)
8
8
  - 圖像/語音/影片:OpenAI 形狀的 HTTP worker(見[媒體](media.md))
@@ -11,6 +11,12 @@ curl -sS http://127.0.0.1:3850/ready
11
11
 
12
12
  `/ready` 檢查 SQLite,以及 `llama-server` 是否在 PATH。
13
13
 
14
+ ## Node.js 執行時期
15
+
16
+ 套件 `engines` 為 Node.js 20 或以上。Node 20 已結束支援(最後版本 20.20.2),沒有 Brotli 越界寫入(CVE-2026-111497)的修補。生產主機至少應使用 **22.23.4**、**24.22.1** 或 **26.12.1**。截至 2026-11-01,這些線上的現行版本是 22.23.4、24.22.2 與 26.13.0。
17
+
18
+ GitHub Actions CI(`.github/workflows/ci.yml`)在 Node 24 上執行測試。發佈工作流程同樣在 Node 24 上發佈。
19
+
14
20
  ## 行程管理
15
21
 
16
22
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ysk-omni",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "YSK Omni — local models behind an OpenAI-compatible gateway, with Admin panel and CLI",
5
5
  "keywords": [
6
6
  "openai",
@@ -82,7 +82,7 @@
82
82
  "express": "^4.22.3",
83
83
  "express-rate-limit": "^7.5.0",
84
84
  "helmet": "^8.0.0",
85
- "multer": "^1.4.5-lts.1",
85
+ "multer": "^2.5.0",
86
86
  "pino": "^9.6.0",
87
87
  "pino-http": "^10.4.0",
88
88
  "prisma": "6.19.3",
@@ -92,7 +92,7 @@
92
92
  "@eslint/js": "^9.39.5",
93
93
  "@types/cors": "^2.8.17",
94
94
  "@types/express": "^4.17.21",
95
- "@types/multer": "^1.4.12",
95
+ "@types/multer": "^2.3.0",
96
96
  "@types/node": "^22.20.5",
97
97
  "@vitest/coverage-v8": "^3.0.9",
98
98
  "eslint": "^9.39.5",
@@ -100,11 +100,14 @@
100
100
  "pino-pretty": "^13.2.0",
101
101
  "tsx": "^4.23.15",
102
102
  "typescript": "5.8",
103
- "typescript-eslint": "^8.71.1",
104
- "vite": "^6.4.4",
103
+ "typescript-eslint": "^8.72.1",
104
+ "vite": "^6.4.5",
105
105
  "vitest": "^3.0.9"
106
106
  },
107
107
  "engines": {
108
108
  "node": ">=20"
109
+ },
110
+ "overrides": {
111
+ "body-parser": "1.20.9"
109
112
  }
110
113
  }
@@ -28,7 +28,7 @@ const Vs="YSK Omni",Ws="Admin Panel",Qs="Admin",Js="API Key",Ys="One-time login
28
28
  <div class="lang-switch-heading">${dt(a)}</div>
29
29
  <ul class="lang-switch-list" role="listbox" aria-label="${dt(a)}">${i}</ul>
30
30
  </div>
31
- </div>`}function Ht(){document.querySelectorAll("[data-lang-switch]").forEach(a=>{a.classList.remove("is-open");const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");s&&s.setAttribute("aria-expanded","false"),i&&i.setAttribute("hidden","")})}function cm(a){const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");if(!s||!i)return;const o=s.getBoundingClientRect(),n=Math.min(280,Math.max(o.width,228)),d=Math.min(Math.max(8,o.left),Math.max(8,window.innerWidth-n-8));i.style.width=`${n}px`,i.style.left=`${d}px`;const r=window.innerHeight-o.bottom;r<260&&o.top>r?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top+6}px`):(i.style.top=`${o.bottom+6}px`,i.style.bottom="auto")}function ns(a){document.querySelectorAll("[data-lang-switch]").forEach(s=>{const i=s.querySelector(".lang-switch-btn"),o=s.querySelector(".lang-switch-panel");if(!i||!o)return;const n=()=>{Ht(),s.classList.add("is-open"),i.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),cm(s)},d=()=>{s.classList.remove("is-open"),i.setAttribute("aria-expanded","false"),o.setAttribute("hidden","")};o.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("click",r=>{r.stopPropagation(),s.classList.contains("is-open")?d():n()}),s.querySelectorAll("[data-lang]").forEach(r=>{r.addEventListener("click",u=>{u.stopPropagation();const m=r.getAttribute("data-lang")||"";if(!Ma(m)||m===ze){d();return}nm(m),a()})})}),window.__yskLangSwitchBound||(window.__yskLangSwitchBound=!0,document.addEventListener("click",()=>Ht()),document.addEventListener("keydown",s=>{s.key==="Escape"&&Ht()}),window.addEventListener("resize",()=>Ht()))}os(ze);const um="1.0.4",mm={version:um},pm=String(mm.version),rs=new Set([".txt",".md",".markdown",".csv",".json",".xml",".html",".htm",".js",".ts",".tsx",".jsx",".py",".java",".go",".rs",".c",".cpp",".h",".hpp",".css",".yml",".yaml",".toml",".ini",".env",".sh",".sql",".log",".pdf",".png",".jpg",".jpeg",".webp",".gif"]),gm=[...rs].join(","),ft="/admin/api",Vt="gog_admin_session";let Xe=null,Ze=!1;function Ia(a,s){const i=a?.error&&typeof a.error=="object"?a.error:a||{},o=typeof i.code=="string"?i.code:"",n=i.details&&typeof i.details=="object"?i.details:{},d=typeof n.feature=="string"?n.feature:typeof n.flag=="string"?n.flag:"",r=typeof n.reason=="string"?n.reason:"",u=String(i.message||a?.message||s||"");if(d&&(o==="feature_disabled"||o==="media_not_supported"||o==="forbidden")){const c=`errors.feature.${d}`;if(Pe(c))return e(c)}if(o==="feature_disabled"&&Pe("errors.feature_disabled")){const c=la(u);return c&&Pe(`errors.feature.${c}`)?e(`errors.feature.${c}`):e("errors.feature_disabled")}if(r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_generation_failed"&&r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_forbidden"&&Pe("errors.media_forbidden"))return e("errors.media_forbidden");const m=la(u);if(m&&Pe(`errors.feature.${m}`))return e(`errors.feature.${m}`);if(o){const c=`errors.${o}`;if(Pe(c))return e(c)}const g=la(u);return g&&Pe(`errors.feature.${g}`)?e(`errors.feature.${g}`):/agent-mode|agent mode|Safe keys cannot/i.test(u)?e("errors.media.agent_or_admin_required"):/no image file was found/i.test(u)?e("errors.media.no_image_in_sandbox"):/no video file was found/i.test(u)?e("errors.media.no_video_in_sandbox"):/does not support image edits/i.test(u)?e("errors.media.provider_no_edit"):/Provide an image file|sourceAssetId|sourceDocumentId/i.test(u)?e("errors.media.source_required"):/must be an image/i.test(u)?e("errors.media.source_must_be_image"):u||e("common.requestFailed")}function la(a){const s=String(a||"");return/videoApi/i.test(s)||/Video API is disabled/i.test(s)?"videoApi":/imagesApi/i.test(s)||/Images API is disabled/i.test(s)?"imagesApi":/audioApi/i.test(s)||/Audio API is disabled/i.test(s)?"audioApi":/filesOpenAiAlias/i.test(s)||/Files API alias/i.test(s)?"filesOpenAiAlias":/Tools are disabled/i.test(s)||/\btools\b/i.test(s)&&/disabled/i.test(s)&&/image/i.test(s)?"tools":""}const l={key:sessionStorage.getItem(Vt)||"",page:"dashboard",me:null,error:"",modal:null,chatFilter:{q:"",status:"",model:"",apiKeyId:"",from:"",to:"",policyMode:"",hasDocuments:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},docFilter:{q:"",apiKeyId:"",storageType:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},keyFilter:{q:"",role:"",mode:"",isActive:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},auditFilter:{q:"",action:"",apiKeyId:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},usageFilter:{tab:"model",modelQ:"",keyQ:"",keyActive:"",modelPage:0,keyPage:0,pageSize:10,sortBy:"lastUsedAt",sortDir:"desc",modelSortBy:"requests",modelSortDir:"desc"},ddosFilter:{tab:"policy",liveQ:"",banQ:"",banSource:"",livePage:0,banPage:0,pageSize:15,liveSortBy:"startedAt",liveSortDir:"desc",banSortBy:"createdAt",banSortDir:"desc",eventSortBy:"at",eventSortDir:"desc"},mediaFilter:{tab:"studio",q:"",kind:"",provider:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",jobSortBy:"createdAt",jobSortDir:"desc",limit:20,offset:0},systemTab:"software",sessionQ:"",pm2Tab:"runner",apiFeaturesTab:"protocols",catalogTab:"local",catalogModality:"",catalogPulling:"",catalogPull:{id:"",bytes:0,total:0},catalogQueue:[],catalogQueueRunning:!1,catalogHubQ:"",catalogHubHits:null,catalogHubNext:"",catalogHubBusy:!1,catalogPopularSyncedAt:"",runtimesOs:"host",runtimesMod:"",runtimesReport:null,runtimesInstall:null,models:[],catalogLocal:[],keys:[]},fm={login:"login",dashboard:"dashboard",chat:"chat",chats:"chats",keys:"keys",documents:"documents",media:"media",catalog:"catalog",runtimes:"runtimes",audit:"audit",settings:"settings","api-features":"apiFeatures",apifeatures:"apiFeatures",usage:"usage",ddos:"ddos",queue:"queue",pm2:"pm2",system:"system",support:"support",business:"business"};function bm(a){return a==="apiFeatures"?"api-features":a||"dashboard"}function wa(a){const s=String(a||"").replace(/^#\/?/,"").split("?")[0].split("/")[0].toLowerCase();return s?s==="runtime"||s==="engines"||s==="engine"?"runtimes":fm[s]||null:null}function Ta(a){const s=`#/${bm(a)}`;location.hash!==s&&history.pushState(null,"",s)}function hm(){const a=wa(location.hash);return a||(l.key?"dashboard":"login")}async function I(a,s={}){const i={...s.body?{"Content-Type":"application/json"}:{},...l.key?{Authorization:`Bearer ${l.key}`}:{},...s.headers||{}},o=await fetch(`${ft}${a}`,{...s,headers:i}),n=await o.text();let d=null;try{d=n?JSON.parse(n):null}catch{d={error:{message:n}}}if(!o.ok){const r=Ia(d,o.statusText),u=d?.error?.code||"";o.status===401?l.page!=="login"&&Wt(!1):o.status===403&&!["media_forbidden","feature_disabled","forbidden","media_not_supported"].includes(u)&&l.page!=="login"&&Wt(!1);const m=new Error(r);throw m.status=o.status,m.code=u,m.details=d?.error?.details,m}return d}async function Ft(a){const s=await a.text();let i=null;try{i=s?JSON.parse(s):null}catch{i={error:{message:s}}}if(!a.ok){const o=Ia(i,a.statusText),n=new Error(o);throw n.status=a.status,n.code=i?.error?.code,n.details=i?.error?.details,n}return i}function Wt(a=!0){const s=l.key;a&&s&&String(s).startsWith("gog_sess_")&&fetch("/admin/api/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${s}`}}).catch(()=>{}),a&&sessionStorage.removeItem(Vt),l.key="",l.me=null,l.page="login",Ta("login"),oa()}function xa(a){Ca(a,{writeHash:!0})}function Ca(a,s={}){const i=a||"dashboard";l.page=i,l.modal=null,l.error="",i==="chats"&&(l.chatFilter.offset=0),i==="documents"&&(l.docFilter.offset=0),i==="keys"&&(l.keyFilter.offset=0),i==="audit"&&(l.auditFilter.offset=0),i==="media"&&(l.mediaFilter.offset=0),i!=="ddos"&&Xe&&(clearInterval(Xe),Xe=null),i!=="chat"&&document.body.classList.remove("chat-history-open"),s.writeHash!==!1&&Ta(i),oa()}function t(a){return String(a??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}let Le=null,Qt=null;function et(a){const s=Qt;Qt=null,Le&&(Le.remove(),Le=null),document.body.classList.remove("ui-dialog-open"),document.removeEventListener("keydown",Ea,!0),s&&s(a)}function Ea(a){if(Le&&a.key==="Escape"){a.preventDefault(),a.stopPropagation();const s=Le.dataset.cancelable!=="0";et(s?Le.dataset.prompt==="1"?null:!1:!0)}}function La(a){Le&&et(!1);const s=a.variant||(a.showCancel===!1?"info":"confirm"),i=a.showCancel!==!1,o=!!a.input,n=a.title||e(s==="danger"?"common.dangerTitle":i?"common.confirmTitle":"common.notice"),d=a.confirmText||e(i?"common.confirm":"common.ok"),r=a.cancelText||e("common.cancel"),u=s==="danger"?"!":s==="info"&&!i?"i":"?",m=document.createElement("div");m.className="ui-dialog-back",m.id="ui-dialog-back",m.dataset.cancelable=i||o?"1":"0",m.dataset.prompt=o?"1":"0",m.setAttribute("role","presentation"),m.innerHTML=`
31
+ </div>`}function Ht(){document.querySelectorAll("[data-lang-switch]").forEach(a=>{a.classList.remove("is-open");const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");s&&s.setAttribute("aria-expanded","false"),i&&i.setAttribute("hidden","")})}function cm(a){const s=a.querySelector(".lang-switch-btn"),i=a.querySelector(".lang-switch-panel");if(!s||!i)return;const o=s.getBoundingClientRect(),n=Math.min(280,Math.max(o.width,228)),d=Math.min(Math.max(8,o.left),Math.max(8,window.innerWidth-n-8));i.style.width=`${n}px`,i.style.left=`${d}px`;const r=window.innerHeight-o.bottom;r<260&&o.top>r?(i.style.top="auto",i.style.bottom=`${window.innerHeight-o.top+6}px`):(i.style.top=`${o.bottom+6}px`,i.style.bottom="auto")}function ns(a){document.querySelectorAll("[data-lang-switch]").forEach(s=>{const i=s.querySelector(".lang-switch-btn"),o=s.querySelector(".lang-switch-panel");if(!i||!o)return;const n=()=>{Ht(),s.classList.add("is-open"),i.setAttribute("aria-expanded","true"),o.removeAttribute("hidden"),cm(s)},d=()=>{s.classList.remove("is-open"),i.setAttribute("aria-expanded","false"),o.setAttribute("hidden","")};o.addEventListener("click",r=>r.stopPropagation()),i.addEventListener("click",r=>{r.stopPropagation(),s.classList.contains("is-open")?d():n()}),s.querySelectorAll("[data-lang]").forEach(r=>{r.addEventListener("click",u=>{u.stopPropagation();const m=r.getAttribute("data-lang")||"";if(!Ma(m)||m===ze){d();return}nm(m),a()})})}),window.__yskLangSwitchBound||(window.__yskLangSwitchBound=!0,document.addEventListener("click",()=>Ht()),document.addEventListener("keydown",s=>{s.key==="Escape"&&Ht()}),window.addEventListener("resize",()=>Ht()))}os(ze);const um="1.0.6",mm={version:um},pm=String(mm.version),rs=new Set([".txt",".md",".markdown",".csv",".json",".xml",".html",".htm",".js",".ts",".tsx",".jsx",".py",".java",".go",".rs",".c",".cpp",".h",".hpp",".css",".yml",".yaml",".toml",".ini",".env",".sh",".sql",".log",".pdf",".png",".jpg",".jpeg",".webp",".gif"]),gm=[...rs].join(","),ft="/admin/api",Vt="gog_admin_session";let Xe=null,Ze=!1;function Ia(a,s){const i=a?.error&&typeof a.error=="object"?a.error:a||{},o=typeof i.code=="string"?i.code:"",n=i.details&&typeof i.details=="object"?i.details:{},d=typeof n.feature=="string"?n.feature:typeof n.flag=="string"?n.flag:"",r=typeof n.reason=="string"?n.reason:"",u=String(i.message||a?.message||s||"");if(d&&(o==="feature_disabled"||o==="media_not_supported"||o==="forbidden")){const c=`errors.feature.${d}`;if(Pe(c))return e(c)}if(o==="feature_disabled"&&Pe("errors.feature_disabled")){const c=la(u);return c&&Pe(`errors.feature.${c}`)?e(`errors.feature.${c}`):e("errors.feature_disabled")}if(r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_generation_failed"&&r&&Pe(`errors.media.${r}`))return e(`errors.media.${r}`);if(o==="media_forbidden"&&Pe("errors.media_forbidden"))return e("errors.media_forbidden");const m=la(u);if(m&&Pe(`errors.feature.${m}`))return e(`errors.feature.${m}`);if(o){const c=`errors.${o}`;if(Pe(c))return e(c)}const g=la(u);return g&&Pe(`errors.feature.${g}`)?e(`errors.feature.${g}`):/agent-mode|agent mode|Safe keys cannot/i.test(u)?e("errors.media.agent_or_admin_required"):/no image file was found/i.test(u)?e("errors.media.no_image_in_sandbox"):/no video file was found/i.test(u)?e("errors.media.no_video_in_sandbox"):/does not support image edits/i.test(u)?e("errors.media.provider_no_edit"):/Provide an image file|sourceAssetId|sourceDocumentId/i.test(u)?e("errors.media.source_required"):/must be an image/i.test(u)?e("errors.media.source_must_be_image"):u||e("common.requestFailed")}function la(a){const s=String(a||"");return/videoApi/i.test(s)||/Video API is disabled/i.test(s)?"videoApi":/imagesApi/i.test(s)||/Images API is disabled/i.test(s)?"imagesApi":/audioApi/i.test(s)||/Audio API is disabled/i.test(s)?"audioApi":/filesOpenAiAlias/i.test(s)||/Files API alias/i.test(s)?"filesOpenAiAlias":/Tools are disabled/i.test(s)||/\btools\b/i.test(s)&&/disabled/i.test(s)&&/image/i.test(s)?"tools":""}const l={key:sessionStorage.getItem(Vt)||"",page:"dashboard",me:null,error:"",modal:null,chatFilter:{q:"",status:"",model:"",apiKeyId:"",from:"",to:"",policyMode:"",hasDocuments:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},docFilter:{q:"",apiKeyId:"",storageType:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},keyFilter:{q:"",role:"",mode:"",isActive:"",sortBy:"createdAt",sortDir:"desc",limit:20,offset:0},auditFilter:{q:"",action:"",apiKeyId:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",limit:50,offset:0},usageFilter:{tab:"model",modelQ:"",keyQ:"",keyActive:"",modelPage:0,keyPage:0,pageSize:10,sortBy:"lastUsedAt",sortDir:"desc",modelSortBy:"requests",modelSortDir:"desc"},ddosFilter:{tab:"policy",liveQ:"",banQ:"",banSource:"",livePage:0,banPage:0,pageSize:15,liveSortBy:"startedAt",liveSortDir:"desc",banSortBy:"createdAt",banSortDir:"desc",eventSortBy:"at",eventSortDir:"desc"},mediaFilter:{tab:"studio",q:"",kind:"",provider:"",from:"",to:"",sortBy:"createdAt",sortDir:"desc",jobSortBy:"createdAt",jobSortDir:"desc",limit:20,offset:0},systemTab:"software",sessionQ:"",pm2Tab:"runner",apiFeaturesTab:"protocols",catalogTab:"local",catalogModality:"",catalogPulling:"",catalogPull:{id:"",bytes:0,total:0},catalogQueue:[],catalogQueueRunning:!1,catalogHubQ:"",catalogHubHits:null,catalogHubNext:"",catalogHubBusy:!1,catalogPopularSyncedAt:"",runtimesOs:"host",runtimesMod:"",runtimesReport:null,runtimesInstall:null,models:[],catalogLocal:[],keys:[]},fm={login:"login",dashboard:"dashboard",chat:"chat",chats:"chats",keys:"keys",documents:"documents",media:"media",catalog:"catalog",runtimes:"runtimes",audit:"audit",settings:"settings","api-features":"apiFeatures",apifeatures:"apiFeatures",usage:"usage",ddos:"ddos",queue:"queue",pm2:"pm2",system:"system",support:"support",business:"business"};function bm(a){return a==="apiFeatures"?"api-features":a||"dashboard"}function wa(a){const s=String(a||"").replace(/^#\/?/,"").split("?")[0].split("/")[0].toLowerCase();return s?s==="runtime"||s==="engines"||s==="engine"?"runtimes":fm[s]||null:null}function Ta(a){const s=`#/${bm(a)}`;location.hash!==s&&history.pushState(null,"",s)}function hm(){const a=wa(location.hash);return a||(l.key?"dashboard":"login")}async function I(a,s={}){const i={...s.body?{"Content-Type":"application/json"}:{},...l.key?{Authorization:`Bearer ${l.key}`}:{},...s.headers||{}},o=await fetch(`${ft}${a}`,{...s,headers:i}),n=await o.text();let d=null;try{d=n?JSON.parse(n):null}catch{d={error:{message:n}}}if(!o.ok){const r=Ia(d,o.statusText),u=d?.error?.code||"";o.status===401?l.page!=="login"&&Wt(!1):o.status===403&&!["media_forbidden","feature_disabled","forbidden","media_not_supported"].includes(u)&&l.page!=="login"&&Wt(!1);const m=new Error(r);throw m.status=o.status,m.code=u,m.details=d?.error?.details,m}return d}async function Ft(a){const s=await a.text();let i=null;try{i=s?JSON.parse(s):null}catch{i={error:{message:s}}}if(!a.ok){const o=Ia(i,a.statusText),n=new Error(o);throw n.status=a.status,n.code=i?.error?.code,n.details=i?.error?.details,n}return i}function Wt(a=!0){const s=l.key;a&&s&&String(s).startsWith("gog_sess_")&&fetch("/admin/api/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${s}`}}).catch(()=>{}),a&&sessionStorage.removeItem(Vt),l.key="",l.me=null,l.page="login",Ta("login"),oa()}function xa(a){Ca(a,{writeHash:!0})}function Ca(a,s={}){const i=a||"dashboard";l.page=i,l.modal=null,l.error="",i==="chats"&&(l.chatFilter.offset=0),i==="documents"&&(l.docFilter.offset=0),i==="keys"&&(l.keyFilter.offset=0),i==="audit"&&(l.auditFilter.offset=0),i==="media"&&(l.mediaFilter.offset=0),i!=="ddos"&&Xe&&(clearInterval(Xe),Xe=null),i!=="chat"&&document.body.classList.remove("chat-history-open"),s.writeHash!==!1&&Ta(i),oa()}function t(a){return String(a??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}let Le=null,Qt=null;function et(a){const s=Qt;Qt=null,Le&&(Le.remove(),Le=null),document.body.classList.remove("ui-dialog-open"),document.removeEventListener("keydown",Ea,!0),s&&s(a)}function Ea(a){if(Le&&a.key==="Escape"){a.preventDefault(),a.stopPropagation();const s=Le.dataset.cancelable!=="0";et(s?Le.dataset.prompt==="1"?null:!1:!0)}}function La(a){Le&&et(!1);const s=a.variant||(a.showCancel===!1?"info":"confirm"),i=a.showCancel!==!1,o=!!a.input,n=a.title||e(s==="danger"?"common.dangerTitle":i?"common.confirmTitle":"common.notice"),d=a.confirmText||e(i?"common.confirm":"common.ok"),r=a.cancelText||e("common.cancel"),u=s==="danger"?"!":s==="info"&&!i?"i":"?",m=document.createElement("div");m.className="ui-dialog-back",m.id="ui-dialog-back",m.dataset.cancelable=i||o?"1":"0",m.dataset.prompt=o?"1":"0",m.setAttribute("role","presentation"),m.innerHTML=`
32
32
  <div class="ui-dialog ui-dialog--${t(s)}" role="alertdialog" aria-modal="true" aria-labelledby="ui-dialog-title" aria-describedby="ui-dialog-msg">
33
33
  <div class="ui-dialog-h">
34
34
  <div class="ui-dialog-icon" aria-hidden="true">${u}</div>