feat: optimize file icons, UI, share direct links, and upload performance

- Replace CSS-only file icons with SVG icons for each file type (folder, image, video, audio, archive, document, app)
- Add navigation icons to left sidebar (Baidu Netdisk style)
- Enlarge file cards (108px -> 120px) with smoother transitions
- Add direct links section to share page with copy/delete actions
- Add Rust bridge commands for fetching and deleting direct links
- Optimize local storage put() to use rename-first strategy instead of copyFileSync for instant large file completion
- Show "server processing" status during upload finalization instead of appearing stuck

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
237899745
2026-04-04 00:19:20 +08:00
parent b02b168eb2
commit f40fd6003c
3 changed files with 247 additions and 65 deletions

View File

@@ -244,16 +244,25 @@ class LocalStorageClient {
const tempPath = `${destPath}.uploading_${Date.now()}`;
try {
// 复制到临时文件
fs.copyFileSync(localPath, tempPath);
// 如果目标文件存在,先删除
if (fs.existsSync(destPath)) {
fs.unlinkSync(destPath);
}
// 重命名临时文件为目标文件
fs.renameSync(tempPath, destPath);
// 优先尝试 rename同文件系统下瞬时完成大文件不再需要逐字节复制
let movedDirectly = false;
try {
fs.renameSync(localPath, destPath);
movedDirectly = true;
} catch (renameErr) {
if (renameErr.code === 'EXDEV') {
// 跨文件系统,回退到 copy + rename
fs.copyFileSync(localPath, tempPath);
fs.renameSync(tempPath, destPath);
} else {
throw renameErr;
}
}
// 更新已使用空间(使用净增量)
if (netIncrease !== 0) {
@@ -262,7 +271,7 @@ class LocalStorageClient {
} catch (error) {
// 清理临时文件
if (fs.existsSync(tempPath)) {
fs.unlinkSync(tempPath);
try { fs.unlinkSync(tempPath); } catch (_) {}
}
throw error;
}