Conversation
- Normalize driver names to support both "GitHub Releases" and "CNB Releases". - Add driver configurations for GitHub Releases and CNB Releases, including required fields and settings. - Add unit tests for both drivers and integration coverage for admin registration and storage creation. - Preserve compatibility with existing driver info retrieval, supporting exact and Go-style driver names. Co-Authored-By: DeepSeek <noreply@deepseek.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
修复 Issue #107:GitHub Releases(以及同样遗漏的 CNB Releases)驱动未登记到后台驱动列表,导致前端存储列表没有对应选项、无法挂载发行版。
用户可感知的变化 / User-visible changes:
[path:]org/repo多挂载(多行,兼容分号)、最新版本 / 全部版本(含 per_page / max_page 分页)、README/LICENSE、源码包(zip/tar.gz)、私有仓库 token、gh_proxy 代理。重要实现变化 / Implementation changes:
server/admin.ts:driverConfigs注册两个驱动的表单字段与 config;/driver/names同步;/driver/info支持归一化回退;normalizeDriver保证 releases 别名优先于通用 github 别名,并让Github别名返回真实配置键GitHub API。drivers/github_releases:Client 重写 —— repo_structure 解析对齐 GoParseRepos;挂载点最长匹配(修复根挂载点);祖先目录逐级合成;新增isDirectory目录判定;gh_proxy仅替换https://github.com前缀;per_page/max_page分页;下载链接按「版本目录 → 最新版本 → 其它版本 → README/LICENSE」解析。drivers/cnb_releases:新增findRelease/findAsset,先把路径名解析为 API 所需的 release/asset ID(TS 链路传路径名而非 Go 对象 ID)。兼容性 / Compatibility:
纯新增与修复,无破坏性变更;既有驱动行为不变。
/driver/info对既有驱动仍精确匹配,新增对 Go 风格驱动名(GithubReleases、cnb_releases、Github等)的归一化支持。不涉及存储格式变更与数据迁移。
This PR has breaking changes.
/ 此 PR 包含破坏性变更。
This PR changes public API, config, storage format, or migration behavior.
/ 此 PR 修改了公开 API、配置、存储格式或迁移行为。
(说明:仅为追加式新增
/driver/list、/driver/names返回项与驱动配置表单;存储格式与迁移不变)This PR requires corresponding changes in related repositories.
/ 此 PR 需要关联仓库同步修改。
(官方前端 i18n 已包含 "GitHub Releases" / "CNB Releases" 条目,无需同步改动)
Related repository PRs / 关联仓库 PR:
Related Issues / 关联 Issue
Fixes #107
Testing / 测试
go test ./...(不适用:本仓库为 TypeScript + Serverless 移植版,无 Go 测试)repo_structure=OpenListTeam/OpenList)并端到端列出 release 资产(已由集成测试覆盖)。pnpm run test:all:398/398 通过(test:189 20、test:drivers 147、test:server 180、test:store 12、test:model 39),0 失败scripts/_regress.mjs:71/71 通过driver_list.test.ts(集成 5 例)、github_releases/driver.test.ts(单元 9 例)、cnb_releases/driver.test.ts(单元 7 例)prettier --check通过;tsc --noEmit仅剩仓库既有的db_cipher.test.ts重复导入报错(与本次改动无关)Checklist / 检查清单
gofmt,go fmt, orprettierwhere applicable. / 已使用 prettier 格式化全部改动文件AI Disclosure / AI 使用声明
Tools used / 使用工具:
Usage scope / 使用范围:
Code generation / 代码生成
Refactoring / 重构
Documentation / 文档
Tests / 测试
Translation / 翻译
Review assistance / 审查辅助
I have reviewed and validated all AI-assisted content included in this PR.
(所有 AI 生成内容均已通过上述单元 / 集成 / 回归测试验证)
I have ensured that all AI-assisted commits include
Co-Authored-Byattribution.I can reproduce all AI-assisted content included in this PR without any AI tools.
(改动均为纯 TypeScript 代码与测试,可按 patch 直接复现)