重构:Wails v3 迁移 + 前端目录规范化 + Sidebar滚动优化
- web/ → frontend/ 目录重命名(Wails v3 标准结构) - main.go: Middleware 修复 custom.js 404 + DevTools 延迟启动 - Sidebar: 收藏夹内部独立滚动 + 帮助区块固定底部 - useFavorites.ts: longPressTimer const→let 修复 TypeError - App.vue: Arco Tabs padding-top 覆盖 - build: config.yml / Taskfile.yml 对齐官方模板,devtools build tag - 新增 v3 bindings、vite.config.js、跨平台构建配置 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
71
frontend/src/api/transport.ts
Normal file
71
frontend/src/api/transport.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* 文件系统传输层接口
|
||||
* 本地模式走 Wails IPC,远程模式走 HTTP REST API
|
||||
* Composable 和组件不感知底层差异
|
||||
*/
|
||||
|
||||
export type FileItem = {
|
||||
name: string
|
||||
path: string
|
||||
size: number
|
||||
size_str?: string
|
||||
is_dir: boolean
|
||||
mod_time?: string
|
||||
mode?: string
|
||||
}
|
||||
|
||||
export type FileOperationResult = {
|
||||
path: string
|
||||
name: string
|
||||
size: number
|
||||
size_str?: string
|
||||
is_dir: boolean
|
||||
mod_time?: string
|
||||
mode?: string
|
||||
old_path?: string
|
||||
deleted?: boolean
|
||||
}
|
||||
|
||||
export type DetectTypeResult = {
|
||||
extension: string
|
||||
category: string
|
||||
mime_type: string
|
||||
confidence: number
|
||||
}
|
||||
|
||||
export interface FsTransport {
|
||||
// 文件列表与信息
|
||||
listDir(path: string): Promise<FileItem[]>
|
||||
getFileInfo(path: string): Promise<Record<string, any>>
|
||||
|
||||
// 文件读写
|
||||
readFile(path: string): Promise<string>
|
||||
writeFile(path: string, content: string): Promise<void>
|
||||
saveBase64File(path: string, content: string): Promise<void>
|
||||
|
||||
// 文件操作
|
||||
createFile(dirPath: string, filename: string): Promise<FileOperationResult>
|
||||
createDir(parentPath: string, dirname: string): Promise<FileOperationResult>
|
||||
deletePath(path: string): Promise<FileOperationResult>
|
||||
renamePath(oldPath: string, newPath: string): Promise<FileOperationResult>
|
||||
|
||||
// ZIP 操作(Wave 3)
|
||||
listZipContents(zipPath: string): Promise<FileItem[]>
|
||||
extractFileFromZip(zipPath: string, filePath: string): Promise<string>
|
||||
extractFileFromZipToTemp(zipPath: string, filePath: string): Promise<string>
|
||||
getZipFileInfo(zipPath: string, filePath: string): Promise<FileItem>
|
||||
|
||||
// 系统操作
|
||||
openPath(path: string): Promise<void>
|
||||
getFileServerURL(): Promise<string>
|
||||
getPreviewToken(): string
|
||||
resolveShortcut(lnkPath: string): Promise<any>
|
||||
detectFileTypeByContent(path: string): Promise<DetectTypeResult>
|
||||
getCommonPaths(): Promise<Record<string, string>>
|
||||
|
||||
// 回收站(Wave 3)
|
||||
getRecycleBinEntries(): Promise<any[]>
|
||||
restoreFromRecycleBin(path: string): Promise<void>
|
||||
deletePermanently(path: string): Promise<void>
|
||||
emptyRecycleBin(): Promise<void>
|
||||
}
|
||||
Reference in New Issue
Block a user