From ac65c1eb9d301944c94bfd276ee9d427d8245582 Mon Sep 17 00:00:00 2001 From: O96u Date: Tue, 1 Sep 2026 17:15:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E3=80=81API=E3=80=81=E5=9B=BE=E5=BA=93=E4=B8=8E?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E9=A1=B5=E9=9D=A2=E5=89=8D=E7=AB=AF=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将操作日志并入设置侧栏,补齐检查更新提示与版本接口刷新;拆分各模块组件并修复图库搜索分页变量。 --- app/assets/css/main.css | 18 + app/components/ApiCurlBlock.vue | 14 +- app/components/AppShell.vue | 9 +- app/components/CopyButton.vue | 5 +- app/components/ImageCard.vue | 152 +++- app/components/ImageGrid.vue | 22 +- app/components/ImagePreviewModal.vue | 435 +++++++--- app/components/MobileUserMenu.vue | 18 - app/components/PaginationBar.vue | 304 +++++-- app/components/UploadPreferencesPanel.vue | 42 +- app/components/api/ApiDebugger.vue | 379 ++++++++ app/components/api/ApiDocView.vue | 121 +++ app/components/api/ApiMethodBadge.vue | 34 + app/components/api/ApiSidebar.vue | 148 ++++ app/components/api/ApiTokenCard.vue | 146 ++++ app/components/gallery/GalleryFilterBar.vue | 136 +++ app/components/gallery/GalleryImageList.vue | 221 +++++ .../gallery/GallerySelectionBar.vue | 55 ++ .../gallery/GalleryStatsOverview.vue | 238 +++++ app/components/settings/SettingsGroup.vue | 5 + app/components/settings/SettingsLogsPanel.vue | 566 ++++++++++++ app/components/settings/SettingsPanel.vue | 7 + app/components/settings/SettingsSection.vue | 37 + .../settings/SettingsServerFooter.vue | 33 + app/components/settings/SettingsSidebar.vue | 47 + .../settings/SettingsSystemInfo.vue | 36 + app/components/settings/SettingsToggleRow.vue | 34 + .../SettingsUserPreferencesFields.vue | 148 ++++ app/components/storage/StorageBackendCard.vue | 279 +++--- app/components/storage/StorageOverview.vue | 184 ++++ .../storage/StorageSupportedBackends.vue | 62 ++ app/components/storage/StorageUsageBar.vue | 63 +- app/composables/useApiDocs.ts | 323 +++++++ app/composables/useImageList.ts | 76 +- app/pages/api.vue | 297 +------ app/pages/gallery.vue | 359 +++----- app/pages/logs.vue | 618 +------------ app/pages/settings/index.vue | 813 ++++++++++-------- app/pages/storage.vue | 108 +-- app/types/settings.ts | 5 + i18n/locales/en.json | 187 +++- i18n/locales/zh-CN.json | 193 ++++- server/api/images/index.get.ts | 19 +- server/api/images/search.get.ts | 20 +- server/api/stats.get.ts | 44 +- server/api/version/latest.get.ts | 4 +- server/utils/app-version.ts | 4 +- server/utils/db.ts | 27 + server/utils/image-index.ts | 58 +- server/utils/image-query.ts | 19 + server/utils/storage.ts | 6 + 51 files changed, 5119 insertions(+), 2059 deletions(-) create mode 100644 app/components/api/ApiDebugger.vue create mode 100644 app/components/api/ApiDocView.vue create mode 100644 app/components/api/ApiMethodBadge.vue create mode 100644 app/components/api/ApiSidebar.vue create mode 100644 app/components/api/ApiTokenCard.vue create mode 100644 app/components/gallery/GalleryFilterBar.vue create mode 100644 app/components/gallery/GalleryImageList.vue create mode 100644 app/components/gallery/GallerySelectionBar.vue create mode 100644 app/components/gallery/GalleryStatsOverview.vue create mode 100644 app/components/settings/SettingsGroup.vue create mode 100644 app/components/settings/SettingsLogsPanel.vue create mode 100644 app/components/settings/SettingsPanel.vue create mode 100644 app/components/settings/SettingsSection.vue create mode 100644 app/components/settings/SettingsServerFooter.vue create mode 100644 app/components/settings/SettingsSidebar.vue create mode 100644 app/components/settings/SettingsSystemInfo.vue create mode 100644 app/components/settings/SettingsToggleRow.vue create mode 100644 app/components/settings/SettingsUserPreferencesFields.vue create mode 100644 app/components/storage/StorageOverview.vue create mode 100644 app/components/storage/StorageSupportedBackends.vue create mode 100644 app/composables/useApiDocs.ts create mode 100644 app/types/settings.ts diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 7dfffc1..eea00f0 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -106,3 +106,21 @@ .upload-settings-btn:hover .upload-settings-icon { transform: rotate(90deg); } + +.api-debug-response { + scrollbar-width: thin; + scrollbar-color: rgb(82 82 82) transparent; +} + +.api-debug-response::-webkit-scrollbar { + width: 6px; +} + +.api-debug-response::-webkit-scrollbar-thumb { + border-radius: 9999px; + background-color: rgb(82 82 82); +} + +.api-debug-response::-webkit-scrollbar-track { + background: transparent; +} diff --git a/app/components/ApiCurlBlock.vue b/app/components/ApiCurlBlock.vue index 15ae6ba..d3067bb 100644 --- a/app/components/ApiCurlBlock.vue +++ b/app/components/ApiCurlBlock.vue @@ -3,9 +3,11 @@ const props = withDefaults( defineProps<{ code: string scrollable?: boolean + lang?: string }>(), { - scrollable: true + scrollable: true, + lang: '' } ) @@ -34,6 +36,12 @@ async function copyCode() { + + {{ lang }} +
{{ props.code }}
+ :class="scrollable ? 'max-h-80' : ''" + >{{ code }} diff --git a/app/components/AppShell.vue b/app/components/AppShell.vue index a8552f1..c251183 100644 --- a/app/components/AppShell.vue +++ b/app/components/AppShell.vue @@ -17,17 +17,12 @@ const navItems = computed(() => { ] if (isAdmin.value) { items.push({ label: t('nav.storage'), to: '/storage', icon: 'i-lucide-hard-drive' }) - items.push({ label: t('nav.settings'), to: '/settings', icon: 'i-lucide-settings' }) } + items.push({ label: t('nav.settings'), to: '/settings', icon: 'i-lucide-settings' }) return items }) const accountMenuItems = computed(() => [ - { - label: t('nav.logs'), - icon: 'i-lucide-scroll-text', - to: '/logs' - }, { label: t('nav.changePassword'), icon: 'i-lucide-key-round', @@ -48,7 +43,7 @@ const desktopUserMenuItems = computed(() => [ function isNavActive(to: string) { if (to === '/settings') { - return route.path === '/settings' + return route.path.startsWith('/settings') } return route.path.startsWith(to) } diff --git a/app/components/CopyButton.vue b/app/components/CopyButton.vue index dd54a58..d8bb78d 100644 --- a/app/components/CopyButton.vue +++ b/app/components/CopyButton.vue @@ -6,6 +6,8 @@ const props = defineProps<{ icon?: string block?: boolean successTitle?: string + variant?: 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'link' + color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral' }>() const emit = defineEmits<{ @@ -76,7 +78,8 @@ async function copy() {