启动时清理解压缓存、缩短解压缓存哈希、Reader 跳转 Explorer 默认 table+按名排序#412
启动时清理解压缓存、缩短解压缓存哈希、Reader 跳转 Explorer 默认 table+按名排序#412hjyssg wants to merge 1 commit intonodejs-backendfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27b27b2653
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const hash = crypto.createHash("sha256").update(archivePath).digest("hex"); | ||
| const base = path.resolve(config.EXTRACT_CACHE_DIR); | ||
| return path.join(base, hash.slice(0, 2), hash.slice(2)); | ||
| const shortHash = hash.slice(0, 10); |
There was a problem hiding this comment.
Restore sufficiently unique extract cache keys
Using only hash.slice(0, 10) reduces the cache key to 40 bits, so different archive paths can map to the same extraction directory once libraries get moderately large. Because extraction/read paths are keyed only by getExtractCacheDir(archivePath) (no archive identity check in the cache directory), a collision will cause cross-archive cache reuse (wrong files shown, stale reads, and accidental overwrite of another archive’s extracted files).
Useful? React with 👍 / 👎.
| isLoading={isLoading} | ||
| currentPath={path} | ||
| initialViewMode="mixed" | ||
| initialViewMode={viewMode ?? "mixed"} |
There was a problem hiding this comment.
Honor viewMode URL override instead of stored preference
Passing viewMode via initialViewMode does not reliably enforce the requested mode, because FileViewContainer initializes view mode from localStorage first and only falls back to initialViewMode. In practice, users with an existing explorer-view-mode value (for example grid) will still land in that saved mode even when links now set viewMode=table, so the new Reader→Explorer default is silently ignored for those users.
Useful? React with 👍 / 👎.
Motivation
Description
backendnode/src/server.ts初始化 DB 后调用clearExtractCache做启动前的解压缓存清理,并打印清理结果与 activity log 写入状态。backendnode/src/services/archiveService.ts中getExtractCacheDir改为仅使用sha256前 10 位(保留二级目录切分 2+8)。FileViewContainer的ViewMode类型并在frontend/src/routes/_layout/explorer.tsx中增加对可选viewMode查询参数的解析、验证与透传,且在分页/排序/面包屑跳转时保留该参数。frontend/src/routes/_layout/read.tsx中多个从 Reader 跳转到 Explorer 的入口统一改为viewMode=table, sortField=name, sortOrder=asc,并在无图/音频模式等处同步使用该默认参数。Testing
npm run -C backendnode build(tsc)时被仓库已有的类型测试错误阻断,错误与本次改动无关(若干测试使用了未在类型中声明的字段如fingerprint)。npm run -C frontend build时 TypeScript 编译通过但 Vite 打包阶段因环境缺失可选原生依赖@rollup/rollup-linux-x64-gnu而失败,TS 部分的改动已通过本地类型检查。Codex Task