Store uploaded audio in GridFS instead of base64 inside the File document
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
调研方向
Read src/pages/api/files/index.js, src/pages/api/files/[id].js, and src/models/File.js, then trace the upload in src/pages/apps/musicplayer.js and the existing cases in tests/files.api.test.js. Start by checking the current upload and download flows and how MongoDB's GridFSBucket is used in the project. Done means large uploads work, Range requests stream only requested bytes, protections remain in place, existing tests pass with streaming, and the migration is documented.
由索引模型根据 Issue 内容生成。
描述
New here? Say hi on Discord first, it's the fastest way to get help: https://discord.gg/NW2YZACf4k
Right now an uploaded song is stored as a base64 data URL in the content field of a File document. That works, but it has real limits:
- MongoDB documents max out at 16 MB, so we cap uploads at 8 MB, and base64 makes files about 33% bigger.
- Every request that loads the full
Filedocument drags the whole song along. GET /api/files/:iddecodes the entire file into memory even when the browser asks for a small byte range to seek.
Proposal
- Store binary files (audio, images) in GridFS using the MongoDB driver's
GridFSBucket. TheFiledocument keeps metadata and a reference such asgridfsId. - Make the upload a streaming
multipart/form-datarequest instead of JSON.multeris already a dependency. - Make
GET /api/files/:idstream from GridFS and pass Range requests through toopenDownloadStream(id, { start, end }). - Keep the existing protections from #120: an allow-list of inline content types,
nosniff, the sandbox CSP, and owner/collaborator checks. - Write a one-off migration script that moves existing base64 audio into GridFS.
Where: src/pages/api/files/index.js, src/pages/api/files/[id].js, src/models/File.js, and the upload in src/pages/apps/musicplayer.js.
Done when
- Uploads of 30–50 MB work.
- Seeking only reads the requested bytes.
- The existing tests in
tests/files.api.test.jsstill pass (adjusted for streaming). - The migration is documented in the PR.
This one is meatier. Talk it through on Discord before starting.
Comment "I'd like to take this" and we'll assign you. Questions are welcome in Discord: https://discord.gg/NW2YZACf4k
- 主要语言
- JavaScript
- 星标
- 16
- 派生
- 8
- 平均合并
- 4 小时 24 分钟
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codehubbers/OrbitOS 的其他 Issue
-
difficulty: easy good first issue security
难度 1/5 1-3 小时 新手友好度 88/100
codehubbers/OrbitOS#129 ·
维护者通常 1 天内回复
-
ci difficulty: easy documentation good first issue
难度 2/5 1-3 小时 新手友好度 72/100
codehubbers/OrbitOS#80 ·
维护者通常 1 天内回复
-
difficulty: easy documentation good first issue
难度 2/5 1-3 小时 新手友好度 74/100
codehubbers/OrbitOS#79 ·
维护者通常 1 天内回复
-
difficulty: easy good first issue
难度 1/5 1 小时以内 新手友好度 72/100
codehubbers/OrbitOS#78 ·
维护者通常 1 天内回复
-
🎨 Add 5+ new high-quality wallpapers to the Settings app可能已有人在做 @anshumanjadiya1102 于 1 天前认领。 未关闭design difficulty: easy frontend good first issue
难度 2/5 1-3 小时 新手友好度 85/100
codehubbers/OrbitOS#75 ·
维护者通常 1 天内回复
查看 codehubbers/OrbitOS 的全部 Issue
相似的 Issue
-
flex-flow: wrap-reverse gets a vertical, reversed 2009 box fallback可能已有人在做 @goranai 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 86/100
postcss/autoprefixer#1577 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
-
bug
难度 1/5 1 小时以内 新手友好度 78/100
PranshulGG/WeatherMaster#1266 · 3 条评论 ·
维护者通常 1 天内回复
-
FEATURE REQUEST
难度 2/5 1-3 小时 新手友好度 67/100
linuxmint/cinnamon-spices-applets#9356 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
opnsense/plugins#5976 · 1 条评论 ·
维护者通常 1 天内回复