Feature(custom): optimize the logic of second picbed upload, and fix a bug of local picbed

This commit is contained in:
Kuingsmile
2026-01-12 21:13:21 +08:00
parent a57afd4161
commit e69ebd95ac
19 changed files with 142 additions and 165 deletions

View File

@@ -388,6 +388,18 @@
</svg>
</div>
</div>
<div class="system-option-card">
<div class="system-option-header">
<Settings2Icon :size="18" />
<span>{{ t('pages.settings.upload.chooseSecondPicBedMode') }}</span>
</div>
<select v-model="currentSecondMode" class="form-select">
<option v-for="item in secondModeList" :key="item.value" :value="item.value">
{{ item.label }}
</option>
</select>
</div>
</div>
</div>
@@ -1757,6 +1769,7 @@ import {
RotateCcw,
Server,
Settings,
Settings2Icon,
Store,
} from 'lucide-vue-next'
import { marked } from 'marked'
@@ -1810,6 +1823,11 @@ const languageList = [
{ label: 'English', value: 'en' },
]
const secondModeList = [
{ label: t('pages.settings.upload.secondPicBedMode.backup'), value: 'backup' },
{ label: t('pages.settings.upload.secondPicBedMode.seperate'), value: 'seperate' },
]
const formOfSetting = ref<ISettingForm>({
showUpdateTip: true,
autoStart: false,
@@ -1900,6 +1918,12 @@ const addWatch = () => {
)
})
watch(currentSecondMode, newVal => {
if (newVal) {
saveConfig({ [configPaths.settings.secondPicBedMode]: newVal })
}
})
watch(currentLanguage, newVal => {
if (newVal) {
handleLanguageChange(newVal)
@@ -1959,6 +1983,7 @@ function copyPlaceholder(placeholder: string) {
}
const currentLanguage = ref()
const currentSecondMode = ref()
const currentStartMode = ref()
const currentShortUrlServer = ref()
@@ -2079,6 +2104,7 @@ async function initData() {
formOfSetting.value.autoImportPicBed = initArray(settings.autoImportPicBed || [], [])
currentLanguage.value = settings.language || 'zh-CN'
currentStartMode.value = settings.startMode || ISartMode.QUIET
currentSecondMode.value = settings.secondPicBedMode || 'backup'
if (osGlobal.value === 'darwin' && currentStartMode.value === ISartMode.MINI) {
currentStartMode.value = ISartMode.QUIET
saveConfig(configPaths.settings.startMode, ISartMode.QUIET)

View File

@@ -86,7 +86,7 @@
@drop.prevent="onDrop"
@dragover.prevent="dragover = true"
@dragleave.prevent="dragover = false"
@click="openUplodWindow"
@click="openUploadWindow"
>
<div class="upload-content">
<div class="upload-icon">
@@ -709,12 +709,10 @@ const taskQueueStatus = reactive<IUploadTaskQueueStatus>({
const filteredTasks = computed(() => {
let tasks = taskQueueStatus.tasks
// Filter by status
if (taskFilter.value !== 'all') {
tasks = tasks.filter(t => t.status === taskFilter.value)
}
// Filter by search query
if (taskSearchQuery.value) {
const query = taskSearchQuery.value.toLowerCase()
tasks = tasks.filter(t => t.fileName.toLowerCase().includes(query))
@@ -823,8 +821,6 @@ function onDrop(e: DragEvent) {
}
function handleURLDrag(items: DataTransferItemList, dataTransfer: DataTransfer) {
// text/html
// Use this data to get a more precise URL
const urlString = dataTransfer.getData(items[1].type)
const urlMatch = urlString.match(/<img.*src="(.*?)"/)
if (urlMatch) {
@@ -838,7 +834,7 @@ function handleURLDrag(items: DataTransferItemList, dataTransfer: DataTransfer)
}
}
function openUplodWindow() {
function openUploadWindow() {
fileInput.value?.click()
}

View File

@@ -58,7 +58,7 @@ html, body {
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
max-width: calc(100% - 300px); /* Leave space for header-actions */
max-width: calc(100% - 300px);
}
.provider-button {
@@ -164,8 +164,6 @@ html, body {
.picbed-badge.is-active {
border-color: var(--color-accent);
color: var(--color-accent);
background: var(--color-accent-soft, rgb(59 130 246 / 10%));
font-weight: 600;
}
@@ -464,7 +462,6 @@ html, body {
/* Quick Actions Card */
.card-header {
border-bottom: 1px solid var(--color-border-secondary);
padding: 1rem 1.5rem;
}
@@ -605,7 +602,7 @@ html, body {
.format-button {
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
padding: 0.4rem 0.75rem;
padding: 0.5rem 0.75rem;
font-size: 0.7rem;
font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
font-weight: 500;
@@ -637,7 +634,7 @@ html, body {
.toggle-button {
border: none;
padding: 0.625rem 0.875rem;
padding: 0.325rem 0.675rem;
font-size: 0.8rem;
font-family: inherit;
font-weight: 500;