@dsh-plus/access-gate 0.2.0 → 0.2.2
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/lib/client.js +61139 -20
- package/lib/index.js +9 -8
- package/lib/style.css +1627 -0
- package/package.json +11 -11
- package/src/client/client.ts +1 -1
- package/src/config.ts +2 -3
- package/src/index.ts +10 -6
- package/src/ns.ts +3 -2
package/lib/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
|
-
import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
|
|
3
2
|
import z from "@deepseek-ai/schemastery";
|
|
4
3
|
//#endregion
|
|
5
4
|
//#region src/config.ts
|
|
@@ -15,8 +14,8 @@ import z from "@deepseek-ai/schemastery";
|
|
|
15
14
|
* schemastery 透传忽略,不阻断加载(已实测验证)。
|
|
16
15
|
* @module access-gate/config
|
|
17
16
|
*/
|
|
18
|
-
/** settings
|
|
19
|
-
const SETTINGS_NS =
|
|
17
|
+
/** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
|
|
18
|
+
const SETTINGS_NS = "dsh-plus-access-gate";
|
|
20
19
|
const Config = z.object({
|
|
21
20
|
enabled: z.boolean().description("访问围栏总开关(false = 一切放行,等价插件缺席)").default(false),
|
|
22
21
|
allowedIps: z.array(z.string()).description("附加 IP 围栏:非空时仅白名单条目(精确 IP 或 CIDR,IPv4/IPv6 皆可)可通行与登录;空 = 不限制来源 IP(仅官方登录保护)").default([]),
|
|
@@ -555,11 +554,13 @@ var AccessGateService = class extends Service {
|
|
|
555
554
|
constructor(ctx, config) {
|
|
556
555
|
super(ctx, "accessGate");
|
|
557
556
|
this.current = () => config;
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
557
|
+
ctx.inject(["settings"], (settingsCtx) => {
|
|
558
|
+
settingsCtx.settings.installSection(ctx, SETTINGS_NS, Config, config, {
|
|
559
|
+
setSource: (source) => {
|
|
560
|
+
this.current = source;
|
|
561
|
+
},
|
|
562
|
+
onChange: () => {}
|
|
563
|
+
});
|
|
563
564
|
});
|
|
564
565
|
const logger = ctx.logger("access-gate");
|
|
565
566
|
const officialAuth = (req) => ctx.connection.requestRejection({ headers: req.headers }) === void 0;
|