refactor: simplify auth and subscription links
This commit is contained in:
@@ -269,9 +269,9 @@ sub-store-cloudflare/
|
||||
| GET | `/api/link/collection/:name` | 生成下载链接 |
|
||||
| GET | `/api/source/flow/:name` | 流量信息(解析 subscription-userinfo 头) |
|
||||
|
||||
### 5.3 下载 API (`/download/*`)
|
||||
### 5.3 下载 API
|
||||
|
||||
**路由**: `GET /download/collection/:name/:target?/:token?` 和 `GET /download/source/:name/:target?/:token?`
|
||||
**路由**: `GET /collections/:name/:token` 和 `GET /sources/:name/:token`,目标格式通过 `?target=` 指定
|
||||
|
||||
**鉴权**:
|
||||
1. 先校验全局 `SUB_STORE_PUBLIC_DOWNLOAD_TOKEN`(timingSafeEqual)
|
||||
|
||||
@@ -566,8 +566,8 @@ func RunSettledWithConcurrency[T any](tasks []func() (T, error), concurrency int
|
||||
|
||||
| 任务 | 产出 | 原项目对照 |
|
||||
|------|------|-----------|
|
||||
| `GET /download/collection/:name/:target?/:token?` | `handler/download.go` | `download.ts` |
|
||||
| `GET /download/source/:name/:target?/:token?` | `handler/download.go` | `download.ts` |
|
||||
| `GET /collections/:name/:token` | `handler/download.go` | `download.ts` |
|
||||
| `GET /sources/:name/:token` | `handler/download.go` | `download.ts` |
|
||||
| Download token 验证 (全局 + scoped grant) | `handler/download.go` | `download.ts` rejectInvalidDownloadToken |
|
||||
| Target 推断 (显式 + UA 推断) | `handler/download.go` | `download.ts` getDownloadTarget |
|
||||
| 临时源覆盖 (url/content/ua query) | `handler/download.go` | `download.ts` getTemporarySourceOverride |
|
||||
@@ -720,8 +720,8 @@ func RunSettledWithConcurrency[T any](tasks []func() (T, error), concurrency int
|
||||
|
||||
| 方法 | 路径 | Phase | 说明 |
|
||||
|------|------|-------|------|
|
||||
| GET | `/download/collection/:name/:target?/:token?` | 8 | 下载集合 |
|
||||
| GET | `/download/source/:name/:target?/:token?` | 8 | 下载源 |
|
||||
| GET | `/collections/:name/:token` | 8 | 下载集合 |
|
||||
| GET | `/sources/:name/:token` | 8 | 下载源 |
|
||||
|
||||
### 其他
|
||||
|
||||
@@ -808,7 +808,7 @@ output: YAML with proxies: [{name:"test", type:"ss", ...}]
|
||||
```
|
||||
1. 创建 remote source (url: mock server)
|
||||
2. 创建 collection (sourceIds: [source.id])
|
||||
3. GET /download/collection/:id/mihomo?token=xxx
|
||||
3. GET /collections/:id/xxx?target=mihomo
|
||||
4. 验证 YAML 输出包含正确的 proxy 节点
|
||||
```
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
| 35 | 缓存操作错误吞咽 | recover + 日志,不传播 | `database/cache_repo.go` |
|
||||
| 36 | 并发 wait 延迟 | 保留 waitMs 参数 | `service/concurrency.go` |
|
||||
| 37 | MAX_SCRIPT_ACTIONS | custom 规则上限 32 条 | `filter/custom.go` |
|
||||
| 38 | restoreDownloadGrantSnapshot | 恢复时写回 tokenHash | `handler/recycle.go` |
|
||||
| 38 | restoreDownloadGrantSnapshot | 不实现,分享已移除 | `handler/recycle.go` |
|
||||
| 39 | FRONTEND_VERSION 常量 | 定义 = "1.0.0" | `config/` |
|
||||
| 40 | TEST_URL 常量 | 定义 generate_204 | `render/` |
|
||||
| 41 | defaultProxyGroups | 无模板时生成 3 默认组 | `template/builtin.go` |
|
||||
@@ -118,7 +118,6 @@
|
||||
buildTimeScripts: false // 无 JS 引擎
|
||||
proxyConversion: true // POST /api/proxy/parse
|
||||
ruleConversion: true // POST /api/rule/parse
|
||||
scopedShares: true // 分享令牌
|
||||
recycleBin: true // 回收站
|
||||
nodeInfo: true // POST /api/utils/node-info
|
||||
surgeMac: true // surge-mac 渲染
|
||||
@@ -568,11 +567,11 @@ func safeCacheGet(repo *CacheRepo, key string) (string, bool) {
|
||||
|
||||
**落地**:`filter/custom.go` 的验证逻辑。
|
||||
|
||||
#### #38 restoreDownloadGrantSnapshot → 恢复时写回 tokenHash
|
||||
#### #38 restoreDownloadGrantSnapshot → 不实现
|
||||
|
||||
**决议**:从回收站恢复 `share` 类型时,快照中的 `tokenHash` 需写回 `download_grants` 表。这是 share 恢复的特殊逻辑——其他资源类型(source/collection/template)恢复时不需要处理 tokenHash。
|
||||
**决议**:分享功能已移除,不再创建或恢复 `share` 类型回收站记录。
|
||||
|
||||
**落地**:`handler/recycle.go` 的 restore 逻辑。
|
||||
**落地**:`handler/recycle.go` 的 restore 逻辑不包含 share 分支。
|
||||
|
||||
#### #39 FRONTEND_VERSION 常量
|
||||
|
||||
|
||||
Reference in New Issue
Block a user