🚧 WIP(custom): support sync gallery db file

ISSUES CLOSED: #355,#417
This commit is contained in:
Kuingsmile
2025-12-30 23:03:52 +08:00
parent 95cc7753b4
commit 6a8d3f6bbf
12 changed files with 475 additions and 101 deletions

View File

@@ -685,6 +685,7 @@
"commonConfig": "Common Configuration",
"downloadSettings": "Download Settings",
"fileManagement": "File Management",
"galleryDB": "Gallery Database Sync",
"gitea": {
"branch": "Branch Name",
"repo": "Repository Name",

View File

@@ -685,6 +685,7 @@
"commonConfig": "通用配置",
"downloadSettings": "下载配置",
"fileManagement": "文件管理",
"galleryDB": "相册数据库同步",
"gitea": { "branch": "分支名", "repo": "仓库名", "token": "访问令牌", "username": "用户名" },
"giteaHost": "Gitea 地址",
"gitee": {

View File

@@ -685,6 +685,7 @@
"commonConfig": "通用配置",
"downloadSettings": "下載配置",
"fileManagement": "文件管理",
"galleryDB": "相冊數據庫同步",
"gitea": { "branch": "分支名", "repo": "倉庫名", "token": "訪問令牌", "username": "用戶名" },
"giteaHost": "Gitea 地址",
"gitee": {

View File

@@ -1224,37 +1224,70 @@
<!-- Upload/Download Config Dialog -->
<div v-if="upDownConfigVisible" class="dialog-overlay" @click="upDownConfigVisible = false">
<div class="dialog" @click.stop>
<div class="dialog config-dialog" @click.stop>
<div class="dialog-header">
<h3 class="dialog-title">
{{ t('pages.settings.sync.upDownloadSettings') }}
</h3>
<div class="dialog-header-content">
<RotateCcw :size="20" class="dialog-icon" />
<h3 class="dialog-title">
{{ t('pages.settings.sync.upDownloadSettings') }}
</h3>
</div>
<button class="dialog-close" @click="upDownConfigVisible = false">×</button>
</div>
<div class="dialog-content">
<div class="form-group">
<label>{{ t('pages.settings.sync.uploadSettings') }}</label>
<div class="button-group">
<!-- Upload Settings Section -->
<div class="config-section">
<div class="config-section-header">
<CloudUpload :size="18" />
<h4>{{ t('pages.settings.sync.uploadSettings') }}</h4>
</div>
<div class="config-button-grid">
<button
v-for="item in syncTaskList.slice(0, 3)"
:key="item.task"
class="btn btn-primary"
class="config-button"
@click="syncTaskFn(item.task, item.number)"
>
{{ item.label }}
<Import :size="16" class="button-icon" />
<span>{{ item.label }}</span>
</button>
</div>
</div>
<div class="form-group">
<label>{{ t('pages.settings.sync.downloadSettings') }}</label>
<div class="button-group">
<!-- Download Settings Section -->
<div class="config-section">
<div class="config-section-header">
<Download :size="18" />
<h4>{{ t('pages.settings.sync.downloadSettings') }}</h4>
</div>
<div class="config-button-grid">
<button
v-for="item in syncTaskList.slice(3)"
v-for="item in syncTaskList.slice(3, 6)"
:key="item.task"
class="btn btn-primary"
class="config-button"
@click="syncTaskFn(item.task, item.number)"
>
{{ item.label }}
<Download :size="16" class="button-icon" />
<span>{{ item.label }}</span>
</button>
</div>
</div>
<!-- Gallery DB Section -->
<div class="config-section">
<div class="config-section-header">
<ImageIcon :size="18" />
<h4>{{ t('pages.settings.sync.galleryDB') }}</h4>
</div>
<div class="config-button-grid full-width">
<button
v-for="item in syncTaskList.slice(6, 7)"
:key="item.task"
class="config-button"
@click="syncTaskFn(item.task, item.number)"
>
<RefreshCw :size="16" class="button-icon" />
<span>{{ item.label }}</span>
</button>
</div>
</div>
@@ -1940,6 +1973,7 @@ const syncTaskList = [
{ task: IRPCActionType.CONFIGURE_DOWNLOAD_COMMON_CONFIG, label: t('pages.settings.sync.commonConfig'), number: 2 },
{ task: IRPCActionType.CONFIGURE_DOWNLOAD_MANAGE_CONFIG, label: t('pages.settings.sync.manageConfig'), number: 2 },
{ task: IRPCActionType.CONFIGURE_DOWNLOAD_ALL_CONFIG, label: t('pages.settings.sync.allConfig'), number: 4 },
{ task: IRPCActionType.CONFIGURE_SYNC_GALLERY_DB, label: t('pages.settings.sync.galleryDB'), number: 2 },
]
async function syncTaskFn(task: string, number: number) {

View File

@@ -964,3 +964,121 @@ small {
.rotate {
animation: rotate 1s linear infinite;
}
/* Config Dialog Styles */
.config-dialog {
width: 90%;
max-width: 600px;
}
.dialog-header-content {
display: flex;
align-items: center;
gap: 0.75rem;
}
.dialog-icon {
color: var(--color-accent);
}
.config-section {
border: 1px solid var(--color-border);
border-radius: 12px;
padding: 1.25rem;
background: var(--color-background-secondary);
transition: all 0.2s ease;
}
.config-section:hover {
border-color: var(--color-accent);
box-shadow: 0 2px 12px rgb(64 158 255 / 15%);
}
.config-section:not(:last-child) {
margin-bottom: 1rem;
}
.config-section-header {
display: flex;
align-items: center;
margin-bottom: 1rem;
gap: 0.5rem;
}
.config-section-header h4 {
margin: 0;
font-size: 0.95rem;
font-weight: 600;
color: var(--color-text-primary);
}
.config-section-header svg {
color: var(--color-accent);
}
.config-button-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.75rem;
}
.config-button-grid.full-width {
grid-template-columns: 1fr;
}
.config-button {
display: flex;
justify-content: center;
align-items: center;
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 0.875rem 1rem;
min-height: 48px;
font-size: 0.875rem;
font-weight: 500;
color: var(--color-text-primary);
background: var(--color-background-primary);
transition: all 0.2s ease;
cursor: pointer;
gap: 0.5rem;
}
.config-button:hover {
border-color: var(--color-accent);
color: var(--color-accent);
background: var(--color-background-hover);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgb(64 158 255 / 20%);
}
.config-button:active {
transform: translateY(0);
box-shadow: 0 2px 6px rgb(64 158 255 / 15%);
}
.config-button .button-icon {
flex-shrink: 0;
color: var(--color-accent);
transition: transform 0.2s ease;
}
.config-button:hover .button-icon {
transform: scale(1.1);
}
.config-button span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@media (width <= 768px) {
.config-button-grid {
grid-template-columns: 1fr;
}
.config-dialog {
max-width: 95%;
}
}

View File

@@ -73,6 +73,7 @@ export const IRPCActionType = {
CONFIGURE_DOWNLOAD_COMMON_CONFIG: 'CONFIGURE_DOWNLOAD_COMMON_CONFIG',
CONFIGURE_DOWNLOAD_MANAGE_CONFIG: 'CONFIGURE_DOWNLOAD_MANAGE_CONFIG',
CONFIGURE_DOWNLOAD_ALL_CONFIG: 'CONFIGURE_DOWNLOAD_ALL_CONFIG',
CONFIGURE_SYNC_GALLERY_DB: 'CONFIGURE_SYNC_GALLERY_DB',
// advanced setting rpc
ADVANCED_UPDATE_SERVER: 'ADVANCED_UPDATE_SERVER',