mirror of
https://github.com/vastsa/FileCodeBoxFronted.git
synced 2026-11-24 21:58:01 +08:00
feat: rename config keys to snake_case (sync with backend migration 007)
This commit is contained in:
1 parent
2f0a04d2a5
commit
c6b6b64869
18 files changed
+129
-129
No files matched your search
+1
-1
@@ -26,7 +26,7 @@ const { config } = storeToRefs(configStore)
|
||||
const adminStore = useAdminStore()
|
||||
const { t } = useI18n()
|
||||
const { verifySession } = useAdminSession()
|
||||
const showAdminAddress = computed(() => config.value.showAdminAddr === 1)
|
||||
const showAdminAddress = computed(() => config.value.show_admin_addr === 1)
|
||||
const adminEntryLabel = computed(() =>
|
||||
t(adminStore.isAuthenticated ? 'admin.session.loggedIn' : 'admin.session.loggedOut')
|
||||
)
|
||||
|
||||
@@ -24,8 +24,8 @@ const emptyDashboardData = (): DashboardViewData => ({
|
||||
usedCount: 0,
|
||||
storageBackend: '-',
|
||||
uploadSizeLimit: 0,
|
||||
openUpload: 0,
|
||||
enableChunk: 0,
|
||||
open_upload: 0,
|
||||
enable_chunk: 0,
|
||||
maxSaveSeconds: 0,
|
||||
healthAttentionCount: 0,
|
||||
healthDangerCount: 0,
|
||||
@@ -128,8 +128,8 @@ export function useDashboardStats(options: UseDashboardStatsOptions = {}) {
|
||||
dashboardData.usedCount = toNumber(detail.usedCount)
|
||||
dashboardData.storageBackend = detail.storageBackend || '-'
|
||||
dashboardData.uploadSizeLimit = toNumber(detail.uploadSizeLimit)
|
||||
dashboardData.openUpload = toNumber(detail.openUpload)
|
||||
dashboardData.enableChunk = toNumber(detail.enableChunk)
|
||||
dashboardData.open_upload = toNumber(detail.open_upload)
|
||||
dashboardData.enable_chunk = toNumber(detail.enable_chunk)
|
||||
dashboardData.maxSaveSeconds = toNumber(detail.maxSaveSeconds)
|
||||
const healthSummary = normalizeHealthSummary(detail)
|
||||
healthSummaryKeys.forEach((key) => {
|
||||
|
||||
@@ -136,7 +136,7 @@ export function usePresignedUpload(options: UsePresignedUploadOptions = {}) {
|
||||
file_name: file.name,
|
||||
file_size: file.size,
|
||||
expire_value: options?.expireValue ?? DEFAULT_EXPIRE_VALUE,
|
||||
expire_style: options?.expireStyle ?? DEFAULT_EXPIRE_STYLE
|
||||
expire_style: options?.expire_style ?? DEFAULT_EXPIRE_STYLE
|
||||
})
|
||||
|
||||
if (response.code === 200 && response.detail) {
|
||||
@@ -178,7 +178,7 @@ export function usePresignedUpload(options: UsePresignedUploadOptions = {}) {
|
||||
presignStatus.value = PRESIGN_UPLOAD_STATUS.CONFIRMING
|
||||
const confirmResponse = await PresignUploadService.confirmUpload(session.upload_id, {
|
||||
expire_value: options?.expireValue ?? DEFAULT_EXPIRE_VALUE,
|
||||
expire_style: options?.expireStyle ?? DEFAULT_EXPIRE_STYLE
|
||||
expire_style: options?.expire_style ?? DEFAULT_EXPIRE_STYLE
|
||||
})
|
||||
|
||||
if (confirmResponse.code === 200 && confirmResponse.detail?.code) {
|
||||
|
||||
@@ -24,7 +24,7 @@ export function useSendFlow() {
|
||||
const selectedFile = ref<File | null>(null)
|
||||
const selectedFiles = ref<File[]>([])
|
||||
const textContent = ref('')
|
||||
const expirationMethod = ref(config.value.expireStyle[0] || 'day')
|
||||
const expirationMethod = ref(config.value.expire_style[0] || 'day')
|
||||
const expirationValue = ref('1')
|
||||
const uploadProgress = ref(0)
|
||||
const uploadedBytes = ref(0)
|
||||
@@ -38,7 +38,7 @@ export function useSendFlow() {
|
||||
const sendRecords = computed(() => fileDataStore.shareData)
|
||||
const uploadDescription = computed(() =>
|
||||
t('send.uploadArea.descriptionWithLimit', {
|
||||
size: getStorageUnit(config.value.uploadSize)
|
||||
size: getStorageUnit(config.value.upload_size)
|
||||
})
|
||||
)
|
||||
const allowedFileTypes = computed(() => {
|
||||
@@ -58,16 +58,16 @@ export function useSendFlow() {
|
||||
.join(',')
|
||||
})
|
||||
const expirationOptions = computed(() =>
|
||||
config.value.expireStyle.map((value) => ({
|
||||
config.value.expire_style.map((value) => ({
|
||||
value,
|
||||
label: getUnit(value)
|
||||
}))
|
||||
)
|
||||
watch(
|
||||
() => config.value.expireStyle,
|
||||
(expireStyle) => {
|
||||
if (expireStyle.length > 0 && !expireStyle.includes(expirationMethod.value)) {
|
||||
expirationMethod.value = expireStyle[0]
|
||||
() => config.value.expire_style,
|
||||
(expire_style) => {
|
||||
if (expire_style.length > 0 && !expire_style.includes(expirationMethod.value)) {
|
||||
expirationMethod.value = expire_style[0]
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -102,7 +102,7 @@ export function useSendFlow() {
|
||||
})
|
||||
|
||||
const checkOpenUpload = () => {
|
||||
if (config.value.openUpload === 0 && !adminStore.hasToken) {
|
||||
if (config.value.open_upload === 0 && !adminStore.hasToken) {
|
||||
alertStore.showAlert(t('send.messages.guestUploadDisabled'), 'error')
|
||||
return false
|
||||
}
|
||||
@@ -118,9 +118,9 @@ export function useSendFlow() {
|
||||
}
|
||||
|
||||
const checkFileSize = (file: File) => {
|
||||
if (file.size > config.value.uploadSize) {
|
||||
if (file.size > config.value.upload_size) {
|
||||
alertStore.showAlert(
|
||||
t('send.messages.fileSizeExceeded', { size: getStorageUnit(config.value.uploadSize) }),
|
||||
t('send.messages.fileSizeExceeded', { size: getStorageUnit(config.value.upload_size) }),
|
||||
'error'
|
||||
)
|
||||
selectedFile.value = null
|
||||
@@ -315,15 +315,15 @@ export function useSendFlow() {
|
||||
selectedFile: selectedFile.value,
|
||||
selectedFiles: selectedFiles.value,
|
||||
expireValue,
|
||||
expireStyle: expirationMethod.value,
|
||||
enableChunk: Boolean(config.value.enableChunk),
|
||||
expire_style: expirationMethod.value,
|
||||
enable_chunk: Boolean(config.value.enable_chunk),
|
||||
validateFileSize: checkFileSize
|
||||
})
|
||||
} else {
|
||||
response = await submitText({
|
||||
text: textContent.value,
|
||||
expireValue,
|
||||
expireStyle: expirationMethod.value
|
||||
expire_style: expirationMethod.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ type SubmitFileOptions = {
|
||||
selectedFile: File | null
|
||||
selectedFiles: File[]
|
||||
expireValue: number
|
||||
expireStyle: string
|
||||
enableChunk: boolean
|
||||
expire_style: string
|
||||
enable_chunk: boolean
|
||||
validateFileSize: (file: File) => boolean
|
||||
}
|
||||
|
||||
type SubmitTextOptions = {
|
||||
text: string
|
||||
expireValue: number
|
||||
expireStyle: string
|
||||
expire_style: string
|
||||
}
|
||||
|
||||
export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
@@ -40,11 +40,11 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
const handleChunkUpload = async (
|
||||
file: File,
|
||||
expireValue: number,
|
||||
expireStyle: string
|
||||
expire_style: string
|
||||
): Promise<ApiResponse> => {
|
||||
return uploadChunkedFile(file, {
|
||||
expireValue,
|
||||
expireStyle,
|
||||
expire_style,
|
||||
onHashCalculated: options.onHashCalculated,
|
||||
onProgress: (progress: UploadProgress) => {
|
||||
options.onProgress(progress)
|
||||
@@ -60,11 +60,11 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
const handlePresignedUpload = async (
|
||||
file: File,
|
||||
expireValue: number,
|
||||
expireStyle: string
|
||||
expire_style: string
|
||||
): Promise<ApiResponse<{ code?: string; name?: string }>> => {
|
||||
const code = await presignUploadFile(file, {
|
||||
expireValue,
|
||||
expireStyle: expireStyle as ExpireStyle,
|
||||
expire_style: expire_style as ExpireStyle,
|
||||
onProgress: (progress) => {
|
||||
options.onProgress(progress)
|
||||
}
|
||||
@@ -87,8 +87,8 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
selectedFile,
|
||||
selectedFiles,
|
||||
expireValue,
|
||||
expireStyle,
|
||||
enableChunk,
|
||||
expire_style,
|
||||
enable_chunk,
|
||||
validateFileSize
|
||||
}: SubmitFileOptions): Promise<ApiResponse | null> => {
|
||||
let fileToUpload = selectedFile
|
||||
@@ -106,13 +106,13 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
|
||||
throw new Error(options.translate('send.messages.selectFile'))
|
||||
}
|
||||
|
||||
return enableChunk
|
||||
? handleChunkUpload(fileToUpload, expireValue, expireStyle)
|
||||
: handlePresignedUpload(fileToUpload, expireValue, expireStyle)
|
||||
return enable_chunk
|
||||
? handleChunkUpload(fileToUpload, expireValue, expire_style)
|
||||
: handlePresignedUpload(fileToUpload, expireValue, expire_style)
|
||||
}
|
||||
|
||||
const submitText = ({ text, expireValue, expireStyle }: SubmitTextOptions) =>
|
||||
FileService.uploadText(text, expireValue, expireStyle)
|
||||
const submitText = ({ text, expireValue, expire_style }: SubmitTextOptions) =>
|
||||
FileService.uploadText(text, expireValue, expire_style)
|
||||
|
||||
return {
|
||||
resetPresignUpload,
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
type SaveTimeUnit
|
||||
} from '@/utils/config-form'
|
||||
|
||||
type ConfigFlagKey = 'enableChunk' | 's3_proxy' | 'openUpload' | 'showAdminAddr'
|
||||
type ConfigFlagKey = 'enable_chunk' | 's3_proxy' | 'open_upload' | 'show_admin_addr'
|
||||
|
||||
const SECONDS_PER_DAY = 24 * 60 * 60
|
||||
|
||||
@@ -29,7 +29,7 @@ export function useSystemConfig() {
|
||||
const savedPayloadSnapshot = ref('')
|
||||
const fileSize = ref(1)
|
||||
const sizeUnit = ref<FileSizeUnit>('MB')
|
||||
const storageLimit = ref(0)
|
||||
const storage_limit = ref(0)
|
||||
const storageLimitUnit = ref<FileSizeUnit>('GB')
|
||||
const saveTime = ref(1)
|
||||
const saveTimeUnit = ref<SaveTimeUnit>('天')
|
||||
@@ -43,9 +43,9 @@ export function useSystemConfig() {
|
||||
{ value: fileSize.value, unit: sizeUnit.value },
|
||||
{ value: saveTime.value, unit: saveTimeUnit.value }
|
||||
)
|
||||
payload.adminSessionExpire = Math.round(adminSessionDays.value * SECONDS_PER_DAY)
|
||||
payload.storageLimit =
|
||||
storageLimit.value === 0 ? 0 : fileSizeFormToBytes(storageLimit.value, storageLimitUnit.value)
|
||||
payload.admin_session_expire = Math.round(adminSessionDays.value * SECONDS_PER_DAY)
|
||||
payload.storage_limit =
|
||||
storage_limit.value === 0 ? 0 : fileSizeFormToBytes(storage_limit.value, storageLimitUnit.value)
|
||||
|
||||
if (!payload.admin_token) {
|
||||
delete payload.admin_token
|
||||
@@ -170,12 +170,12 @@ export function useSystemConfig() {
|
||||
}
|
||||
|
||||
const syncConfigForm = (nextConfig: ConfigState) => {
|
||||
const sizeForm = bytesToFileSizeForm(nextConfig.uploadSize)
|
||||
const sizeForm = bytesToFileSizeForm(nextConfig.upload_size)
|
||||
fileSize.value = sizeForm.value
|
||||
sizeUnit.value = sizeForm.unit
|
||||
|
||||
const storageLimitForm = bytesToFileSizeForm(nextConfig.storageLimit)
|
||||
storageLimit.value = storageLimitForm.value
|
||||
const storageLimitForm = bytesToFileSizeForm(nextConfig.storage_limit)
|
||||
storage_limit.value = storageLimitForm.value
|
||||
storageLimitUnit.value = storageLimitForm.unit
|
||||
|
||||
const saveTimeForm = secondsToSaveTimeForm(nextConfig.max_save_seconds)
|
||||
@@ -183,7 +183,7 @@ export function useSystemConfig() {
|
||||
saveTimeUnit.value = saveTimeForm.unit
|
||||
adminSessionDays.value = Math.max(
|
||||
1,
|
||||
Math.round(nextConfig.adminSessionExpire / SECONDS_PER_DAY)
|
||||
Math.round(nextConfig.admin_session_expire / SECONDS_PER_DAY)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ export function useSystemConfig() {
|
||||
|
||||
// 计算属性
|
||||
const maxFileSizeMB = computed(() => {
|
||||
return Math.round(config.value.uploadSize / 1024 / 1024)
|
||||
return Math.round(config.value.upload_size / 1024 / 1024)
|
||||
})
|
||||
|
||||
const isConfigLoaded = computed(() => {
|
||||
@@ -235,7 +235,7 @@ export function useSystemConfig() {
|
||||
isDirty,
|
||||
fileSize,
|
||||
sizeUnit,
|
||||
storageLimit,
|
||||
storage_limit,
|
||||
storageLimitUnit,
|
||||
saveTime,
|
||||
saveTimeUnit,
|
||||
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
notificationTitle: 'Announcement Title',
|
||||
notificationContent: 'Announcement Content',
|
||||
storageSettings: 'Storage',
|
||||
storageLimit: 'Total Storage Capacity',
|
||||
storage_limit: 'Total Storage Capacity',
|
||||
storageLimitHelp:
|
||||
'Active shares and pending uploads share this quota. Set to 0 for unlimited.',
|
||||
storagePath: 'Storage Path',
|
||||
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
notificationTitle: '公告标题',
|
||||
notificationContent: '公告内容',
|
||||
storageSettings: '存储配置',
|
||||
storageLimit: '总存储容量上限',
|
||||
storage_limit: '总存储容量上限',
|
||||
storageLimitHelp: '所有有效分享与未完成上传共同占用容量,设置为 0 表示不限制。',
|
||||
storagePath: '文件存储路径',
|
||||
storagePathPlaceholder: '使用默认路径可留空',
|
||||
|
||||
@@ -63,12 +63,12 @@ export class FileService {
|
||||
static async uploadText(
|
||||
text: string,
|
||||
expireValue = 1,
|
||||
expireStyle = 'day'
|
||||
expire_style = 'day'
|
||||
): Promise<ApiResponse<TextSendResponse>> {
|
||||
const formData = new FormData()
|
||||
formData.append('text', text)
|
||||
formData.append('expire_value', String(expireValue))
|
||||
formData.append('expire_style', expireStyle)
|
||||
formData.append('expire_style', expire_style)
|
||||
return api.post('/share/text/', formData, multipartUploadConfig())
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ const CHUNK_SIZE = 5 * 1024 * 1024
|
||||
|
||||
type ChunkedUploadOptions = {
|
||||
expireValue: number
|
||||
expireStyle: string
|
||||
expire_style: string
|
||||
onHashCalculated?: (hash: string) => void
|
||||
onProgress?: (progress: UploadProgress) => void
|
||||
messages?: {
|
||||
@@ -86,7 +86,7 @@ export const uploadChunkedFile = async (
|
||||
|
||||
const completeResponse = await FileService.completeChunkUpload(uploadId, {
|
||||
expire_value: options.expireValue,
|
||||
expire_style: options.expireStyle
|
||||
expire_style: options.expire_style
|
||||
})
|
||||
|
||||
if (completeResponse.code !== 200) {
|
||||
|
||||
@@ -18,7 +18,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
})
|
||||
const publicMeta = ref<PublicConfigMeta>({})
|
||||
|
||||
const uploadSizeLimit = computed(() => config.value.uploadSize)
|
||||
const uploadSizeLimit = computed(() => config.value.upload_size)
|
||||
const appVersion = computed(() => publicMeta.value.version || '')
|
||||
|
||||
const updateConfig = (nextConfig: Partial<ConfigState>) => {
|
||||
|
||||
+14
-14
@@ -31,28 +31,28 @@ export interface ConfigState {
|
||||
name: string
|
||||
description: string
|
||||
file_storage: string
|
||||
themesChoices: ThemeChoice[]
|
||||
expireStyle: string[]
|
||||
themes_choices: ThemeChoice[]
|
||||
expire_style: string[]
|
||||
code_generate_type: 'number' | 'secret'
|
||||
adminSessionExpire: number
|
||||
admin_session_expire: number
|
||||
admin_token: string
|
||||
robotsText: string
|
||||
robots_text: string
|
||||
keywords: string
|
||||
notify_title: string
|
||||
notify_content: string
|
||||
openUpload: number
|
||||
uploadSize: number
|
||||
open_upload: number
|
||||
upload_size: number
|
||||
allowed_file_types: string[]
|
||||
allowedFileTypes?: string[]
|
||||
storage_path: string
|
||||
storageLimit: number
|
||||
uploadMinute: number
|
||||
storage_limit: number
|
||||
upload_minute: number
|
||||
max_save_seconds: number
|
||||
opacity: number
|
||||
enableChunk: number
|
||||
enable_chunk: number
|
||||
s3_access_key_id: string
|
||||
background: string
|
||||
showAdminAddr: number
|
||||
show_admin_addr: number
|
||||
page_explain: string
|
||||
s3_secret_access_key: string
|
||||
aws_session_token: string
|
||||
@@ -62,11 +62,11 @@ export interface ConfigState {
|
||||
s3_bucket_name: string
|
||||
s3_endpoint_url: string
|
||||
s3_hostname: string
|
||||
uploadCount: number
|
||||
errorMinute: number
|
||||
errorCount: number
|
||||
upload_count: number
|
||||
error_minute: number
|
||||
error_count: number
|
||||
s3_proxy: number
|
||||
themesSelect: string
|
||||
themes_select: string
|
||||
webdav_url: string
|
||||
webdav_username: string
|
||||
webdav_password: string
|
||||
|
||||
@@ -27,8 +27,8 @@ export interface DashboardData {
|
||||
usedCount?: number
|
||||
storageBackend?: string
|
||||
uploadSizeLimit?: number
|
||||
openUpload?: number
|
||||
enableChunk?: number
|
||||
open_upload?: number
|
||||
enable_chunk?: number
|
||||
maxSaveSeconds?: number
|
||||
healthAttentionCount?: number
|
||||
healthDangerCount?: number
|
||||
@@ -52,8 +52,8 @@ export type DashboardViewData = Omit<
|
||||
| 'usedCount'
|
||||
| 'storageBackend'
|
||||
| 'uploadSizeLimit'
|
||||
| 'openUpload'
|
||||
| 'enableChunk'
|
||||
| 'open_upload'
|
||||
| 'enable_chunk'
|
||||
| 'maxSaveSeconds'
|
||||
| 'storageUsed'
|
||||
| 'yesterdaySize'
|
||||
@@ -69,8 +69,8 @@ export type DashboardViewData = Omit<
|
||||
usedCount: number
|
||||
storageBackend: string
|
||||
uploadSizeLimit: number
|
||||
openUpload: number
|
||||
enableChunk: number
|
||||
open_upload: number
|
||||
enable_chunk: number
|
||||
maxSaveSeconds: number
|
||||
storageUsed: number
|
||||
yesterdaySize: number
|
||||
|
||||
@@ -50,6 +50,6 @@ export interface PresignStatusResponse {
|
||||
|
||||
export interface PresignUploadOptions {
|
||||
expireValue?: number
|
||||
expireStyle?: ExpireStyle
|
||||
expire_style?: ExpireStyle
|
||||
onProgress?: (progress: UploadProgress) => void
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export function buildConfigSubmitPayload(
|
||||
): ConfigState {
|
||||
return {
|
||||
...config,
|
||||
uploadSize: fileSizeFormToBytes(fileSize.value, fileSize.unit),
|
||||
upload_size: fileSizeFormToBytes(fileSize.value, fileSize.unit),
|
||||
max_save_seconds: saveTimeFormToSeconds(saveTime.value, saveTime.unit)
|
||||
}
|
||||
}
|
||||
+33
-33
@@ -2,66 +2,66 @@ import { DEFAULT_CONFIG, FILE_SIZE_LIMITS, STORAGE_KEYS } from '@/constants'
|
||||
import type { ConfigState, SystemConfig } from '@/types'
|
||||
|
||||
export type PublicConfig = SystemConfig & {
|
||||
uploadSize: number
|
||||
upload_size: number
|
||||
allowed_file_types?: string[]
|
||||
expireStyle: string[]
|
||||
expire_style: string[]
|
||||
code_generate_type?: 'number' | 'secret'
|
||||
openUpload: number
|
||||
open_upload: number
|
||||
max_save_seconds: number
|
||||
enableChunk: number
|
||||
enable_chunk: number
|
||||
notify_title?: string
|
||||
notify_content?: string
|
||||
page_explain?: string
|
||||
showAdminAddr?: number
|
||||
themesSelect?: string
|
||||
show_admin_addr?: number
|
||||
themes_select?: string
|
||||
background?: string
|
||||
opacity?: number
|
||||
}
|
||||
|
||||
type PublicConfigInput = Omit<Partial<ConfigState>, 'showAdminAddr'> & {
|
||||
showAdminAddr?: number | string
|
||||
type PublicConfigInput = Omit<Partial<ConfigState>, 'show_admin_addr'> & {
|
||||
show_admin_addr?: number | string
|
||||
show_admin_address?: number | string
|
||||
}
|
||||
|
||||
export const DEFAULT_PUBLIC_CONFIG: PublicConfig = {
|
||||
...DEFAULT_CONFIG,
|
||||
uploadSize: FILE_SIZE_LIMITS.MAX_FILE_SIZE,
|
||||
upload_size: FILE_SIZE_LIMITS.MAX_FILE_SIZE,
|
||||
allowedFileTypes: ['*'],
|
||||
allowed_file_types: ['*'],
|
||||
expireStyle: ['day'],
|
||||
expire_style: ['day'],
|
||||
code_generate_type: 'secret',
|
||||
openUpload: 1,
|
||||
open_upload: 1,
|
||||
max_save_seconds: 0,
|
||||
enableChunk: 0,
|
||||
showAdminAddr: 0
|
||||
enable_chunk: 0,
|
||||
show_admin_addr: 0
|
||||
}
|
||||
|
||||
export const DEFAULT_CONFIG_STATE: ConfigState = {
|
||||
name: DEFAULT_PUBLIC_CONFIG.name,
|
||||
description: DEFAULT_PUBLIC_CONFIG.description || '',
|
||||
file_storage: '',
|
||||
themesChoices: [],
|
||||
expireStyle: DEFAULT_PUBLIC_CONFIG.expireStyle,
|
||||
themes_choices: [],
|
||||
expire_style: DEFAULT_PUBLIC_CONFIG.expire_style,
|
||||
code_generate_type: DEFAULT_PUBLIC_CONFIG.code_generate_type || 'secret',
|
||||
adminSessionExpire: 30 * 24 * 60 * 60,
|
||||
admin_session_expire: 30 * 24 * 60 * 60,
|
||||
admin_token: '',
|
||||
robotsText: '',
|
||||
robots_text: '',
|
||||
keywords: '',
|
||||
notify_title: '',
|
||||
notify_content: '',
|
||||
openUpload: DEFAULT_PUBLIC_CONFIG.openUpload,
|
||||
uploadSize: DEFAULT_PUBLIC_CONFIG.uploadSize,
|
||||
open_upload: DEFAULT_PUBLIC_CONFIG.open_upload,
|
||||
upload_size: DEFAULT_PUBLIC_CONFIG.upload_size,
|
||||
allowed_file_types: DEFAULT_PUBLIC_CONFIG.allowedFileTypes,
|
||||
allowedFileTypes: DEFAULT_PUBLIC_CONFIG.allowedFileTypes,
|
||||
storage_path: '',
|
||||
storageLimit: 0,
|
||||
uploadMinute: 1,
|
||||
storage_limit: 0,
|
||||
upload_minute: 1,
|
||||
max_save_seconds: DEFAULT_PUBLIC_CONFIG.max_save_seconds,
|
||||
opacity: 0.9,
|
||||
enableChunk: DEFAULT_PUBLIC_CONFIG.enableChunk,
|
||||
enable_chunk: DEFAULT_PUBLIC_CONFIG.enable_chunk,
|
||||
s3_access_key_id: '',
|
||||
background: '',
|
||||
showAdminAddr: 0,
|
||||
show_admin_addr: 0,
|
||||
page_explain: '',
|
||||
s3_secret_access_key: '',
|
||||
aws_session_token: '',
|
||||
@@ -71,11 +71,11 @@ export const DEFAULT_CONFIG_STATE: ConfigState = {
|
||||
s3_bucket_name: '',
|
||||
s3_endpoint_url: '',
|
||||
s3_hostname: '',
|
||||
uploadCount: 1,
|
||||
errorMinute: 1,
|
||||
errorCount: 1,
|
||||
upload_count: 1,
|
||||
error_minute: 1,
|
||||
error_count: 1,
|
||||
s3_proxy: 0,
|
||||
themesSelect: '',
|
||||
themes_select: '',
|
||||
webdav_url: '',
|
||||
webdav_username: '',
|
||||
webdav_password: ''
|
||||
@@ -116,19 +116,19 @@ export function toPublicConfig(
|
||||
return {
|
||||
name: config.name,
|
||||
description: config.description,
|
||||
uploadSize: config.uploadSize,
|
||||
upload_size: config.upload_size,
|
||||
allowedFileTypes,
|
||||
allowed_file_types: allowedFileTypes,
|
||||
expireStyle: config.expireStyle,
|
||||
expire_style: config.expire_style,
|
||||
code_generate_type: config.code_generate_type,
|
||||
openUpload: config.openUpload,
|
||||
open_upload: config.open_upload,
|
||||
max_save_seconds: config.max_save_seconds,
|
||||
enableChunk: config.enableChunk,
|
||||
enable_chunk: config.enable_chunk,
|
||||
notify_title: config.notify_title,
|
||||
notify_content: config.notify_content,
|
||||
page_explain: config.page_explain,
|
||||
showAdminAddr: normalizeAdminAddress(config.showAdminAddr ?? config.show_admin_address),
|
||||
themesSelect: config.themesSelect,
|
||||
show_admin_addr: normalizeAdminAddress(config.show_admin_addr ?? config.show_admin_address),
|
||||
themes_select: config.themes_select,
|
||||
background: config.background,
|
||||
opacity: config.opacity
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
{{ dashboardData.chunkedCount }}
|
||||
</strong>
|
||||
<span class="text-sm" :class="[mutedTextClass]">
|
||||
{{ dashboardData.enableChunk ? t('common.enabled') : t('common.disabled') }}
|
||||
{{ dashboardData.enable_chunk ? t('common.enabled') : t('common.disabled') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,7 +196,7 @@
|
||||
/>
|
||||
<PolicyRow
|
||||
:label="t('admin.dashboard.guestUpload')"
|
||||
:value="dashboardData.openUpload ? t('common.enabled') : t('common.disabled')"
|
||||
:value="dashboardData.open_upload ? t('common.enabled') : t('common.disabled')"
|
||||
/>
|
||||
<PolicyRow :label="t('admin.dashboard.maxSaveTime')" :value="maxSaveTimeText" />
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ const {
|
||||
isDirty,
|
||||
fileSize,
|
||||
sizeUnit,
|
||||
storageLimit,
|
||||
storage_limit,
|
||||
storageLimitUnit,
|
||||
saveTime,
|
||||
saveTimeUnit,
|
||||
@@ -185,10 +185,10 @@ onMounted(() => {
|
||||
|
||||
<SettingSwitch
|
||||
:label="t('admin.settings.showAdminAddress')"
|
||||
:model-value="config.showAdminAddr"
|
||||
:model-value="config.show_admin_addr"
|
||||
:enabled-text="t('common.enabled')"
|
||||
:disabled-text="t('common.disabled')"
|
||||
@toggle="toggleConfigFlag('showAdminAddr')"
|
||||
@toggle="toggleConfigFlag('show_admin_addr')"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -220,7 +220,7 @@ onMounted(() => {
|
||||
{{ t('manage.settings.themeSelection') }}
|
||||
</label>
|
||||
<select
|
||||
v-model="config.themesSelect"
|
||||
v-model="config.themes_select"
|
||||
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border appearance-none bg-no-repeat bg-right focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none cursor-pointer"
|
||||
:class="[
|
||||
isDarkMode
|
||||
@@ -231,7 +231,7 @@ onMounted(() => {
|
||||
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20fill%3D%22none%22%3E%3Cpath%20d%3D%22M7%208l3%203%203-3%22%20stroke%3D%22%236B7280%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E');
|
||||
"
|
||||
>
|
||||
<option v-for="item in config.themesChoices" :value="item.key" :key="item.key">
|
||||
<option v-for="item in config.themes_choices" :value="item.key" :key="item.key">
|
||||
{{ item.name }} (by {{ item.author }} V{{ item.version }})
|
||||
</option>
|
||||
</select>
|
||||
@@ -244,7 +244,7 @@ onMounted(() => {
|
||||
{{ t('manage.settings.robotsFile') }}
|
||||
</label>
|
||||
<textarea
|
||||
v-model="config.robotsText"
|
||||
v-model="config.robots_text"
|
||||
rows="3"
|
||||
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border resize-none focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
|
||||
:class="[
|
||||
@@ -354,10 +354,10 @@ onMounted(() => {
|
||||
<SettingSwitch
|
||||
v-if="config.file_storage === 'local'"
|
||||
:label="t('manage.settings.chunkUploadNote')"
|
||||
:model-value="config.enableChunk"
|
||||
:model-value="config.enable_chunk"
|
||||
:enabled-text="t('common.enabled')"
|
||||
:disabled-text="t('common.disabled')"
|
||||
@toggle="toggleConfigFlag('enableChunk')"
|
||||
@toggle="toggleConfigFlag('enable_chunk')"
|
||||
/>
|
||||
<div v-if="config.file_storage === 'webdav'" class="space-y-4">
|
||||
<!-- 通知设置 -->
|
||||
@@ -593,10 +593,10 @@ onMounted(() => {
|
||||
|
||||
<SettingSwitch
|
||||
:label="t('manage.settings.chunkUploadNote')"
|
||||
:model-value="config.enableChunk"
|
||||
:model-value="config.enable_chunk"
|
||||
:enabled-text="t('common.enabled')"
|
||||
:disabled-text="t('common.disabled')"
|
||||
@toggle="toggleConfigFlag('enableChunk')"
|
||||
@toggle="toggleConfigFlag('enable_chunk')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -614,13 +614,13 @@ onMounted(() => {
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<SettingNumberInput
|
||||
v-model="config.uploadMinute"
|
||||
v-model="config.upload_minute"
|
||||
:label="t('manage.settings.uploadPerMinute')"
|
||||
:suffix="t('common.minute')"
|
||||
/>
|
||||
|
||||
<SettingNumberInput
|
||||
v-model="config.uploadCount"
|
||||
v-model="config.upload_count"
|
||||
:label="t('manage.settings.uploadCountLimit')"
|
||||
:suffix="t('common.files')"
|
||||
/>
|
||||
@@ -699,13 +699,13 @@ onMounted(() => {
|
||||
<input
|
||||
type="checkbox"
|
||||
:value="style"
|
||||
v-model="config.expireStyle"
|
||||
v-model="config.expire_style"
|
||||
class="peer sr-only"
|
||||
/>
|
||||
<div
|
||||
class="px-4 py-2 rounded-full border-2 transition-all duration-200 select-none"
|
||||
:class="[
|
||||
config.expireStyle.includes(style)
|
||||
config.expire_style.includes(style)
|
||||
? isDarkMode
|
||||
? 'bg-zinc-600 border-zinc-600 text-white'
|
||||
: 'bg-zinc-600 border-zinc-600 text-white'
|
||||
@@ -784,11 +784,11 @@ onMounted(() => {
|
||||
class="block text-sm font-medium"
|
||||
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
|
||||
>
|
||||
{{ t('admin.settings.storageLimit') }}
|
||||
{{ t('admin.settings.storage_limit') }}
|
||||
</label>
|
||||
<div class="flex items-center space-x-2">
|
||||
<input
|
||||
v-model.number="storageLimit"
|
||||
v-model.number="storage_limit"
|
||||
type="number"
|
||||
min="0"
|
||||
step="1"
|
||||
@@ -820,10 +820,10 @@ onMounted(() => {
|
||||
|
||||
<SettingSwitch
|
||||
:label="t('manage.settings.guestUpload')"
|
||||
:model-value="config.openUpload"
|
||||
:model-value="config.open_upload"
|
||||
:enabled-text="t('common.enabled')"
|
||||
:disabled-text="t('common.disabled')"
|
||||
@toggle="toggleConfigFlag('openUpload')"
|
||||
@toggle="toggleConfigFlag('open_upload')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -839,13 +839,13 @@ onMounted(() => {
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<SettingNumberInput
|
||||
v-model="config.errorMinute"
|
||||
v-model="config.error_minute"
|
||||
:label="t('manage.settings.errorPerMinute')"
|
||||
:suffix="t('common.minute')"
|
||||
/>
|
||||
|
||||
<SettingNumberInput
|
||||
v-model="config.errorCount"
|
||||
v-model="config.error_count"
|
||||
:label="t('manage.settings.errorCountLimit')"
|
||||
:suffix="t('common.times')"
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user