Add dashboard support for API service
This commit is contained in:
@@ -22,6 +22,13 @@ sing-box API 服务是用于观察与控制正在运行的 sing-box 实例的 gR
|
||||
"secret": "",
|
||||
"access_control_allow_origin": [],
|
||||
"access_control_allow_private_network": false,
|
||||
"dashboard": {
|
||||
"enabled": true,
|
||||
"path": "",
|
||||
"download_url": "",
|
||||
"http_client": "", // 或 {}
|
||||
"update_interval": ""
|
||||
},
|
||||
"tls": {}
|
||||
}
|
||||
```
|
||||
@@ -38,7 +45,7 @@ API 密钥。
|
||||
|
||||
客户端通过标准的 `authorization: Bearer <secret>` gRPC metadata 头认证。
|
||||
|
||||
留空则禁用认证。
|
||||
默认无需认证。
|
||||
|
||||
#### access_control_allow_origin
|
||||
|
||||
@@ -48,6 +55,54 @@ API 密钥。
|
||||
|
||||
允许从私有网络访问。
|
||||
|
||||
#### dashboard
|
||||
|
||||
下载并通过 API 监听器在 `/dashboard/` 提供的 Web 仪表板;其他浏览器请求将被重定向到该路径。
|
||||
|
||||
!!! info ""
|
||||
|
||||
该对象可以替换为布尔值(等同于 `{ "enabled": <bool> }`),
|
||||
或字符串路径(等同于 `{ "enabled": true, "path": "<string>" }`)。
|
||||
|
||||
##### enabled
|
||||
|
||||
启用仪表板。
|
||||
|
||||
##### path
|
||||
|
||||
存放仪表板文件的目录。
|
||||
|
||||
默认使用工作目录下的 `dashboard`。
|
||||
|
||||
如果目录为空,将下载仪表板,并在其中存放 `.etag` 文件以跳过未变更的更新。
|
||||
非空且不含 `.etag` 文件的目录将按原样提供,且不会自动更新。
|
||||
|
||||
##### download_url
|
||||
|
||||
仪表板压缩包(zip)的下载 URL。
|
||||
|
||||
默认使用 `https://github.com/SagerNet/sing-box-dashboard/archive/refs/heads/gh-pages.zip`。
|
||||
|
||||
##### http_client
|
||||
|
||||
用于下载仪表板的 HTTP 客户端,行为与远程规则集相同。
|
||||
|
||||
参阅 [HTTP 客户端字段](/zh/configuration/shared/http-client/)。
|
||||
|
||||
留空时使用默认 HTTP 客户端:即由 [`default_http_client`](/zh/configuration/route/#default_http_client)
|
||||
指定的客户端,或当 `default_http_client` 为空时使用顶级 `http_clients` 的第一项。
|
||||
|
||||
!!! failure "隐式默认已在 sing-box 1.14.0 废弃"
|
||||
|
||||
当 `http_clients` 与 `default_http_client` 均未配置时,将使用通过默认出站连接的隐式 HTTP 客户端。
|
||||
该隐式默认已在 sing-box 1.14.0 废弃,并将在 sing-box 1.16.0 移除;请改为定义 `http_clients`。
|
||||
|
||||
##### update_interval
|
||||
|
||||
仪表板的更新间隔。
|
||||
|
||||
默认使用 `1d`。
|
||||
|
||||
#### tls
|
||||
|
||||
TLS 配置,参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
||||
|
||||
Reference in New Issue
Block a user