Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(settings): enchanted settings page with erasing locataion info and more improvement (#260)

Timothy Yind1e6b008256b
diff --git a/.env.example b/.env.example
index 5cf828fa..389c48a9 100644
--- a/.env.example
+++ b/.env.example
@@ -95,11 +95,7 @@ NUXT_UPLOAD_MIME_WHITELIST=image/jpeg,image/png,image/webp,image/gif,image/bmp,i
# NUXT_UPLOAD_MIME_WHITELIST_ENABLED=false
-# Enable duplicate file detection during upload (default: true)
-NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED=true
-
-# Duplicate detection mode (default: skip)
-# - 'warn': Show warning but allow upload (will overwrite existing photo)
-# - 'block': Reject upload if file already exists
-# - 'skip': Skip upload and return existing photo info
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=skip
+# Duplicate file handling has been moved to System Settings page.
+# Configure it in Dashboard -> Settings -> System:
+# - Detect duplicate files on upload (enabled/disabled)
+# - Duplicate file handling mode (skip/warn/block)
diff --git a/app/app.vue b/app/app.vue
index 5236ca3f..a30487d2 100644
--- a/app/app.vue
+++ b/app/app.vue
@@ -42,7 +42,7 @@ const apiEndpoint = computed(() => {
if (route.path.startsWith('/dashboard')) {
return '/api/photos'
}
- // 前端页面:登录用户显示所有照片,未登录用户只显示可见照片
+ // 前端页面:登录用户显示所有照片,未登录用户只显示可见照片
return loggedIn.value ? '/api/photos' : '/api/photos/visible'
})
const { data, refresh, status } = await useFetch(() => apiEndpoint.value, {
diff --git a/app/components/setting/SettingField.vue b/app/components/setting/SettingField.vue
index 3e89bed1..731fe056 100644
--- a/app/components/setting/SettingField.vue
+++ b/app/components/setting/SettingField.vue
@@ -22,7 +22,7 @@ const getComponentName = (uiType: FieldUIType): string => {
select: 'USelectMenu',
radio: 'URadioGroup',
tabs: 'UTabs',
- toggle: 'UToggle',
+ toggle: 'USwitch',
number: 'UInput',
custom: 'UInput', // 默认降级到 input
}
@@ -35,7 +35,7 @@ const UTextarea = resolveComponent('UTextarea')
const USelectMenu = resolveComponent('USelectMenu')
const URadioGroup = resolveComponent('URadioGroup')
const UTabs = resolveComponent('UTabs')
-const UToggle = resolveComponent('UToggle')
+const USwitch = resolveComponent('USwitch')
const UFormField = resolveComponent('UFormField')
const componentName = computed(() => {
@@ -51,8 +51,8 @@ const componentName = computed(() => {
return URadioGroup
case 'UTabs':
return UTabs
- case 'UToggle':
- return UToggle
+ case 'USwitch':
+ return USwitch
default:
return UInput
}
@@ -125,21 +125,54 @@ const descriptionKey = computed(() => {
}
return `settings.${props.field.namespace}.${props.field.key}.description`
})
+
+const isToggleField = computed(() => props.field.ui.type === 'toggle')
</script>
<template>
+ <div
+ v-if="isToggleField"
+ class="rounded-md border border-neutral-200 bg-neutral-50/50 px-4 py-3 dark:border-neutral-800 dark:bg-neutral-900/40"
+ >
+ <div class="flex items-start justify-between gap-6">
+ <div class="space-y-1">
+ <p class="text-sm font-medium text-neutral-900 dark:text-neutral-100">
+ {{ $t(labelKey) }}
+ </p>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ {{ $t(descriptionKey) }}
+ </p>
+ <p
+ v-if="field.ui.help"
+ class="text-xs text-neutral-500 dark:text-neutral-500"
+ >
+ {{ $t(field.ui.help) }}
+ </p>
+ </div>
+
+ <component
+ :is="componentName"
+ :model-value="modelValue"
+ v-bind="componentProps"
+ @update:model-value="handleChange"
+ />
+ </div>
+ </div>
+
<component
:is="UFormField"
+ v-else
:name="field.key"
:label="$t(labelKey)"
:description="$t(descriptionKey)"
:help="field.ui.help ? $t(field.ui.help) : undefined"
:required="field.ui.required"
:ui="{
- container: 'w-full sm:max-w-sm *:w-full',
+ container: 'w-full *:w-full',
+ label: 'text-sm font-medium',
+ description: 'text-sm text-neutral-600 dark:text-neutral-400',
}"
>
- <!-- 动态渲染不同的组件 -->
<component
:is="componentName"
:model-value="modelValue"
diff --git a/app/components/ui/UploadQueueItem.vue b/app/components/ui/UploadQueueItem.vue
index ec8cbe37..1501d963 100644
--- a/app/components/ui/UploadQueueItem.vue
+++ b/app/components/ui/UploadQueueItem.vue
@@ -18,6 +18,7 @@ interface UploadFile {
stage?: string | null
progress?: number
error?: string
+ warning?: string
taskId?: number
uploadProgress?: {
loaded: number
@@ -363,7 +364,9 @@ const generateParticleStyle = (index: number) => {
<motion.div
v-if="
uploadingFile.status === 'completed' ||
- uploadingFile.status === 'error'
+ uploadingFile.status === 'error' ||
+ uploadingFile.status === 'skipped' ||
+ uploadingFile.status === 'blocked'
"
:initial="{ opacity: 0, scale: 0.8 }"
:animate="{ opacity: 1, scale: 1 }"
@@ -480,6 +483,58 @@ const generateParticleStyle = (index: number) => {
</motion.div>
</AnimatePresence>
+ <!-- 跳过/阻止提示 -->
+ <AnimatePresence>
+ <motion.div
+ v-if="
+ (uploadingFile.status === 'skipped' ||
+ uploadingFile.status === 'blocked') &&
+ uploadingFile.error
+ "
+ :initial="{ opacity: 0, height: 0, y: -10 }"
+ :animate="{ opacity: 1, height: 'auto', y: 0 }"
+ :exit="{ opacity: 0, height: 0, y: -10 }"
+ :transition="{ duration: 0.3 }"
+ class="mt-3"
+ >
+ <UAlert
+ :description="uploadingFile.error"
+ :color="uploadingFile.status === 'blocked' ? 'error' : 'warning'"
+ variant="soft"
+ :icon="
+ uploadingFile.status === 'blocked'
+ ? 'tabler:ban'
+ : 'tabler:player-track-next'
+ "
+ :ui="{
+ root: 'px-2.5 py-2',
+ }"
+ />
+ </motion.div>
+ </AnimatePresence>
+
+ <!-- 警告信息(如重复文件警告并覆盖) -->
+ <AnimatePresence>
+ <motion.div
+ v-if="uploadingFile.warning"
+ :initial="{ opacity: 0, height: 0, y: -10 }"
+ :animate="{ opacity: 1, height: 'auto', y: 0 }"
+ :exit="{ opacity: 0, height: 0, y: -10 }"
+ :transition="{ duration: 0.3 }"
+ class="mt-3"
+ >
+ <UAlert
+ :description="uploadingFile.warning"
+ color="warning"
+ variant="soft"
+ icon="tabler:alert-triangle"
+ :ui="{
+ root: 'px-2.5 py-2',
+ }"
+ />
+ </motion.div>
+ </AnimatePresence>
+
<!-- 处理时间警告 -->
<AnimatePresence>
<motion.div
diff --git a/app/components/ui/UploadQueuePanel.vue b/app/components/ui/UploadQueuePanel.vue
index aee49d6d..2f5aa84f 100644
--- a/app/components/ui/UploadQueuePanel.vue
+++ b/app/components/ui/UploadQueuePanel.vue
@@ -272,7 +272,7 @@ const clearAllFiles = () => {
:animate="{ height: 'auto', opacity: 1 }"
:exit="{ height: 0, opacity: 0 }"
:transition="{ duration: 0.3, ease: 'easeInOut' }"
- class="max-h-[calc(100vh-25.3rem)] sm:max-h-[600px] overflow-hidden overflow-y-auto filelist-container"
+ class="max-h-[calc(100vh-25.3rem)] sm:max-h-150 overflow-hidden overflow-y-auto filelist-container"
>
<div class="p-2 space-y-2">
<AnimatePresence mode="popLayout">
@@ -291,7 +291,15 @@ const clearAllFiles = () => {
<!-- 底部操作栏 -->
<AnimatePresence>
<motion.div
- v-if="!isCollapsed && (stats.completed > 0 || stats.error > 0)"
+ v-if="
+ !isCollapsed &&
+ (
+ stats.completed > 0 ||
+ stats.error > 0 ||
+ stats.skipped > 0 ||
+ stats.blocked > 0
+ )
+ "
:initial="{ opacity: 0, scaleY: 0 }"
:animate="{ opacity: 1, scaleY: 1 }"
:exit="{ opacity: 0, scaleY: 0 }"
@@ -301,7 +309,9 @@ const clearAllFiles = () => {
>
<div class="flex items-center justify-between gap-2">
<div class="text-xs text-neutral-500 dark:text-neutral-400">
- {{ stats.completed }} 完成, {{ stats.error }} 失败
+ {{ stats.completed }} 完成, {{ stats.error }} 失败, {{
+ stats.skipped
+ }} 跳过, {{ stats.blocked }} 阻止
</div>
<div class="flex items-center gap-0.5">
diff --git a/app/composables/useSettingsForm.ts b/app/composables/useSettingsForm.ts
index 8eae7c6f..902d3428 100644
--- a/app/composables/useSettingsForm.ts
+++ b/app/composables/useSettingsForm.ts
@@ -19,7 +19,8 @@ export function useSettingsForm(namespace: string) {
const fields = ref<FieldDescriptor[]>([])
const state = reactive<Record<string, any>>({})
- const loading = ref(false)
+ // Start in loading state to avoid first-paint empty container before skeleton.
+ const loading = ref(true)
const error = ref<string | null>(null)
/**
diff --git a/app/layouts/dashboard.vue b/app/layouts/dashboard.vue
index 4b5e2822..a52a8d90 100644
--- a/app/layouts/dashboard.vue
+++ b/app/layouts/dashboard.vue
@@ -53,6 +53,11 @@ const navItems = computed<NavigationMenuItem[][]>(() => [
icon: 'tabler:database',
to: '/dashboard/settings/storage',
},
+ {
+ label: $t('title.privacySettings'),
+ icon: 'tabler:shield-lock',
+ to: '/dashboard/settings/privacy',
+ },
{
label: $t('title.mapAndLocation'),
icon: 'tabler:map-pin',
@@ -62,7 +67,6 @@ const navItems = computed<NavigationMenuItem[][]>(() => [
label: $t('title.systemSettings'),
icon: 'tabler:cpu',
to: '/dashboard/settings/system',
- disabled: true,
},
],
},
diff --git a/app/pages/dashboard/albums.vue b/app/pages/dashboard/albums.vue
index 23120ac1..99ba4b3b 100644
--- a/app/pages/dashboard/albums.vue
+++ b/app/pages/dashboard/albums.vue
@@ -146,7 +146,7 @@ const onFormSubmit = async (event: FormSubmitEvent<AlbumFormState>) => {
description: event.data.description || undefined,
coverPhotoId: coverPhotoId.value || undefined,
photoIds: selectedPhotoIds.value,
- isHidden: event.data.isHidden,
+ isHidden: event.data.isHidden,
},
})
@@ -164,7 +164,7 @@ const onFormSubmit = async (event: FormSubmitEvent<AlbumFormState>) => {
description: event.data.description || undefined,
coverPhotoId: coverPhotoId.value || undefined,
photoIds: selectedPhotoIds.value,
- isHidden: event.data.isHidden,
+ isHidden: event.data.isHidden,
},
})
@@ -557,7 +557,7 @@ const columns: any[] = [
:rows="3"
/>
</UFormField>
-
+
<UFormField
:label="$t('dashboard.albums.form.isHidden')"
name="isHidden"
diff --git a/app/pages/dashboard/photos.vue b/app/pages/dashboard/photos.vue
index c1746f75..11f53d46 100644
--- a/app/pages/dashboard/photos.vue
+++ b/app/pages/dashboard/photos.vue
@@ -34,10 +34,15 @@ useHead({
})
const maxFileSizeMB = computed(() => {
- const val = getSetting('app:upload.maxFileSize')
+ const val = getSetting('system:upload.maxFileSize')
return typeof val === 'number' ? val : 256
})
+const systemUploadEraseLocationDefault = computed(() => {
+ const val = getSetting('privacy:upload.autoEraseLocation')
+ return typeof val === 'boolean' ? val : false
+})
+
const dayjs = useDayjs()
const { status, refresh } = usePhotos()
@@ -51,6 +56,7 @@ const totalSelectedFilters = computed(() => {
})
const reverseGeocodeLoading = ref<Record<string, boolean>>({})
+const eraseLocationLoading = ref<Record<string, boolean>>({})
const setReverseGeocodeLoading = (photoId: string, loading: boolean) => {
if (loading) {
@@ -64,6 +70,18 @@ const setReverseGeocodeLoading = (photoId: string, loading: boolean) => {
}
}
+const setEraseLocationLoading = (photoId: string, loading: boolean) => {
+ if (loading) {
+ eraseLocationLoading.value = {
+ ...eraseLocationLoading.value,
+ [photoId]: true,
+ }
+ } else {
+ const { [photoId]: _removed, ...rest } = eraseLocationLoading.value
+ eraseLocationLoading.value = rest
+ }
+}
+
// 表态数据
const reactionsData = ref<Record<string, Record<string, number>>>({})
const reactionsLoading = ref(false)
@@ -101,6 +119,7 @@ interface UploadingFile {
stage?: PipelineQueueItem['statusStage'] | null
progress?: number
error?: string
+ warning?: string
taskId?: number
signedUrlResponse?: { signedUrl: string; fileKey: string; expiresIn: number }
uploadProgress?: {
@@ -243,7 +262,11 @@ const formattedCoordinates = computed(() => {
}
})
-const uploadImage = async (file: File, existingFileId?: string) => {
+const uploadImage = async (
+ file: File,
+ existingFileId?: string,
+ eraseLocationOnUpload?: boolean,
+) => {
const fileName = file.name
const fileId = existingFileId || `${Date.now()}-${fileName}`
@@ -267,6 +290,7 @@ const uploadImage = async (file: File, existingFileId?: string) => {
// 更新现有条目的状态和回调
uploadingFile.status = 'preparing'
uploadingFile.canAbort = false
+ uploadingFile.warning = undefined
uploadingFile.abortUpload = () => uploadManager.abortUpload()
uploadingFiles.value = new Map(uploadingFiles.value)
}
@@ -289,10 +313,32 @@ const uploadImage = async (file: File, existingFileId?: string) => {
uploadingFile.status = 'skipped'
uploadingFile.progress = 100
uploadingFile.canAbort = false
+ uploadingFile.error =
+ signedUrlResponse.message ||
+ $t('upload.duplicate.skip.message', { fileName })
+
+ toast.add({
+ title: signedUrlResponse.title || $t('upload.duplicate.skip.title'),
+ description:
+ signedUrlResponse.message ||
+ $t('upload.duplicate.skip.message', { fileName }),
+ color: 'warning',
+ })
+
uploadingFiles.value = new Map(uploadingFiles.value)
return
}
+ if (signedUrlResponse.warningInfo) {
+ uploadingFile.error =
+ undefined
+ uploadingFile.warning =
+ signedUrlResponse.warningInfo.warning ||
+ signedUrlResponse.warningInfo.message
+
+ uploadingFiles.value = new Map(uploadingFiles.value)
+ }
+
uploadingFile.status = 'uploading'
uploadingFile.canAbort = true
uploadingFile.progress = 0
@@ -340,6 +386,13 @@ const uploadImage = async (file: File, existingFileId?: string) => {
payload: {
type: isMovFile ? 'live-photo-video' : 'photo',
storageKey: signedUrlResponse.fileKey,
+ ...(isMovFile
+ ? {}
+ : {
+ eraseLocation:
+ eraseLocationOnUpload ??
+ systemUploadEraseLocationDefault.value,
+ }),
},
priority: isMovFile ? 0 : 1, // Live Photo 视频优先级更低,确保图片优先处理
maxAttempts: 3,
@@ -368,8 +421,18 @@ const uploadImage = async (file: File, existingFileId?: string) => {
}
},
onError: (error: string) => {
- uploadingFile.status = 'error'
- uploadingFile.error = error
+ const isConflict = /\b409\b|Conflict/i.test(error)
+
+ if (isConflict) {
+ uploadingFile.status = 'blocked'
+ uploadingFile.error = $t('upload.duplicate.block.message', {
+ fileName,
+ })
+ } else {
+ uploadingFile.status = 'error'
+ uploadingFile.error = error
+ }
+
uploadingFile.canAbort = false
uploadingFiles.value = new Map(uploadingFiles.value)
},
@@ -379,10 +442,25 @@ const uploadImage = async (file: File, existingFileId?: string) => {
uploadingFile.canAbort = false
// 处理重复文件阻止模式的错误
- if (error.statusCode === 409 && error.data?.duplicate) {
+ const isDuplicateConflict =
+ (error.statusCode === 409 ||
+ error.status === 409 ||
+ error.response?.status === 409) &&
+ (error.data?.duplicate || /Conflict|409/i.test(error.message || ''))
+
+ if (isDuplicateConflict) {
uploadingFile.status = 'blocked'
uploadingFile.error =
- error.data.title || $t('upload.duplicate.block.title')
+ error.data.message ||
+ $t('upload.duplicate.block.message', { fileName })
+
+ toast.add({
+ title: error.data?.title || $t('upload.duplicate.block.title'),
+ description:
+ error.data?.message ||
+ $t('upload.duplicate.block.message', { fileName }),
+ color: 'error',
+ })
} else {
// 其他错误
uploadingFile.error =
@@ -412,6 +490,7 @@ const uploadImage = async (file: File, existingFileId?: string) => {
const toast = useToast()
const selectedFiles = ref<File[]>([])
const isUploadSlideoverOpen = ref(false)
+const uploadEraseLocationEnabled = ref(systemUploadEraseLocationDefault.value)
const hasSelectedFiles = computed(() => selectedFiles.value.length > 0)
@@ -443,10 +522,12 @@ const clearSelectedFiles = () => {
watch(isUploadSlideoverOpen, (open) => {
if (!open) {
clearSelectedFiles()
+ uploadEraseLocationEnabled.value = systemUploadEraseLocationDefault.value
}
})
const openUploadSlideover = () => {
+ uploadEraseLocationEnabled.value = systemUploadEraseLocationDefault.value
isUploadSlideoverOpen.value = true
}
@@ -983,7 +1064,13 @@ const columns: TableColumn<Photo>[] = [
]
// 文件验证函数
-const validateFile = (file: File): { valid: boolean; error?: string } => {
+const validateFile = (
+ file: File,
+): {
+ valid: boolean
+ error?: string
+ reason?: 'unsupported-format' | 'file-too-large'
+} => {
// 检查文件类型
const allowedTypes = [
'image/jpeg',
@@ -1002,6 +1089,7 @@ const validateFile = (file: File): { valid: boolean; error?: string } => {
if (!isValidImageType && !isValidImageExtension && !isValidVideoExtension) {
return {
valid: false,
+ reason: 'unsupported-format',
error: $t('dashboard.photos.errors.unsupportedFormat', {
type: file.type,
}),
@@ -1012,6 +1100,7 @@ const validateFile = (file: File): { valid: boolean; error?: string } => {
if (file.size > maxSize) {
return {
valid: false,
+ reason: 'file-too-large',
error: $t('dashboard.photos.errors.fileTooLarge', {
size: (file.size / 1024 / 1024).toFixed(2),
maxSize: maxFileSizeMB.value,
@@ -1030,6 +1119,8 @@ const handleUpload = async () => {
}
const errors: string[] = []
+ let tooLargeCount = 0
+ let unsupportedCount = 0
// 先验证所有文件
const validFiles: File[] = []
@@ -1039,6 +1130,11 @@ const handleUpload = async () => {
const validation = validateFile(file)
if (!validation.valid) {
errors.push(`${file.name}: ${validation.error}`)
+ if (validation.reason === 'file-too-large') {
+ tooLargeCount += 1
+ } else if (validation.reason === 'unsupported-format') {
+ unsupportedCount += 1
+ }
} else {
validFiles.push(file)
// 为每个有效文件生成唯一ID
@@ -1048,13 +1144,43 @@ const handleUpload = async () => {
}
if (validFiles.length === 0) {
+ if (tooLargeCount > 0 && unsupportedCount === 0) {
+ toast.add({
+ title: $t('upload.error.tooLarge.title'),
+ description: $t('dashboard.photos.errors.allFilesTooLarge', {
+ count: tooLargeCount,
+ maxSize: maxFileSizeMB.value,
+ }),
+ color: 'error',
+ })
+ } else {
+ toast.add({
+ title: $t('dashboard.photos.messages.error'),
+ description: $t('dashboard.photos.errors.allFilesValidationFailed'),
+ color: 'error',
+ })
+ }
+
+ return
+ }
+
+ if (tooLargeCount > 0) {
toast.add({
- title: $t('dashboard.photos.messages.error'),
- description: $t('dashboard.photos.errors.allFilesValidationFailed'),
- color: 'error',
+ title: $t('upload.error.tooLarge.title'),
+ description: $t('dashboard.photos.errors.filesTooLargeSkipped', {
+ count: tooLargeCount,
+ maxSize: maxFileSizeMB.value,
+ }),
+ color: 'warning',
+ })
+ } else if (unsupportedCount > 0) {
+ toast.add({
+ title: $t('dashboard.photos.errors.fileValidationFailed'),
+ description: $t('dashboard.photos.errors.filesUnsupportedSkipped', {
+ count: unsupportedCount,
+ }),
+ color: 'warning',
})
- selectedFiles.value = []
- return
}
// 立即为所有有效文件创建队列条目,状态为 waiting
@@ -1084,7 +1210,7 @@ const handleUpload = async () => {
const startUpload = async (file: File): Promise<void> => {
const fileId = fileIdMapping.get(file)!
try {
- uploadImage(file, fileId)
+ await uploadImage(file, fileId, uploadEraseLocationEnabled.value)
} catch (error: any) {
errors.push(`${file.name}: ${error.message || '上传失败'}`)
console.error('上传错误:', error)
@@ -1170,6 +1296,32 @@ const clearSelectedLocation = () => {
locationTouched.value = true
}
+const enqueueEraseLocationTask = async (photo: Photo) => {
+ if (!photo?.id) {
+ throw new Error($t('dashboard.photos.messages.photoNotFound'))
+ }
+
+ const result = await $fetch('/api/queue/add-task', {
+ method: 'POST',
+ body: {
+ payload: {
+ type: 'photo-erase-location',
+ photoId: photo.id,
+ },
+ priority: 2,
+ maxAttempts: 3,
+ },
+ })
+
+ if (!result.success) {
+ throw new Error(
+ result?.message || $t('dashboard.photos.messages.eraseLocationFailed'),
+ )
+ }
+
+ return result.taskId
+}
+
const saveMetadataChanges = async () => {
if (!editingPhoto.value || !isMetadataDirty.value) {
return
@@ -1197,34 +1349,53 @@ const saveMetadataChanges = async () => {
payload.tags = [...editFormState.tags]
}
- if (locationChanged.value) {
- payload.location = locationSelection.value
- ? {
- latitude: locationSelection.value.latitude,
- longitude: locationSelection.value.longitude,
- }
- : null
+ const shouldQueueLocationErase =
+ locationChanged.value && locationSelection.value === null
+
+ if (locationChanged.value && locationSelection.value) {
+ payload.location = {
+ latitude: locationSelection.value.latitude,
+ longitude: locationSelection.value.longitude,
+ }
}
if (ratingChanged.value) {
payload.rating = editFormState.rating
}
- if (Object.keys(payload).length === 0) {
- isEditModalOpen.value = false
- return
+ let hasAnySuccessfulAction = false
+
+ if (Object.keys(payload).length > 0) {
+ await $fetch(`/api/photos/${editingPhoto.value.id}`, {
+ method: 'PUT',
+ body: payload,
+ })
+
+ toast.add({
+ title: $t('dashboard.photos.messages.metadataUpdateSuccess'),
+ description: '',
+ color: 'success',
+ })
+ hasAnySuccessfulAction = true
}
- await $fetch(`/api/photos/${editingPhoto.value.id}`, {
- method: 'PUT',
- body: payload,
- })
+ if (shouldQueueLocationErase) {
+ const taskId = await enqueueEraseLocationTask(editingPhoto.value)
+ toast.add({
+ title: $t('dashboard.photos.messages.eraseLocationQueued'),
+ description:
+ typeof taskId === 'number'
+ ? $t('dashboard.photos.messages.reprocessTaskId', { taskId })
+ : '',
+ color: 'success',
+ })
+ hasAnySuccessfulAction = true
+ }
- toast.add({
- title: $t('dashboard.photos.messages.metadataUpdateSuccess'),
- description: '',
- color: 'success',
- })
+ if (!hasAnySuccessfulAction) {
+ isEditModalOpen.value = false
+ return
+ }
await refresh()
isEditModalOpen.value = false
@@ -1316,6 +1487,41 @@ const handleReverseGeocodeRequest = async (photo: Photo) => {
}
}
+const handleEraseLocationRequest = async (photo: Photo) => {
+ if (!photo?.id) {
+ return
+ }
+
+ setEraseLocationLoading(photo.id, true)
+
+ try {
+ const taskId = await enqueueEraseLocationTask(photo)
+ toast.add({
+ title: $t('dashboard.photos.messages.eraseLocationQueued'),
+ description:
+ typeof taskId === 'number'
+ ? $t('dashboard.photos.messages.reprocessTaskId', { taskId })
+ : '',
+ color: 'success',
+ })
+ } catch (error: any) {
+ console.error('Failed to enqueue erase location task:', error)
+ const message =
+ error?.data?.statusMessage ||
+ error?.statusMessage ||
+ error?.message ||
+ $t('dashboard.photos.messages.eraseLocationFailed')
+
+ toast.add({
+ title: $t('dashboard.photos.messages.eraseLocationFailed'),
+ description: message,
+ color: 'error',
+ })
+ } finally {
+ setEraseLocationLoading(photo.id, false)
+ }
+}
+
// 重新处理单张照片
const handleReprocessSingle = async (photo: Photo) => {
try {
@@ -1373,6 +1579,7 @@ const handleReprocessSingle = async (photo: Photo) => {
const getRowActions = (photo: Photo) => {
const isReverseLoading = !!reverseGeocodeLoading.value[photo.id]
+ const isEraseLocationLoading = !!eraseLocationLoading.value[photo.id]
return [
[
@@ -1398,6 +1605,14 @@ const getRowActions = (photo: Photo) => {
handleReverseGeocodeRequest(photo)
},
},
+ {
+ label: $t('dashboard.photos.actions.eraseLocationInfo'),
+ icon: isEraseLocationLoading ? 'tabler:loader-2' : 'tabler:map-off',
+ disabled: isEraseLocationLoading,
+ onSelect() {
+ handleEraseLocationRequest(photo)
+ },
+ },
{
label: $t('dashboard.photos.actions.previewPhoto'),
icon: 'tabler:photo',
@@ -1625,6 +1840,91 @@ const handleBatchReprocess = async () => {
}
}
+// 批量抹除位置信息
+const handleBatchEraseLocation = async () => {
+ const selectedRowModel = table.value?.tableApi?.getFilteredSelectedRowModel()
+ const selectedPhotos =
+ selectedRowModel?.rows.map((row: any) => row.original) || []
+
+ if (selectedPhotos.length === 0) {
+ toast.add({
+ title: $t('dashboard.photos.messages.batchSelectRequired'),
+ description: '',
+ color: 'warning',
+ })
+ return
+ }
+
+ const targetPhotoIds = selectedPhotos
+ .map((photo: Photo) => photo.id)
+ .filter((id): id is string => !!id)
+
+ if (targetPhotoIds.length === 0) {
+ toast.add({
+ title: $t('dashboard.photos.messages.photoNotFound'),
+ description: '',
+ color: 'error',
+ })
+ return
+ }
+
+ for (const photoId of targetPhotoIds) {
+ setEraseLocationLoading(photoId, true)
+ }
+
+ try {
+ const result = await $fetch('/api/queue/add-tasks', {
+ method: 'POST',
+ body: {
+ tasks: targetPhotoIds.map((photoId) => ({
+ payload: {
+ type: 'photo-erase-location',
+ photoId,
+ },
+ priority: 2,
+ maxAttempts: 3,
+ })),
+ },
+ })
+
+ if (result.success) {
+ toast.add({
+ title: $t('dashboard.photos.messages.batchEraseLocationQueued', {
+ count: targetPhotoIds.length,
+ }),
+ description: '',
+ color: 'success',
+ })
+ rowSelection.value = {}
+ } else {
+ toast.add({
+ title: $t('dashboard.photos.messages.batchEraseLocationFailed'),
+ description:
+ result?.message ||
+ $t('dashboard.photos.messages.batchEraseLocationFailed'),
+ color: 'error',
+ })
+ }
+ } catch (error: any) {
+ console.error('批量抹除位置信息入队失败:', error)
+ const message =
+ error?.data?.statusMessage ||
+ error?.statusMessage ||
+ error?.message ||
+ $t('dashboard.photos.messages.batchEraseLocationFailed')
+
+ toast.add({
+ title: $t('dashboard.photos.messages.batchEraseLocationFailed'),
+ description: message,
+ color: 'error',
+ })
+ } finally {
+ for (const photoId of targetPhotoIds) {
+ setEraseLocationLoading(photoId, false)
+ }
+ }
+}
+
// 批量下载照片
const handleBatchDownload = async () => {
const selectedRowModel = table.value?.tableApi?.getFilteredSelectedRowModel()
@@ -1899,39 +2199,70 @@ onUnmounted(() => {
}"
>
<template #body>
- <UFileUpload
- v-model="selectedFiles"
- :label="$t('dashboard.photos.uploader.label')"
- :description="
- $t('dashboard.photos.uploader.description', {
- maxSize: maxFileSizeMB,
- })
- "
- icon="tabler:cloud-upload"
- layout="list"
- size="xl"
- accept="image/jpeg,image/png,image/heic,image/heif,video/quicktime,.mov"
- multiple
- highlight
- dropzone
- :file-delete="{ variant: 'soft', color: 'neutral' }"
- :ui="{
- root: 'w-full',
- base: 'group relative flex flex-col items-center justify-center gap-3 rounded-3xl border-2 border-dashed border-neutral-200/80 bg-white/90 px-6 py-12 text-center shadow-sm transition-all duration-300 hover:border-primary-400/80 hover:bg-primary-500/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/60 dark:border-neutral-700/70 dark:bg-neutral-900/80',
- wrapper: 'flex flex-col items-center gap-2',
- label:
- 'text-base font-semibold text-neutral-800 dark:text-neutral-100',
- description: 'text-sm text-neutral-500 dark:text-neutral-400',
- files: 'mt-2 flex w-full flex-col gap-2 overflow-y-auto',
- file: 'flex items-center justify-between gap-3 rounded-2xl border border-neutral-200/80 bg-white/80 px-4 py-3 text-left shadow-sm shadow-black/5 backdrop-blur-sm dark:border-neutral-800/80 dark:bg-neutral-900/70',
- fileLeadingAvatar: 'ring-1 ring-white/80 dark:ring-neutral-800',
- fileWrapper: 'min-w-0 flex-1',
- fileName:
- 'text-sm font-medium text-neutral-700 dark:text-neutral-100 truncate',
- fileSize: 'text-xs text-neutral-500 dark:text-neutral-400',
- fileTrailingButton: 'text-neutral-400 hover:text-error-500',
- }"
- />
+ <div class="space-y-4">
+ <UFileUpload
+ v-model="selectedFiles"
+ :label="$t('dashboard.photos.uploader.label')"
+ :description="
+ $t('dashboard.photos.uploader.description', {
+ maxSize: maxFileSizeMB,
+ })
+ "
+ icon="tabler:cloud-upload"
+ layout="list"
+ size="xl"
+ accept="image/jpeg,image/png,image/heic,image/heif,video/quicktime,.mov"
+ multiple
+ highlight
+ dropzone
+ :file-delete="{ variant: 'soft', color: 'neutral' }"
+ :ui="{
+ root: 'w-full',
+ base: 'group relative flex flex-col items-center justify-center gap-3 rounded-3xl border-2 border-dashed border-neutral-200/80 bg-white/90 px-6 py-12 text-center shadow-sm transition-all duration-300 hover:border-primary-400/80 hover:bg-primary-500/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/60 dark:border-neutral-700/70 dark:bg-neutral-900/80',
+ wrapper: 'flex flex-col items-center gap-2',
+ label:
+ 'text-base font-semibold text-neutral-800 dark:text-neutral-100',
+ description: 'text-sm text-neutral-500 dark:text-neutral-400',
+ files: 'mt-2 flex w-full flex-col gap-2 overflow-y-auto',
+ file: 'flex items-center justify-between gap-3 rounded-2xl border border-neutral-200/80 bg-white/80 px-4 py-3 text-left shadow-sm shadow-black/5 backdrop-blur-sm dark:border-neutral-800/80 dark:bg-neutral-900/70',
+ fileLeadingAvatar:
+ 'ring-1 ring-white/80 dark:ring-neutral-800',
+ fileWrapper: 'min-w-0 flex-1',
+ fileName:
+ 'text-sm font-medium text-neutral-700 dark:text-neutral-100 truncate',
+ fileSize: 'text-xs text-neutral-500 dark:text-neutral-400',
+ fileTrailingButton: 'text-neutral-400 hover:text-error-500',
+ }"
+ />
+
+ <UCard
+ variant="soft"
+ class="border border-neutral-200/80 dark:border-neutral-800/80"
+ >
+ <div class="flex items-start justify-between gap-4">
+ <div class="space-y-1">
+ <p
+ class="text-sm font-medium text-neutral-800 dark:text-neutral-100"
+ >
+ {{
+ $t(
+ 'dashboard.photos.slideover.options.eraseLocation.label',
+ )
+ }}
+ </p>
+ <p class="text-xs text-neutral-500 dark:text-neutral-400">
+ {{
+ $t(
+ 'dashboard.photos.slideover.options.eraseLocation.description',
+ )
+ }}
+ </p>
+ </div>
+ <USwitch v-model="uploadEraseLocationEnabled" />
+ </div>
+ </UCard>
+
+ </div>
</template>
<template #footer>
@@ -2212,6 +2543,19 @@ onUnmounted(() => {
}}</span>
</UButton>
+ <UButton
+ variant="soft"
+ color="primary"
+ size="xs"
+ icon="tabler:map-off"
+ class="flex-1 sm:flex-none"
+ @click="handleBatchEraseLocation"
+ >
+ <span>{{
+ $t('dashboard.photos.selection.batchEraseLocation')
+ }}</span>
+ </UButton>
+
<UButton
variant="soft"
color="primary"
diff --git a/app/pages/dashboard/queue.vue b/app/pages/dashboard/queue.vue
index 465a1374..e4c43a93 100644
--- a/app/pages/dashboard/queue.vue
+++ b/app/pages/dashboard/queue.vue
@@ -202,6 +202,10 @@ const typeOptions = [
label: $t('dashboard.queue.types.photo-reverse-geocoding'),
value: 'photo-reverse-geocoding',
},
+ {
+ label: $t('dashboard.queue.types.photo-erase-location'),
+ value: 'photo-erase-location',
+ },
]
// 展开行状态
diff --git a/app/pages/dashboard/settings/general.vue b/app/pages/dashboard/settings/general.vue
index 4b0ddc7d..27adc08a 100644
--- a/app/pages/dashboard/settings/general.vue
+++ b/app/pages/dashboard/settings/general.vue
@@ -19,6 +19,36 @@ const appearanceFields = computed(() =>
fields.value.filter((f) => f.key.startsWith('appearance.')),
)
+const sameValue = (left: any, right: any) =>
+ JSON.stringify(left ?? null) === JSON.stringify(right ?? null)
+
+const getDefaultFieldValue = (field: (typeof fields.value)[number]) =>
+ field.value ?? field.defaultValue ?? null
+
+const isAppDirty = computed(() =>
+ appFields.value.some((field) =>
+ !sameValue(state[field.key], getDefaultFieldValue(field)),
+ ),
+)
+
+const isAppearanceDirty = computed(() =>
+ appearanceFields.value.some((field) =>
+ !sameValue(state[field.key], getDefaultFieldValue(field)),
+ ),
+)
+
+const resetAppSettings = () => {
+ appFields.value.forEach((field) => {
+ state[field.key] = getDefaultFieldValue(field)
+ })
+}
+
+const resetAppearanceSettings = () => {
+ appearanceFields.value.forEach((field) => {
+ state[field.key] = getDefaultFieldValue(field)
+ })
+}
+
const handleAppSettingsSubmit = async () => {
const appData = Object.fromEntries(
appFields.value.map((f) => [f.key, state[f.key]]),
@@ -52,16 +82,39 @@ const handleAppearanceSettingsSubmit = async () => {
</template>
<template #body>
- <div class="space-y-6 max-w-6xl">
- <!-- 通用设置 -->
- <UCard variant="outline">
- <template #header>
- <span>{{ $t('title.generalSettings') }}</span>
- </template>
+ <div class="mx-auto w-full max-w-5xl space-y-6">
+ <section class="space-y-2 border-b border-neutral-200 pb-4 dark:border-neutral-800">
+ <h2 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.generalSettings') }}
+ </h2>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ 管理站点基础信息与展示外观。更改会立即影响控制台和前台展示。
+ </p>
+ </section>
+
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.generalSettings') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="loading && appFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-32" />
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-4 w-44" />
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-4 w-36" />
+ <USkeleton class="h-10 w-full" />
+ </div>
<UForm
+ v-else
id="appSettingsForm"
- class="space-y-4"
+ class="space-y-5 px-5 py-5"
@submit="handleAppSettingsSubmit"
>
<SettingField
@@ -73,28 +126,55 @@ const handleAppearanceSettingsSubmit = async () => {
/>
</UForm>
- <template #footer>
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isAppDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isAppDirty"
+ @click="resetAppSettings"
+ >
+ 重置
+ </UButton>
<UButton
:loading="loading"
type="submit"
form="appSettingsForm"
- variant="soft"
+ :disabled="!isAppDirty"
icon="tabler:device-floppy"
>
保存设置
</UButton>
- </template>
- </UCard>
+ </div>
+ </footer>
+ </section>
- <!-- 外观设置 -->
- <UCard variant="outline">
- <template #header>
- <span>{{ $t('title.appearanceSettings') }}</span>
- </template>
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.appearanceSettings') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="loading && appearanceFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-40" />
+ <USkeleton class="h-10 w-full" />
+ </div>
<UForm
+ v-else
id="appearanceSettingsForm"
- class="space-y-4"
+ class="space-y-5 px-5 py-5"
@submit="handleAppearanceSettingsSubmit"
>
<SettingField
@@ -106,18 +186,35 @@ const handleAppearanceSettingsSubmit = async () => {
/>
</UForm>
- <template #footer>
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isAppearanceDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isAppearanceDirty"
+ @click="resetAppearanceSettings"
+ >
+ 重置
+ </UButton>
<UButton
:loading="loading"
type="submit"
form="appearanceSettingsForm"
- variant="soft"
+ :disabled="!isAppearanceDirty"
icon="tabler:device-floppy"
>
保存设置
</UButton>
- </template>
- </UCard>
+ </div>
+ </footer>
+ </section>
</div>
</template>
</UDashboardPanel>
diff --git a/app/pages/dashboard/settings/map.vue b/app/pages/dashboard/settings/map.vue
index 67e47adb..1b5f36c8 100644
--- a/app/pages/dashboard/settings/map.vue
+++ b/app/pages/dashboard/settings/map.vue
@@ -31,6 +31,40 @@ const visibleMapFields = computed(() => {
})
})
+const sameValue = (left: any, right: any) =>
+ JSON.stringify(left ?? null) === JSON.stringify(right ?? null)
+
+const getDefaultFieldValue = (field: (typeof mapFields.value)[number]) =>
+ field.value ?? field.defaultValue ?? null
+
+const isMapDirty = computed(() =>
+ visibleMapFields.value.some(
+ (field) => !sameValue(mapState[field.key], getDefaultFieldValue(field)),
+ ),
+)
+
+const isLocationDirty = computed(() =>
+ locationFields.value.some(
+ (field) =>
+ !sameValue(
+ locationState[field.key],
+ field.value ?? field.defaultValue ?? null,
+ ),
+ ),
+)
+
+const resetMapSettings = () => {
+ visibleMapFields.value.forEach((field) => {
+ mapState[field.key] = getDefaultFieldValue(field)
+ })
+}
+
+const resetLocationSettings = () => {
+ locationFields.value.forEach((field) => {
+ locationState[field.key] = field.value ?? field.defaultValue ?? null
+ })
+}
+
const handleMapSettingsSubmit = async () => {
const mapData = Object.fromEntries(
visibleMapFields.value.map((f) => [f.key, mapState[f.key]]),
@@ -61,16 +95,37 @@ const handleLocationSettingsSubmit = async () => {
</template>
<template #body>
- <div class="space-y-6 max-w-6xl">
- <!-- 地图设置 -->
- <UCard variant="outline">
- <template #header>
- <span>{{ $t('title.mapAndLocation') }}</span>
- </template>
+ <div class="mx-auto w-full max-w-5xl space-y-6">
+ <section class="space-y-2 border-b border-neutral-200 pb-4 dark:border-neutral-800">
+ <h2 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.mapAndLocation') }}
+ </h2>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ 配置地图展示与地理编码服务。地图服务商会影响地图样式与访问凭证。
+ </p>
+ </section>
+
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.mapAndLocation') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="mapLoading && visibleMapFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-32" />
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-4 w-44" />
+ <USkeleton class="h-10 w-full" />
+ </div>
<UForm
+ v-else
id="mapSettingsForm"
- class="space-y-4"
+ class="space-y-5 px-5 py-5"
@submit="handleMapSettingsSubmit"
>
<SettingField
@@ -82,28 +137,57 @@ const handleLocationSettingsSubmit = async () => {
/>
</UForm>
- <template #footer>
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isMapDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isMapDirty"
+ @click="resetMapSettings"
+ >
+ 重置
+ </UButton>
<UButton
:loading="mapLoading"
type="submit"
form="mapSettingsForm"
- variant="soft"
+ :disabled="!isMapDirty"
icon="tabler:device-floppy"
>
保存设置
</UButton>
- </template>
- </UCard>
+ </div>
+ </footer>
+ </section>
- <!-- 位置设置 -->
- <UCard variant="outline">
- <template #header>
- <span>{{ $t('title.location') }}</span>
- </template>
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.location') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="locationLoading && locationFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-36" />
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-4 w-40" />
+ <USkeleton class="h-10 w-full" />
+ </div>
<UForm
+ v-else
id="locationSettingsForm"
- class="space-y-4"
+ class="space-y-5 px-5 py-5"
@submit="handleLocationSettingsSubmit"
>
<SettingField
@@ -115,18 +199,35 @@ const handleLocationSettingsSubmit = async () => {
/>
</UForm>
- <template #footer>
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isLocationDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isLocationDirty"
+ @click="resetLocationSettings"
+ >
+ 重置
+ </UButton>
<UButton
:loading="locationLoading"
type="submit"
form="locationSettingsForm"
- variant="soft"
+ :disabled="!isLocationDirty"
icon="tabler:device-floppy"
>
保存设置
</UButton>
- </template>
- </UCard>
+ </div>
+ </footer>
+ </section>
</div>
</template>
</UDashboardPanel>
diff --git a/app/pages/dashboard/settings/privacy.vue b/app/pages/dashboard/settings/privacy.vue
new file mode 100644
index 00000000..3e7811e0
--- /dev/null
+++ b/app/pages/dashboard/settings/privacy.vue
@@ -0,0 +1,128 @@
+<script lang="ts" setup>
+definePageMeta({
+ layout: 'dashboard',
+})
+
+useHead({
+ title: $t('title.privacySettings'),
+})
+
+const {
+ fields: privacyFields,
+ state: privacyState,
+ submit: submitPrivacy,
+ loading: privacyLoading,
+} = useSettingsForm('privacy')
+
+const sameValue = (left: any, right: any) =>
+ JSON.stringify(left ?? null) === JSON.stringify(right ?? null)
+
+const isPrivacyDirty = computed(() =>
+ privacyFields.value.some(
+ (field) =>
+ !sameValue(
+ privacyState[field.key],
+ field.value ?? field.defaultValue ?? null,
+ ),
+ ),
+)
+
+const resetPrivacySettings = () => {
+ privacyFields.value.forEach((field) => {
+ privacyState[field.key] = field.value ?? field.defaultValue ?? null
+ })
+}
+
+const handlePrivacySettingsSubmit = async () => {
+ const privacyData = Object.fromEntries(
+ privacyFields.value.map((f) => [f.key, privacyState[f.key]]),
+ )
+
+ try {
+ await submitPrivacy(privacyData)
+ } catch {
+ /* empty */
+ }
+}
+</script>
+
+<template>
+ <UDashboardPanel>
+ <template #header>
+ <UDashboardNavbar :title="$t('title.privacySettings')" />
+ </template>
+
+ <template #body>
+ <div class="mx-auto w-full max-w-5xl space-y-6">
+ <section class="space-y-2 border-b border-neutral-200 pb-4 dark:border-neutral-800">
+ <h2 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.privacySettings') }}
+ </h2>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ 管理照片上传时的数据隐私策略。建议在公开站点启用位置信息抹除。
+ </p>
+ </section>
+
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.privacySettings') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="privacyLoading && privacyFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-44" />
+ <USkeleton class="h-12 w-full" />
+ </div>
+
+ <UForm
+ v-else
+ id="privacySettingsForm"
+ class="space-y-5 px-5 py-5"
+ @submit="handlePrivacySettingsSubmit"
+ >
+ <SettingField
+ v-for="field in privacyFields"
+ :key="field.key"
+ :field="field"
+ :model-value="privacyState[field.key]"
+ @update:model-value="(val) => (privacyState[field.key] = val)"
+ />
+ </UForm>
+
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isPrivacyDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isPrivacyDirty"
+ @click="resetPrivacySettings"
+ >
+ 重置
+ </UButton>
+ <UButton
+ :loading="privacyLoading"
+ type="submit"
+ form="privacySettingsForm"
+ :disabled="!isPrivacyDirty"
+ icon="tabler:device-floppy"
+ >
+ 保存设置
+ </UButton>
+ </div>
+ </footer>
+ </section>
+ </div>
+ </template>
+ </UDashboardPanel>
+</template>
diff --git a/app/pages/dashboard/settings/storage.vue b/app/pages/dashboard/settings/storage.vue
index 1f3f23f0..16c00a8f 100644
--- a/app/pages/dashboard/settings/storage.vue
+++ b/app/pages/dashboard/settings/storage.vue
@@ -25,7 +25,11 @@ const { data: currentStorageProvider, refresh: refreshCurrentStorageProvider } =
value: SettingValue
}>('/api/system/settings/storage/provider')
-const { data: availableStorage, refresh: refreshAvailableStorage } =
+const {
+ data: availableStorage,
+ refresh: refreshAvailableStorage,
+ status: availableStorageStatus,
+} =
await useFetch<SettingStorageProvider[]>(
'/api/system/settings/storage-config',
)
@@ -92,6 +96,16 @@ const storageSettingsState = reactive<{
: undefined,
})
+const isStorageDefaultDirty = computed(() => {
+ return storageSettingsState.storageConfigId !== currentStorageProvider.value?.value
+})
+
+const resetStorageDefault = () => {
+ storageSettingsState.storageConfigId = currentStorageProvider.value
+ ? (currentStorageProvider.value.value as number)
+ : undefined
+}
+
const handleStorageSettingsSubmit = async (close?: () => void) => {
try {
await $fetch('/api/system/settings/storage/provider', {
@@ -347,9 +361,35 @@ const onStorageDelete = async (storageId: number) => {
</template>
<template #body>
- <div class="space-y-6 max-w-6xl">
- <UCard variant="outline">
- <div class="space-y-4">
+ <div class="mx-auto w-full max-w-5xl space-y-6">
+ <section class="space-y-2 border-b border-neutral-200 pb-4 dark:border-neutral-800">
+ <h2 class="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
+ {{ $t('title.storageSettings') }}
+ </h2>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ 管理默认存储方案与可用存储提供者。此页面的设置仅影响后续上传文件。
+ </p>
+ </section>
+
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ 当前默认存储
+ </h3>
+ </header>
+
+ <div
+ v-if="availableStorageStatus !== 'success' && !availableStorage"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-32" />
+ <USkeleton class="h-10 w-72" />
+ </div>
+
+ <div
+ v-else
+ class="space-y-4 px-5 py-5"
+ >
<UFormField
name="storageConfigId"
label="存储方案"
@@ -382,14 +422,29 @@ const onStorageDelete = async (storageId: number) => {
</UFormField>
</div>
- <template #footer>
- <div class="flex items-center gap-3">
+ <footer class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <div
+ v-if="isStorageDefaultDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isStorageDefaultDirty"
+ @click="resetStorageDefault"
+ >
+ 重置
+ </UButton>
<UModal
title="变更存储方案"
:ui="{ footer: 'justify-end' }"
>
<UButton
- variant="soft"
+ :disabled="!isStorageDefaultDirty"
icon="tabler:device-floppy"
>
保存设置
@@ -423,112 +478,119 @@ const onStorageDelete = async (storageId: number) => {
</template>
</UModal>
</div>
- </template>
- </UCard>
-
- <UCard
- variant="outline"
- :ui="{
- body: 'p-0 sm:p-0',
- }"
- >
- <template #header>
- <div class="w-full flex items-center justify-between">
- <span>存储方案管理</span>
- <div>
- <USlideover
- title="创建存储方案"
- :ui="{ footer: 'justify-end' }"
+ </footer>
+ </section>
+
+ <section class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950">
+ <header class="flex w-full items-center justify-between border-b border-neutral-200 px-5 py-4 dark:border-neutral-800">
+ <h3 class="text-base font-semibold text-neutral-900 dark:text-neutral-100">
+ 存储方案管理
+ </h3>
+ <div>
+ <USlideover
+ title="创建存储方案"
+ :ui="{ footer: 'justify-end' }"
+ >
+ <UButton
+ size="sm"
+ variant="soft"
+ icon="tabler:plus"
>
- <UButton
- size="sm"
- variant="soft"
- icon="tabler:plus"
- >
- 添加存储
- </UButton>
-
- <template #body="{ close }">
- <div class="space-y-4">
- <!-- Provider 选择 -->
- <UFormField
- label="存储类型"
- class="w-full"
- required
- :ui="{
- container: 'sm:max-w-full',
- }"
- >
- <USelectMenu
- v-model="storageConfigState.provider"
- :icon="
- PROVIDER_ICON[
- storageConfigState.provider as keyof typeof PROVIDER_ICON
- ] || 'tabler:database'
- "
- :items="providerOptions"
- label-key="label"
- value-key="value"
- placeholder="选择存储类型"
- @update:model-value="
- (val: string) => {
- storageConfigState.provider = val
- storageConfigState.config =
- getStorageConfigDefaults(val)
- }
- "
- />
- </UFormField>
-
- <UFormField
- label="存储名称"
- required
- :ui="{
- container: 'sm:max-w-full',
- }"
- >
- <UInput v-model="storageConfigState.name" />
- </UFormField>
-
- <USeparator />
-
- <AutoForm
- id="createStorageForm"
- :schema="currentStorageSchema"
- :state="storageConfigState.config"
- :fields-config="storageFieldsConfig"
- @submit="onStorageConfigSubmit($event, close)"
+ 添加存储
+ </UButton>
+
+ <template #body="{ close }">
+ <div class="space-y-4">
+ <!-- Provider 选择 -->
+ <UFormField
+ label="存储类型"
+ class="w-full"
+ required
+ :ui="{
+ container: 'sm:max-w-full',
+ }"
+ >
+ <USelectMenu
+ v-model="storageConfigState.provider"
+ :icon="
+ PROVIDER_ICON[
+ storageConfigState.provider as keyof typeof PROVIDER_ICON
+ ] || 'tabler:database'
+ "
+ :items="providerOptions"
+ label-key="label"
+ value-key="value"
+ placeholder="选择存储类型"
+ @update:model-value="
+ (val: string) => {
+ storageConfigState.provider = val
+ storageConfigState.config =
+ getStorageConfigDefaults(val)
+ }
+ "
/>
- </div>
- </template>
-
- <template #footer="{ close }">
- <UButton
- label="取消"
- color="neutral"
- variant="outline"
- @click="close"
- />
- <UButton
- label="创建存储"
- variant="soft"
- icon="tabler:check"
- type="submit"
- form="createStorageForm"
+ </UFormField>
+
+ <UFormField
+ label="存储名称"
+ required
+ :ui="{
+ container: 'sm:max-w-full',
+ }"
+ >
+ <UInput v-model="storageConfigState.name" />
+ </UFormField>
+
+ <USeparator />
+
+ <AutoForm
+ id="createStorageForm"
+ :schema="currentStorageSchema"
+ :state="storageConfigState.config"
+ :fields-config="storageFieldsConfig"
+ @submit="onStorageConfigSubmit($event, close)"
/>
- </template>
- </USlideover>
- </div>
+ </div>
+ </template>
+
+ <template #footer="{ close }">
+ <UButton
+ label="取消"
+ color="neutral"
+ variant="outline"
+ @click="close"
+ />
+ <UButton
+ label="创建存储"
+ variant="soft"
+ icon="tabler:check"
+ type="submit"
+ form="createStorageForm"
+ />
+ </template>
+ </USlideover>
</div>
- </template>
+ </header>
+
+ <div
+ v-if="availableStorageStatus !== 'success' && !availableStorage"
+ class="space-y-3 px-5 py-5"
+ >
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-10 w-full" />
+ <USkeleton class="h-10 w-full" />
+ </div>
- <div>
+ <div
+ v-else
+ class="px-0 py-0"
+ >
<UTable
:columns="availableStorageColumns"
:data="availableStorage"
/>
</div>
- </UCard>
+ </section>
</div>
</template>
</UDashboardPanel>
diff --git a/app/pages/dashboard/settings/system.vue b/app/pages/dashboard/settings/system.vue
new file mode 100644
index 00000000..f550bf95
--- /dev/null
+++ b/app/pages/dashboard/settings/system.vue
@@ -0,0 +1,143 @@
+<script lang="ts" setup>
+definePageMeta({
+ layout: 'dashboard',
+})
+
+useHead({
+ title: $t('title.systemSettings'),
+})
+
+const {
+ fields: rawSystemFields,
+ state: systemState,
+ submit: submitSystem,
+ loading: systemLoading,
+} = useSettingsForm('system')
+
+const systemFields = computed(() =>
+ rawSystemFields.value.filter((field) => !field.isReadonly),
+)
+
+const sameValue = (left: any, right: any) =>
+ JSON.stringify(left ?? null) === JSON.stringify(right ?? null)
+
+const getDefaultFieldValue = (field: (typeof rawSystemFields.value)[number]) =>
+ field.value ?? field.defaultValue ?? null
+
+const isSystemDirty = computed(() =>
+ systemFields.value.some(
+ (field) => !sameValue(systemState[field.key], getDefaultFieldValue(field)),
+ ),
+)
+
+const resetSystemSettings = () => {
+ systemFields.value.forEach((field) => {
+ systemState[field.key] = getDefaultFieldValue(field)
+ })
+}
+
+const handleSystemSettingsSubmit = async () => {
+ const systemData = Object.fromEntries(
+ systemFields.value.map((f) => [f.key, systemState[f.key]]),
+ )
+
+ try {
+ await submitSystem(systemData)
+ } catch {
+ /* empty */
+ }
+}
+</script>
+
+<template>
+ <UDashboardPanel>
+ <template #header>
+ <UDashboardNavbar :title="$t('title.systemSettings')" />
+ </template>
+
+ <template #body>
+ <div class="mx-auto w-full max-w-5xl space-y-6">
+ <section
+ class="space-y-2 border-b border-neutral-200 pb-4 dark:border-neutral-800"
+ >
+ <h2
+ class="text-xl font-semibold text-neutral-900 dark:text-neutral-100"
+ >
+ {{ $t('title.systemSettings') }}
+ </h2>
+ <p class="text-sm text-neutral-600 dark:text-neutral-400">
+ 配置系统级行为参数。这里的修改会影响全局上传和服务行为。
+ </p>
+ </section>
+
+ <section
+ class="rounded-md border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-950"
+ >
+ <header
+ class="border-b border-neutral-200 px-5 py-4 dark:border-neutral-800"
+ >
+ <h3
+ class="text-base font-semibold text-neutral-900 dark:text-neutral-100"
+ >
+ {{ $t('title.systemSettings') }}
+ </h3>
+ </header>
+
+ <div
+ v-if="systemLoading && systemFields.length === 0"
+ class="space-y-4 px-5 py-5"
+ >
+ <USkeleton class="h-4 w-40" />
+ <USkeleton class="h-10 w-full" />
+ </div>
+
+ <UForm
+ v-else
+ id="systemSettingsForm"
+ class="space-y-5 px-5 py-5"
+ @submit="handleSystemSettingsSubmit"
+ >
+ <SettingField
+ v-for="field in systemFields"
+ :key="field.key"
+ :field="field"
+ :model-value="systemState[field.key]"
+ @update:model-value="(val) => (systemState[field.key] = val)"
+ />
+ </UForm>
+
+ <footer
+ class="border-t border-neutral-200 px-5 py-4 dark:border-neutral-800"
+ >
+ <div
+ v-if="isSystemDirty"
+ class="mb-3 rounded-md border border-warning-200 bg-warning-50 px-3 py-2 text-sm text-warning-800 dark:border-warning-900/60 dark:bg-warning-950/30 dark:text-warning-200"
+ >
+ {{ $t('common.unsavedChanges') }}
+ </div>
+
+ <div class="flex items-center justify-end gap-2">
+ <UButton
+ color="neutral"
+ variant="outline"
+ :disabled="!isSystemDirty"
+ @click="resetSystemSettings"
+ >
+ 重置
+ </UButton>
+ <UButton
+ :loading="systemLoading"
+ type="submit"
+ form="systemSettingsForm"
+ :disabled="!isSystemDirty"
+ icon="tabler:device-floppy"
+ >
+ 保存设置
+ </UButton>
+ </div>
+ </footer>
+ </section>
+ </div>
+ </template>
+ </UDashboardPanel>
+</template>
diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md
index 1a01fea4..8178372a 100644
--- a/docs/guide/configuration.md
+++ b/docs/guide/configuration.md
@@ -48,8 +48,6 @@ Whether using Docker or Docker Compose (.env) deployment, configuration is done
| NUXT_PUBLIC_ANALYTICS_MATOMO_SITE_ID | Matomo site ID | None | No (required when Matomo is enabled) |
| NUXT_UPLOAD_MIME_WHITELIST_ENABLED | Enable MIME type whitelist validation for uploads | `true` | No |
| NUXT_UPLOAD_MIME_WHITELIST | Allowed MIME types for uploads (comma-separated) | See below | No |
-| NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED | Enable duplicate file detection during upload | `true` | No |
-| NUXT_UPLOAD_DUPLICATE_CHECK_MODE | Duplicate handling mode, options: `warn`, `block`, `skip` | `skip` | No |
| ALLOW_INSECURE_COOKIE | Allow insecure cookies (only for development environment) | `false` | No |
## Upload File Type Whitelist
@@ -78,52 +76,3 @@ To disable whitelist validation (allow any file type), set:
```
NUXT_UPLOAD_MIME_WHITELIST_ENABLED=false
```
-
-## Duplicate File Detection
-
-`NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED` controls whether to detect duplicate files during upload.
-
-`NUXT_UPLOAD_DUPLICATE_CHECK_MODE` has three modes:
-
-### skip (Skip Mode) - Default
-
-- Skips upload when duplicate file is detected
-- Returns existing photo info without any operations
-- Suitable for automatic deduplication during batch uploads
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=skip
-```
-
-### warn (Warning Mode)
-
-- Shows warning when duplicate file is detected
-- Continues upload, will overwrite existing photo data
-- Suitable for scenarios where photo updates are needed
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=warn
-```
-
-### block (Block Mode)
-
-- Rejects upload if duplicate file is detected
-- Returns 409 error, doesn't allow overwriting
-- Suitable for scenarios requiring strict duplicate prevention
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=block
-```
-
-### Completely Disable Detection
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED=false
-```
-
-**Notes**:
-
-- Duplicate detection is based on filename, not file content
-- Same filename generates same photoId
-- Even with detection disabled, uploading same filename will still overwrite existing data (database uses `onConflictDoUpdate`)
-- Recommend using unique filenames (e.g., adding timestamps) to avoid conflicts
diff --git a/docs/zh/guide/configuration.md b/docs/zh/guide/configuration.md
index b5326f2c..aecb059e 100644
--- a/docs/zh/guide/configuration.md
+++ b/docs/zh/guide/configuration.md
@@ -48,8 +48,6 @@
| NUXT_PUBLIC_ANALYTICS_MATOMO_SITE_ID | Matomo 站点 ID | 无 | 否(启用 Matomo 时必需) |
| NUXT_UPLOAD_MIME_WHITELIST_ENABLED | 是否启用上传文件 MIME 类型白名单验证 | `true` | 否 |
| NUXT_UPLOAD_MIME_WHITELIST | 上传文件允许的 MIME 类型列表(逗号分隔) | 见下方说明 | 否 |
-| NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED | 是否启用重复文件检测 | `true` | 否 |
-| NUXT_UPLOAD_DUPLICATE_CHECK_MODE | 重复文件处理模式,可选 `warn`、`block`、`skip` | `skip` | 否 |
| ALLOW_INSECURE_COOKIE | 是否允许非安全 Cookie(仅在开发环境使用) | `false` | 否 |
## 上传文件类型白名单
@@ -78,52 +76,3 @@ NUXT_UPLOAD_MIME_WHITELIST=image/jpeg,image/png,video/mp4
```
NUXT_UPLOAD_MIME_WHITELIST_ENABLED=false
```
-
-## 重复文件检测
-
-`NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED` 控制是否在上传时检测重复文件。
-
-`NUXT_UPLOAD_DUPLICATE_CHECK_MODE` 有三种模式:
-
-### skip(跳过模式)- 默认
-
-- 检测到重复文件时跳过上传
-- 返回现有照片信息,不进行任何操作
-- 适合批量上传时自动去重
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=skip
-```
-
-### warn(警告模式)
-
-- 检测到重复文件时显示警告
-- 继续上传,会覆盖现有照片数据
-- 适合需要更新照片的场景
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=warn
-```
-
-### block(阻止模式)
-
-- 检测到重复文件时拒绝上传
-- 返回 409 错误,不允许覆盖
-- 适合严格防止重复的场景
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_MODE=block
-```
-
-### 完全禁用检测
-
-```
-NUXT_UPLOAD_DUPLICATE_CHECK_ENABLED=false
-```
-
-**注意事项**:
-
-- 重复检测基于文件名,不基于文件内容
-- 相同文件名会生成相同的 photoId
-- 即使禁用检测,上传同名文件仍会覆盖现有数据(数据库使用 `onConflictDoUpdate`)
-- 建议使用唯一的文件名(如添加时间戳)来避免冲突
diff --git a/i18n/locales/en.json b/i18n/locales/en.json
index 541b4297..8355d141 100644
--- a/i18n/locales/en.json
+++ b/i18n/locales/en.json
@@ -364,6 +364,7 @@
"location": "Location services",
"generalSettings": "General Settings",
"appearanceSettings": "Appearance Settings",
+ "privacySettings": "Privacy Settings",
"mapAndLocation": "Map & Location"
},
"auth": {
@@ -389,6 +390,7 @@
},
"common": {
"unknown": "unknown",
+ "unsavedChanges": "There are unsaved changes.",
"months": {
"jan": "Jan",
"feb": "Feb",
@@ -439,7 +441,7 @@
"warn": {
"title": "Duplicate File Detected",
"message": "Photo \"{fileName}\" already exists. Continuing will overwrite the existing photo",
- "warning": "After overwriting, all information of the original photo (EXIF, tags, reactions, etc.) will be replaced",
+ "warning": "Overwrite the existing photo file",
"info": "Existing photo: {title}, taken on {dateTaken}"
}
},
@@ -537,6 +539,7 @@
"actions": {
"reprocess": "Reprocess",
"refreshLocation": "Re-fetch City",
+ "eraseLocationInfo": "Erase location info",
"delete": "Delete",
"editMetadata": "Edit Metadata",
"previewPhoto": "Photo Preview"
@@ -544,12 +547,27 @@
"selection": {
"selected": "{count} / {total} rows selected",
"batchReprocess": "Reprocess",
+ "batchEraseLocation": "Erase location info",
"batchDownload": "Download",
"batchDelete": "Batch Delete"
},
"slideover": {
"title": "Upload Photos",
"description": "Drag and drop or select files. Photos will be automatically processed and added to the library.",
+ "options": {
+ "eraseLocation": {
+ "label": "Erase location info on upload",
+ "description": "This upload can override the system default and be toggled on or off anytime."
+ },
+ "duplicateCheck": {
+ "label": "Duplicate file strategy",
+ "descriptionEnabled": "Duplicate detection is enabled and same-name files will follow the selected handling mode.",
+ "descriptionDisabled": "Duplicate detection is disabled and same-name files will continue directly through upload.",
+ "enabled": "Detection enabled",
+ "disabled": "Detection disabled",
+ "currentMode": "Current mode: {mode}"
+ }
+ },
"buttons": {
"clear": "Clear Selection",
"upload": "Upload {count} file(s)"
@@ -620,12 +638,19 @@
"noChangesProvided": "No changes to apply",
"queueUnavailable": "Task queue is not available",
"reverseGeocodeQueued": "Reverse geocoding task queued",
- "reverseGeocodeFailed": "Failed to queue reverse geocoding"
+ "reverseGeocodeFailed": "Failed to queue reverse geocoding",
+ "eraseLocationQueued": "Erase location info task queued",
+ "eraseLocationFailed": "Failed to queue erase location info task",
+ "batchEraseLocationQueued": "Queued {count} erase-location task(s)",
+ "batchEraseLocationFailed": "Failed to queue batch erase-location tasks"
},
"errors": {
"noSelection": "Please select photos to upload",
"fileValidationFailed": "File validation failed",
"allFilesValidationFailed": "All files failed validation",
+ "allFilesTooLarge": "All {count} selected files exceed the maximum size limit ({maxSize}MB).",
+ "filesTooLargeSkipped": "Skipped {count} oversized file(s) (limit {maxSize}MB). Remaining files will continue uploading.",
+ "filesUnsupportedSkipped": "Skipped {count} file(s) with unsupported formats. Remaining files will continue uploading.",
"unsupportedFormat": "Unsupported file format: {type}. Please select JPEG, PNG, or HEIC photos, or MOV format Live Photo videos.",
"fileTooLarge": "File too large: {size}MB. Maximum supported: {maxSize}MB.",
"uploadFailed": "Upload failed",
@@ -661,7 +686,7 @@
"tagsHint": "Press Enter to add each tag.",
"location": "Location",
"locationHint": "Click on the map to set the shooting location.",
- "clearLocation": "Clear location",
+ "clearLocation": "Erase location info",
"coordinates": "Coordinates",
"noLocation": "No location selected",
"rating": "Rating",
@@ -837,7 +862,8 @@
"types": {
"photo": "Photo Processing",
"live-photo-video": "LivePhoto Video",
- "photo-reverse-geocoding": "Photo Reverse Geocoding"
+ "photo-reverse-geocoding": "Photo Reverse Geocoding",
+ "photo-erase-location": "Photo Location Erasure"
},
"stages": {
"preprocessing": "Preprocessing",
@@ -845,7 +871,8 @@
"thumbnail": "Thumbnail",
"exif": "EXIF Processing",
"reverse-geocoding": "Geocoding",
- "live-photo": "LivePhoto Processing"
+ "live-photo": "LivePhoto Processing",
+ "location-erase": "Location Erasure"
},
"buttons": {
"retry": "Retry",
@@ -904,6 +931,27 @@
}
}
},
+ "system": {
+ "upload": {
+ "duplicateCheck": {
+ "enabled": {
+ "label": "Detect duplicate files on upload",
+ "description": "Detect duplicate photos by filename and apply the selected strategy",
+ "help": "When disabled, duplicate pre-check is skipped and files with the same name continue through upload"
+ },
+ "mode": {
+ "label": "Duplicate file handling mode",
+ "description": "How to handle files detected as duplicates",
+ "help": "Only effective when duplicate detection is enabled",
+ "options": {
+ "skip": "Skip",
+ "warn": "Warn and overwrite",
+ "block": "Block upload"
+ }
+ }
+ }
+ }
+ },
"map": {
"provider": {
"label": "Map Provider",
@@ -948,6 +996,15 @@
}
}
},
+ "privacy": {
+ "upload": {
+ "autoEraseLocation": {
+ "label": "Automatically erase location info on upload",
+ "description": "Automatically remove EXIF GPS metadata and clear geolocation fields while processing uploaded photos",
+ "help": "When enabled, location erasure will run asynchronously in the processing queue"
+ }
+ }
+ },
"storage": {
"name": {
"label": "Provider Name",
@@ -1095,4 +1152,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/i18n/locales/ja.json b/i18n/locales/ja.json
index 6db1d5a0..35c80ea1 100644
--- a/i18n/locales/ja.json
+++ b/i18n/locales/ja.json
@@ -362,6 +362,7 @@
"siteAdministration": "サイト設定",
"generalSettings": "一般設定",
"appearanceSettings": "外観設定",
+ "privacySettings": "プライバシー設定",
"mapAndLocation": "地図と場所",
"location": "位置情報サービス"
},
@@ -382,6 +383,7 @@
}
},
"common": {
+ "unsavedChanges": "未保存の変更があります。",
"months": {
"jan": "1月",
"feb": "2月",
@@ -480,6 +482,7 @@
"actions": {
"reprocess": "再処理",
"refreshLocation": "都市情報を再取得",
+ "eraseLocationInfo": "位置情報を抹消",
"delete": "削除",
"editMetadata": "メタデータを編集",
"previewPhoto": "プレビュー写真"
@@ -487,12 +490,19 @@
"selection": {
"selected": "{count} / {total}行選択済み",
"batchReprocess": "一括再処理",
+ "batchEraseLocation": "位置情報を抹消",
"batchDownload": "一括ダウンロード",
"batchDelete": "一括削除"
},
"slideover": {
"title": "写真をアップロード",
"description": "ドラッグアンドドロップするか、ファイルを選択します。写真は自動的に処理され、ライブラリに追加されます。",
+ "options": {
+ "eraseLocation": {
+ "label": "アップロード時に位置情報を抹消",
+ "description": "このアップロードではシステム既定値を上書きでき、いつでもオン/オフを切り替えできます。"
+ }
+ },
"buttons": {
"clear": "選択をクリア",
"upload": "{count}個のファイルをアップロード"
@@ -563,12 +573,19 @@
"noChangesProvided": "適用できる変更がありません",
"queueUnavailable": "タスクキューを利用できません",
"reverseGeocodeQueued": "都市情報の再取得タスクをキューに追加しました",
- "reverseGeocodeFailed": "都市情報の再取得タスクの追加に失敗しました"
+ "reverseGeocodeFailed": "都市情報の再取得タスクの追加に失敗しました",
+ "eraseLocationQueued": "位置情報の抹消タスクをキューに追加しました",
+ "eraseLocationFailed": "位置情報の抹消タスクの追加に失敗しました",
+ "batchEraseLocationQueued": "{count} 件の位置情報抹消タスクをキューに追加しました",
+ "batchEraseLocationFailed": "位置情報抹消タスクの一括追加に失敗しました"
},
"errors": {
"noSelection": "アップロードする写真を選択してください",
"fileValidationFailed": "ファイル検証に失敗しました",
"allFilesValidationFailed": "すべてのファイルが検証に失敗しました",
+ "allFilesTooLarge": "選択した {count} 件のファイルはすべて最大サイズ制限({maxSize}MB)を超えています。",
+ "filesTooLargeSkipped": "サイズ超過のファイルを {count} 件スキップしました(上限 {maxSize}MB)。残りのファイルはアップロードを続行します。",
+ "filesUnsupportedSkipped": "未対応形式のファイルを {count} 件スキップしました。残りのファイルはアップロードを続行します。",
"unsupportedFormat": "サポートされていないファイル形式:{type}。JPEG、PNG、またはHEIC写真、またはMOV形式のライブフォトビデオを選択してください。",
"fileTooLarge": "ファイルが大きすぎます:{size}MB。最大サポート:{maxSize}MB。",
"uploadFailed": "アップロードに失敗しました",
@@ -604,7 +621,7 @@
"tagsHint": "タグを入力し、Enter キーで追加してください。",
"location": "撮影場所",
"locationHint": "地図をクリックして撮影場所を選択してください。",
- "clearLocation": "位置情報をクリア",
+ "clearLocation": "位置情報を抹消",
"coordinates": "座標",
"noLocation": "位置情報が未設定です",
"rating": "評価",
@@ -780,7 +797,8 @@
"types": {
"photo": "写真処理",
"live-photo-video": "LivePhoto動画",
- "photo-reverse-geocoding": "写真の逆ジオコーディング"
+ "photo-reverse-geocoding": "写真の逆ジオコーディング",
+ "photo-erase-location": "写真位置情報の抹消"
},
"stages": {
"preprocessing": "前処理",
@@ -788,7 +806,8 @@
"thumbnail": "サムネイル",
"exif": "EXIF処理",
"reverse-geocoding": "地理解析",
- "live-photo": "LivePhoto処理"
+ "live-photo": "LivePhoto処理",
+ "location-erase": "位置情報の抹消"
},
"buttons": {
"retry": "再試行",
@@ -847,6 +866,27 @@
}
}
},
+ "system": {
+ "upload": {
+ "duplicateCheck": {
+ "enabled": {
+ "label": "アップロード時に重複ファイルを検出",
+ "description": "ファイル名で重複写真を検出し、選択した方針を適用します",
+ "help": "無効にすると重複の事前チェックを行わず、同名ファイルはそのままアップロード処理に進みます"
+ },
+ "mode": {
+ "label": "重複ファイル処理モード",
+ "description": "重複ファイルを検出した場合の処理方法",
+ "help": "重複検出が有効な場合のみ適用されます",
+ "options": {
+ "skip": "スキップ",
+ "warn": "警告して上書き",
+ "block": "アップロードを拒否"
+ }
+ }
+ }
+ }
+ },
"map": {
"provider": {
"label": "地図プロバイダー",
@@ -891,6 +931,15 @@
}
}
},
+ "privacy": {
+ "upload": {
+ "autoEraseLocation": {
+ "label": "アップロード時に位置情報を自動で抹消",
+ "description": "アップロード処理中に EXIF の GPS 情報と地理位置フィールドを自動的に削除します",
+ "help": "有効化すると、位置情報抹消はキューで非同期に実行されます"
+ }
+ }
+ },
"storage": {
"name": {
"label": "設定名",
@@ -1038,4 +1087,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/i18n/locales/zh-Hans.json b/i18n/locales/zh-Hans.json
index 235e932e..e7356031 100644
--- a/i18n/locales/zh-Hans.json
+++ b/i18n/locales/zh-Hans.json
@@ -364,6 +364,7 @@
"generalSettings": "基本设置",
"appearanceSettings": "外观设置",
"storageSettings": "存储设置",
+ "privacySettings": "隐私设置",
"systemSettings": "系统设置",
"mapAndLocation": "地图和位置",
"location": "位置服务"
@@ -391,6 +392,7 @@
},
"common": {
"unknown": "未知",
+ "unsavedChanges": "存在未保存的更改。",
"months": {
"jan": "一月",
"feb": "二月",
@@ -441,7 +443,7 @@
"warn": {
"title": "检测到重复文件",
"message": "照片 \"{fileName}\" 已存在,继续上传将会覆盖现有照片",
- "warning": "覆盖后,原有照片的所有信息(EXIF、标签、表态等)将被替换",
+ "warning": "覆盖已存在的照片文件",
"info": "现有照片:{title},拍摄于 {dateTaken}"
}
},
@@ -539,6 +541,7 @@
"actions": {
"reprocess": "重新处理",
"refreshLocation": "重新获取城市",
+ "eraseLocationInfo": "抹除位置信息",
"delete": "删除",
"editMetadata": "编辑信息",
"previewPhoto": "预览照片"
@@ -546,12 +549,27 @@
"selection": {
"selected": "{count} / {total} 行已选择",
"batchReprocess": "重新处理",
+ "batchEraseLocation": "抹除位置信息",
"batchDownload": "批量下载",
"batchDelete": "批量删除"
},
"slideover": {
"title": "上传照片",
"description": "拖拽或选择文件。上传后照片会自动处理并添加到库中。",
+ "options": {
+ "eraseLocation": {
+ "label": "上传时抹除位置信息",
+ "description": "本次上传将覆盖系统默认值,可随时开启或关闭。"
+ },
+ "duplicateCheck": {
+ "label": "重复文件处理策略",
+ "descriptionEnabled": "当前已启用重复检测,上传时会按所选模式处理同名文件。",
+ "descriptionDisabled": "当前已关闭重复检测,同名文件将直接进入上传流程。",
+ "enabled": "检测已开启",
+ "disabled": "检测已关闭",
+ "currentMode": "当前模式:{mode}"
+ }
+ },
"buttons": {
"clear": "清空选择",
"upload": "上传 {count} 个文件"
@@ -622,12 +640,19 @@
"noChangesProvided": "没有可应用的修改",
"queueUnavailable": "任务队列不可用",
"reverseGeocodeQueued": "已加入重新获取城市任务",
- "reverseGeocodeFailed": "重新获取城市任务添加失败"
+ "reverseGeocodeFailed": "重新获取城市任务添加失败",
+ "eraseLocationQueued": "已加入抹除位置信息任务",
+ "eraseLocationFailed": "抹除位置信息任务添加失败",
+ "batchEraseLocationQueued": "已加入 {count} 条抹除位置信息任务",
+ "batchEraseLocationFailed": "批量抹除位置信息任务添加失败"
},
"errors": {
"noSelection": "请选择要上传的照片",
"fileValidationFailed": "文件验证失败",
"allFilesValidationFailed": "所有文件验证失败",
+ "allFilesTooLarge": "所选 {count} 个文件均超过最大大小限制({maxSize}MB)。",
+ "filesTooLargeSkipped": "已跳过 {count} 个超大文件(上限 {maxSize}MB),其余文件继续上传。",
+ "filesUnsupportedSkipped": "已跳过 {count} 个不支持格式的文件,其余文件继续上传。",
"unsupportedFormat": "不支持的文件格式: {type}。请选择 JPEG、PNG、HEIC 格式的图片或 MOV 格式的 Live Photo 视频。",
"fileTooLarge": "文件太大: {size}MB。最大支持 {maxSize}MB。",
"uploadFailed": "上传失败",
@@ -663,7 +688,7 @@
"tagsHint": "按下 Enter 键添加每个标签。",
"location": "拍摄位置",
"locationHint": "点击地图选择或更新拍摄位置。",
- "clearLocation": "清除位置",
+ "clearLocation": "抹除位置信息",
"coordinates": "坐标",
"noLocation": "未选择位置",
"rating": "评分",
@@ -841,7 +866,8 @@
"types": {
"photo": "照片处理",
"live-photo-video": "LivePhoto视频",
- "photo-reverse-geocoding": "照片逆地理编码"
+ "photo-reverse-geocoding": "照片逆地理编码",
+ "photo-erase-location": "照片位置信息抹除"
},
"stages": {
"preprocessing": "预处理",
@@ -849,7 +875,8 @@
"thumbnail": "缩略图",
"exif": "EXIF处理",
"reverse-geocoding": "地理解析",
- "live-photo": "LivePhoto处理"
+ "live-photo": "LivePhoto处理",
+ "location-erase": "位置信息抹除"
},
"buttons": {
"retry": "重试",
@@ -908,6 +935,27 @@
}
}
},
+ "system": {
+ "upload": {
+ "duplicateCheck": {
+ "enabled": {
+ "label": "上传时检测重复文件",
+ "description": "根据文件名检测重复照片并执行对应处理策略",
+ "help": "关闭后将不进行重复预检查,同名文件会直接进入上传流程"
+ },
+ "mode": {
+ "label": "重复文件处理模式",
+ "description": "检测到重复文件时的处理方式",
+ "help": "仅在开启重复文件检测时生效",
+ "options": {
+ "skip": "跳过",
+ "warn": "警告并覆盖",
+ "block": "阻止上传"
+ }
+ }
+ }
+ }
+ },
"map": {
"provider": {
"label": "地图服务商",
@@ -952,6 +1000,15 @@
}
}
},
+ "privacy": {
+ "upload": {
+ "autoEraseLocation": {
+ "label": "上传时自动抹除位置信息",
+ "description": "上传和处理照片时自动抹除 EXIF GPS 信息并清空地理位置字段",
+ "help": "启用后会将抹除位置信息操作放入队列异步执行"
+ }
+ }
+ },
"storage": {
"name": {
"label": "配置名称",
@@ -1099,4 +1156,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/i18n/locales/zh-Hant-HK.json b/i18n/locales/zh-Hant-HK.json
index 76985c13..6726c33e 100644
--- a/i18n/locales/zh-Hant-HK.json
+++ b/i18n/locales/zh-Hant-HK.json
@@ -362,6 +362,7 @@
"siteAdministration": "站點設置",
"generalSettings": "基本設置",
"appearanceSettings": "外觀設置",
+ "privacySettings": "隱私設置",
"mapAndLocation": "地圖和位置",
"location": "位置服務"
},
@@ -382,6 +383,7 @@
}
},
"common": {
+ "unsavedChanges": "目前有尚未儲存的變更。",
"months": {
"jan": "一月",
"feb": "二月",
@@ -480,6 +482,7 @@
"actions": {
"reprocess": "重新處理",
"refreshLocation": "重新取得城市",
+ "eraseLocationInfo": "抹除位置資訊",
"delete": "刪除",
"editMetadata": "編輯資訊",
"previewPhoto": "相片預覽"
@@ -487,12 +490,19 @@
"selection": {
"selected": "已選擇 {count} / {total} 列",
"batchReprocess": "批量重新處理",
+ "batchEraseLocation": "抹除位置資訊",
"batchDownload": "批量下載",
"batchDelete": "批量刪除"
},
"slideover": {
"title": "上傳相片",
"description": "拖曳或選擇檔案。相片會自動處理並新增到圖庫。",
+ "options": {
+ "eraseLocation": {
+ "label": "上傳時抹除位置資訊",
+ "description": "本次上傳可覆蓋系統預設值,您可隨時切換開啟或關閉。"
+ }
+ },
"buttons": {
"clear": "清除選擇",
"upload": "上傳 {count} 個檔案"
@@ -563,12 +573,19 @@
"noChangesProvided": "沒有可套用的變更",
"queueUnavailable": "任務隊列不可用",
"reverseGeocodeQueued": "已新增重新取得城市的任務",
- "reverseGeocodeFailed": "重新取得城市任務新增失敗"
+ "reverseGeocodeFailed": "重新取得城市任務新增失敗",
+ "eraseLocationQueued": "已新增抹除位置資訊任務",
+ "eraseLocationFailed": "抹除位置資訊任務新增失敗",
+ "batchEraseLocationQueued": "已新增 {count} 條抹除位置資訊任務",
+ "batchEraseLocationFailed": "批量抹除位置資訊任務新增失敗"
},
"errors": {
"noSelection": "請選擇相片進行上傳",
"fileValidationFailed": "檔案驗證失敗",
"allFilesValidationFailed": "所有檔案驗證失敗",
+ "allFilesTooLarge": "所選 {count} 個檔案皆超過最大大小限制({maxSize}MB)。",
+ "filesTooLargeSkipped": "已略過 {count} 個過大檔案(上限 {maxSize}MB),其餘檔案將繼續上傳。",
+ "filesUnsupportedSkipped": "已略過 {count} 個不支援格式的檔案,其餘檔案將繼續上傳。",
"unsupportedFormat": "不支援的檔案格式:{type}。請選擇 JPEG、PNG 或 HEIC 相片,或 MOV 格式的實況相片影片。",
"fileTooLarge": "檔案過大:{size}MB。最大支援:{maxSize}MB。",
"uploadFailed": "上傳失敗",
@@ -604,7 +621,7 @@
"tagsHint": "按 Enter 鍵新增每個標籤。",
"location": "拍攝位置",
"locationHint": "點擊地圖選擇或更新拍攝位置。",
- "clearLocation": "清除位置",
+ "clearLocation": "抹除位置資訊",
"coordinates": "座標",
"noLocation": "未選擇位置",
"rating": "評分",
@@ -780,7 +797,8 @@
"types": {
"photo": "照片處理",
"live-photo-video": "LivePhoto視頻",
- "photo-reverse-geocoding": "照片逆地理編碼"
+ "photo-reverse-geocoding": "照片逆地理編碼",
+ "photo-erase-location": "照片位置資訊抹除"
},
"stages": {
"preprocessing": "預處理",
@@ -788,7 +806,8 @@
"thumbnail": "縮略圖",
"exif": "EXIF處理",
"reverse-geocoding": "地理解析",
- "live-photo": "LivePhoto處理"
+ "live-photo": "LivePhoto處理",
+ "location-erase": "位置資訊抹除"
},
"buttons": {
"retry": "重試",
@@ -847,6 +866,27 @@
}
}
},
+ "system": {
+ "upload": {
+ "duplicateCheck": {
+ "enabled": {
+ "label": "上傳時偵測重複檔案",
+ "description": "按檔名偵測重複相片並套用對應策略",
+ "help": "關閉後會略過重複預檢,同名檔案會直接進入上傳流程"
+ },
+ "mode": {
+ "label": "重複檔案處理模式",
+ "description": "偵測到重複檔案時嘅處理方式",
+ "help": "只會喺啟用重複檔案偵測時生效",
+ "options": {
+ "skip": "跳過",
+ "warn": "警告並覆蓋",
+ "block": "阻止上傳"
+ }
+ }
+ }
+ }
+ },
"map": {
"provider": {
"label": "地圖服務商",
@@ -891,6 +931,15 @@
}
}
},
+ "privacy": {
+ "upload": {
+ "autoEraseLocation": {
+ "label": "上傳時自動抹除位置資訊",
+ "description": "在上傳與處理照片時自動抹除 EXIF GPS 資訊並清空地理位置欄位",
+ "help": "啟用後會將抹除位置資訊操作放入佇列非同步執行"
+ }
+ }
+ },
"storage": {
"name": {
"label": "配置名稱",
@@ -1038,4 +1087,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/i18n/locales/zh-Hant-TW.json b/i18n/locales/zh-Hant-TW.json
index 6e77596f..eb7bd521 100644
--- a/i18n/locales/zh-Hant-TW.json
+++ b/i18n/locales/zh-Hant-TW.json
@@ -362,6 +362,7 @@
"siteAdministration": "站點設置",
"generalSettings": "基本設置",
"appearanceSettings": "外觀設置",
+ "privacySettings": "隱私設置",
"mapAndLocation": "地圖和位置",
"location": "位置服務"
},
@@ -382,6 +383,7 @@
}
},
"common": {
+ "unsavedChanges": "目前有尚未儲存的變更。",
"months": {
"jan": "一月",
"feb": "二月",
@@ -480,6 +482,7 @@
"actions": {
"reprocess": "重新處理",
"refreshLocation": "重新取得城市",
+ "eraseLocationInfo": "抹除位置資訊",
"delete": "刪除",
"editMetadata": "編輯資訊",
"previewPhoto": "照片預覽"
@@ -487,12 +490,19 @@
"selection": {
"selected": "已選擇 {count} / {total} 列",
"batchReprocess": "批量重新處理",
+ "batchEraseLocation": "抹除位置資訊",
"batchDownload": "批量下載",
"batchDelete": "批量刪除"
},
"slideover": {
"title": "上傳照片",
"description": "拖曳或選擇檔案。照片會自動處理並新增到圖庫。",
+ "options": {
+ "eraseLocation": {
+ "label": "上傳時抹除位置資訊",
+ "description": "本次上傳可覆蓋系統預設值,您可隨時切換開啟或關閉。"
+ }
+ },
"buttons": {
"clear": "清除選擇",
"upload": "上傳 {count} 個檔案"
@@ -563,12 +573,19 @@
"noChangesProvided": "沒有可套用的變更",
"queueUnavailable": "任務佇列不可用",
"reverseGeocodeQueued": "已新增重新取得城市的任務",
- "reverseGeocodeFailed": "重新取得城市任務新增失敗"
+ "reverseGeocodeFailed": "重新取得城市任務新增失敗",
+ "eraseLocationQueued": "已新增抹除位置資訊任務",
+ "eraseLocationFailed": "抹除位置資訊任務新增失敗",
+ "batchEraseLocationQueued": "已新增 {count} 條抹除位置資訊任務",
+ "batchEraseLocationFailed": "批量抹除位置資訊任務新增失敗"
},
"errors": {
"noSelection": "請選擇照片進行上傳",
"fileValidationFailed": "檔案驗證失敗",
"allFilesValidationFailed": "所有檔案驗證失敗",
+ "allFilesTooLarge": "所選 {count} 個檔案皆超過最大大小限制({maxSize}MB)。",
+ "filesTooLargeSkipped": "已略過 {count} 個過大檔案(上限 {maxSize}MB),其餘檔案將繼續上傳。",
+ "filesUnsupportedSkipped": "已略過 {count} 個不支援格式的檔案,其餘檔案將繼續上傳。",
"unsupportedFormat": "不支援的檔案格式:{type}。請選擇 JPEG、PNG 或 HEIC 照片,或 MOV 格式的原況照片影片。",
"fileTooLarge": "檔案過大:{size}MB。最大支援:{maxSize}MB。",
"uploadFailed": "上傳失敗",
@@ -604,7 +621,7 @@
"tagsHint": "按 Enter 鍵新增每個標籤。",
"location": "拍攝位置",
"locationHint": "點擊地圖選擇或更新拍攝位置。",
- "clearLocation": "清除位置",
+ "clearLocation": "抹除位置資訊",
"coordinates": "座標",
"noLocation": "未選擇位置",
"rating": "評分",
@@ -780,7 +797,8 @@
"types": {
"photo": "照片處理",
"live-photo-video": "LivePhoto影片",
- "photo-reverse-geocoding": "照片逆地理編碼"
+ "photo-reverse-geocoding": "照片逆地理編碼",
+ "photo-erase-location": "照片位置資訊抹除"
},
"stages": {
"preprocessing": "預處理",
@@ -788,7 +806,8 @@
"thumbnail": "縮圖",
"exif": "EXIF處理",
"reverse-geocoding": "地理解析",
- "live-photo": "LivePhoto處理"
+ "live-photo": "LivePhoto處理",
+ "location-erase": "位置資訊抹除"
},
"buttons": {
"retry": "重試",
@@ -847,6 +866,27 @@
}
}
},
+ "system": {
+ "upload": {
+ "duplicateCheck": {
+ "enabled": {
+ "label": "上傳時偵測重複檔案",
+ "description": "依檔名偵測重複照片並套用對應策略",
+ "help": "關閉後將略過重複預檢,同名檔案會直接進入上傳流程"
+ },
+ "mode": {
+ "label": "重複檔案處理模式",
+ "description": "偵測到重複檔案時的處理方式",
+ "help": "僅在啟用重複檔案偵測時生效",
+ "options": {
+ "skip": "跳過",
+ "warn": "警告並覆蓋",
+ "block": "阻止上傳"
+ }
+ }
+ }
+ }
+ },
"map": {
"provider": {
"label": "地圖服務商",
@@ -891,6 +931,15 @@
}
}
},
+ "privacy": {
+ "upload": {
+ "autoEraseLocation": {
+ "label": "上傳時自動抹除位置資訊",
+ "description": "在上傳與處理照片時自動抹除 EXIF GPS 資訊並清空地理位置欄位",
+ "help": "啟用後會將抹除位置資訊操作放入佇列非同步執行"
+ }
+ }
+ },
"storage": {
"name": {
"label": "配置名稱",
@@ -1038,4 +1087,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/renovate.json b/renovate.json
index 7454baac..b23dcf4c 100644
--- a/renovate.json
+++ b/renovate.json
@@ -1,15 +1,9 @@
{
- "extends": [
- "config:recommended"
- ],
- "schedule": [
- "before 5am on monday"
- ],
+ "extends": ["config:recommended"],
+ "schedule": ["before 5am on monday"],
"prConcurrentLimit": 3,
"rangeStrategy": "bump",
- "labels": [
- "dependencies"
- ],
+ "labels": ["dependencies"],
"dependencyDashboard": false,
"rebaseWhen": "conflicted",
"ignoreDeps": [],
@@ -18,17 +12,12 @@
},
"packageRules": [
{
- "matchUpdateTypes": [
- "minor",
- "patch"
- ],
+ "matchUpdateTypes": ["minor", "patch"],
"groupName": "non-major deps"
},
{
- "matchUpdateTypes": [
- "patch"
- ],
+ "matchUpdateTypes": ["patch"],
"automerge": true
}
]
-}
\ No newline at end of file
+}
diff --git a/server/api/albums/[albumId]/index.get.ts b/server/api/albums/[albumId]/index.get.ts
index ac101232..9bfe3ed2 100644
--- a/server/api/albums/[albumId]/index.get.ts
+++ b/server/api/albums/[albumId]/index.get.ts
@@ -26,7 +26,7 @@ export default eventHandler(async (event) => {
statusMessage: 'Album not found',
})
}
-
+
// 检查相册是否隐藏,如果隐藏则需要用户登录才能访问
if (album.isHidden) {
const session = await getUserSession(event)
diff --git a/server/api/photos/index.post.ts b/server/api/photos/index.post.ts
index ae84047d..7f6c7217 100644
--- a/server/api/photos/index.post.ts
+++ b/server/api/photos/index.post.ts
@@ -2,6 +2,7 @@ import path from 'path'
import { useStorageProvider } from '~~/server/utils/useStorageProvider'
import { eq } from 'drizzle-orm'
import { generateSafePhotoId } from '~~/server/utils/file-utils'
+import { settingsManager } from '~~/server/services/settings/settingsManager'
const VIDEO_EXTENSIONS = new Set(['.mov', '.mp4'])
@@ -43,7 +44,6 @@ const isLikelyImageKey = (storageKey?: string | null): boolean => {
export default eventHandler(async (event) => {
await requireUserSession(event)
const { storageProvider } = useStorageProvider(event)
- const config = useRuntimeConfig(event)
const t = await useTranslation(event)
const body = await readBody(event)
@@ -62,7 +62,10 @@ export default eventHandler(async (event) => {
// 重复文件检测
const duplicateCheckEnabled =
- config.upload.duplicateCheck.enabled && !skipDuplicateCheck
+ ((await settingsManager.get<boolean>(
+ 'system',
+ 'upload.duplicateCheck.enabled',
+ )) ?? true) && !skipDuplicateCheck
let existingPhoto = null
if (duplicateCheckEnabled) {
@@ -91,7 +94,11 @@ export default eventHandler(async (event) => {
}
if (existingPhoto) {
- const checkMode = config.upload.duplicateCheck.mode || 'skip'
+ const checkMode =
+ (await settingsManager.get<'warn' | 'block' | 'skip'>(
+ 'system',
+ 'upload.duplicateCheck.mode',
+ )) ?? 'skip'
if (checkMode === 'block') {
// 阻止模式:直接拒绝上传
diff --git a/server/api/photos/livephoto/manage.post.ts b/server/api/photos/livephoto/manage.post.ts
index 32a00b87..c18f8990 100644
--- a/server/api/photos/livephoto/manage.post.ts
+++ b/server/api/photos/livephoto/manage.post.ts
@@ -59,7 +59,8 @@ export default eventHandler(async (event) => {
}
}
- case 'update-photo': { // 为特定照片检查和更新 LivePhoto 状态
+ case 'update-photo': {
+ // 为特定照片检查和更新 LivePhoto 状态
if (!photoId) {
throw createError({
statusCode: 400,
diff --git a/server/api/photos/upload.put.ts b/server/api/photos/upload.put.ts
index fd071448..7e7356bf 100644
--- a/server/api/photos/upload.put.ts
+++ b/server/api/photos/upload.put.ts
@@ -66,7 +66,7 @@ export default eventHandler(async (event) => {
// 简单大小限制(从设置中读取,默认 256MB)
const maxFileSizeMB =
- (await settingsManager.get<number>('app', 'upload.maxFileSize')) ?? 256
+ (await settingsManager.get<number>('system', 'upload.maxFileSize')) ?? 256
const maxBytes = maxFileSizeMB * 1024 * 1024
if (raw.byteLength > maxBytes) {
const sizeInMB = (raw.byteLength / 1024 / 1024).toFixed(2)
diff --git a/server/api/photos/visible.get.ts b/server/api/photos/visible.get.ts
index 84ad3990..c267ab71 100644
--- a/server/api/photos/visible.get.ts
+++ b/server/api/photos/visible.get.ts
@@ -9,10 +9,7 @@ export default eventHandler(async (_event) => {
photoId: tables.albumPhotos.photoId,
})
.from(tables.albumPhotos)
- .innerJoin(
- tables.albums,
- eq(tables.albumPhotos.albumId, tables.albums.id),
- )
+ .innerJoin(tables.albums, eq(tables.albumPhotos.albumId, tables.albums.id))
.where(eq(tables.albums.isHidden, true))
.all()
diff --git a/server/api/queue/add-task.post.ts b/server/api/queue/add-task.post.ts
index 66fa0f0e..c1cff048 100644
--- a/server/api/queue/add-task.post.ts
+++ b/server/api/queue/add-task.post.ts
@@ -8,6 +8,7 @@ export default defineEventHandler(async (event) => {
z.object({
type: z.literal('photo'),
storageKey: z.string().nonempty(),
+ eraseLocation: z.boolean().optional(),
}),
z.object({
type: z.literal('live-photo-video'),
@@ -19,6 +20,10 @@ export default defineEventHandler(async (event) => {
latitude: z.number().min(-90).max(90).optional(),
longitude: z.number().min(-180).max(180).optional(),
}),
+ z.object({
+ type: z.literal('photo-erase-location'),
+ photoId: z.string().min(1),
+ }),
])
const { payload, priority, maxAttempts } = await readValidatedBody(
diff --git a/server/api/queue/add-tasks.post.ts b/server/api/queue/add-tasks.post.ts
index 9a4933b1..1b0155ec 100644
--- a/server/api/queue/add-tasks.post.ts
+++ b/server/api/queue/add-tasks.post.ts
@@ -8,6 +8,7 @@ export default defineEventHandler(async (event) => {
z.object({
type: z.literal('photo'),
storageKey: z.string().nonempty(),
+ eraseLocation: z.boolean().optional(),
}),
z.object({
type: z.literal('live-photo-video'),
@@ -19,6 +20,10 @@ export default defineEventHandler(async (event) => {
latitude: z.number().min(-90).max(90).optional(),
longitude: z.number().min(-180).max(180).optional(),
}),
+ z.object({
+ type: z.literal('photo-erase-location'),
+ photoId: z.string().min(1),
+ }),
])
const { tasks, defaultPriority, defaultMaxAttempts } =
diff --git a/server/api/queue/task/list.get.ts b/server/api/queue/task/list.get.ts
index 6529554c..b60b1ffa 100644
--- a/server/api/queue/task/list.get.ts
+++ b/server/api/queue/task/list.get.ts
@@ -15,7 +15,12 @@ export default defineEventHandler(async (event) => {
.enum(['pending', 'in-stages', 'completed', 'failed'])
.optional(),
type: z
- .enum(['photo', 'live-photo-video', 'photo-reverse-geocoding'])
+ .enum([
+ 'photo',
+ 'live-photo-video',
+ 'photo-reverse-geocoding',
+ 'photo-erase-location',
+ ])
.optional(),
})
.parseAsync(query)
diff --git a/server/api/system/settings/[namespace]/[key].ts b/server/api/system/settings/[namespace]/[key].ts
index 4a0a0329..0b1a808c 100644
--- a/server/api/system/settings/[namespace]/[key].ts
+++ b/server/api/system/settings/[namespace]/[key].ts
@@ -46,7 +46,11 @@ export default eventHandler(async (event) => {
// 获取当前用户ID,如果用户不存在于数据库则返回null
const db = useDB()
const currentUser = session.user.id
- ? db.select().from(tables.users).where(eq(tables.users.id, session.user.id)).get()
+ ? db
+ .select()
+ .from(tables.users)
+ .where(eq(tables.users.id, session.user.id))
+ .get()
: null
const updatedBy = currentUser ? currentUser.id : undefined
diff --git a/server/api/system/settings/batch.put.ts b/server/api/system/settings/batch.put.ts
index 2b0ff959..f8bdbb67 100644
--- a/server/api/system/settings/batch.put.ts
+++ b/server/api/system/settings/batch.put.ts
@@ -53,7 +53,11 @@ export default eventHandler(async (event) => {
// 获取当前用户ID,如果用户不存在于数据库则返回null
const db = useDB()
const currentUser = session.user.id
- ? db.select().from(tables.users).where(eq(tables.users.id, session.user.id)).get()
+ ? db
+ .select()
+ .from(tables.users)
+ .where(eq(tables.users.id, session.user.id))
+ .get()
: null
const updatedBy = currentUser ? currentUser.id : undefined
diff --git a/server/api/system/settings/fields.get.ts b/server/api/system/settings/fields.get.ts
index 9662fefd..3a357fdf 100644
--- a/server/api/system/settings/fields.get.ts
+++ b/server/api/system/settings/fields.get.ts
@@ -1,5 +1,6 @@
import { z } from 'zod'
import { settingsManager } from '~~/server/services/settings/settingsManager'
+import { DEFAULT_SETTINGS } from '~~/server/services/settings/contants'
import { getSettingUIConfig } from '~~/server/services/settings/ui-config'
import type { SettingsFieldsResponse } from '~~/shared/types/settings'
@@ -32,8 +33,13 @@ export default eventHandler(async (event) => {
try {
// 获取该命名空间的所有设置
const schema = await settingsManager.getSchema()
+ const allowedKeys = new Set(
+ DEFAULT_SETTINGS
+ .filter((s) => s.namespace === query.namespace)
+ .map((s) => s.key),
+ )
const namespaceSettings = schema.filter(
- (s) => s.namespace === query.namespace,
+ (s) => s.namespace === query.namespace && allowedKeys.has(s.key),
)
if (namespaceSettings.length === 0) {
diff --git a/server/database/migrations/meta/0010_snapshot.json b/server/database/migrations/meta/0010_snapshot.json
index 8582af71..941dd2f6 100644
--- a/server/database/migrations/meta/0010_snapshot.json
+++ b/server/database/migrations/meta/0010_snapshot.json
@@ -51,12 +51,8 @@
"name": "album_photos_album_id_albums_id_fk",
"tableFrom": "album_photos",
"tableTo": "albums",
- "columnsFrom": [
- "album_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["album_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -64,12 +60,8 @@
"name": "album_photos_photo_id_photos_id_fk",
"tableFrom": "album_photos",
"tableTo": "photos",
- "columnsFrom": [
- "photo_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["photo_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -140,12 +132,8 @@
"name": "albums_cover_photo_id_photos_id_fk",
"tableFrom": "albums",
"tableTo": "photos",
- "columnsFrom": [
- "cover_photo_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["cover_photo_id"],
+ "columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -222,12 +210,8 @@
"name": "photo_reactions_photo_id_photos_id_fk",
"tableFrom": "photo_reactions",
"tableTo": "photos",
- "columnsFrom": [
- "photo_id"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["photo_id"],
+ "columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -412,9 +396,7 @@
"indexes": {
"photos_id_unique": {
"name": "photos_id_unique",
- "columns": [
- "id"
- ],
+ "columns": ["id"],
"isUnique": true
}
},
@@ -619,10 +601,7 @@
"indexes": {
"idx_namespace_key": {
"name": "idx_namespace_key",
- "columns": [
- "namespace",
- "key"
- ],
+ "columns": ["namespace", "key"],
"isUnique": true
}
},
@@ -631,12 +610,8 @@
"name": "settings_updated_by_users_id_fk",
"tableFrom": "settings",
"tableTo": "users",
- "columnsFrom": [
- "updated_by"
- ],
- "columnsTo": [
- "id"
- ],
+ "columnsFrom": ["updated_by"],
+ "columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -756,16 +731,12 @@
"indexes": {
"users_name_unique": {
"name": "users_name_unique",
- "columns": [
- "name"
- ],
+ "columns": ["name"],
"isUnique": true
},
"users_email_unique": {
"name": "users_email_unique",
- "columns": [
- "email"
- ],
+ "columns": ["email"],
"isUnique": true
}
},
@@ -785,4 +756,4 @@
"internal": {
"indexes": {}
}
-}
\ No newline at end of file
+}
diff --git a/server/database/migrations/meta/_journal.json b/server/database/migrations/meta/_journal.json
index 6a094a68..c507adcf 100644
--- a/server/database/migrations/meta/_journal.json
+++ b/server/database/migrations/meta/_journal.json
@@ -80,4 +80,4 @@
"breakpoints": true
}
]
-}
\ No newline at end of file
+}
diff --git a/server/database/schema.ts b/server/database/schema.ts
index 0765cac0..8d916a35 100644
--- a/server/database/schema.ts
+++ b/server/database/schema.ts
@@ -13,6 +13,7 @@ type PipelineQueuePayload =
| {
type: 'photo'
storageKey: string
+ eraseLocation?: boolean
}
| {
type: 'live-photo-video'
@@ -24,6 +25,10 @@ type PipelineQueuePayload =
latitude?: number | null
longitude?: number | null
}
+ | {
+ type: 'photo-erase-location'
+ photoId: string
+ }
export const users = sqliteTable('users', {
id: integer('id').primaryKey({ autoIncrement: true }),
@@ -95,6 +100,7 @@ export const pipelineQueue = sqliteTable('pipeline_queue', {
'motion-photo',
'reverse-geocoding',
'live-photo',
+ 'location-erase',
],
}),
errorMessage: text('error_message'),
@@ -133,9 +139,7 @@ export const albums = sqliteTable('albums', {
coverPhotoId: text('cover_photo_id').references(() => photos.id, {
onDelete: 'set null',
}),
- isHidden: integer('is_hidden', { mode: 'boolean' })
- .default(false)
- .notNull(),
+ isHidden: integer('is_hidden', { mode: 'boolean' }).default(false).notNull(),
createdAt: integer('created_at', { mode: 'timestamp' })
.notNull()
.default(sql`(unixepoch())`),
diff --git a/server/plugins/2.settings-manager.ts b/server/plugins/2.settings-manager.ts
index 7699010e..b3030a2c 100644
--- a/server/plugins/2.settings-manager.ts
+++ b/server/plugins/2.settings-manager.ts
@@ -1,5 +1,6 @@
import { DEFAULT_SETTINGS } from '../services/settings/contants'
import { settingsManager } from '../services/settings/settingsManager'
+import { and, eq, tables, useDB } from '../utils/db'
export default defineNitroPlugin(async (_nitroApp) => {
const _settingsManager = settingsManager
@@ -12,6 +13,9 @@ export default defineNitroPlugin(async (_nitroApp) => {
// Initialize default settings first
await _settingsManager.init(DEFAULT_SETTINGS)
+ // Clean up deprecated settings keys from pre-release iterations.
+ await removeDeprecatedSettings()
+
// Migrate existing configurations from runtimeConfig
// Note: Storage manager will be initialized in the next plugin (2_storage.ts)
await migrateRuntimeConfigToSettings()
@@ -127,6 +131,19 @@ async function migrateRuntimeConfigToSettings() {
}
}
+async function removeDeprecatedSettings() {
+ const db = useDB()
+
+ db.delete(tables.settings)
+ .where(
+ and(
+ eq(tables.settings.namespace, 'app'),
+ eq(tables.settings.key, 'upload.maxFileSize'),
+ ),
+ )
+ .run()
+}
+
/**
* Normalize provider configuration based on provider type
*/
diff --git a/server/services/pipeline-queue/manager.ts b/server/services/pipeline-queue/manager.ts
index e29a1294..e8f19f0e 100644
--- a/server/services/pipeline-queue/manager.ts
+++ b/server/services/pipeline-queue/manager.ts
@@ -1,6 +1,9 @@
import type { ConsolaInstance } from 'consola'
+import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
import path from 'path'
import { asc, desc, eq, sql } from 'drizzle-orm'
+import { exiftool } from 'exiftool-vendored'
import type {
NewPipelineQueueItem,
PipelineQueueItem,
@@ -17,10 +20,44 @@ import {
extractLocationFromGPS,
parseGPSCoordinates,
} from '../location/geocoding'
+import { settingsManager } from '../settings/settingsManager'
import { findLivePhotoVideoForImage } from '../video/livephoto'
import { processMotionPhotoFromXmp } from '../video/motion-photo'
import { getStorageManager } from '~~/server/plugins/3.storage'
+const EXIF_LOCATION_KEYS = [
+ 'GPSAltitude',
+ 'GPSAltitudeRef',
+ 'GPSLatitude',
+ 'GPSLatitudeRef',
+ 'GPSLongitude',
+ 'GPSLongitudeRef',
+ 'GPSPosition',
+ 'GPSDateStamp',
+ 'GPSTimeStamp',
+ 'GPSImgDirection',
+ 'GPSImgDirectionRef',
+ 'GPSDestBearing',
+ 'GPSDestBearingRef',
+] as const
+
+const stripLocationFromExif = <
+ T extends Record<string, any> | null | undefined,
+>(
+ exif: T,
+): T => {
+ if (!exif || typeof exif !== 'object') {
+ return exif
+ }
+
+ const cloned = { ...exif }
+ for (const key of EXIF_LOCATION_KEYS) {
+ delete cloned[key]
+ }
+
+ return cloned as T
+}
+
export class QueueManager {
private static instances: Map<string, QueueManager> = new Map()
private workerId: string
@@ -309,9 +346,21 @@ export class QueueManager {
imageBuffers.raw,
this.logger,
)
+ const systemAutoEraseLocationOnUpload =
+ (await settingsManager.get<boolean>(
+ 'privacy',
+ 'upload.autoEraseLocation',
+ )) ?? false
+ const shouldAutoEraseLocationOnUpload =
+ typeof payload.eraseLocation === 'boolean'
+ ? payload.eraseLocation
+ : systemAutoEraseLocationOnUpload
+ const normalizedExifData = shouldAutoEraseLocationOnUpload
+ ? stripLocationFromExif(exifData)
+ : exifData
// 提取照片基本信息
- const photoInfo = extractPhotoInfo(storageKey, exifData)
+ const photoInfo = extractPhotoInfo(storageKey, normalizedExifData)
// STEP 5: 地理位置反向解析
// 这里逆编码失败不报错,宽容处理
@@ -320,8 +369,9 @@ export class QueueManager {
let coordinates = null
let locationInfo = null
- if (exifData) {
- const { latitude, longitude } = parseGPSCoordinates(exifData)
+ if (!shouldAutoEraseLocationOnUpload && normalizedExifData) {
+ const { latitude, longitude } =
+ parseGPSCoordinates(normalizedExifData)
coordinates = { latitude, longitude }
if (latitude && longitude) {
locationInfo = await extractLocationFromGPS(latitude, longitude)
@@ -336,7 +386,7 @@ export class QueueManager {
photoId,
storageKey,
rawImageBuffer: imageBuffers.raw,
- exifData,
+ exifData: normalizedExifData,
storageProvider,
logger: this.logger,
})
@@ -397,7 +447,7 @@ export class QueueManager {
thumbnailHash: thumbnailHash
? compressUint8Array(thumbnailHash)
: null,
- exif: exifData,
+ exif: normalizedExifData,
// 地理位置信息
latitude: coordinates?.latitude || null,
longitude: coordinates?.longitude || null,
@@ -425,6 +475,26 @@ export class QueueManager {
set: result,
})
+ if (shouldAutoEraseLocationOnUpload) {
+ try {
+ await this.addTask(
+ {
+ type: 'photo-erase-location',
+ photoId,
+ },
+ {
+ priority: 2,
+ maxAttempts: 3,
+ },
+ )
+ } catch (enqueueError) {
+ this.logger.warn(
+ `[${taskId}:location-erase] failed to enqueue location erase task for ${photoId}`,
+ enqueueError,
+ )
+ }
+ }
+
this.logger.success(`Task ${taskId} processed successfully`)
return result
} catch (error) {
@@ -536,6 +606,97 @@ export class QueueManager {
throw error
}
},
+ eraseLocation: async (task: PipelineQueueItem) => {
+ const db = useDB()
+ const storageProvider = getStorageManager().getProvider()
+ const { id: taskId, payload } = task
+
+ if (payload.type !== 'photo-erase-location') {
+ throw new Error(
+ `Invalid payload type for erase location task: ${payload.type}`,
+ )
+ }
+
+ await this.updateTaskStage(taskId, 'location-erase')
+ this.logger.info(
+ `[${taskId}:in-stage] erase location info for photo ${payload.photoId}`,
+ )
+
+ const photo = await db
+ .select()
+ .from(tables.photos)
+ .where(eq(tables.photos.id, payload.photoId))
+ .get()
+
+ if (!photo) {
+ throw new Error(`Photo ${payload.photoId} not found`)
+ }
+
+ if (!photo.storageKey) {
+ throw new Error(`Photo ${payload.photoId} has no storage key`)
+ }
+
+ const originalBuffer = await storageProvider.get(photo.storageKey)
+ if (!originalBuffer) {
+ throw new Error(`Photo file ${photo.storageKey} not found in storage`)
+ }
+
+ const tempDir = await mkdtemp(path.join(tmpdir(), 'cframe-location-'))
+ const ext = path.extname(photo.storageKey) || '.jpg'
+ const tempFile = path.join(tempDir, `erase-location${ext}`)
+
+ try {
+ await writeFile(tempFile, originalBuffer)
+
+ const exifLocationNullMap = EXIF_LOCATION_KEYS.reduce(
+ (acc, key) => {
+ acc[key] = null
+ return acc
+ },
+ {} as Record<string, null>,
+ )
+
+ await exiftool.write(tempFile, exifLocationNullMap, [
+ '-overwrite_original',
+ ])
+
+ const updatedBuffer = await readFile(tempFile)
+
+ const prefix =
+ storageProvider.config && 'prefix' in storageProvider.config
+ ? storageProvider.config.prefix
+ : ''
+
+ await storageProvider.create(
+ photo.storageKey.replace(prefix || '', ''),
+ updatedBuffer,
+ )
+
+ const exifData = stripLocationFromExif(
+ await extractExifData(updatedBuffer),
+ )
+
+ await db
+ .update(tables.photos)
+ .set({
+ exif: exifData,
+ fileSize: updatedBuffer.length,
+ lastModified: new Date().toISOString(),
+ latitude: null,
+ longitude: null,
+ country: null,
+ city: null,
+ locationName: null,
+ })
+ .where(eq(tables.photos.id, payload.photoId))
+
+ this.logger.success(
+ `[${taskId}:location-erase] erased location info for photo ${payload.photoId}`,
+ )
+ } finally {
+ await rm(tempDir, { recursive: true, force: true })
+ }
+ },
livePhotoDetect: async (task: PipelineQueueItem) => {
const db = useDB()
const storageProvider = getStorageManager().getProvider()
@@ -589,8 +750,9 @@ export class QueueManager {
.where(eq(tables.photos.storageKey, photoKey))
.limit(1)
- if (photos.length > 0) {
- matchedPhoto = photos[0]
+ const matched = photos[0]
+ if (matched) {
+ matchedPhoto = matched
this.logger.info(
`Found matching photo for LivePhoto video: ${photoKey}`,
)
@@ -662,6 +824,9 @@ export class QueueManager {
case 'photo-reverse-geocoding':
await this.processors.reverseGeocoding(task)
break
+ case 'photo-erase-location':
+ await this.processors.eraseLocation(task)
+ break
default:
throw new Error(`Unknown task type: ${type}`)
}
diff --git a/server/services/settings/contants.ts b/server/services/settings/contants.ts
index 69dc54c7..34b25599 100644
--- a/server/services/settings/contants.ts
+++ b/server/services/settings/contants.ts
@@ -64,7 +64,7 @@ export const DEFAULT_SETTINGS = [
isPublic: true,
},
{
- namespace: 'app',
+ namespace: 'system',
key: 'upload.maxFileSize',
type: 'number',
defaultValue: 256,
@@ -72,6 +72,35 @@ export const DEFAULT_SETTINGS = [
description: 'settings.app.upload.maxFileSize.description',
isPublic: true,
},
+ {
+ namespace: 'system',
+ key: 'upload.duplicateCheck.enabled',
+ type: 'boolean',
+ defaultValue: true,
+ label: 'settings.system.upload.duplicateCheck.enabled.label',
+ description: 'settings.system.upload.duplicateCheck.enabled.description',
+ isPublic: true,
+ },
+ {
+ namespace: 'system',
+ key: 'upload.duplicateCheck.mode',
+ type: 'string',
+ defaultValue: 'skip',
+ enum: ['warn', 'block', 'skip'],
+ label: 'settings.system.upload.duplicateCheck.mode.label',
+ description: 'settings.system.upload.duplicateCheck.mode.description',
+ isPublic: true,
+ },
+ // NAMESPACE: privacy
+ {
+ namespace: 'privacy',
+ key: 'upload.autoEraseLocation',
+ type: 'boolean',
+ defaultValue: false,
+ label: 'settings.privacy.upload.autoEraseLocation.label',
+ description: 'settings.privacy.upload.autoEraseLocation.description',
+ isPublic: true,
+ },
// NAMESPACE: map
{
namespace: 'map',
diff --git a/server/services/settings/ui-config.ts b/server/services/settings/ui-config.ts
index f36ef485..a427316d 100644
--- a/server/services/settings/ui-config.ts
+++ b/server/services/settings/ui-config.ts
@@ -29,12 +29,6 @@ export const APP_SETTINGS_UI: Record<string, FieldUIConfig> = {
placeholder: 'https://example.com/avatar.jpg',
help: 'settings.app.avatarUrl.help',
},
- 'upload.maxFileSize': {
- type: 'number',
- help: 'settings.app.upload.maxFileSize.help',
- min: 1,
- max: 10240,
- },
'appearance.theme': {
type: 'tabs',
options: [
@@ -105,6 +99,47 @@ export const LOCATION_SETTINGS_UI: Record<string, FieldUIConfig> = {
},
}
+export const PRIVACY_SETTINGS_UI: Record<string, FieldUIConfig> = {
+ 'upload.autoEraseLocation': {
+ type: 'toggle',
+ help: 'settings.privacy.upload.autoEraseLocation.help',
+ },
+}
+
+export const SYSTEM_SETTINGS_UI: Record<string, FieldUIConfig> = {
+ 'upload.maxFileSize': {
+ type: 'number',
+ help: 'settings.app.upload.maxFileSize.help',
+ min: 1,
+ max: 10240,
+ },
+ 'upload.duplicateCheck.enabled': {
+ type: 'toggle',
+ help: 'settings.system.upload.duplicateCheck.enabled.help',
+ },
+ 'upload.duplicateCheck.mode': {
+ type: 'tabs',
+ options: [
+ {
+ label: 'settings.system.upload.duplicateCheck.mode.options.skip',
+ value: 'skip',
+ icon: 'tabler:player-track-next',
+ },
+ {
+ label: 'settings.system.upload.duplicateCheck.mode.options.warn',
+ value: 'warn',
+ icon: 'tabler:alert-triangle',
+ },
+ {
+ label: 'settings.system.upload.duplicateCheck.mode.options.block',
+ value: 'block',
+ icon: 'tabler:ban',
+ },
+ ],
+ help: 'settings.system.upload.duplicateCheck.mode.help',
+ },
+}
+
export const STORAGE_SETTINGS_UI: Record<string, FieldUIConfig> = {
provider: {
type: 'custom',
@@ -276,6 +311,8 @@ export function getSettingUIConfig(
): FieldUIConfig | undefined {
const uiConfigMap: Record<string, Record<string, FieldUIConfig>> = {
app: APP_SETTINGS_UI,
+ system: SYSTEM_SETTINGS_UI,
+ privacy: PRIVACY_SETTINGS_UI,
map: MAP_SETTINGS_UI,
location: LOCATION_SETTINGS_UI,
storage: STORAGE_SETTINGS_UI,