feat: add FTP and SFTP upload support

This commit is contained in:
2026-07-12 10:04:21 +08:00
parent f1998fb23c
commit dd12521be2
22 changed files with 1466 additions and 44 deletions
+14 -1
View File
@@ -22,6 +22,7 @@ import {
CopyRegionImage,
SaveRegionImage,
SaveRegionToRemote,
UploadRegionToFTP,
SummarizeRegion,
ExtractTextRegion,
CancelRegion,
@@ -59,7 +60,7 @@ async function loadThemePreference() {
// `SettingsTab` is hoisted to the App shell so the sidebar (which lives
// here) and the inner SettingsView (which renders the matching card) can
// share a single source of truth without an event bus.
type SettingsTab = 'general' | 's3' | 'ssh' | 'llm' | 'ocr'
type SettingsTab = 'general' | 's3' | 'ftp' | 'ssh' | 'llm' | 'ocr'
const activeTab = ref<SettingsTab>('general')
// Sidebar entries are declarative so adding a destination type later is
@@ -67,6 +68,7 @@ const activeTab = ref<SettingsTab>('general')
const sidebarItems: Array<{ id: SettingsTab; label: string }> = [
{ id: 'general', label: '通用设置' },
{ id: 's3', label: '对象存储' },
{ id: 'ftp', label: 'FTP / SFTP' },
{ id: 'ssh', label: '远程主机' },
{ id: 'llm', label: '智能识图' },
{ id: 'ocr', label: '文字提取' },
@@ -184,6 +186,16 @@ async function onOverlaySaveRemote(rect: OverlayResult) {
}
}
async function onOverlayUploadFTP(rect: OverlayResult) {
mode.value = 'settings'
overlayPayload.value = null
try {
await UploadRegionToFTP(rect as any)
} catch {
/* Surfaced via upload:failure */
}
}
async function onOverlaySummarize(rect: OverlayResult) {
mode.value = 'settings'
overlayPayload.value = null
@@ -275,6 +287,7 @@ onUnmounted(() => {
@copy="onOverlayCopy"
@save="onOverlaySave"
@save-remote="onOverlaySaveRemote"
@upload-ftp="onOverlayUploadFTP"
@summarize="onOverlaySummarize"
@ocr="onOverlayOCR"
@cancel="onOverlayCancel"