@lakphy/local-router 0.4.0 → 0.4.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/README.md CHANGED
@@ -73,10 +73,13 @@ local-router start
73
73
 
74
74
  默认地址:
75
75
 
76
- - 服务:`http://127.0.0.1:4099`
76
+ - 服务监听:`http://0.0.0.0:4099`
77
+ - 本机访问:`http://127.0.0.1:4099`
77
78
  - 管理面板:`http://127.0.0.1:4099/admin`
78
79
  - API 文档:`http://127.0.0.1:4099/api/docs`
79
80
 
81
+ 默认只处理本机来源请求。需要让局域网内其他设备访问时,在管理面板的“通用设置”中开启局域网服务并保存应用。
82
+
80
83
  ## 常用命令
81
84
 
82
85
  ```sh
@@ -60,6 +60,11 @@
60
60
  "$ref": "#/$defs/providerConfig"
61
61
  }
62
62
  },
63
+ "server": {
64
+ "$ref": "#/$defs/serverConfig",
65
+ "description": "通用服务设置。控制服务监听后的访问处理策略。",
66
+ "markdownDescription": "通用服务设置。\n\n服务默认监听所有网卡,但 `lanAccess.enabled` 默认为 `false`,此时只处理本机来源请求;开启后才处理局域网来源请求。"
67
+ },
63
68
  "log": {
64
69
  "$ref": "#/$defs/logConfig",
65
70
  "description": "日志配置。省略此字段或不配置时,日志系统不会启用。配置后默认启用,可通过 enabled: false 暂停。",
@@ -198,6 +203,29 @@
198
203
  }
199
204
  ]
200
205
  },
206
+ "serverConfig": {
207
+ "type": "object",
208
+ "description": "通用服务设置。",
209
+ "additionalProperties": false,
210
+ "properties": {
211
+ "lanAccess": {
212
+ "$ref": "#/$defs/lanAccessConfig",
213
+ "description": "局域网访问控制。默认关闭。"
214
+ }
215
+ }
216
+ },
217
+ "lanAccessConfig": {
218
+ "type": "object",
219
+ "description": "局域网访问控制。关闭时仅处理本机来源请求;开启时处理本机与局域网来源请求。",
220
+ "additionalProperties": false,
221
+ "properties": {
222
+ "enabled": {
223
+ "type": "boolean",
224
+ "default": false,
225
+ "description": "是否允许局域网内其他设备访问 local-router。默认为 false。"
226
+ }
227
+ }
228
+ },
201
229
  "logConfig": {
202
230
  "type": "object",
203
231
  "description": "日志系统配置。控制请求/响应日志的记录方式、存储路径和隐私脱敏策略。",
@@ -277,7 +305,11 @@
277
305
  "type": "string",
278
306
  "minLength": 1,
279
307
  "description": "插件包名、本地路径或远程 URL。以 ./ 或 ../ 或 / 开头视为本地文件(相对于配置文件目录解析);以 http:// 或 https:// 开头视为远程 URL(运行时下载后加载);否则作为 npm 包名通过 import() 加载。支持 .js 和 .ts 文件。",
280
- "examples": ["local-router-plugin-audit", "./plugins/content-filter.ts", "https://example.com/plugins/my-plugin.js"]
308
+ "examples": [
309
+ "local-router-plugin-audit",
310
+ "./plugins/content-filter.ts",
311
+ "https://example.com/plugins/my-plugin.js"
312
+ ]
281
313
  },
282
314
  "params": {
283
315
  "type": "object",