[Draft]feat: dual-backend support (Go + OpenListNext TS) via runtime backend… - #660
Draft
PIKACHUIM wants to merge 2 commits into
Draft
[Draft]feat: dual-backend support (Go + OpenListNext TS) via runtime backend…#660PIKACHUIM wants to merge 2 commits into
PIKACHUIM wants to merge 2 commits into
Conversation
… detection Add runtime backend detection (window config backend field), port TS-only features (plugin system, session chunked upload, Face404) into the official frontend, and gate S3/tasks/multipart to GO mode vs plugins/chunked-upload to TS mode.
PIKACHUIM
marked this pull request as draft
September 4, 2026 09:15
Use MultipartUpload for both GO and TS backends (single API contract); fall back to StreamUpload when backend returns data:null for storages without session upload. Remove ChunkedUpload backend branching.
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.
Frontend Unification: GO / TS Dual-Backend Compatibility
1. 背景
历史上存在两份前端:
OpenList-Frontend(本仓库)OpenList-TSWorker/src(前端部分)两者已双向分叉:官方新增 S3 设置、任务管理、multipart 分片上传;TS 新增插件系统、会话分片上传、中文翻译、Face404。
决定:以官方前端为唯一前端,把 TS 独有能力反向合并进本仓库,通过运行时"模式探测"让同一份构建产物在两种后端下正确显示/屏蔽功能。
2. 模式机制
2.1 探测来源
后端
/api/public/settings返回里新增backend字段(零额外请求):backend: "ts-worker"(见OpenList-TSWorker/src/backend/server/public.ts)"go")2.2 API(
src/utils/backend.ts)setSettings()在拉取/public/settings后自动调用setBackendKind()写入探测结果。3. 功能对照与屏蔽策略
3.1 屏蔽实现点
src/pages/manage/SideMenu.tsx:SideMenuItemProps增加backend?: BackendKind[],ifShow里按模式过滤。src/pages/manage/sidemenu_items.tsx:tasks、s3标backend: ["go"];plugins标backend: ["ts-worker"]。src/pages/manage/routes.tsx:Route透传backend,hide_routes注册plugins/add、plugins/config/:id。src/pages/manage/index.tsx:visibleRoutes用createMemo按模式过滤路由。src/pages/home/uploads/uploads.ts:MultipartUpload仅isGo(),ChunkedUpload仅isTsWorker()。4. 以 GO 为准的原则
src/pages/home/uploads/multipart.ts(MultipartUpload)src/pages/home/uploads/chunked.ts(ChunkedUpload,会话式,为 Workers 环境设计)5. 翻译方案
lang/en为源,其他语言由 CI 生成)。lang/zh-CN已移除,改由官方翻译流程产出。pnpm run i18n:build/pnpm run i18n:release(crowdin download+scripts/i18n.mjs)。6. 插件系统(TS 独有,保留)
src/pages/manage/plugins/*、src/types/plugin.ts、src/utils/plugin_engine.ts、src/utils/zip_plugin.ts、src/lang/en/plugins.json。/public/plugins、/admin/plugin/*接口)。initPluginEngine()在App.tsx初始化;window.OpenListPluginSDK 依赖Window的索引签名(见main.tsx的declare global)。7. 后端集成(TSWorker)
/api/public/settings已返回backend: "ts-worker"。src/(前端部分),改为使用本仓库构建产物(dist/),由构建/CI 拉取官方前端产物注入。8. 关键文件清单
新增:
src/utils/backend.ts(模式探测)src/utils/plugin_engine.ts、src/utils/zip_plugin.ts(插件引擎)src/types/plugin.tssrc/pages/manage/plugins/{index,Plugin,AddPlugin,ConfigPlugin}.tsxsrc/pages/home/uploads/chunked.ts(TS 会话分片上传)src/components/Face404.tsxsrc/lang/en/plugins.json修改:
src/store/settings.ts(setSettings接入setBackendKind)src/utils/index.ts(导出 backend / plugin_engine / zip_plugin)src/types/index.ts(导出 plugin)src/utils/bus.ts(插件事件类型)src/pages/manage/SideMenu.tsx、sidemenu_items.tsx、routes.tsx、index.tsx(模式过滤)src/pages/home/uploads/uploads.ts(上传方式按模式选择)src/components/{index.ts,Base.tsx}(Face404 导出 + Error 的show404Face)src/app/App.tsx(initPluginEngine)src/pages/home/Obj.tsx(分享过期show404Face)src/lang/en/{entry.ts,manage.json,shares.json}(插件/菜单/分享翻译注册)