@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/access-gate",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "dsh-plus service+ui plugin: dsh web 全量访问围栏——与官方 browser-auth 合并:官方 cookie 为唯一凭据,可选 IP 附加围栏,未认证导航渲染 token 输入页(PWA 可恢复),loopback 管理通道",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -31,22 +31,22 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@dsh-plus/shared": "0.1.6"
34
+ "@dsh-plus/shared": "0.1.8"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.1",
38
- "@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.1",
39
- "@deepseek-ai/dsh-settings": "^0.1.2-alpha.1",
38
+ "@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.2",
39
+ "@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
40
40
  "@deepseek-ai/schemastery": "^3.18.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@deepseek-ai/cordis": "4.0.1",
44
- "@deepseek-ai/dsh-client-connection": "0.1.2-alpha.1",
45
- "@deepseek-ai/dsh-home-paths": "0.1.2-alpha.1",
46
- "@deepseek-ai/dsh-settings": "0.1.2-alpha.1",
47
- "@deepseek-ai/dsh-host-webserver": "0.1.2-alpha.1",
48
- "@deepseek-ai/schemastery": "3.18.1",
49
- "@types/react": "~18.3.1",
43
+ "@deepseek-ai/cordis": "4.0.2",
44
+ "@deepseek-ai/dsh-client-connection": "0.1.2-alpha.2",
45
+ "@deepseek-ai/dsh-home-paths": "0.1.2-alpha.2",
46
+ "@deepseek-ai/dsh-host-webserver": "0.1.2-alpha.2",
47
+ "@deepseek-ai/dsh-settings": "0.1.2-alpha.2",
48
+ "@deepseek-ai/schemastery": "3.18.2",
49
+ "@types/react": "~18.3.31",
50
50
  "react": "^18.2.0"
51
51
  },
52
52
  "publishConfig": {
@@ -6,7 +6,7 @@
6
6
  * 类型说明:浏览器半只用到 slots/locale/remote 的很窄一面,
7
7
  * scope 与基础控件走 @dsh-plus/shared/client 套件(收编自本插件原实现)。
8
8
  * 该插槽为 keyed 槽位:key 必须是卡片编辑的 settings 命名空间
9
- * (即服务端 settingsNamespace() 注册的同一字面量,见 ../ns.ts),
9
+ * (即服务端注册的同一字面量,见 ../ns.ts),
10
10
  * 官方配置页按此 key 与 Host 已注册命名空间配对分发。
11
11
  * 配置读写经 ctx.remote.settings 直连(0.1.2-alpha.1 起 connection.api.settings
12
12
  * 已移除;不复用 settingsScope 服务——非 loopback 页面下它固定 memory 模式无数据)。
package/src/config.ts CHANGED
@@ -10,13 +10,12 @@
10
10
  * schemastery 透传忽略,不阻断加载(已实测验证)。
11
11
  * @module access-gate/config
12
12
  */
13
- import { settingsNamespace } from '@deepseek-ai/dsh-settings'
14
13
  import z from '@deepseek-ai/schemastery'
15
14
 
16
15
  import { SETTINGS_NS as NS_LITERAL } from './ns.ts'
17
16
 
18
- /** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
19
- export const SETTINGS_NS = settingsNamespace(NS_LITERAL)
17
+ /** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
18
+ export const SETTINGS_NS = NS_LITERAL
20
19
 
21
20
  export const Config = z.object({
22
21
  enabled: z
package/src/index.ts CHANGED
@@ -27,7 +27,7 @@ import type { IncomingMessage } from 'node:http'
27
27
  import { type Context, Service } from '@deepseek-ai/cordis'
28
28
  // HostConnectionHandle 的 Context 声明合并(connection 服务类型来源)。
29
29
  import type {} from '@deepseek-ai/dsh-client-connection'
30
- import { installSettingsSection } from '@deepseek-ai/dsh-settings'
30
+ import type {} from '@deepseek-ai/dsh-settings'
31
31
 
32
32
  import { type AccessGateConfig, Config, SETTINGS_NS } from './config.ts'
33
33
  import { type GateWebServer, installGateInterceptor } from './interceptor.ts'
@@ -52,11 +52,15 @@ export class AccessGateService extends Service {
52
52
  constructor(ctx: Context, config: AccessGateConfig) {
53
53
  super(ctx, 'accessGate')
54
54
  this.current = () => config
55
- installSettingsSection(ctx, SETTINGS_NS, Config, config, {
56
- setSource: (source) => {
57
- this.current = source
58
- },
59
- onChange: () => {},
55
+ // 官方 installSection 范式(0.1.2-alpha.2):settings 提供方在时以行级 config 为
56
+ // base 注册用户层命名空间,缺席/ detach 时回落行级 config。
57
+ ctx.inject(['settings'], (settingsCtx) => {
58
+ settingsCtx.settings.installSection(ctx, SETTINGS_NS, Config, config, {
59
+ setSource: (source) => {
60
+ this.current = source
61
+ },
62
+ onChange: () => {},
63
+ })
60
64
  })
61
65
  const logger = ctx.logger('access-gate')
62
66
 
package/src/ns.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
3
- * 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
4
- * settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
3
+ * 服务端直接以字面量注册(0.1.2-alpha.2 起 dsh-settings 编译期校验命名空间
4
+ * 语法,见 config.ts),浏览器半将其作为 settings.plugin.item keyed 槽位的
5
+ * key —— 同一字面量两处共用,防止漂移。
5
6
  * @module access-gate/ns
6
7
  */
7
8
  export const SETTINGS_NS = 'dsh-plus-access-gate'