feat(remote): 添加 CORS 中间件支持文件跨域访问

This commit is contained in:
2026-03-09 17:27:47 +08:00
parent 92088e9c8a
commit 49bf8a97d2
22 changed files with 467 additions and 62 deletions

View File

@@ -1 +1 @@
export type TabType = 'markdown' | 'todo' | 'settings' | 'search' | 'recycle-bin' | 'weread' | 'time-tracking' | 'pydemos' | 'remote' | 'remote-desktop' | 'remote-git' | 'other'
export type TabType = 'markdown' | 'todo' | 'settings' | 'search' | 'recycle-bin' | 'weread' | 'time-tracking' | 'pydemos' | 'remote' | 'remote-desktop' | 'remote-git' | 'file-transfer' | 'other'

View File

@@ -8,6 +8,10 @@ const KNOWN_MODULE_IDS = [
export function getTabTypeFromPath(filePath: string | null): TabType {
if (!filePath) return 'other'
if (filePath.startsWith('file-transfer-panel')) {
return 'file-transfer'
}
if (filePath.startsWith('remote-git://')) {
return 'remote-git'
}
@@ -43,6 +47,12 @@ export function getTabTypeFromPath(filePath: string | null): TabType {
export function getFileNameFromPath(filePath: string | null): string {
if (!filePath) return '未知'
if (filePath.startsWith('file-transfer-panel')) {
const params = new URLSearchParams(filePath.split('?')[1] || '')
const deviceName = params.get('device') || ''
return deviceName ? `文件传输 - ${deviceName}` : '文件传输'
}
for (const moduleId of KNOWN_MODULE_IDS) {
if (filePath === `${moduleId}-tab` || filePath === moduleId) {
const names: Record<string, string> = {