feat: enhance SystemSettingsView with allowed file types input and UI improvements

- Added functionality to update allowed file types via a new input field.
- Updated various UI elements for better accessibility and consistency in dark mode.
- Improved styling for input fields, labels, and buttons to align with the new design system.
- Refactored class bindings to use 'zinc' color palette for better contrast and readability.
This commit is contained in:
Lan committed 2026-06-05 16:15:46 +08:00
1 parent ea61034a1f
commit e0864c2652
46 files changed
+1914 -1172

No files matched your search

+23 -5
View File
@@ -1,9 +1,11 @@
<script setup lang="ts">
import { RouterView } from 'vue-router'
import { RouterLink, RouterView } from 'vue-router'
import { ShieldCheckIcon } from 'lucide-vue-next'
import ThemeToggle from './components/common/ThemeToggle.vue'
import LanguageSwitcher from './components/common/LanguageSwitcher.vue'
import AlertComponent from '@/components/common/AlertComponent.vue'
import { useAppShell } from '@/composables'
import { ROUTES } from '@/constants'
const {
isDarkMode,
@@ -17,7 +19,23 @@ const {
<template>
<div :class="['app-container', isDarkMode ? 'dark' : 'light']">
<div v-if="showGlobalControls" class="fixed top-4 right-4 z-50 flex items-center space-x-3">
<div
v-if="showGlobalControls"
class="fixed top-4 right-4 z-50 flex items-center gap-2 sm:top-6 sm:right-6 sm:gap-3"
>
<RouterLink
:to="ROUTES.ADMIN"
class="rounded-full border p-2.5 shadow-sm backdrop-blur-xl transition-all duration-300 hover:scale-105 active:scale-95 sm:p-3"
:class="
isDarkMode
? 'border-white/10 bg-zinc-800/80 text-zinc-100 hover:bg-zinc-700'
: 'border-slate-200/50 bg-white/80 text-slate-500 hover:text-slate-700'
"
aria-label="进入管理员页面"
title="进入管理员页面"
>
<ShieldCheckIcon class="h-5 w-5" />
</RouterLink>
<LanguageSwitcher />
<ThemeToggle v-model="isDarkMode" />
</div>
@@ -42,11 +60,11 @@ const {
}
.light {
@apply bg-gradient-to-br from-blue-50 via-indigo-50 to-white;
@apply bg-[#f5f5f7] text-zinc-900;
}
.dark {
@apply bg-gradient-to-br from-gray-900 via-indigo-900 to-black;
@apply bg-zinc-950 text-zinc-100;
}
.fade-enter-active,
@@ -100,7 +118,7 @@ const {
width: 50px;
height: 50px;
border: 3px solid #fff;
border-top: 3px solid #3498db;
border-top: 3px solid #27272a;
border-radius: 50%;
animation: spin 1s linear infinite;
}
+85 -36
View File
@@ -2,39 +2,38 @@
<transition-group
name="alert-fade"
tag="div"
class="fixed top-4 left-4 z-50 w-full sm:max-w-sm md:max-w-md space-y-4 px-4 sm:px-0"
class="fixed left-4 right-4 top-4 z-50 space-y-3 sm:left-auto sm:w-[24rem]"
>
<div
v-for="alert in alerts"
:key="alert.id"
:class="[
'w-full rounded-lg shadow-xl overflow-hidden',
'bg-gradient-to-r',
gradientClasses[alert.type]
]"
:class="['w-full overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-2xl', cardClass]"
>
<div class="p-4">
<div class="flex items-start">
<div class="flex-shrink-0">
<component :is="alertIcons[alert.type]" class="h-6 w-6 text-white" />
</div>
<div class="ml-3 flex-1 pt-0.5">
<p class="text-sm font-medium text-white">{{ alert.message }}</p>
</div>
<div class="ml-4 flex-shrink-0 flex">
<button
@click="removeAlert(alert.id)"
class="inline-flex text-white hover:text-gray-200 focus:outline-none transition-colors duration-200"
>
<span class="sr-only">{{ t('common.close') }}</span>
<X class="h-5 w-5" />
</button>
</div>
</div>
</div>
<div class="h-1 bg-white bg-opacity-25">
<div class="flex items-start gap-3 p-4">
<div
class="h-full bg-white transition-all duration-100 ease-out"
class="mt-0.5 flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl"
:class="iconToneClass(alert.type)"
>
<component :is="alertIcons[alert.type]" class="h-5 w-5" />
</div>
<div class="min-w-0 flex-1">
<p class="break-words text-sm font-medium leading-5" :class="messageClass">
{{ alert.message }}
</p>
</div>
<button
@click="removeAlert(alert.id)"
class="inline-flex rounded-lg p-1.5 transition-colors duration-200"
:class="closeClass"
>
<span class="sr-only">{{ t('common.close') }}</span>
<X class="h-4 w-4" />
</button>
</div>
<div class="h-0.5" :class="progressTrackClass">
<div
class="h-full transition-all duration-100 ease-out"
:class="progressToneClass(alert.type)"
:style="{ width: `${alert.progress}%` }"
></div>
</div>
@@ -46,21 +45,18 @@
import { storeToRefs } from 'pinia'
import { useAlertStore } from '@/stores/alertStore'
import { CheckCircle, AlertTriangle, AlertCircle, Info, X } from 'lucide-vue-next'
import { onMounted, onUnmounted } from 'vue'
import { computed, onMounted, onUnmounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { useInjectedDarkMode } from '@/composables'
const { t } = useI18n()
const isDarkMode = useInjectedDarkMode()
const alertStore = useAlertStore()
const { alerts } = storeToRefs(alertStore)
const { removeAlert, startProgressTimer, stopProgressTimer } = alertStore
const gradientClasses = {
success: 'from-green-500 to-green-600',
error: 'from-red-500 to-red-600',
warning: 'from-yellow-500 to-yellow-600',
info: 'from-blue-500 to-blue-600'
}
type AlertType = 'success' | 'error' | 'warning' | 'info'
const alertIcons = {
success: CheckCircle,
@@ -69,6 +65,56 @@ const alertIcons = {
info: Info
}
const cardClass = computed(() =>
isDarkMode.value
? 'border-white/10 bg-zinc-900/[0.88] shadow-[0_22px_70px_-34px_rgba(255,255,255,0.2)]'
: 'border-white/80 bg-white/[0.88] shadow-[0_22px_70px_-34px_rgba(24,24,27,0.3)]'
)
const messageClass = computed(() => (isDarkMode.value ? 'text-zinc-100' : 'text-zinc-900'))
const closeClass = computed(() =>
isDarkMode.value
? 'text-zinc-500 hover:bg-white/10 hover:text-zinc-200'
: 'text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700'
)
const progressTrackClass = computed(() =>
isDarkMode.value ? 'bg-white/[0.06]' : 'bg-zinc-950/[0.06]'
)
const iconToneClass = (type: AlertType) => {
const darkClasses: Record<AlertType, string> = {
success: 'bg-white/10 text-zinc-100',
info: 'bg-white/10 text-zinc-100',
warning: 'bg-amber-400/12 text-amber-200',
error: 'bg-red-400/12 text-red-200'
}
const lightClasses: Record<AlertType, string> = {
success: 'bg-zinc-100 text-zinc-800',
info: 'bg-zinc-100 text-zinc-800',
warning: 'bg-amber-50 text-amber-700',
error: 'bg-red-50 text-red-700'
}
return isDarkMode.value ? darkClasses[type] : lightClasses[type]
}
const progressToneClass = (type: AlertType) => {
const darkClasses: Record<AlertType, string> = {
success: 'bg-zinc-100',
info: 'bg-zinc-100',
warning: 'bg-amber-300',
error: 'bg-red-300'
}
const lightClasses: Record<AlertType, string> = {
success: 'bg-zinc-800',
info: 'bg-zinc-800',
warning: 'bg-amber-500',
error: 'bg-red-500'
}
return isDarkMode.value ? darkClasses[type] : lightClasses[type]
}
onMounted(() => {
startProgressTimer()
})
@@ -81,11 +127,14 @@ onUnmounted(() => {
<style scoped>
.alert-fade-enter-active,
.alert-fade-leave-active {
transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition:
opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.alert-fade-enter-from,
.alert-fade-leave-to {
opacity: 0;
transform: translateX(-50px) scale(0.95);
transform: translateY(-8px) scale(0.98);
}
</style>
+21 -14
View File
@@ -3,7 +3,7 @@
:type="type"
:disabled="disabled || loading"
@click="$emit('click', $event)"
class="inline-flex items-center justify-center px-4 py-2 rounded-md font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
class="inline-flex items-center justify-center rounded-xl px-4 py-2 font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
:class="[
sizeClasses,
variantClasses,
@@ -12,7 +12,10 @@
]"
>
<slot name="icon" v-if="$slots.icon && !loading"></slot>
<div v-if="loading" class="animate-spin rounded-full h-4 w-4 border-2 border-current border-t-transparent mr-2"></div>
<div
v-if="loading"
class="animate-spin rounded-full h-4 w-4 border-2 border-current border-t-transparent mr-2"
></div>
<slot></slot>
</button>
</template>
@@ -54,31 +57,35 @@ const sizeClasses = computed(() => {
const variantClasses = computed(() => {
const baseClasses = 'focus:ring-2 focus:ring-offset-2'
if (props.variant === 'primary') {
return `${baseClasses} bg-indigo-600 text-white hover:bg-indigo-700 focus:ring-indigo-500`
return isDarkMode.value
? `${baseClasses} bg-zinc-200 text-zinc-950 hover:bg-zinc-100 focus:ring-zinc-500 focus:ring-offset-zinc-950 shadow-[0_12px_24px_-18px_rgba(255,255,255,0.45)]`
: `${baseClasses} bg-zinc-900 text-white hover:bg-zinc-950 focus:ring-zinc-500 shadow-[0_12px_24px_-18px_rgba(24,24,27,0.45)]`
}
if (props.variant === 'secondary') {
return isDarkMode.value
? `${baseClasses} bg-gray-700 text-gray-300 hover:bg-gray-600 focus:ring-gray-500 border border-gray-600`
: `${baseClasses} bg-gray-100 text-gray-700 hover:bg-gray-200 focus:ring-gray-500 border border-gray-300`
? `${baseClasses} border border-white/10 bg-white/[0.06] text-zinc-300 hover:bg-white/10 focus:ring-zinc-500 focus:ring-offset-zinc-950`
: `${baseClasses} border border-white/80 bg-white/70 text-zinc-700 hover:bg-zinc-50 focus:ring-zinc-500`
}
if (props.variant === 'danger') {
return `${baseClasses} bg-red-600 text-white hover:bg-red-700 focus:ring-red-500`
}
if (props.variant === 'success') {
return `${baseClasses} bg-green-600 text-white hover:bg-green-700 focus:ring-green-500`
return isDarkMode.value
? `${baseClasses} bg-zinc-200 text-zinc-950 hover:bg-zinc-100 focus:ring-zinc-500 focus:ring-offset-zinc-950`
: `${baseClasses} bg-zinc-900 text-white hover:bg-zinc-950 focus:ring-zinc-500`
}
if (props.variant === 'outline') {
return isDarkMode.value
? `${baseClasses} border border-gray-600 text-gray-300 hover:bg-gray-700 focus:ring-gray-500`
: `${baseClasses} border border-gray-300 text-gray-700 hover:bg-gray-50 focus:ring-gray-500`
? `${baseClasses} border border-white/10 text-zinc-300 hover:bg-white/10 focus:ring-zinc-500 focus:ring-offset-zinc-950`
: `${baseClasses} border border-zinc-200/80 bg-white/40 text-zinc-700 hover:bg-zinc-50 focus:ring-zinc-500`
}
return ''
})
</script>
+20 -17
View File
@@ -1,22 +1,20 @@
<template>
<Teleport to="body">
<Transition name="modal" appear>
<div
v-if="show"
class="fixed inset-0 z-50 overflow-y-auto"
@click="handleBackdropClick"
>
<div v-if="show" class="fixed inset-0 z-50 overflow-y-auto" @click="handleBackdropClick">
<!-- 背景遮罩 -->
<div class="fixed inset-0 bg-black bg-opacity-50 transition-opacity"></div>
<div class="fixed inset-0 bg-zinc-950/45 backdrop-blur-sm transition-opacity"></div>
<!-- 模态框容器 -->
<div class="flex min-h-full items-center justify-center p-4">
<div
ref="modalRef"
class="relative transform overflow-hidden rounded-lg shadow-xl transition-all"
class="relative transform overflow-hidden rounded-2xl border shadow-2xl backdrop-blur-xl transition-all"
:class="[
sizeClasses,
isDarkMode ? 'bg-gray-800' : 'bg-white'
isDarkMode
? 'border-white/10 bg-zinc-900/95 shadow-[0_24px_80px_-36px_rgba(255,255,255,0.18)]'
: 'border-white/80 bg-white/90 shadow-[0_24px_80px_-36px_rgba(24,24,27,0.28)]'
]"
@click.stop
>
@@ -24,10 +22,13 @@
<div
v-if="$slots.header || title"
class="flex items-center justify-between px-6 py-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
:class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
>
<slot name="header">
<h3 class="text-lg font-medium" :class="[isDarkMode ? 'text-white' : 'text-gray-900']">
<h3
class="text-lg font-medium"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ title }}
</h3>
</slot>
@@ -37,24 +38,26 @@
class="rounded-md p-2 transition-colors"
:class="[
isDarkMode
? 'text-gray-400 hover:text-gray-300 hover:bg-gray-700'
: 'text-gray-400 hover:text-gray-500 hover:bg-gray-100'
? 'text-zinc-400 hover:text-zinc-100 hover:bg-white/10'
: 'text-zinc-400 hover:text-zinc-700 hover:bg-zinc-100'
]"
>
<X class="h-5 w-5" />
</button>
</div>
<!-- 内容 -->
<div class="px-6 py-4">
<slot></slot>
</div>
<!-- 底部 -->
<div
v-if="$slots.footer"
class="flex items-center justify-end space-x-3 px-6 py-4 border-t"
:class="[isDarkMode ? 'border-gray-700 bg-gray-900/50' : 'border-gray-200 bg-gray-50']"
:class="[
isDarkMode ? 'border-white/10 bg-zinc-950/35' : 'border-zinc-200/70 bg-zinc-50/80'
]"
>
<slot name="footer"></slot>
</div>
@@ -127,4 +130,4 @@ const handleBackdropClick = (event: MouseEvent) => {
.modal-leave-to .relative {
transform: scale(0.95) translateY(-20px);
}
</style>
</style>
+116 -74
View File
@@ -5,135 +5,177 @@
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { ref, onMounted, watch } from 'vue'
const props = defineProps<{
progress: number;
}>();
progress: number
}>()
const container = ref<HTMLDivElement | null>(null);
const canvas = ref<HTMLCanvasElement | null>(null);
let ctx: CanvasRenderingContext2D | null = null;
const container = ref<HTMLDivElement | null>(null)
const canvas = ref<HTMLCanvasElement | null>(null)
let ctx: CanvasRenderingContext2D | null = null
const drawProgress = () => {
if (!ctx || !canvas.value || !container.value) return;
if (!ctx || !canvas.value || !container.value) return
const width = container.value.clientWidth;
const height = container.value.clientHeight;
canvas.value.width = width;
canvas.value.height = height;
const width = container.value.clientWidth
const height = container.value.clientHeight
canvas.value.width = width
canvas.value.height = height
const borderWidth = 4; // 边框宽度
const cornerRadius = 8; // 拐角半径
ctx.lineWidth = borderWidth;
const borderWidth = 4 // 边框宽度
const cornerRadius = 8 // 拐角半径
ctx.lineWidth = borderWidth
// 创建渐变
const gradient = ctx.createLinearGradient(0, 0, width, height);
gradient.addColorStop(0, '#4f46e5'); // 靛蓝色
gradient.addColorStop(0.5, '#7c3aed'); // 紫色
gradient.addColorStop(1, '#db2777'); // 粉色
const gradient = ctx.createLinearGradient(0, 0, width, height)
gradient.addColorStop(0, '#18181b')
gradient.addColorStop(0.5, '#71717a')
gradient.addColorStop(1, '#e4e4e7')
// 绘制背景
ctx.strokeStyle = 'rgba(229, 231, 235, 0.2)'; // 淡灰色半透明
drawRoundedRect(ctx, borderWidth / 2, borderWidth / 2, width - borderWidth, height - borderWidth, cornerRadius);
ctx.stroke();
ctx.strokeStyle = 'rgba(229, 231, 235, 0.2)' // 淡灰色半透明
drawRoundedRect(
ctx,
borderWidth / 2,
borderWidth / 2,
width - borderWidth,
height - borderWidth,
cornerRadius
)
ctx.stroke()
// 计算进度
const totalLength = (width + height) * 2 - 8 * cornerRadius + 2 * Math.PI * cornerRadius;
const progressLength = (totalLength * props.progress) / 100;
const totalLength = (width + height) * 2 - 8 * cornerRadius + 2 * Math.PI * cornerRadius
const progressLength = (totalLength * props.progress) / 100
// 绘制进度
ctx.strokeStyle = gradient;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.beginPath();
ctx.strokeStyle = gradient
ctx.lineCap = 'round'
ctx.lineJoin = 'round'
ctx.beginPath()
let remainingLength = progressLength;
const halfBorder = borderWidth / 2;
const innerWidth = width - borderWidth;
const innerHeight = height - borderWidth;
let remainingLength = progressLength
const halfBorder = borderWidth / 2
const innerWidth = width - borderWidth
const innerHeight = height - borderWidth
// 上边
if (remainingLength > 0) {
const topLength = Math.min(innerWidth - 2 * cornerRadius, remainingLength);
ctx.moveTo(cornerRadius + halfBorder, halfBorder);
ctx.lineTo(topLength + cornerRadius + halfBorder, halfBorder);
remainingLength -= topLength;
const topLength = Math.min(innerWidth - 2 * cornerRadius, remainingLength)
ctx.moveTo(cornerRadius + halfBorder, halfBorder)
ctx.lineTo(topLength + cornerRadius + halfBorder, halfBorder)
remainingLength -= topLength
}
// 右上角
if (remainingLength > 0) {
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius);
ctx.arc(innerWidth - cornerRadius + halfBorder, cornerRadius + halfBorder, cornerRadius, -Math.PI / 2, angle - Math.PI / 2, false);
remainingLength -= angle * cornerRadius;
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius)
ctx.arc(
innerWidth - cornerRadius + halfBorder,
cornerRadius + halfBorder,
cornerRadius,
-Math.PI / 2,
angle - Math.PI / 2,
false
)
remainingLength -= angle * cornerRadius
}
// 右边
if (remainingLength > 0) {
const rightLength = Math.min(innerHeight - 2 * cornerRadius, remainingLength);
ctx.lineTo(innerWidth + halfBorder, rightLength + cornerRadius + halfBorder);
remainingLength -= rightLength;
const rightLength = Math.min(innerHeight - 2 * cornerRadius, remainingLength)
ctx.lineTo(innerWidth + halfBorder, rightLength + cornerRadius + halfBorder)
remainingLength -= rightLength
}
// 右下角
if (remainingLength > 0) {
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius);
ctx.arc(innerWidth - cornerRadius + halfBorder, innerHeight - cornerRadius + halfBorder, cornerRadius, 0, angle, false);
remainingLength -= angle * cornerRadius;
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius)
ctx.arc(
innerWidth - cornerRadius + halfBorder,
innerHeight - cornerRadius + halfBorder,
cornerRadius,
0,
angle,
false
)
remainingLength -= angle * cornerRadius
}
// 下边
if (remainingLength > 0) {
const bottomLength = Math.min(innerWidth - 2 * cornerRadius, remainingLength);
ctx.lineTo(innerWidth - bottomLength - cornerRadius + halfBorder, innerHeight + halfBorder);
remainingLength -= bottomLength;
const bottomLength = Math.min(innerWidth - 2 * cornerRadius, remainingLength)
ctx.lineTo(innerWidth - bottomLength - cornerRadius + halfBorder, innerHeight + halfBorder)
remainingLength -= bottomLength
}
// 左下角
if (remainingLength > 0) {
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius);
ctx.arc(cornerRadius + halfBorder, innerHeight - cornerRadius + halfBorder, cornerRadius, Math.PI / 2, Math.PI / 2 + angle, false);
remainingLength -= angle * cornerRadius;
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius)
ctx.arc(
cornerRadius + halfBorder,
innerHeight - cornerRadius + halfBorder,
cornerRadius,
Math.PI / 2,
Math.PI / 2 + angle,
false
)
remainingLength -= angle * cornerRadius
}
// 左边
if (remainingLength > 0) {
const leftLength = Math.min(innerHeight - 2 * cornerRadius, remainingLength);
ctx.lineTo(halfBorder, innerHeight - leftLength - cornerRadius + halfBorder);
remainingLength -= leftLength;
const leftLength = Math.min(innerHeight - 2 * cornerRadius, remainingLength)
ctx.lineTo(halfBorder, innerHeight - leftLength - cornerRadius + halfBorder)
remainingLength -= leftLength
}
// 左上角
if (remainingLength > 0) {
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius);
ctx.arc(cornerRadius + halfBorder, cornerRadius + halfBorder, cornerRadius, Math.PI, Math.PI + angle, false);
const angle = Math.min(Math.PI / 2, remainingLength / cornerRadius)
ctx.arc(
cornerRadius + halfBorder,
cornerRadius + halfBorder,
cornerRadius,
Math.PI,
Math.PI + angle,
false
)
}
ctx.stroke();
};
ctx.stroke()
}
function drawRoundedRect(ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) {
ctx.beginPath();
ctx.moveTo(x + radius, y);
ctx.lineTo(x + width - radius, y);
ctx.arcTo(x + width, y, x + width, y + radius, radius);
ctx.lineTo(x + width, y + height - radius);
ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius);
ctx.lineTo(x + radius, y + height);
ctx.arcTo(x, y + height, x, y + height - radius, radius);
ctx.lineTo(x, y + radius);
ctx.arcTo(x, y, x + radius, y, radius);
ctx.closePath();
function drawRoundedRect(
ctx: CanvasRenderingContext2D,
x: number,
y: number,
width: number,
height: number,
radius: number
) {
ctx.beginPath()
ctx.moveTo(x + radius, y)
ctx.lineTo(x + width - radius, y)
ctx.arcTo(x + width, y, x + width, y + radius, radius)
ctx.lineTo(x + width, y + height - radius)
ctx.arcTo(x + width, y + height, x + width - radius, y + height, radius)
ctx.lineTo(x + radius, y + height)
ctx.arcTo(x, y + height, x, y + height - radius, radius)
ctx.lineTo(x, y + radius)
ctx.arcTo(x, y, x + radius, y, radius)
ctx.closePath()
}
onMounted(() => {
if (canvas.value) {
ctx = canvas.value.getContext('2d');
drawProgress();
ctx = canvas.value.getContext('2d')
drawProgress()
}
});
})
watch(() => props.progress, drawProgress);
watch(() => props.progress, drawProgress)
</script>
<style scoped>
@@ -151,4 +193,4 @@ watch(() => props.progress, drawProgress);
height: 100%;
transition: all 0.3s ease;
}
</style>
</style>
+27 -28
View File
@@ -2,38 +2,41 @@
<transition name="fade">
<div
v-if="visible"
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm"
@click.self="$emit('close')"
>
<div
class="p-6 rounded-2xl max-w-3xl w-full mx-4 shadow-2xl transform transition-all duration-300 ease-out backdrop-filter backdrop-blur-lg bg-opacity-70 max-h-[85vh] overflow-hidden flex flex-col"
:class="[isDarkMode ? 'bg-gray-800' : 'bg-white']"
class="flex max-h-[85vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border p-5 shadow-2xl backdrop-blur-xl transition-all duration-300 ease-out sm:p-6"
:class="isDarkMode ? 'border-zinc-800 bg-zinc-950/95' : 'border-white/50 bg-white/95'"
>
<div class="flex justify-between items-center mb-4 flex-shrink-0">
<h3 class="text-2xl font-bold" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
<h3
class="text-xl font-semibold tracking-tight sm:text-2xl"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
{{ t('contentPreview.title') }}
</h3>
<div class="flex items-center gap-3">
<button
@click="$emit('copy-content')"
class="px-4 py-1.5 rounded-lg transition duration-300 flex items-center gap-2 text-sm font-medium"
:class="[
class="flex items-center gap-2 rounded-xl px-4 py-1.5 text-sm font-medium transition duration-300"
:class="
isDarkMode
? 'bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white'
: 'bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-900'
]"
? 'bg-zinc-800 text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100'
: 'bg-slate-100 text-slate-700 hover:bg-slate-200 hover:text-slate-900'
"
>
<CopyIcon class="w-4 h-4" />
{{ t('common.copy') }}
</button>
<button
@click="$emit('close')"
class="p-1.5 rounded-lg transition duration-300 hover:bg-opacity-10"
:class="[
class="rounded-xl p-1.5 transition duration-300"
:class="
isDarkMode
? 'text-gray-400 hover:text-white hover:bg-white'
: 'text-gray-500 hover:text-gray-900 hover:bg-black'
]"
? 'text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100'
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-900'
"
>
<XIcon class="w-5 h-5" />
</button>
@@ -42,7 +45,7 @@
<div class="flex-1 overflow-y-auto custom-scrollbar">
<div
class="prose max-w-none p-6 rounded-xl break-words overflow-wrap-anywhere"
:class="[isDarkMode ? 'prose-invert bg-gray-900 bg-opacity-50' : 'bg-gray-50']"
:class="isDarkMode ? 'prose-invert bg-zinc-900/60' : 'bg-slate-50'"
v-html="renderedContent"
></div>
</div>
@@ -156,8 +159,7 @@ const isDarkMode = inject('isDarkMode')
:deep(.prose h4),
:deep(.prose h5),
:deep(.prose h6) {
color: rgb(79, 70, 229);
/* text-indigo-600 */
color: rgb(39, 39, 42);
word-wrap: break-word;
overflow-wrap: break-word;
}
@@ -181,15 +183,12 @@ const isDarkMode = inject('isDarkMode')
white-space: pre-wrap;
}
@media (prefers-color-scheme: dark) {
:deep(.prose h1),
:deep(.prose h2),
:deep(.prose h3),
:deep(.prose h4),
:deep(.prose h5),
:deep(.prose h6) {
color: rgb(129, 140, 248);
/* text-indigo-400 */
}
:deep(.prose-invert h1),
:deep(.prose-invert h2),
:deep(.prose-invert h3),
:deep(.prose-invert h4),
:deep(.prose-invert h5),
:deep(.prose-invert h6) {
color: rgb(244, 244, 245);
}
</style>
</style>
+42 -23
View File
@@ -1,54 +1,73 @@
<template>
<div class="mt-4 flex items-center justify-between px-6 py-4 border-t"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<div class="flex items-center text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
<div
class="mt-4 flex items-center justify-between px-6 py-4 border-t"
:class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
>
<div
class="flex items-center text-sm"
:class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']"
>
显示第 {{ (currentPage - 1) * pageSize + 1 }} 到
{{ Math.min(currentPage * pageSize, total) }} 条,共 {{ total }} 条
</div>
<div class="flex items-center space-x-2">
<button @click="$emit('page-change', currentPage - 1)" :disabled="currentPage === 1"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200" :class="[
<button
@click="$emit('page-change', currentPage - 1)"
:disabled="currentPage === 1"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200"
:class="[
isDarkMode
? currentPage === 1
? 'bg-gray-800 text-gray-600 cursor-not-allowed'
: 'bg-gray-800 text-gray-300 hover:bg-gray-700'
? 'bg-white/[0.04] text-zinc-600 cursor-not-allowed'
: 'bg-white/[0.06] text-zinc-300 hover:bg-white/10'
: currentPage === 1
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]">
: 'bg-white/70 text-zinc-700 hover:bg-zinc-50'
]"
>
<ChevronLeftIcon class="w-4 h-4" />
上一页
</button>
<div class="flex items-center space-x-1">
<template v-for="pageNum in displayedPages" :key="pageNum">
<button v-if="pageNum !== '...'" @click="$emit('page-change', pageNum as number)"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200" :class="[
<button
v-if="pageNum !== '...'"
@click="$emit('page-change', pageNum as number)"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200"
:class="[
currentPage === pageNum
? 'bg-indigo-600 text-white'
? isDarkMode
? 'bg-zinc-100 text-zinc-950'
: 'bg-zinc-900 text-white'
: isDarkMode
? 'bg-gray-800 text-gray-300 hover:bg-gray-700'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]">
? 'bg-white/[0.06] text-zinc-300 hover:bg-white/10'
: 'bg-white/70 text-zinc-700 hover:bg-zinc-50'
]"
>
{{ pageNum }}
</button>
<span v-else class="px-2" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
<span v-else class="px-2" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']">
...
</span>
</template>
</div>
<button @click="$emit('page-change', currentPage + 1)" :disabled="currentPage >= totalPages"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200" :class="[
<button
@click="$emit('page-change', currentPage + 1)"
:disabled="currentPage >= totalPages"
class="inline-flex items-center px-3 py-1.5 rounded-md transition-colors duration-200"
:class="[
isDarkMode
? currentPage >= totalPages
? 'bg-gray-800 text-gray-600 cursor-not-allowed'
: 'bg-gray-800 text-gray-300 hover:bg-gray-700'
? 'bg-white/[0.04] text-zinc-600 cursor-not-allowed'
: 'bg-white/[0.06] text-zinc-300 hover:bg-white/10'
: currentPage >= totalPages
? 'bg-gray-100 text-gray-400 cursor-not-allowed'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
]">
: 'bg-white/70 text-zinc-700 hover:bg-zinc-50'
]"
>
下一页
<ChevronRightIcon class="w-4 h-4" />
</button>
@@ -112,4 +131,4 @@ const displayedPages = computed(() => {
return pages
})
</script>
</script>
+31 -14
View File
@@ -1,27 +1,44 @@
<template>
<div class="rounded-lg shadow-sm overflow-hidden transition-all duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div class="px-6 py-4 border-b" :class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<h3 class="text-lg font-medium" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
<div
class="overflow-hidden rounded-2xl border shadow-sm backdrop-blur-xl transition-all duration-300"
:class="[
isDarkMode
? 'border-white/10 bg-white/[0.06] shadow-[0_22px_54px_-36px_rgba(255,255,255,0.22)]'
: 'border-white/80 bg-white/70 shadow-[0_22px_54px_-36px_rgba(24,24,27,0.28)]'
]"
>
<div
class="px-6 py-4 border-b"
:class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
>
<h3 class="text-lg font-medium" :class="[isDarkMode ? 'text-white' : 'text-zinc-950']">
{{ title }}
</h3>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y" :class="[isDarkMode ? 'divide-gray-700' : 'divide-gray-200']">
<thead :class="[isDarkMode ? 'bg-gray-900/50' : 'bg-gray-50']">
<table
class="min-w-full divide-y"
:class="[isDarkMode ? 'divide-white/10' : 'divide-zinc-200/70']"
>
<thead :class="[isDarkMode ? 'bg-zinc-950/35' : 'bg-zinc-50/80']">
<tr>
<th v-for="header in headers" :key="header"
<th
v-for="header in headers"
:key="header"
class="px-6 py-3.5 text-left text-xs font-medium uppercase tracking-wider"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">
:class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']"
>
{{ header }}
</th>
</tr>
</thead>
<tbody :class="[
isDarkMode
? 'bg-gray-800/50 divide-y divide-gray-700'
: 'bg-white divide-y divide-gray-200'
]">
<tbody
:class="[
isDarkMode
? 'bg-transparent divide-y divide-white/10'
: 'bg-white/40 divide-y divide-zinc-200/70'
]"
>
<slot name="body"></slot>
</tbody>
</table>
@@ -41,4 +58,4 @@ interface Props {
defineProps<Props>()
const isDarkMode = inject('isDarkMode')
</script>
</script>
+18 -18
View File
@@ -1,6 +1,6 @@
<template>
<div class="flex flex-col space-y-3">
<label :class="['text-sm font-medium', isDarkMode ? 'text-gray-300' : 'text-gray-700']">
<label :class="['text-sm font-medium', isDarkMode ? 'text-zinc-300' : 'text-slate-700']">
{{ t('send.expiration.label') }}
</label>
<div class="relative flex-grow group">
@@ -8,8 +8,8 @@
:class="[
'relative h-12 rounded-2xl border transition-all duration-300 shadow-sm',
isDarkMode
? 'bg-gray-800/60 border-gray-700/60 group-hover:border-gray-600/80 group-hover:shadow-lg group-hover:shadow-gray-900/20'
: 'bg-white border-gray-200 group-hover:border-gray-300 group-hover:shadow-md group-hover:shadow-gray-200/50'
? 'bg-zinc-950/50 border-zinc-800 group-hover:border-zinc-700 group-hover:shadow-lg group-hover:shadow-zinc-950/20'
: 'bg-white border-slate-200/80 group-hover:border-slate-300 group-hover:shadow-md group-hover:shadow-slate-200/50'
]"
>
<template v-if="expirationMethod !== 'forever'">
@@ -25,13 +25,13 @@
'[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none',
'bg-transparent',
isDarkMode
? 'text-gray-100 focus:ring-indigo-500/80 placeholder-gray-500'
: 'text-gray-900 focus:ring-indigo-500/60 placeholder-gray-400'
? 'text-zinc-100 focus:ring-white/10 placeholder-zinc-500'
: 'text-slate-900 focus:ring-zinc-950/10 placeholder-slate-400'
]"
/>
<div
class="absolute right-28 top-0 h-full flex flex-col border-l"
:class="[isDarkMode ? 'border-gray-700/60' : 'border-gray-200']"
:class="[isDarkMode ? 'border-zinc-800' : 'border-slate-200']"
>
<button
type="button"
@@ -39,8 +39,8 @@
class="flex-1 px-2 flex items-center justify-center transition-all duration-200"
:class="[
isDarkMode
? 'hover:bg-gray-700/60 text-gray-400 hover:text-gray-200'
: 'hover:bg-gray-50 text-gray-500 hover:text-gray-700'
? 'hover:bg-zinc-800 text-zinc-400 hover:text-zinc-200'
: 'hover:bg-slate-50 text-slate-500 hover:text-slate-700'
]"
>
<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -58,8 +58,8 @@
class="flex-1 px-2 flex items-center justify-center transition-all duration-200"
:class="[
isDarkMode
? 'hover:bg-gray-700/60 text-gray-400 hover:text-gray-200'
: 'hover:bg-gray-50 text-gray-500 hover:text-gray-700'
? 'hover:bg-zinc-800 text-zinc-400 hover:text-zinc-200'
: 'hover:bg-slate-50 text-slate-500 hover:text-slate-700'
]"
>
<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@@ -83,22 +83,22 @@
? 'w-full px-5 rounded-2xl'
: 'w-28 pl-4 pr-9 border-l rounded-r-2xl',
isDarkMode
? 'text-gray-100 border-gray-700/60 focus:ring-indigo-500/80 bg-gray-800/60'
: 'text-gray-900 border-gray-200 focus:ring-indigo-500/60 bg-white'
? 'text-zinc-100 border-zinc-800 focus:ring-white/10 bg-zinc-950/50'
: 'text-slate-900 border-slate-200 focus:ring-zinc-950/10 bg-white'
]"
:style="{
color: isDarkMode ? '#f3f4f6' : '#111827',
backgroundColor: isDarkMode ? 'rgba(31, 41, 55, 0.5)' : '#ffffff'
color: isDarkMode ? '#f4f4f5' : '#0f172a',
backgroundColor: isDarkMode ? 'rgba(9, 9, 11, 0.5)' : '#ffffff'
}"
>
<option
v-for="option in options"
:key="option.value"
:value="option.value"
:class="[isDarkMode ? 'bg-gray-800 text-gray-100' : 'bg-white text-gray-900']"
:class="[isDarkMode ? 'bg-zinc-900 text-zinc-100' : 'bg-white text-slate-900']"
:style="{
color: isDarkMode ? '#f3f4f6' : '#111827',
backgroundColor: isDarkMode ? '#1f2937' : '#ffffff'
color: isDarkMode ? '#f4f4f5' : '#0f172a',
backgroundColor: isDarkMode ? '#18181b' : '#ffffff'
}"
>
{{ option.label }}
@@ -109,7 +109,7 @@
:class="[
expirationMethod === 'forever' ? 'right-3' : 'right-2',
'top-1/2 -translate-y-1/2',
isDarkMode ? 'text-gray-400' : 'text-gray-500'
isDarkMode ? 'text-zinc-400' : 'text-slate-500'
]"
>
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+78 -34
View File
@@ -2,78 +2,92 @@
<transition name="fade">
<div
v-if="visible"
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm"
@click.self="$emit('close')"
>
<div
class="p-8 rounded-2xl max-w-md w-full mx-4 shadow-2xl transform transition-all duration-300 ease-out backdrop-filter backdrop-blur-lg overflow-hidden"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white bg-opacity-95']"
class="w-full max-w-md overflow-hidden rounded-2xl border p-6 shadow-2xl backdrop-blur-xl transition-all duration-300 ease-out sm:p-8"
:class="isDarkMode ? 'border-zinc-800 bg-zinc-950/95' : 'border-white/50 bg-white/95'"
>
<h3
class="text-2xl font-bold mb-6 truncate"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
class="mb-6 truncate text-xl font-semibold tracking-tight sm:text-2xl"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
{{ t('fileDetail.title') }}
</h3>
<div class="space-y-4" v-if="record">
<div class="flex items-center">
<FileIcon
class="w-6 h-6 mr-3 flex-shrink-0"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
class="mr-3 h-5 w-5 flex-shrink-0 sm:h-6 sm:w-6"
:class="isDarkMode ? 'text-zinc-200' : 'text-zinc-800'"
/>
<p
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
class="truncate flex-grow"
>
<p class="truncate flex-grow" :class="isDarkMode ? 'text-zinc-300' : 'text-slate-700'">
<span class="font-medium">{{ t('fileRecord.filename') }}:</span>{{ record.filename }}
</p>
</div>
<div class="flex items-center">
<CalendarIcon
class="w-6 h-6 mr-3 flex-shrink-0"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
class="mr-3 h-5 w-5 flex-shrink-0 sm:h-6 sm:w-6"
:class="isDarkMode ? 'text-zinc-200' : 'text-zinc-800'"
/>
<p
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
class="truncate flex-grow"
>
<p class="truncate flex-grow" :class="isDarkMode ? 'text-zinc-300' : 'text-slate-700'">
<span class="font-medium">{{ t('fileRecord.date') }}:</span>{{ record.date }}
</p>
</div>
<div class="flex items-center">
<HardDriveIcon
class="w-6 h-6 mr-3 flex-shrink-0"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
class="mr-3 h-5 w-5 flex-shrink-0 sm:h-6 sm:w-6"
:class="isDarkMode ? 'text-zinc-200' : 'text-zinc-800'"
/>
<p
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
class="truncate flex-grow"
>
<p class="truncate flex-grow" :class="isDarkMode ? 'text-zinc-300' : 'text-slate-700'">
<span class="font-medium">{{ t('fileRecord.size') }}:</span>{{ record.size }}
</p>
</div>
<div class="flex items-center">
<DownloadIcon
class="w-6 h-6 mr-3"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
class="mr-3 h-5 w-5 sm:h-6 sm:w-6"
:class="isDarkMode ? 'text-zinc-200' : 'text-zinc-800'"
/>
<p :class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']">
<p :class="isDarkMode ? 'text-zinc-300' : 'text-slate-700'">
<span class="font-medium">{{ t('fileDetail.content') }}:</span>
</p>
<div v-if="record.filename === 'Text'" class="ml-2">
<button
@click="$emit('preview-content')"
class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-300"
class="rounded-xl px-4 py-2 text-sm font-semibold transition duration-300"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
>
{{ t('fileDetail.previewContent') }}
</button>
</div>
<div v-else>
<div v-else class="ml-2 flex flex-wrap gap-2">
<button
v-if="isPreviewable(record)"
type="button"
class="rounded-xl px-4 py-2 text-sm font-semibold transition duration-300"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
@click="$emit('preview-file')"
>
{{ t('fileRecord.preview') }}
</button>
<a
:href="getDownloadUrl(record)"
target="_blank"
rel="noopener noreferrer"
class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-300"
class="rounded-xl px-4 py-2 text-sm font-semibold transition duration-300"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
>
{{ t('fileDetail.download') }}
</a>
@@ -83,22 +97,27 @@
<div class="mt-6 flex flex-col items-center" v-if="record">
<h4
class="text-lg font-semibold mb-3"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
class="mb-3 text-lg font-semibold"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
{{ t('fileDetail.qrCode') }}
</h4>
<div class="bg-white p-2 rounded-lg shadow-md">
<div class="rounded-xl bg-white p-2 shadow-md">
<QRCode :value="getQRCodeValue(record)" :size="128" level="M" />
</div>
<p class="mt-2 text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
<p class="mt-2 text-sm" :class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'">
{{ t('fileDetail.scanQrCode') }}
</p>
</div>
<button
@click="$emit('close')"
class="mt-8 w-full bg-gradient-to-r from-indigo-500 to-purple-600 text-white px-6 py-3 rounded-lg font-medium hover:from-indigo-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition duration-300 transform hover:scale-105"
class="mt-8 w-full rounded-xl px-6 py-3 font-semibold transition duration-300 hover:-translate-y-0.5 sm:rounded-2xl"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
>
{{ t('common.close') }}
</button>
@@ -123,6 +142,7 @@ interface Props {
interface Emits {
close: []
'preview-content': []
'preview-file': []
}
defineProps<Props>()
@@ -137,6 +157,30 @@ const getDownloadUrl = (record: ReceivedFileRecord) => {
const getQRCodeValue = (record: ReceivedFileRecord) => {
return buildReceivedRecordQrValue(record)
}
const isPreviewable = (record: ReceivedFileRecord) => {
if (!record.downloadUrl) return false
const extension = record.filename.split('.').pop()?.toLowerCase() || ''
return [
'jpg',
'jpeg',
'png',
'gif',
'webp',
'bmp',
'svg',
'mp4',
'webm',
'ogg',
'mov',
'm4v',
'mp3',
'wav',
'm4a',
'flac',
'pdf'
].includes(extension)
}
</script>
<style scoped>
+7 -7
View File
@@ -4,8 +4,8 @@
class="text-sm font-medium flex items-center space-x-2 transition-colors duration-200"
:class="[
isDarkMode
? 'text-gray-300 group-focus-within:text-indigo-400'
: 'text-gray-700 group-focus-within:text-indigo-600'
? 'text-gray-300 group-focus-within:text-zinc-100'
: 'text-gray-700 group-focus-within:text-zinc-950'
]"
>
<span>{{ label }}</span>
@@ -13,8 +13,8 @@
class="h-px flex-1 transition-colors duration-200"
:class="[
isDarkMode
? 'bg-gray-700 group-focus-within:bg-indigo-500/50'
: 'bg-gray-200 group-focus-within:bg-indigo-500/30'
? 'bg-gray-700 group-focus-within:bg-zinc-500/50'
: 'bg-gray-200 group-focus-within:bg-zinc-500/30'
]"
></div>
</label>
@@ -25,8 +25,8 @@
class="block w-full rounded-lg border-0 py-2.5 pl-4 pr-10 transition-all duration-200 focus:ring-2 focus:ring-inset sm:text-sm"
:class="[
isDarkMode
? 'bg-gray-700/50 text-white placeholder-gray-400 focus:ring-indigo-500/50'
: 'bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-indigo-500'
? 'bg-gray-700/50 text-white placeholder-gray-400 focus:ring-zinc-500/50'
: 'bg-gray-50 text-gray-900 placeholder-gray-400 focus:ring-zinc-500'
]"
:placeholder="placeholder"
@input="handleInput"
@@ -34,7 +34,7 @@
<div
class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none transition-opacity duration-200 opacity-0 group-focus-within:opacity-100"
>
<CheckIcon class="w-5 h-5" :class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']" />
<CheckIcon class="w-5 h-5" :class="[isDarkMode ? 'text-zinc-100' : 'text-zinc-900']" />
</div>
</div>
</div>
+67 -40
View File
@@ -1,75 +1,102 @@
<template>
<div class="flex-grow overflow-y-auto p-6">
<transition-group name="list" tag="div" class="space-y-4">
<div class="flex-1 overflow-y-auto p-4 sm:p-6">
<transition-group v-if="records.length" name="list" tag="div" class="space-y-3 sm:space-y-4">
<div
v-for="record in records"
:key="record.id"
class="bg-opacity-50 rounded-lg p-4 flex items-center shadow-md hover:shadow-lg transition duration-300 transform hover:scale-102"
:class="[isDarkMode ? 'bg-gray-800 hover:bg-gray-700' : 'bg-gray-100 hover:bg-white']"
class="group flex cursor-pointer items-center gap-3 rounded-xl border p-3 transition-all duration-300 sm:gap-4 sm:rounded-2xl sm:p-4"
:class="
isDarkMode
? 'border-zinc-800/50 bg-zinc-900/40 hover:border-zinc-700 hover:bg-zinc-800/80'
: 'border-slate-100 bg-white shadow-[0_2px_10px_-4px_rgba(0,0,0,0.05)] hover:border-slate-200 hover:shadow-[0_8px_20px_-8px_rgba(0,0,0,0.1)]'
"
@click="$emit('view-details', record)"
>
<div class="flex-shrink-0 mr-4">
<FileIcon
class="w-10 h-10"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<div
class="rounded-lg p-2.5 transition-colors sm:rounded-[1rem] sm:p-3.5"
:class="
isDarkMode
? 'bg-zinc-950 text-zinc-200 group-hover:bg-white/10'
: 'bg-zinc-100 text-zinc-800 group-hover:bg-zinc-200'
"
>
<FileIcon class="h-5 w-5" :stroke-width="1.5" />
</div>
<div class="flex-grow min-w-0 mr-4">
<div class="min-w-0 flex-1">
<p
class="font-medium text-lg truncate"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
class="mb-0.5 truncate text-sm font-medium sm:mb-1"
:class="isDarkMode ? 'text-zinc-200' : 'text-slate-700'"
>
{{ record.filename }}
</p>
<p
class="text-sm truncate"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']"
<div
class="flex items-center gap-1.5 truncate text-[10px] font-medium sm:gap-2 sm:text-xs"
:class="isDarkMode ? 'text-zinc-500' : 'text-slate-400'"
>
{{ record.date }} · {{ record.size }}
</p>
<span>{{ record.size }}</span>
<span class="h-1 w-1 rounded-full bg-current opacity-50"></span>
<span class="truncate">{{ record.date }}</span>
</div>
</div>
<div class="flex-shrink-0 flex space-x-2">
<div class="flex shrink-0 items-center gap-1">
<button
@click="$emit('view-details', record)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode
? 'hover:bg-indigo-400 text-indigo-400'
: 'hover:bg-indigo-100 text-indigo-600'
]"
type="button"
@click.stop="$emit('view-details', record)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-zinc-300 hover:bg-zinc-700' : 'text-slate-600 hover:bg-slate-100'
"
:aria-label="t('fileRecord.viewDetails')"
>
<EyeIcon class="w-5 h-5" />
<EyeIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
<button
@click="$emit('download-record', record)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode
? 'hover:bg-green-400 text-green-400'
: 'hover:bg-green-100 text-green-600'
]"
type="button"
@click.stop="$emit('download-record', record)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-zinc-300 hover:bg-zinc-700' : 'text-slate-600 hover:bg-slate-100'
"
:aria-label="t('fileRecord.download')"
>
<DownloadIcon class="w-5 h-5" />
<DownloadIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
<button
@click="$emit('delete-record', record.id)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode ? 'hover:bg-red-400 text-red-400' : 'hover:bg-red-100 text-red-600'
]"
type="button"
@click.stop="$emit('delete-record', record.id)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-red-300 hover:bg-red-500/10' : 'text-red-500 hover:bg-red-50'
"
:aria-label="t('fileRecord.deleteRecord')"
>
<TrashIcon class="w-5 h-5" />
<TrashIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
</div>
</div>
</transition-group>
<div
v-else
class="rounded-2xl border px-4 py-10 text-center text-sm"
:class="
isDarkMode
? 'border-zinc-800 bg-zinc-900/40 text-zinc-500'
: 'border-slate-100 bg-white text-slate-400'
"
>
{{ t('common.noData') }}
</div>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { FileIcon, EyeIcon, DownloadIcon, TrashIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import type { ReceivedFileRecord } from '@/types'
const { t } = useI18n()
interface Props {
records: ReceivedFileRecord[]
}
+33 -25
View File
@@ -1,14 +1,14 @@
<template>
<div
class="rounded-2xl p-8 flex flex-col items-center justify-center border-2 border-dashed transition-all duration-300 group cursor-pointer relative min-h-72 overflow-hidden"
class="group relative flex min-h-[10rem] cursor-pointer flex-col items-center justify-center overflow-hidden rounded-2xl border-2 border-dashed p-6 transition-all duration-300 sm:min-h-[12rem] sm:p-8"
:class="[
isDarkMode
? 'bg-gray-800/60 border-gray-600 hover:border-indigo-400'
: 'bg-white/80 border-gray-300 hover:border-indigo-500',
? 'bg-zinc-950/50 border-zinc-800 hover:border-zinc-600'
: 'bg-white border-slate-200 hover:border-zinc-400',
isDragActive
? isDarkMode
? 'border-indigo-400 bg-indigo-500/10 shadow-lg shadow-indigo-900/30'
: 'border-indigo-500 bg-indigo-50 shadow-lg shadow-indigo-100'
? 'border-zinc-500 bg-white/5 shadow-lg shadow-white/5'
: 'border-zinc-400 bg-zinc-100/80 shadow-lg shadow-zinc-200'
: '',
statusClass
]"
@@ -38,9 +38,7 @@
>
<div
class="absolute inset-3 rounded-2xl border"
:class="[
isDarkMode ? 'border-indigo-300/30 bg-indigo-400/5' : 'border-indigo-300 bg-indigo-50/80'
]"
:class="[isDarkMode ? 'border-white/15 bg-white/5' : 'border-zinc-300 bg-zinc-100/80']"
></div>
</div>
@@ -51,16 +49,19 @@
<!-- 上传状态图标 -->
<component
:is="statusIcon"
:class="['relative z-10 w-16 h-16 transition-colors duration-300', statusIconClass]"
:class="[
'relative z-10 h-14 w-14 transition-colors duration-300 sm:h-16 sm:w-16',
statusIconClass
]"
/>
<!-- 文件名或占位文本 -->
<p
:class="[
'relative z-10 mt-4 text-sm transition-colors duration-300 w-full text-center',
'relative z-10 mt-3 w-full text-center text-sm transition-colors duration-300 sm:mt-4',
isDarkMode
? 'text-gray-400 group-hover:text-indigo-400'
: 'text-gray-600 group-hover:text-indigo-600'
? 'text-zinc-400 group-hover:text-zinc-100'
: 'text-slate-600 group-hover:text-zinc-950'
]"
>
<span v-if="selectedFiles && selectedFiles.length > 1" class="block">
@@ -84,26 +85,30 @@
v-for="file in selectedFiles.slice(0, 3)"
:key="`${file.name}-${file.size}`"
class="max-w-40 truncate rounded-full px-3 py-1 text-xs"
:class="[isDarkMode ? 'bg-gray-700/80 text-gray-200' : 'bg-gray-100 text-gray-700']"
:class="[isDarkMode ? 'bg-zinc-800/80 text-zinc-200' : 'bg-slate-100 text-slate-700']"
>
{{ file.name }}
</span>
<span
v-if="selectedFiles.length > 3"
class="rounded-full px-3 py-1 text-xs"
:class="[isDarkMode ? 'bg-indigo-500/20 text-indigo-200' : 'bg-indigo-100 text-indigo-700']"
:class="[isDarkMode ? 'bg-white/10 text-zinc-100' : 'bg-zinc-100 text-zinc-700']"
>
+{{ selectedFiles.length - 3 }}
</span>
</div>
<!-- 进度详情(上传中显示) -->
<div v-if="isUploading && showProgressDetails" class="relative z-10 mt-3 w-full">
<div
v-if="isUploading && showProgressDetails && totalBytes > 0"
class="relative z-10 mt-3 w-full"
>
<div
class="flex justify-between text-xs mb-1"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="[isDarkMode ? 'text-zinc-400' : 'text-slate-500']"
>
<span>{{ formatBytes(uploadedBytes) }} / {{ formatBytes(totalBytes) }}</span>
<span v-if="uploadSpeed > 0">{{ formatBytes(uploadSpeed) }}/s</span>
<span>{{ progress }}%</span>
</div>
</div>
@@ -115,8 +120,8 @@
class="mt-3 px-4 py-2 text-sm rounded-lg transition-colors duration-200"
:class="[
isDarkMode
? 'bg-indigo-600 hover:bg-indigo-500 text-white'
: 'bg-indigo-500 hover:bg-indigo-600 text-white'
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
]"
>
{{ retryLabel }}
@@ -148,6 +153,8 @@ interface Props {
uploadedBytes?: number
/** 总字节数 */
totalBytes?: number
/** 上传速度,单位 bytes/s */
uploadSpeed?: number
/** 错误消息 */
errorMessage?: string
/** 是否允许重试 */
@@ -175,6 +182,7 @@ const props = withDefaults(defineProps<Props>(), {
uploadStatus: 'idle',
uploadedBytes: 0,
totalBytes: 0,
uploadSpeed: 0,
errorMessage: '',
allowRetry: true,
retryText: '',
@@ -222,17 +230,17 @@ const statusIcon = computed(() => {
const statusIconClass = computed(() => {
if (isUploading.value) {
return isDarkMode.value ? 'text-indigo-400 animate-spin' : 'text-indigo-600 animate-spin'
return isDarkMode.value ? 'text-zinc-100 animate-spin' : 'text-zinc-900 animate-spin'
}
if (isSuccess.value) {
return isDarkMode.value ? 'text-green-400' : 'text-green-600'
return isDarkMode.value ? 'text-zinc-100' : 'text-zinc-900'
}
if (hasError.value) {
return isDarkMode.value ? 'text-red-400' : 'text-red-600'
}
return isDarkMode.value
? 'text-gray-400 group-hover:text-indigo-400'
: 'text-gray-600 group-hover:text-indigo-600'
? 'text-zinc-400 group-hover:text-zinc-100'
: 'text-slate-600 group-hover:text-zinc-950'
})
const statusClass = computed(() => {
@@ -240,7 +248,7 @@ const statusClass = computed(() => {
return isDarkMode.value ? 'border-red-500/50' : 'border-red-300'
}
if (isSuccess.value) {
return isDarkMode.value ? 'border-green-500/50' : 'border-green-300'
return isDarkMode.value ? 'border-zinc-500/70' : 'border-zinc-300'
}
return ''
})
@@ -269,9 +277,9 @@ const statusDescriptionClass = computed(() => {
return isDarkMode.value ? 'text-red-400' : 'text-red-500'
}
if (isSuccess.value) {
return isDarkMode.value ? 'text-green-400' : 'text-green-500'
return isDarkMode.value ? 'text-zinc-200' : 'text-zinc-700'
}
return isDarkMode.value ? 'text-gray-500' : 'text-gray-400'
return isDarkMode.value ? 'text-zinc-500' : 'text-slate-400'
})
const formatBytes = (bytes: number): string => {
+12 -6
View File
@@ -1,6 +1,10 @@
<template>
<div class="space-y-2">
<label v-if="label" class="block text-sm font-medium" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
<label
v-if="label"
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ label }}
<span v-if="required" class="text-red-500 ml-1">*</span>
</label>
@@ -14,11 +18,11 @@
:disabled="disabled"
:minlength="minlength"
:maxlength="maxlength"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-xl border px-4 py-2.5 shadow-sm outline-none transition-all duration-200 ease-in-out focus:border-zinc-500 focus:ring-2 focus:ring-zinc-500"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500',
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300',
disabled ? 'opacity-50 cursor-not-allowed' : '',
error ? 'border-red-500 focus:border-red-500 focus:ring-red-500' : ''
]"
@@ -26,7 +30,9 @@
<slot name="suffix"></slot>
</div>
<p v-if="error" class="text-sm text-red-500">{{ error }}</p>
<p v-if="hint" class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']">{{ hint }}</p>
<p v-if="hint" class="text-sm" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']">
{{ hint }}
</p>
</div>
</template>
@@ -57,4 +63,4 @@ defineEmits<{
}>()
const isDarkMode = inject('isDarkMode')
</script>
</script>
+18 -17
View File
@@ -3,22 +3,19 @@
<button
@click="toggleDropdown"
:class="[
'flex items-center space-x-2 px-3 py-2 rounded-lg transition-all duration-200',
'flex items-center gap-2 rounded-full border px-3 py-2 text-sm shadow-sm backdrop-blur-xl transition-all duration-300 hover:scale-105 active:scale-95',
isDarkMode
? 'bg-gray-800/60 hover:bg-gray-700/80 text-gray-300 hover:text-white'
: 'bg-gray-100 hover:bg-gray-200 text-gray-700 hover:text-gray-900'
? 'border-zinc-700 bg-zinc-800/80 text-zinc-300 hover:bg-zinc-700 hover:text-zinc-100'
: 'border-slate-200/50 bg-white/80 text-slate-500 hover:text-slate-700'
]"
>
<GlobeIcon class="w-4 h-4" />
<span class="text-sm font-medium">{{ currentLanguage.name }}</span>
<ChevronDownIcon
:class="[
'w-4 h-4 transition-transform duration-200',
{ 'rotate-180': isDropdownOpen }
]"
<ChevronDownIcon
:class="['w-4 h-4 transition-transform duration-200', { 'rotate-180': isDropdownOpen }]"
/>
</button>
<transition
enter-active-class="transition ease-out duration-200"
enter-from-class="opacity-0 scale-95"
@@ -30,10 +27,10 @@
<div
v-if="isDropdownOpen"
:class="[
'absolute right-0 mt-2 w-32 rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 z-50',
'absolute right-0 z-50 mt-2 w-32 overflow-hidden rounded-xl border shadow-lg',
isDarkMode
? 'bg-gray-800 border border-gray-700'
: 'bg-white border border-gray-200'
? 'border-zinc-800 bg-zinc-900 text-zinc-100'
: 'border-slate-100 bg-white text-slate-700'
]"
>
<div class="py-1">
@@ -45,11 +42,11 @@
'w-full text-left px-4 py-2 text-sm transition-colors duration-150',
currentLocale === language.code
? isDarkMode
? 'bg-indigo-600 text-white'
: 'bg-indigo-50 text-indigo-600'
? 'bg-white/10 text-zinc-100'
: 'bg-zinc-100 text-zinc-900'
: isDarkMode
? 'text-gray-300 hover:bg-gray-700 hover:text-white'
: 'text-gray-700 hover:bg-gray-100'
? 'text-zinc-300 hover:bg-zinc-800 hover:text-zinc-100'
: 'text-slate-600 hover:bg-slate-50'
]"
>
{{ language.name }}
@@ -73,7 +70,11 @@ const switcherRef = ref<HTMLElement | null>(null)
const currentLocale = computed(() => locale.value)
const currentLanguage = computed(() => {
return availableLocales.find((lang: { code: string; name: string }) => lang.code === currentLocale.value) || availableLocales[0]
return (
availableLocales.find(
(lang: { code: string; name: string }) => lang.code === currentLocale.value
) || availableLocales[0]
)
})
const toggleDropdown = () => {
+113
View File
@@ -0,0 +1,113 @@
<template>
<transition name="fade">
<div
v-if="visible && record"
class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm"
@click.self="$emit('close')"
>
<div
class="flex max-h-[90vh] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border p-5 shadow-2xl backdrop-blur-xl transition-all duration-300 ease-out"
:class="isDarkMode ? 'border-zinc-800 bg-zinc-950/95' : 'border-white/50 bg-white/95'"
>
<div class="mb-4 flex flex-shrink-0 items-center justify-between gap-4">
<h3
class="min-w-0 truncate text-xl font-semibold tracking-tight"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
{{ record.filename }}
</h3>
<div class="flex items-center gap-2">
<a
:href="previewUrl"
target="_blank"
rel="noopener noreferrer"
class="rounded-xl px-3 py-1.5 text-sm font-semibold transition duration-300"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
>
{{ t('fileDetail.download') }}
</a>
<button
type="button"
class="rounded-xl p-1.5 transition duration-300"
:class="
isDarkMode
? 'text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100'
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-900'
"
@click="$emit('close')"
>
<XIcon class="h-5 w-5" />
</button>
</div>
</div>
<div
class="flex min-h-[16rem] flex-1 items-center justify-center overflow-hidden rounded-xl"
:class="isDarkMode ? 'bg-zinc-900/70' : 'bg-slate-50'"
>
<img
v-if="mediaType === 'image'"
:src="previewUrl"
:alt="record.filename"
class="max-h-[70vh] max-w-full object-contain"
/>
<video
v-else-if="mediaType === 'video'"
:src="previewUrl"
class="max-h-[70vh] w-full"
controls
></video>
<audio
v-else-if="mediaType === 'audio'"
:src="previewUrl"
class="w-full px-4"
controls
></audio>
<iframe
v-else
:src="previewUrl"
class="h-[70vh] w-full border-0"
:title="record.filename"
></iframe>
</div>
</div>
</div>
</transition>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { XIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import { useInjectedDarkMode } from '@/composables'
import type { ReceivedFileRecord } from '@/types'
import { buildDownloadUrl } from '@/utils/share-url'
interface Props {
visible: boolean
record: ReceivedFileRecord | null
}
const props = defineProps<Props>()
defineEmits<{
close: []
}>()
const { t } = useI18n()
const isDarkMode = useInjectedDarkMode()
const previewUrl = computed(() =>
props.record?.downloadUrl ? buildDownloadUrl(props.record.downloadUrl) : ''
)
const extension = computed(() => props.record?.filename.split('.').pop()?.toLowerCase() || '')
const mediaType = computed(() => {
if (['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'svg'].includes(extension.value)) return 'image'
if (['mp4', 'webm', 'ogg', 'mov', 'm4v'].includes(extension.value)) return 'video'
if (['mp3', 'wav', 'ogg', 'm4a', 'flac'].includes(extension.value)) return 'audio'
return 'document'
})
</script>
+30 -46
View File
@@ -1,56 +1,40 @@
<template>
<div>
<div class="mb-6 text-center" v-if="linkText && linkTo">
<router-link
:to="linkTo"
class="text-indigo-400 hover:text-indigo-300 transition duration-300"
>
{{ linkText }}
</router-link>
</div>
<div
class="px-8 py-4 bg-opacity-50 flex justify-between items-center"
:class="[isDarkMode ? 'bg-gray-800' : 'bg-gray-100']"
<div
class="flex items-center justify-between border-t px-5 py-4 transition-colors sm:px-8 sm:py-6"
:class="isDarkMode ? 'border-zinc-800/60 bg-zinc-900/40' : 'border-slate-100 bg-slate-50/50'"
>
<router-link
v-if="linkText && linkTo"
:to="linkTo"
class="group flex items-center gap-1.5 text-xs font-medium transition-colors sm:gap-2 sm:text-sm"
:class="
isDarkMode ? 'text-zinc-400 hover:text-zinc-100' : 'text-slate-500 hover:text-zinc-950'
"
>
<span
class="text-sm flex items-center"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
>
<ShieldCheckIcon class="w-4 h-4 mr-1 text-green-400" />
{{ t('send.secureEncryption') }}
</span>
<div class="flex items-center space-x-4">
<router-link
to="/login"
class="text-sm hover:text-indigo-300 transition duration-300 flex items-center"
:class="[
isDarkMode
? 'text-gray-400 hover:text-indigo-400'
: 'text-gray-500 hover:text-indigo-600'
]"
>
<UserIcon class="w-4 h-4" />
</router-link>
<button
@click="$emit('toggle-drawer')"
class="text-sm hover:text-indigo-300 transition duration-300 flex items-center"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
>
{{ drawerText }}
<ClipboardListIcon class="w-4 h-4 ml-1" />
</button>
</div>
</div>
<SendIcon
class="h-3.5 w-3.5 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5 sm:h-4 sm:w-4"
/>
{{ linkText }}
</router-link>
<span v-else></span>
<button
type="button"
@click="$emit('toggle-drawer')"
class="group flex items-center gap-1.5 text-xs font-medium transition-colors sm:gap-2 sm:text-sm"
:class="
isDarkMode ? 'text-zinc-400 hover:text-zinc-100' : 'text-slate-500 hover:text-zinc-950'
"
>
<HistoryIcon class="h-3.5 w-3.5 transition-transform group-hover:-rotate-12 sm:h-4 sm:w-4" />
{{ drawerText }}
</button>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { ShieldCheckIcon, ClipboardListIcon, UserIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import { HistoryIcon, SendIcon } from 'lucide-vue-next'
interface Props {
linkText?: string
+37 -35
View File
@@ -1,57 +1,59 @@
<template>
<div class="text-center">
<div class="flex justify-center mb-8">
<div
class="rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"
>
<div class="rounded-full bg-gray-900 p-2">
<BoxIcon class="w-8 h-8 text-white" />
</div>
</div>
</div>
<h2
<div class="mb-7 flex flex-col items-center text-center sm:mb-10">
<button
type="button"
@click="$emit('title-click')"
class="text-3xl cursor-pointer font-extrabold text-center mb-6"
:class="[
class="group relative mb-4 flex h-14 w-14 items-center justify-center rounded-[1rem] border transition-transform duration-300 hover:scale-105 sm:mb-6 sm:h-16 sm:w-16 sm:rounded-[1.25rem]"
:class="
isDarkMode
? 'text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300'
: 'text-indigo-600'
]"
? 'border-white/10 bg-white/10 text-zinc-100 shadow-[inset_0_1px_1px_rgba(255,255,255,0.08)]'
: 'border-white/80 bg-zinc-100 text-zinc-900 shadow-[inset_0_1px_1px_rgba(255,255,255,1),0_4px_10px_rgba(24,24,27,0.04)]'
"
:aria-label="title"
>
<div
class="absolute inset-0 rounded-[1rem] opacity-0 blur-md transition-opacity duration-300 group-hover:opacity-100 sm:rounded-[1.25rem]"
:class="isDarkMode ? 'bg-white/10' : 'bg-zinc-300/40'"
></div>
<component :is="headerIcon" class="relative z-10 h-7 w-7 sm:h-8 sm:w-8" :stroke-width="1.5" />
</button>
<h1
@click="$emit('title-click')"
class="mb-2 cursor-pointer text-xl font-semibold tracking-tight sm:text-2xl"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
{{ title }}
</h2>
</h1>
<p
v-if="subtitle"
class="text-xs font-medium sm:text-sm"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
>
{{ subtitle }}
</p>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { BoxIcon } from 'lucide-vue-next'
import { computed, inject } from 'vue'
import { CloudDownloadIcon, SendIcon } from 'lucide-vue-next'
interface Props {
title: string
subtitle?: string
mode?: 'retrieve' | 'send'
}
interface Emits {
'title-click': []
}
defineProps<Props>()
const props = withDefaults(defineProps<Props>(), {
subtitle: '',
mode: 'retrieve'
})
defineEmits<Emits>()
const isDarkMode = inject('isDarkMode')
const headerIcon = computed(() => (props.mode === 'send' ? SendIcon : CloudDownloadIcon))
</script>
<style scoped>
@keyframes spin-slow {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.animate-spin-slow {
animation: spin-slow 3s linear infinite;
}
</style>
+144 -66
View File
@@ -1,67 +1,47 @@
<template>
<form @submit.prevent="$emit('submit')">
<div class="mb-6 relative">
<label
for="code"
class="block text-sm font-medium mb-2"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
>{{ t('retrieve.codeInput.label') }}</label
>
<div class="relative">
<input
id="code"
v-model="code"
type="text"
ref="codeInput"
class="w-full px-4 py-3 rounded-lg placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition duration-300 pr-10"
:class="[
isDarkMode ? 'bg-gray-700 bg-opacity-50' : 'bg-gray-100',
{ 'ring-2 ring-red-500': error },
isDarkMode ? 'text-gray-300' : 'text-gray-800'
]"
:placeholder="t('retrieve.codeInput.placeholder')"
required
:readonly="inputStatus.readonly"
maxlength="5"
@focus="isInputFocused = true"
@blur="isInputFocused = false"
/>
<div
v-if="inputStatus.loading"
class="absolute inset-y-0 right-0 flex items-center pr-3"
>
<span
class="animate-spin rounded-full h-5 w-5 border-b-2 border-indigo-500"
></span>
</div>
</div>
<div
class="absolute -bottom-0.5 left-2 h-0.5 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 transition-all duration-300 ease-in-out"
:class="{ 'w-97-100': isInputFocused, 'w-0': !isInputFocused }"
></div>
<form class="space-y-6 sm:space-y-8" @submit.prevent="$emit('submit')">
<div class="flex justify-between gap-2 px-1 sm:gap-4 sm:px-2">
<input
v-for="(_, index) in codeSlots"
:key="index"
:ref="(el) => setInputRef(el, index)"
:value="codeSlots[index]"
type="text"
inputmode="text"
maxlength="1"
autocomplete="one-time-code"
:readonly="inputStatus.readonly"
:aria-label="`${t('retrieve.codeInput.label')} ${index + 1}`"
class="h-14 w-12 rounded-xl border text-center text-2xl font-semibold outline-none transition-all duration-300 sm:h-20 sm:w-16 sm:rounded-2xl sm:text-3xl"
:class="inputClass"
@input="handleInput($event, index)"
@keydown="handleKeyDown($event, index)"
@paste="handlePaste($event, index)"
/>
</div>
<button
type="submit"
class="w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold py-3 px-4 rounded-lg hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition duration-300 transform hover:scale-105 hover:shadow-lg relative overflow-hidden group"
:disabled="inputStatus.loading"
:disabled="isSubmitDisabled"
class="flex w-full items-center justify-center gap-2 rounded-xl py-3.5 text-sm font-semibold tracking-wide transition-all duration-300 sm:rounded-2xl sm:py-4 sm:text-base"
:class="submitClass"
>
<span class="flex items-center justify-center relative z-10">
<span>{{ inputStatus.loading ? t('common.loading') : t('retrieve.submit') }}</span>
<ArrowRightIcon
class="w-5 h-5 ml-2 transition-transform duration-300 transform group-hover:translate-x-1"
/>
</span>
<span
class="absolute top-0 left-0 w-full h-full bg-gradient-to-r from-pink-500 via-purple-500 to-indigo-500 opacity-0 group-hover:opacity-100 transition-opacity duration-300"
></span>
<LoaderCircleIcon
v-if="inputStatus.loading"
class="h-4 w-4 animate-spin sm:h-5 sm:w-5"
:stroke-width="2"
/>
<CloudDownloadIcon v-else class="h-4 w-4 sm:h-5 sm:w-5" :stroke-width="2" />
{{ inputStatus.loading ? t('common.loading') : t('retrieve.submit') }}
</button>
</form>
</template>
<script setup lang="ts">
import { ref, inject, computed } from 'vue'
import { ArrowRightIcon } from 'lucide-vue-next'
import { computed, nextTick, ref, watch } from 'vue'
import { CloudDownloadIcon, LoaderCircleIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import { useInjectedDarkMode } from '@/composables'
const { t } = useI18n()
@@ -84,21 +64,119 @@ interface Emits {
const props = defineProps<Props>()
const emit = defineEmits<Emits>()
const isDarkMode = inject('isDarkMode')
const code = computed({
get: () => props.modelValue,
set: (value) => emit('update:modelValue', value)
const isDarkMode = useInjectedDarkMode()
const codeSlots = ref<string[]>(Array(5).fill(''))
const inputRefs = ref<HTMLInputElement[]>([])
const joinedCode = computed(() => codeSlots.value.join(''))
const isComplete = computed(() => codeSlots.value.every(Boolean))
const inputStatusLocked = computed(() => props.inputStatus.loading || props.inputStatus.readonly)
const isSubmitDisabled = computed(() => inputStatusLocked.value || !isComplete.value)
const inputClass = computed(() => {
if (isDarkMode.value) {
return [
props.error
? 'border-red-500/60 focus:border-red-400 focus:ring-red-500/10'
: 'border-zinc-800 focus:border-zinc-500 focus:ring-white/10',
'bg-zinc-950/50 text-white focus:bg-zinc-900 focus:ring-2 sm:focus:ring-4 focus:shadow-[0_0_18px_rgba(255,255,255,0.1)]'
]
}
return [
props.error
? 'border-red-300 focus:border-red-400 focus:ring-red-500/10'
: 'border-slate-200 focus:border-zinc-400 focus:ring-zinc-950/10',
'bg-white text-slate-900 shadow-[inset_0_2px_4px_rgba(15,23,42,0.02)] focus:bg-white focus:ring-2 sm:focus:ring-4 focus:shadow-[0_10px_22px_-12px_rgba(24,24,27,0.2)]'
]
})
const isInputFocused = ref(false)
const codeInput = ref<HTMLInputElement>()
const submitClass = computed(() => {
if (isComplete.value && !inputStatusLocked.value) {
return isDarkMode.value
? 'bg-zinc-200 text-zinc-950 shadow-[0_10px_28px_-12px_rgba(255,255,255,0.45)] hover:-translate-y-0.5 hover:bg-white hover:shadow-[0_16px_34px_-14px_rgba(255,255,255,0.5)]'
: 'bg-zinc-800 text-white shadow-[0_10px_28px_-12px_rgba(24,24,27,0.35)] hover:-translate-y-0.5 hover:bg-zinc-900 hover:shadow-[0_16px_34px_-14px_rgba(24,24,27,0.42)]'
}
return isDarkMode.value
? 'cursor-not-allowed border border-zinc-700/30 bg-zinc-800/50 text-zinc-500'
: 'cursor-not-allowed border border-slate-200/50 bg-slate-100 text-slate-400'
})
const syncFromModel = (value: string) => {
const chars = value.slice(0, 5).split('')
codeSlots.value = Array.from({ length: 5 }, (_, index) => chars[index] ?? '')
}
const emitCode = () => {
emit('update:modelValue', joinedCode.value)
}
const focusInput = async (index: number) => {
await nextTick()
inputRefs.value[Math.max(0, Math.min(index, 4))]?.focus()
}
const setInputRef = (el: unknown, index: number) => {
if (el instanceof HTMLInputElement) {
inputRefs.value[index] = el
}
}
const fillFrom = (value: string, startIndex: number) => {
const chars = value
.replace(/\s/g, '')
.slice(0, 5 - startIndex)
.split('')
if (chars.length === 0) return
chars.forEach((char, offset) => {
codeSlots.value[startIndex + offset] = char
})
emitCode()
void focusInput(Math.min(startIndex + chars.length, 4))
}
const handleInput = (event: Event, index: number) => {
const target = event.target as HTMLInputElement
const value = target.value
if (value.length > 1) {
fillFrom(value, index)
return
}
codeSlots.value[index] = value.slice(-1)
emitCode()
if (value && index < 4) {
void focusInput(index + 1)
}
}
const handleKeyDown = (event: KeyboardEvent, index: number) => {
if (event.key === 'Backspace' && !codeSlots.value[index] && index > 0) {
event.preventDefault()
void focusInput(index - 1)
}
}
const handlePaste = (event: ClipboardEvent, index: number) => {
event.preventDefault()
fillFrom(event.clipboardData?.getData('text') ?? '', index)
}
watch(
() => props.modelValue,
(value) => {
if (value !== joinedCode.value) {
syncFromModel(value)
}
},
{ immediate: true }
)
defineExpose({
focus: () => codeInput.value?.focus()
focus: () => inputRefs.value[0]?.focus()
})
</script>
<style scoped>
.w-97-100 {
width: calc(100% - 1rem);
}
</style>
+27 -21
View File
@@ -1,40 +1,34 @@
<template>
<div class="flex justify-center space-x-4 mb-6">
<div
class="mb-5 grid grid-cols-2 rounded-2xl border p-1 sm:mb-6"
:class="isDarkMode ? 'border-zinc-800 bg-zinc-950/50' : 'border-slate-200/80 bg-slate-100/80'"
>
<button
type="button"
@click="selectType('file')"
:class="[
'px-4 py-2 rounded-lg transition-colors duration-300',
selectedType === 'file'
? 'bg-indigo-600 text-white'
: isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
]"
class="flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-sm font-semibold transition-all duration-300 sm:py-2.5"
:class="getButtonClass('file')"
>
<FileIcon class="h-4 w-4" />
{{ t('nav.sendFile') }}
</button>
<button
type="button"
@click="selectType('text')"
:class="[
'px-4 py-2 rounded-lg transition-colors duration-300',
selectedType === 'text'
? 'bg-indigo-600 text-white'
: isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
]"
class="flex items-center justify-center gap-2 rounded-xl px-4 py-2 text-sm font-semibold transition-all duration-300 sm:py-2.5"
:class="getButtonClass('text')"
>
<FileTextIcon class="h-4 w-4" />
{{ t('send.sendText') }}
</button>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { FileIcon, FileTextIcon } from 'lucide-vue-next'
import type { SendType } from '@/types'
import { useI18n } from 'vue-i18n'
import { useInjectedDarkMode } from '@/composables'
const { t } = useI18n()
@@ -46,11 +40,23 @@ interface Emits {
'update:selectedType': [type: SendType]
}
defineProps<Props>()
const props = defineProps<Props>()
const emit = defineEmits<Emits>()
const isDarkMode = inject('isDarkMode')
const isDarkMode = useInjectedDarkMode()
const selectType = (type: SendType) => {
emit('update:selectedType', type)
}
</script>
const getButtonClass = (type: SendType) => {
if (props.selectedType === type) {
return isDarkMode.value
? 'bg-zinc-200 text-zinc-950 shadow-[0_8px_22px_-12px_rgba(255,255,255,0.45)]'
: 'bg-white text-zinc-950 shadow-sm'
}
return isDarkMode.value
? 'text-zinc-500 hover:text-zinc-100'
: 'text-slate-500 hover:text-zinc-950'
}
</script>
+59 -41
View File
@@ -2,57 +2,59 @@
<transition name="fade">
<div
v-if="record"
class="fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-3 sm:p-4 overflow-y-auto"
class="fixed inset-0 z-50 flex items-center justify-center overflow-y-auto bg-black/60 p-3 backdrop-blur-sm sm:p-4"
>
<div
class="w-full max-w-2xl rounded-2xl shadow-2xl transform transition-all duration-300 ease-out overflow-hidden"
:class="[isDarkMode ? 'bg-gray-900 bg-opacity-70' : 'bg-white bg-opacity-95']"
class="w-full max-w-2xl overflow-hidden rounded-2xl border shadow-2xl transition-all duration-300 ease-out"
:class="isDarkMode ? 'border-zinc-800 bg-zinc-950/95' : 'border-white/50 bg-white/95'"
>
<div
class="px-4 sm:px-6 py-3 sm:py-4 border-b"
:class="[isDarkMode ? 'border-gray-800' : 'border-gray-100']"
class="border-b px-4 py-3 sm:px-6 sm:py-4"
:class="isDarkMode ? 'border-zinc-800' : 'border-slate-100'"
>
<div class="flex items-center justify-between">
<h3
class="text-lg sm:text-xl font-semibold"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
class="text-lg font-semibold sm:text-xl"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-900'"
>
{{ t('send.fileDetails') }}
</h3>
<button
@click="$emit('close')"
class="p-1.5 sm:p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"
class="rounded-lg p-1.5 transition-all duration-300 hover:scale-105 active:scale-95 sm:rounded-xl sm:p-2"
:class="
isDarkMode
? 'text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200'
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-700'
"
>
<XIcon
class="w-4 h-4 sm:w-5 sm:h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
/>
<XIcon class="h-4 w-4 sm:h-5 sm:w-5" />
</button>
</div>
</div>
<div class="p-4 sm:p-6">
<div
class="rounded-xl p-3 sm:p-4 mb-4 sm:mb-6"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-50' : 'bg-gray-50 bg-opacity-95']"
class="mb-4 rounded-2xl p-3 sm:mb-6 sm:p-4"
:class="isDarkMode ? 'bg-zinc-900/60' : 'bg-slate-50/95'"
>
<div class="flex items-center mb-3 sm:mb-4">
<div class="p-2 sm:p-3 rounded-lg" :class="[isDarkMode ? 'bg-gray-800' : 'bg-white']">
<div class="rounded-xl p-2 sm:p-3" :class="isDarkMode ? 'bg-zinc-950' : 'bg-white'">
<FileIcon
class="w-5 h-5 sm:w-6 sm:h-6"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
class="h-5 w-5 sm:h-6 sm:w-6"
:class="isDarkMode ? 'text-zinc-200' : 'text-zinc-800'"
/>
</div>
<div class="ml-3 sm:ml-4 min-w-0 flex-1">
<h4
class="font-medium text-sm sm:text-base truncate"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
class="truncate text-sm font-medium sm:text-base"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-900'"
>
{{ record.filename }}
</h4>
<p
class="text-xs sm:text-sm truncate"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
class="truncate text-xs sm:text-sm"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
>
{{ record.size }} · {{ record.date }}
</p>
@@ -62,11 +64,11 @@
<div class="flex items-center min-w-0">
<ClockIcon
class="w-3.5 h-3.5 sm:w-4 sm:h-4 mr-1.5 sm:mr-2 flex-shrink-0"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
/>
<span
class="text-xs sm:text-sm truncate"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']"
:class="isDarkMode ? 'text-zinc-300' : 'text-slate-600'"
>
{{ record.expiration }}
</span>
@@ -74,11 +76,11 @@
<div class="flex items-center min-w-0">
<ShieldCheckIcon
class="w-3.5 h-3.5 sm:w-4 sm:h-4 mr-1.5 sm:mr-2 flex-shrink-0"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
/>
<span
class="text-xs sm:text-sm truncate"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']"
:class="isDarkMode ? 'text-zinc-300' : 'text-slate-600'"
>
安全加密
</span>
@@ -88,7 +90,14 @@
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 sm:gap-6">
<div class="space-y-3 sm:space-y-4">
<div class="bg-gradient-to-br from-indigo-500 to-purple-600 rounded-xl p-4 sm:p-5 text-white">
<div
class="rounded-2xl p-4 sm:p-5"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 shadow-[0_14px_28px_-16px_rgba(255,255,255,0.45)]'
: 'bg-zinc-800 text-white shadow-[0_14px_28px_-16px_rgba(24,24,27,0.45)]'
"
>
<div class="flex items-center justify-between mb-3 sm:mb-4">
<h4 class="font-medium text-sm sm:text-base">取件码</h4>
<button
@@ -104,30 +113,34 @@
</div>
<div
class="rounded-xl p-3 sm:p-4"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-50' : 'bg-gray-50 bg-opacity-95']"
class="rounded-2xl p-3 sm:p-4"
:class="isDarkMode ? 'bg-zinc-900/60' : 'bg-slate-50/95'"
>
<div class="flex items-center justify-between mb-2 sm:mb-3">
<h4
class="font-medium text-sm sm:text-base flex items-center min-w-0"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-900'"
>
<TerminalIcon class="w-4 h-4 sm:w-5 sm:h-5 mr-1.5 sm:mr-2 text-indigo-500 flex-shrink-0" />
<TerminalIcon
class="mr-1.5 h-4 w-4 flex-shrink-0 sm:mr-2 sm:h-5 sm:w-5"
:class="isDarkMode ? 'text-zinc-300' : 'text-zinc-700'"
/>
<span class="truncate">wget下载</span>
</h4>
<button
@click="$emit('copy-wget', record)"
class="p-1.5 sm:p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors flex-shrink-0"
class="flex-shrink-0 rounded-lg p-1.5 transition-colors sm:rounded-xl sm:p-2"
:class="isDarkMode ? 'hover:bg-zinc-800' : 'hover:bg-slate-100'"
>
<ClipboardCopyIcon
class="w-4 h-4 sm:w-5 sm:h-5"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
class="h-4 w-4 sm:h-5 sm:w-5"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
/>
</button>
</div>
<p
class="text-xs sm:text-sm font-mono break-all line-clamp-2"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-600']"
:class="isDarkMode ? 'text-zinc-300' : 'text-slate-600'"
>
点击复制wget命令
</p>
@@ -135,15 +148,15 @@
</div>
<div
class="rounded-xl p-4 sm:p-5 flex flex-col items-center"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-50' : 'bg-gray-50 bg-opacity-95']"
class="flex flex-col items-center rounded-2xl p-4 sm:p-5"
:class="isDarkMode ? 'bg-zinc-900/60' : 'bg-slate-50/95'"
>
<div class="bg-white p-3 sm:p-4 rounded-lg shadow-sm mb-3 sm:mb-4">
<div class="mb-3 rounded-xl bg-white p-3 shadow-sm sm:mb-4 sm:p-4">
<QRCode :value="qrValue" :size="140" level="M" class="sm:w-[160px] sm:h-[160px]" />
</div>
<p
class="text-xs sm:text-sm truncate max-w-full"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="isDarkMode ? 'text-zinc-400' : 'text-slate-500'"
>
扫描二维码快速取件
</p>
@@ -152,12 +165,17 @@
</div>
<div
class="px-4 sm:px-6 py-3 sm:py-4 border-t"
:class="[isDarkMode ? 'border-gray-800' : 'border-gray-100']"
class="border-t px-4 py-3 sm:px-6 sm:py-4"
:class="isDarkMode ? 'border-zinc-800' : 'border-slate-100'"
>
<button
@click="$emit('copy-link', record)"
class="w-full bg-indigo-600 hover:bg-indigo-700 text-white px-4 sm:px-6 py-2 sm:py-3 rounded-lg text-sm sm:text-base font-medium transition-colors"
class="w-full rounded-xl px-4 py-2 text-sm font-semibold transition-colors sm:rounded-2xl sm:px-6 sm:py-3 sm:text-base"
:class="
isDarkMode
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100'
: 'bg-zinc-800 text-white hover:bg-zinc-900'
"
>
复制取件链接
</button>
+68 -36
View File
@@ -1,70 +1,102 @@
<template>
<div class="flex-grow overflow-y-auto p-6">
<transition-group name="list" tag="div" class="space-y-4">
<div class="flex-1 overflow-y-auto p-4 sm:p-6">
<transition-group v-if="records.length" name="list" tag="div" class="space-y-3 sm:space-y-4">
<div
v-for="record in records"
:key="record.id"
class="bg-opacity-50 rounded-lg p-4 flex items-center shadow-md hover:shadow-lg transition duration-300 transform hover:scale-102"
:class="[isDarkMode ? 'bg-gray-800 hover:bg-gray-700' : 'bg-gray-100 hover:bg-white']"
class="group flex cursor-pointer items-center gap-3 rounded-xl border p-3 transition-all duration-300 sm:gap-4 sm:rounded-2xl sm:p-4"
:class="
isDarkMode
? 'border-zinc-800/50 bg-zinc-900/40 hover:border-zinc-700 hover:bg-zinc-800/80'
: 'border-slate-100 bg-white shadow-[0_2px_10px_-4px_rgba(0,0,0,0.05)] hover:border-slate-200 hover:shadow-[0_8px_20px_-8px_rgba(0,0,0,0.1)]'
"
@click="$emit('view-details', record)"
>
<div class="flex-shrink-0 mr-4">
<FileIcon
class="w-10 h-10"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<div
class="rounded-lg p-2.5 transition-colors sm:rounded-[1rem] sm:p-3.5"
:class="
isDarkMode
? 'bg-zinc-950 text-zinc-200 group-hover:bg-white/10'
: 'bg-zinc-100 text-zinc-800 group-hover:bg-zinc-200'
"
>
<FileIcon class="h-5 w-5" :stroke-width="1.5" />
</div>
<div class="flex-grow min-w-0 mr-4">
<div class="min-w-0 flex-1">
<p
class="font-medium text-lg truncate"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
class="mb-0.5 truncate text-sm font-medium sm:mb-1"
:class="isDarkMode ? 'text-zinc-200' : 'text-slate-700'"
>
{{ record.filename ? record.filename : 'Text' }}
</p>
<p class="text-sm truncate" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
{{ record.date }} · {{ record.size }}
</p>
<div
class="flex items-center gap-1.5 truncate text-[10px] font-medium sm:gap-2 sm:text-xs"
:class="isDarkMode ? 'text-zinc-500' : 'text-slate-400'"
>
<span>{{ record.size }}</span>
<span class="h-1 w-1 rounded-full bg-current opacity-50"></span>
<span class="truncate">{{ record.date }}</span>
</div>
</div>
<div class="flex-shrink-0 flex space-x-2">
<div class="flex shrink-0 items-center gap-1">
<button
@click="$emit('copy-link', record)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode ? 'hover:bg-blue-400 text-blue-400' : 'hover:bg-blue-100 text-blue-600'
]"
type="button"
@click.stop="$emit('copy-link', record)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-zinc-300 hover:bg-zinc-700' : 'text-slate-600 hover:bg-slate-100'
"
:aria-label="t('fileManage.copyLink')"
>
<ClipboardCopyIcon class="w-5 h-5" />
<ClipboardCopyIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
<button
@click="$emit('view-details', record)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode
? 'hover:bg-green-400 text-green-400'
: 'hover:bg-green-100 text-green-600'
]"
type="button"
@click.stop="$emit('view-details', record)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-zinc-300 hover:bg-zinc-700' : 'text-slate-600 hover:bg-slate-100'
"
:aria-label="t('fileRecord.viewDetails')"
>
<EyeIcon class="w-5 h-5" />
<EyeIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
<button
@click="$emit('delete-record', record.id)"
class="p-2 rounded-full hover:bg-opacity-20 transition duration-300"
:class="[
isDarkMode ? 'hover:bg-red-400 text-red-400' : 'hover:bg-red-100 text-red-600'
]"
type="button"
@click.stop="$emit('delete-record', record.id)"
class="rounded-lg p-2 opacity-100 transition-all duration-300 sm:-translate-x-2 sm:opacity-0 sm:group-hover:translate-x-0 sm:group-hover:opacity-100 sm:rounded-xl sm:p-2.5"
:class="
isDarkMode ? 'text-red-300 hover:bg-red-500/10' : 'text-red-500 hover:bg-red-50'
"
:aria-label="t('fileRecord.deleteRecord')"
>
<TrashIcon class="w-5 h-5" />
<TrashIcon class="h-4 w-4 sm:h-[18px] sm:w-[18px]" />
</button>
</div>
</div>
</transition-group>
<div
v-else
class="rounded-2xl border px-4 py-10 text-center text-sm"
:class="
isDarkMode
? 'border-zinc-800 bg-zinc-900/40 text-zinc-500'
: 'border-slate-100 bg-white text-slate-400'
"
>
{{ t('common.noData') }}
</div>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { ClipboardCopyIcon, EyeIcon, FileIcon, TrashIcon } from 'lucide-vue-next'
import { useI18n } from 'vue-i18n'
import type { SentFileRecord } from '@/types'
const { t } = useI18n()
defineProps<{
records: SentFileRecord[]
}>()
+8 -5
View File
@@ -1,21 +1,24 @@
<template>
<div class="space-y-2">
<label class="block text-sm font-medium" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ label }}
</label>
<div class="flex items-center space-x-2">
<input
type="number"
:value="modelValue"
class="w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-24 rounded-xl border px-4 py-2.5 shadow-sm outline-none transition-all duration-200 ease-in-out focus:border-zinc-500 focus:ring-2 focus:ring-zinc-500"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
@input="handleInput"
/>
<span :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">{{ suffix }}</span>
<span :class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']">{{ suffix }}</span>
</div>
</div>
</template>
+16 -5
View File
@@ -1,13 +1,24 @@
<template>
<div class="space-y-2">
<label class="block text-sm font-medium mb-2" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
<label
class="block text-sm font-medium mb-2"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ label }}
</label>
<div class="flex items-center">
<button
type="button"
class="relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
:class="[modelValue === 1 ? 'bg-indigo-600' : 'bg-gray-200']"
class="relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:ring-offset-2"
:class="[
modelValue === 1
? isDarkMode
? 'bg-zinc-100'
: 'bg-zinc-900'
: isDarkMode
? 'bg-white/10'
: 'bg-zinc-200'
]"
role="switch"
:aria-checked="modelValue === 1"
@click="$emit('toggle')"
@@ -16,11 +27,11 @@
class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
:class="[
modelValue === 1 ? 'translate-x-5' : 'translate-x-0',
isDarkMode && modelValue !== 1 ? 'bg-gray-100' : 'bg-white'
isDarkMode && modelValue === 1 ? 'bg-zinc-950' : 'bg-white'
]"
/>
</button>
<span class="ml-3 text-sm" :class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']">
<span class="ml-3 text-sm" :class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']">
{{ modelValue === 1 ? enabledText : disabledText }}
</span>
</div>
+61 -31
View File
@@ -1,33 +1,60 @@
<template>
<transition name="drawer">
<div
v-if="visible"
class="fixed inset-y-0 right-0 w-full sm:w-120 bg-opacity-70 backdrop-filter backdrop-blur-xl shadow-2xl z-50 overflow-hidden flex flex-col"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-white']"
>
<div v-if="visible">
<transition name="drawer-overlay" appear>
<div
class="flex justify-between items-center p-6 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
class="fixed inset-0 z-40 backdrop-blur-sm"
:class="isDarkMode ? 'bg-black/60' : 'bg-slate-900/20'"
@click="$emit('close')"
></div>
</transition>
<transition name="drawer" appear>
<aside
class="fixed right-0 top-0 z-50 flex h-full w-full flex-col overflow-hidden border-l shadow-2xl sm:w-[28rem]"
:class="
isDarkMode
? 'border-zinc-800 bg-zinc-950'
: 'border-white/50 bg-white/95 backdrop-blur-xl'
"
>
<h3 class="text-2xl font-bold" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
{{ title }}
</h3>
<button
@click="$emit('close')"
class="hover:text-white transition duration-300"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-800']"
<div
class="flex items-center justify-between border-b px-5 py-5 sm:px-8 sm:py-6"
:class="isDarkMode ? 'border-zinc-800/80' : 'border-slate-100'"
>
<XIcon class="w-6 h-6" />
</button>
</div>
<slot></slot>
</div>
</transition>
<h3
class="flex items-center gap-2 text-lg font-semibold tracking-tight sm:gap-3 sm:text-xl"
:class="isDarkMode ? 'text-zinc-100' : 'text-slate-800'"
>
<span
class="rounded-lg p-1.5 sm:rounded-xl sm:p-2"
:class="isDarkMode ? 'bg-white/10 text-zinc-100' : 'bg-zinc-100 text-zinc-900'"
>
<HistoryIcon class="h-[18px] w-[18px] sm:h-5 sm:w-5" />
</span>
{{ title }}
</h3>
<button
type="button"
@click="$emit('close')"
class="rounded-lg p-1.5 transition-all duration-300 hover:scale-105 active:scale-95 sm:rounded-xl sm:p-2"
:class="
isDarkMode
? 'text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200'
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-700'
"
>
<XIcon class="h-5 w-5" />
</button>
</div>
<slot></slot>
</aside>
</transition>
</div>
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { XIcon } from 'lucide-vue-next'
import { HistoryIcon, XIcon } from 'lucide-vue-next'
interface Props {
visible: boolean
@@ -44,20 +71,23 @@ const isDarkMode = inject('isDarkMode')
</script>
<style scoped>
.drawer-overlay-enter-active,
.drawer-overlay-leave-active {
transition: opacity 0.3s ease;
}
.drawer-overlay-enter-from,
.drawer-overlay-leave-to {
opacity: 0;
}
.drawer-enter-active,
.drawer-leave-active {
transition: transform 0.3s ease;
transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.drawer-enter-from,
.drawer-leave-to {
transform: translateX(100%);
}
@media (min-width: 640px) {
.sm\:w-120 {
width: 30rem;
/* 480px */
}
}
</style>
</style>
+18 -21
View File
@@ -1,12 +1,21 @@
<template>
<div class="p-6 rounded-lg shadow-md transition-colors duration-300"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']">
<div
class="rounded-2xl border p-5 shadow-sm backdrop-blur-xl transition-colors duration-300"
:class="[
isDarkMode
? 'border-white/10 bg-white/[0.06] shadow-[0_20px_50px_-34px_rgba(255,255,255,0.2)]'
: 'border-white/80 bg-white/70 shadow-[0_20px_50px_-34px_rgba(24,24,27,0.28)]'
]"
>
<div class="flex items-center justify-between">
<div>
<p class="text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
<p class="text-sm font-medium" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']">
{{ title }}
</p>
<h3 class="text-2xl font-bold mt-1" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
<h3
class="text-2xl font-semibold mt-1"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ value }}
</h3>
</div>
@@ -29,7 +38,7 @@ interface Props {
title: string
value: string | number
icon: Component
iconColor: 'indigo' | 'purple' | 'green' | 'blue'
iconColor: 'zinc'
descriptionType?: 'success' | 'error' | 'neutral'
}
@@ -40,30 +49,18 @@ const props = withDefaults(defineProps<Props>(), {
const isDarkMode = useInjectedDarkMode()
const iconBgClass = computed(() => {
const colorMap = {
indigo: isDarkMode.value ? 'bg-indigo-900' : 'bg-indigo-100',
purple: isDarkMode.value ? 'bg-purple-900' : 'bg-purple-100',
green: isDarkMode.value ? 'bg-green-900' : 'bg-green-100',
blue: isDarkMode.value ? 'bg-blue-900' : 'bg-blue-100'
}
return colorMap[props.iconColor]
return isDarkMode.value ? 'bg-white/10' : 'bg-zinc-100/90'
})
const iconClass = computed(() => {
const colorMap = {
indigo: isDarkMode.value ? 'text-indigo-400' : 'text-indigo-600',
purple: isDarkMode.value ? 'text-purple-400' : 'text-purple-600',
green: isDarkMode.value ? 'text-green-400' : 'text-green-600',
blue: isDarkMode.value ? 'text-blue-400' : 'text-blue-600'
}
return colorMap[props.iconColor]
return isDarkMode.value ? 'text-zinc-100' : 'text-zinc-700'
})
const descriptionClass = computed(() => {
const typeMap = {
success: isDarkMode.value ? 'text-green-400' : 'text-green-600',
success: isDarkMode.value ? 'text-zinc-200' : 'text-zinc-700',
error: isDarkMode.value ? 'text-red-400' : 'text-red-600',
neutral: isDarkMode.value ? 'text-gray-400' : 'text-gray-600'
neutral: isDarkMode.value ? 'text-zinc-500' : 'text-zinc-500'
}
return typeMap[props.descriptionType]
})
+5 -4
View File
@@ -1,15 +1,16 @@
<template>
<div class="flex flex-col">
<textarea
id="text-content"
:value="modelValue"
@input="updateValue"
:rows="rows"
:placeholder="placeholderText"
:class="[
'flex-grow px-4 py-3 rounded-xl placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition duration-300 resize-none custom-scrollbar',
'flex-grow resize-none rounded-2xl border px-4 py-3 placeholder-slate-400 outline-none transition duration-300 custom-scrollbar focus:ring-2',
isDarkMode
? 'bg-gray-800 bg-opacity-50 text-white'
: 'bg-white text-gray-900 border border-gray-300'
? 'border-zinc-800 bg-zinc-950/50 text-zinc-100 focus:border-zinc-500 focus:ring-white/10'
: 'border-slate-200 bg-white text-slate-900 focus:border-zinc-400 focus:ring-zinc-950/10'
]"
></textarea>
</div>
@@ -91,4 +92,4 @@ const updateValue = (event: Event) => {
:deep([class*='dark']) .custom-scrollbar::-webkit-scrollbar-thumb:hover {
background-color: rgba(75, 85, 99, 0.7);
}
</style>
</style>
+9 -4
View File
@@ -13,10 +13,15 @@ const toggleColorMode = () => {
<template>
<button
@click="toggleColorMode"
class="p-2 rounded-full transition-all duration-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transform hover:rotate-180"
:class="isDarkMode ? 'bg-gray-800 text-yellow-300' : 'bg-white text-gray-800'"
class="rounded-full border p-2.5 shadow-sm backdrop-blur-xl transition-all duration-300 hover:scale-105 active:scale-95 sm:p-3"
:class="
isDarkMode
? 'border-white/10 bg-zinc-800/80 text-zinc-100 hover:bg-zinc-700'
: 'border-slate-200/50 bg-white/80 text-slate-500 hover:text-slate-700'
"
aria-label="切换主题"
>
<SunIcon v-if="!isDarkMode" class="w-6 h-6" />
<MoonIcon v-else class="w-6 h-6" />
<SunIcon v-if="isDarkMode" class="h-5 w-5" />
<MoonIcon v-else class="h-5 w-5" />
</button>
</template>
+17
View File
@@ -31,8 +31,10 @@ export function useRetrieveFlow() {
})
const error = ref('')
const selectedRecord = ref<ReceivedFileRecord | null>(null)
const previewMediaRecord = ref<ReceivedFileRecord | null>(null)
const showDrawer = ref(false)
const showPreview = ref(false)
const showMediaPreview = ref(false)
const renderedContent = ref('')
const normalizedCode = computed(() => code.value.trim())
const isWorking = computed(() => isInspecting.value || isRetrieving.value)
@@ -196,6 +198,17 @@ export function useRetrieveFlow() {
showPreview.value = false
}
const showFilePreview = () => {
if (!selectedRecord.value) return
previewMediaRecord.value = selectedRecord.value
showMediaPreview.value = true
}
const closeFilePreview = () => {
showMediaPreview.value = false
previewMediaRecord.value = null
}
watch(
() => selectedRecord.value?.content,
async (content) => {
@@ -229,9 +242,12 @@ export function useRetrieveFlow() {
error,
records,
selectedRecord,
previewMediaRecord,
showDrawer,
showPreview,
showMediaPreview,
renderedContent,
closeFilePreview,
closeContentPreview,
closeDetails,
copyContent,
@@ -240,6 +256,7 @@ export function useRetrieveFlow() {
handleSubmit,
inspectCode,
resetInspection,
showFilePreview,
showContentPreview,
toggleDrawer,
viewDetails
+86 -5
View File
@@ -4,7 +4,7 @@ import { useAlertStore } from '@/stores/alertStore'
import { useAdminStore } from '@/stores/adminStore'
import { useConfigStore } from '@/stores/configStore'
import { useFileDataStore } from '@/stores/fileData'
import type { SendType, SentFileRecord } from '@/types'
import type { SendType, SentFileRecord, UploadProgress } from '@/types'
import { getClipboardFile, insertTextAtSelection } from '@/utils/clipboard-paste'
import { getErrorMessage } from '@/utils/common'
import { getStorageUnit } from '@/utils/convert'
@@ -27,6 +27,10 @@ export function useSendFlow() {
const expirationMethod = ref(config.value.expireStyle[0] || 'day')
const expirationValue = ref('1')
const uploadProgress = ref(0)
const uploadedBytes = ref(0)
const totalBytes = ref(0)
const uploadSpeed = ref(0)
const lastProgressSnapshot = ref({ loaded: 0, time: 0 })
const showDrawer = ref(false)
const selectedRecord = ref<SentFileRecord | null>(null)
const isSubmitting = ref(false)
@@ -37,6 +41,22 @@ export function useSendFlow() {
size: getStorageUnit(config.value.uploadSize)
})
)
const allowedFileTypes = computed(() => {
const types = config.value.allowedFileTypes || config.value.allowed_file_types || ['*']
const normalized = types.map((type) => String(type).trim()).filter(Boolean)
return normalized.length > 0 ? normalized : ['*']
})
const acceptedTypes = computed(() => {
if (allowedFileTypes.value.some((type) => type === '*' || type === '*/*')) return '*'
return allowedFileTypes.value
.map((type) => {
const normalizedType = type.toLowerCase()
if (normalizedType.includes('/')) return normalizedType
return normalizedType.startsWith('.') ? normalizedType : `.${normalizedType}`
})
.join(',')
})
const expirationOptions = computed(() =>
config.value.expireStyle.map((value) => ({
value,
@@ -60,8 +80,21 @@ export function useSendFlow() {
getMaxFileSize: () => configStore.uploadSizeLimit,
notify: (message, type) => alertStore.showAlert(message, type),
translate: t,
onProgress: (progress) => {
uploadProgress.value = progress
onProgress: (progress: UploadProgress) => {
const now = performance.now()
if (lastProgressSnapshot.value.time > 0 && now > lastProgressSnapshot.value.time) {
const deltaBytes = Math.max(0, progress.loaded - lastProgressSnapshot.value.loaded)
const deltaSeconds = (now - lastProgressSnapshot.value.time) / 1000
uploadSpeed.value = deltaSeconds > 0 ? deltaBytes / deltaSeconds : 0
}
lastProgressSnapshot.value = {
loaded: progress.loaded,
time: now
}
uploadedBytes.value = progress.loaded
totalBytes.value = progress.total
uploadProgress.value = progress.percentage
},
onHashCalculated: (hash) => {
fileHash.value = hash
@@ -76,6 +109,14 @@ export function useSendFlow() {
return true
}
const resetUploadProgress = () => {
uploadProgress.value = 0
uploadedBytes.value = 0
totalBytes.value = 0
uploadSpeed.value = 0
lastProgressSnapshot.value = { loaded: 0, time: 0 }
}
const checkFileSize = (file: File) => {
if (file.size > config.value.uploadSize) {
alertStore.showAlert(
@@ -88,6 +129,36 @@ export function useSendFlow() {
return true
}
const checkFileType = (file: File) => {
if (allowedFileTypes.value.some((type) => type === '*' || type === '*/*')) {
return true
}
const fileName = file.name.toLowerCase()
const mimeType = file.type.toLowerCase()
const isAllowed = allowedFileTypes.value.some((type) => {
const rule = type.toLowerCase()
if (rule.includes('/')) {
if (rule.endsWith('/*')) {
return mimeType.startsWith(rule.slice(0, -1))
}
return mimeType === rule
}
const extension = rule.startsWith('.') ? rule : `.${rule}`
return fileName.endsWith(extension)
})
if (!isAllowed) {
alertStore.showAlert(
t('send.messages.fileTypeNotAllowed', { types: allowedFileTypes.value.join(', ') }),
'error'
)
}
return isAllowed
}
const checkExpirationTime = (method: string, value: string): boolean =>
isExpirationWithinLimit(method, value, config.value.max_save_seconds || 0)
@@ -95,6 +166,7 @@ export function useSendFlow() {
if (!selectedFile.value) return false
if (!checkOpenUpload()) return false
if (!checkFileSize(selectedFile.value)) return false
if (!checkFileType(selectedFile.value)) return false
if (!checkExpirationTime(expirationMethod.value, expirationValue.value)) return false
return true
}
@@ -104,11 +176,14 @@ export function useSendFlow() {
selectedFiles.value = []
if (!checkOpenUpload()) return
if (!checkFileSize(file)) return
if (!checkFileType(file)) return
fileHash.value = await calculateFileHash(file)
}
const handleFilesSelected = async (files: File[]) => {
if (!checkOpenUpload()) return
const invalidFile = files.find((file) => !checkFileSize(file) || !checkFileType(file))
if (invalidFile) return
selectedFiles.value = files
selectedFile.value = null
fileHash.value = ''
@@ -125,6 +200,8 @@ export function useSendFlow() {
fileHash.value = await calculateFileHash(file)
} else {
if (!checkOpenUpload()) return
const invalidFile = files.find((file) => !checkFileSize(file) || !checkFileType(file))
if (invalidFile) return
selectedFiles.value = files
selectedFile.value = null
fileHash.value = ''
@@ -272,7 +349,7 @@ export function useSendFlow() {
selectedFile.value = null
selectedFiles.value = []
textContent.value = ''
uploadProgress.value = 0
resetUploadProgress()
resetPresignUpload()
selectedRecord.value = newRecord
await sentRecordActions.copyLink(newRecord)
@@ -282,7 +359,7 @@ export function useSendFlow() {
} catch (error: unknown) {
alertStore.showAlert(getErrorMessage(error, t('send.messages.sendFailed')), 'error')
} finally {
uploadProgress.value = 0
resetUploadProgress()
isSubmitting.value = false
}
}
@@ -315,6 +392,10 @@ export function useSendFlow() {
expirationMethod,
expirationValue,
uploadProgress,
uploadedBytes,
totalBytes,
uploadSpeed,
acceptedTypes,
showDrawer,
selectedRecord,
isSubmitting,
+3 -3
View File
@@ -12,7 +12,7 @@ type UseSendSubmitOptions = {
getMaxFileSize: () => number
notify: (message: string, type: AlertType) => void
translate: Translate
onProgress: (progress: number) => void
onProgress: (progress: UploadProgress) => void
onHashCalculated: (hash: string) => void
}
@@ -47,7 +47,7 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
expireStyle,
onHashCalculated: options.onHashCalculated,
onProgress: (progress: UploadProgress) => {
options.onProgress(progress.percentage)
options.onProgress(progress)
},
messages: {
initFailed: options.translate('send.messages.initChunkUploadFailed'),
@@ -66,7 +66,7 @@ export function useSendSubmit(options: UseSendSubmitOptions) {
expireValue,
expireStyle: expireStyle as ExpireStyle,
onProgress: (progress) => {
options.onProgress(progress.percentage)
options.onProgress(progress)
}
})
+25 -5
View File
@@ -47,11 +47,31 @@ export function useSystemConfig() {
const snapshotPayload = (payload: Partial<ConfigState>) => JSON.stringify(payload)
const normalizeEditableConfig = (nextConfig: Partial<ConfigState>): ConfigState => ({
...DEFAULT_CONFIG_STATE,
...nextConfig,
admin_token: ''
})
const normalizeAllowedFileTypes = (value: unknown): string[] => {
const rawTypes =
typeof value === 'string'
? value.split(',')
: Array.isArray(value)
? value
: DEFAULT_CONFIG_STATE.allowed_file_types
const normalized = rawTypes.map((item) => String(item).trim()).filter(Boolean)
return normalized.length > 0 ? normalized : ['*']
}
const normalizeEditableConfig = (nextConfig: Partial<ConfigState>): ConfigState => {
const allowedFileTypes = normalizeAllowedFileTypes(
nextConfig.allowed_file_types ?? nextConfig.allowedFileTypes
)
return {
...DEFAULT_CONFIG_STATE,
...nextConfig,
allowed_file_types: allowedFileTypes,
allowedFileTypes,
admin_token: ''
}
}
const markConfigSaved = () => {
savedPayloadSnapshot.value = snapshotPayload(buildSubmitPayload())
+29 -13
View File
@@ -3,18 +3,27 @@ import zhCN from './locales/zh-CN'
import enUS from './locales/en-US'
import { readStoredLocale, writeStoredLocale } from '@/utils/preference-storage'
type SupportedLocale = 'zh-CN' | 'en-US'
const normalizeLocale = (locale: string | null | undefined): SupportedLocale | null => {
if (!locale) return null
const normalized = locale.trim().toLowerCase()
if (normalized === 'zh' || normalized.startsWith('zh-')) return 'zh-CN'
if (normalized === 'en' || normalized.startsWith('en-')) return 'en-US'
return null
}
// 获取浏览器语言设置
const getDefaultLocale = (): string => {
const savedLocale = readStoredLocale()
const getDefaultLocale = (): SupportedLocale => {
const savedLocale = normalizeLocale(readStoredLocale())
if (savedLocale) {
writeStoredLocale(savedLocale)
return savedLocale
}
const browserLocale = navigator.language.toLowerCase()
if (browserLocale.startsWith('zh')) {
return 'zh-CN'
}
return 'en-US'
return normalizeLocale(navigator.language) ?? 'en-US'
}
const messages = {
@@ -22,21 +31,28 @@ const messages = {
'en-US': enUS
}
const defaultLocale = getDefaultLocale()
const i18n = createI18n({
legacy: false, // 使用 Composition API 模式
locale: getDefaultLocale(),
locale: defaultLocale,
fallbackLocale: 'zh-CN',
messages,
globalInjection: true // 全局注入 $t 函数
globalInjection: true, // 全局注入 $t 函数
missingWarn: import.meta.env.DEV,
fallbackWarn: import.meta.env.DEV
})
document.documentElement.lang = defaultLocale
export default i18n
// 导出切换语言的函数
export const setLocale = (locale: string) => {
i18n.global.locale.value = locale as 'zh-CN' | 'en-US'
writeStoredLocale(locale)
document.documentElement.lang = locale
const nextLocale = normalizeLocale(locale) ?? 'zh-CN'
i18n.global.locale.value = nextLocale
writeStoredLocale(nextLocale)
document.documentElement.lang = nextLocale
}
// 导出获取当前语言的函数
+15 -4
View File
@@ -145,6 +145,10 @@ export default {
s3EndpointUrl: 'Endpoint URL',
s3RegionName: 'Region Name',
s3SignatureVersion: 'Signature Version',
s3AddressingStyle: 'S3 Addressing Style',
s3AddressingAuto: 'Auto',
s3AddressingPath: 'Path-style',
s3AddressingVirtual: 'Virtual-host',
s3Hostname: 'Custom Domain',
s3v2: 'S3v2',
s3v4: 'S3v4',
@@ -165,6 +169,9 @@ export default {
uploadCountLimit: 'Max Files Allowed (within the time window)',
files: 'files',
fileSizeLimit: 'Max File Size',
allowedFileTypes: 'Allowed File Types',
allowedFileTypesPlaceholder: '* or .rar, .zip, image/*',
allowedFileTypesHelp: 'Separate multiple types with commas. * allows all; extensions and MIME wildcards are supported.',
expirationMethod: 'Expiration Options',
expirationType: 'Expiration Options',
expiration: {
@@ -205,13 +212,13 @@ export default {
// Retrieve page
retrieve: {
title: 'File Retrieval',
title: 'Retrieve File',
codeInput: {
placeholder: 'Enter 5-digit retrieval code',
placeholder: 'Enter your 5-character retrieval code',
label: 'Retrieval Code'
},
submit: 'Retrieve',
needSendFile: 'Need to send a file? Click here',
submit: 'Retrieve Now',
needSendFile: 'Need to send a file?',
recordsDrawer: 'Retrieval Records',
messages: {
invalidCode: 'Please enter a 5-digit retrieval code',
@@ -347,6 +354,7 @@ export default {
uploadFailed: 'Upload failed, please try again later',
guestUploadDisabled: 'Guest upload feature is disabled',
fileSizeExceeded: 'File size exceeds limit ({size})',
fileTypeNotAllowed: 'This file type is not allowed. Allowed types: {types}',
serverError: 'Server response error',
sendFailed: 'Send failed, please try again later',
expiresAfterCount: 'Expires after {count} times',
@@ -690,6 +698,9 @@ export default {
uploadCountLimit: 'Max Files Allowed (within the time window)',
files: 'files',
fileSizeLimit: 'Max File Size',
allowedFileTypes: 'Allowed File Types',
allowedFileTypesPlaceholder: '* or .rar, .zip, image/*',
allowedFileTypesHelp: 'Separate multiple types with commas. * allows all; extensions and MIME wildcards are supported.',
expirationMethod: 'Expiration Options',
expirationType: 'Expiration Options',
expiration: {
+20 -5
View File
@@ -145,6 +145,10 @@ export default {
s3EndpointUrl: '服务端点 URL',
s3RegionName: '区域名称',
s3SignatureVersion: '签名版本',
s3AddressingStyle: 'S3 地址风格',
s3AddressingAuto: '自动',
s3AddressingPath: 'Path-style',
s3AddressingVirtual: 'Virtual-host',
s3Hostname: '自定义域名',
s3v2: 'S3v2',
s3v4: 'S3v4',
@@ -165,6 +169,9 @@ export default {
uploadCountLimit: '允许上传文件数(限流窗口内最多上传几个文件)',
files: '个文件',
fileSizeLimit: '单文件大小上限',
allowedFileTypes: '允许上传类型',
allowedFileTypesPlaceholder: '* 或 .rar, .zip, image/*',
allowedFileTypesHelp: '多个类型用英文逗号分隔,* 表示不限制;支持扩展名和 MIME 通配。',
expirationMethod: '过期方式',
expirationType: '过期方式',
expiration: {
@@ -205,13 +212,13 @@ export default {
// 取件页面
retrieve: {
title: '文件取件',
title: '提取文件',
codeInput: {
placeholder: '请输入5位取件码',
placeholder: '请输入您的 5 位数提取码',
label: '取件码'
},
submit: '取件',
needSendFile: '需要发送文件?点击这里',
submit: '立即提取',
needSendFile: '需要发送文件?',
recordsDrawer: '取件记录',
messages: {
invalidCode: '请输入5位取件码',
@@ -277,7 +284,7 @@ export default {
},
submit: '安全寄送',
submitting: '发送中...',
needRetrieveFile: '需要取件?点击这里',
needRetrieveFile: '需要取件?',
sendRecords: '发件记录',
secureEncryption: '安全加密',
workspace: {
@@ -376,6 +383,7 @@ export default {
uploadFailed: '上传失败,请稍后重试',
guestUploadDisabled: '游客上传功能已关闭',
fileSizeExceeded: '文件大小超过限制 ({size})',
fileTypeNotAllowed: '不允许上传该类型文件,允许类型:{types}',
serverError: '服务器响应异常',
sendFailed: '发送失败,请稍后重试',
expiresAfterCount: '{count}次后过期',
@@ -713,6 +721,9 @@ export default {
uploadPerMinute: '限流时间窗口(在此时间内限制上传次数)',
uploadCountLimit: '允许上传文件数(限流窗口内最多上传几个文件)',
fileSizeLimit: '单文件大小上限',
allowedFileTypes: '允许上传类型',
allowedFileTypesPlaceholder: '* 或 .rar, .zip, image/*',
allowedFileTypesHelp: '多个类型用英文逗号分隔,* 表示不限制;支持扩展名和 MIME 通配。',
expiration: {
day: '按天数',
hour: '按小时',
@@ -727,6 +738,10 @@ export default {
s3EndpointUrl: '服务端点 URL',
s3RegionName: '区域名称',
s3SignatureVersion: '签名版本',
s3AddressingStyle: 'S3 地址风格',
s3AddressingAuto: '自动',
s3AddressingPath: 'Path-style',
s3AddressingVirtual: 'Virtual-host',
s3Hostname: '自定义域名',
s3v2: 'S3v2',
s3v4: 'S3v4',
+23 -27
View File
@@ -1,44 +1,40 @@
<template>
<div
class="flex h-screen overflow-hidden flex-col transition-colors duration-300 lg:flex-row"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']"
:class="[isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
>
<!-- Sidebar -->
<aside
class="fixed inset-y-0 left-0 z-50 flex h-full w-64 shrink-0 transform flex-col border-r lg:relative lg:h-screen lg:translate-x-0"
:class="[
isDarkMode
? 'border-gray-700 bg-gray-800 bg-opacity-90 backdrop-filter backdrop-blur-xl'
: 'border-gray-200 bg-white',
? 'border-white/10 bg-zinc-900/80 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(255,255,255,0.18)]'
: 'border-white/80 bg-white/70 backdrop-blur-2xl shadow-[12px_0_40px_-28px_rgba(24,24,27,0.24)]',
isSidebarOpen ? 'translate-x-0' : '-translate-x-full',
'transition-transform duration-300 ease-in-out lg:transition-none'
]"
>
<!-- Logo区域 -->
<div
class="flex items-center justify-between h-16 px-4 border-b"
:class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']"
class="flex h-16 shrink-0 items-center justify-between gap-3 border-b px-4"
:class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']"
>
<div class="flex items-center">
<div class="flex min-w-0 items-center">
<div
class="rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow"
class="flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl transition-colors"
:class="[isDarkMode ? 'bg-white/10 text-zinc-100' : 'bg-zinc-950 text-white']"
>
<div class="rounded-full p-1" :class="[isDarkMode ? 'bg-gray-800' : 'bg-white']">
<BoxIcon
class="w-6 h-6"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
</div>
<BoxIcon class="h-5 w-5 shrink-0" />
</div>
<h1
@click="router.push('/')"
class="ml-2 text-xl font-semibold cursor-pointer"
class="ml-2 min-w-0 truncate text-xl font-semibold cursor-pointer"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
>
{{ t('common.appName') }}
</h1>
</div>
<button @click="toggleSidebar" class="lg:hidden">
<button @click="toggleSidebar" class="shrink-0 lg:hidden">
<XIcon class="w-6 h-6" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']" />
</button>
</div>
@@ -53,11 +49,11 @@
:class="[
route.name === item.id
? isDarkMode
? 'border-indigo-400 bg-gray-700/70 text-indigo-200'
: 'border-indigo-500 bg-gray-100 text-indigo-700'
? 'border-zinc-200 bg-white/10 text-zinc-50 shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]'
: 'border-zinc-900 bg-zinc-900/[0.06] text-zinc-950 shadow-sm'
: isDarkMode
? 'border-transparent text-gray-400 hover:bg-gray-700'
: 'border-transparent text-gray-600 hover:bg-gray-100'
? 'border-transparent text-zinc-400 hover:bg-white/5 hover:text-zinc-100'
: 'border-transparent text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-900'
]"
>
<component :is="item.icon" class="mr-3 h-5 w-5 shrink-0" />
@@ -68,14 +64,14 @@
</nav>
<!-- 退出登录按钮 -->
<div class="p-4 border-t" :class="[isDarkMode ? 'border-gray-700' : 'border-gray-200']">
<div class="p-4 border-t" :class="[isDarkMode ? 'border-white/10' : 'border-zinc-200/70']">
<button
@click="handleLogout"
class="flex items-center w-full p-2 rounded-lg transition-colors duration-200"
:class="[
isDarkMode
? 'text-gray-400 hover:bg-gray-700 hover:text-white'
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
? 'text-zinc-400 hover:bg-white/5 hover:text-white'
: 'text-zinc-500 hover:bg-zinc-900/[0.04] hover:text-zinc-950'
]"
>
<LogOutIcon class="w-5 h-5 mr-3" />
@@ -88,8 +84,8 @@
<div class="flex h-full min-h-0 min-w-0 flex-1 flex-col">
<!-- Header -->
<header
class="shadow-md border-b transition-colors duration-300 h-16"
:class="[isDarkMode ? 'bg-gray-800 border-gray-700' : 'bg-white border-gray-200']"
class="border-b transition-colors duration-300 h-16 backdrop-blur-xl"
:class="[isDarkMode ? 'border-white/10 bg-zinc-900/70' : 'border-white/80 bg-white/60']"
>
<div class="flex items-center justify-between h-16 px-4">
<button @click="toggleSidebar" class="lg:hidden">
@@ -101,7 +97,7 @@
<!-- Content -->
<main
class="min-h-0 flex-1 overflow-y-auto transition-colors duration-300 custom-scrollbar"
:class="[isDarkMode ? 'bg-gray-900' : 'bg-gray-50']"
:class="[isDarkMode ? 'bg-[#101012]' : 'bg-[#f5f5f7]']"
>
<router-view />
</main>
@@ -223,11 +219,11 @@ const handleLogout = async () => {
}
input:checked + .slider {
background-color: #4f46e5;
background-color: #18181b;
}
.dark input:checked + .slider {
background-color: #4f46e5;
background-color: #f4f4f5;
}
.slider:before {
+13
View File
@@ -7,6 +7,19 @@ import App from './App.vue'
import router from './router'
import i18n from './i18n'
const OPEN_SOURCE_BANNER = String.raw`
______ _ _ _____ _ ____
| ____(_) | / ____| | | | _ \
| |__ _| | ___| | ___ __| | ___| |_) | _____ __
| __| | | |/ _ \ | / _ \ / _\` |/ _ \ _ < / _ \ \/ /
| | | | | __/ |___| (_) | (_| | __/ |_) | (_) > <
|_| |_|_|\___|\_____\___/ \__,_|\___|____/ \___/_/\_\
Open Source: https://github.com/vastsa/FileCodeBox
`
console.info(OPEN_SOURCE_BANNER)
const app = createApp(App)
app.use(createPinia())
+17 -3
View File
@@ -3,6 +3,8 @@ import type { Alert, AlertType } from '@/types'
import { TIME_CONSTANTS } from '@/constants'
let progressTimer: ReturnType<typeof setInterval> | null = null
let alertIdSeed = 0
const alertRemoveTimers = new Map<number, ReturnType<typeof setTimeout>>()
export const useAlertStore = defineStore('alert', {
state: () => ({
@@ -14,16 +16,28 @@ export const useAlertStore = defineStore('alert', {
type: AlertType = 'info',
duration = TIME_CONSTANTS.ALERT_DURATION
) {
const id = Date.now()
const id = Date.now() + alertIdSeed
alertIdSeed = (alertIdSeed + 1) % 1000
const startTime = Date.now()
this.alerts.push({ id, message, type, progress: 100, duration, startTime })
setTimeout(() => this.removeAlert(id), duration)
alertRemoveTimers.set(id, setTimeout(() => this.removeAlert(id), duration))
this.startProgressTimer()
},
removeAlert(id: number) {
const removeTimer = alertRemoveTimers.get(id)
if (removeTimer) {
clearTimeout(removeTimer)
alertRemoveTimers.delete(id)
}
const index = this.alerts.findIndex((alert) => alert.id === id)
if (index > -1) {
this.alerts.splice(index, 1)
}
if (this.alerts.length === 0) {
this.stopProgressTimer()
}
},
updateAlertProgress(id: number) {
const alert = this.alerts.find((a) => a.id === id)
@@ -37,7 +51,7 @@ export const useAlertStore = defineStore('alert', {
}
},
startProgressTimer() {
if (progressTimer) {
if (progressTimer || this.alerts.length === 0) {
return
}
+3
View File
@@ -40,6 +40,8 @@ export interface ConfigState {
notify_content: string
openUpload: number
uploadSize: number
allowed_file_types: string[]
allowedFileTypes?: string[]
storage_path: string
uploadMinute: number
max_save_seconds: number
@@ -52,6 +54,7 @@ export interface ConfigState {
s3_secret_access_key: string
aws_session_token: string
s3_signature_version: string
s3_addressing_style: string
s3_region_name: string
s3_bucket_name: string
s3_endpoint_url: string
+21
View File
@@ -3,6 +3,7 @@ import type { ConfigState, SystemConfig } from '@/types'
export type PublicConfig = SystemConfig & {
uploadSize: number
allowed_file_types?: string[]
expireStyle: string[]
openUpload: number
max_save_seconds: number
@@ -19,6 +20,8 @@ export type PublicConfig = SystemConfig & {
export const DEFAULT_PUBLIC_CONFIG: PublicConfig = {
...DEFAULT_CONFIG,
uploadSize: FILE_SIZE_LIMITS.MAX_FILE_SIZE,
allowedFileTypes: ['*'],
allowed_file_types: ['*'],
expireStyle: ['day'],
openUpload: 1,
max_save_seconds: 0,
@@ -38,6 +41,8 @@ export const DEFAULT_CONFIG_STATE: ConfigState = {
notify_content: '',
openUpload: DEFAULT_PUBLIC_CONFIG.openUpload,
uploadSize: DEFAULT_PUBLIC_CONFIG.uploadSize,
allowed_file_types: DEFAULT_PUBLIC_CONFIG.allowedFileTypes,
allowedFileTypes: DEFAULT_PUBLIC_CONFIG.allowedFileTypes,
storage_path: '',
uploadMinute: 1,
max_save_seconds: DEFAULT_PUBLIC_CONFIG.max_save_seconds,
@@ -50,6 +55,7 @@ export const DEFAULT_CONFIG_STATE: ConfigState = {
s3_secret_access_key: '',
aws_session_token: '',
s3_signature_version: '',
s3_addressing_style: 'auto',
s3_region_name: '',
s3_bucket_name: '',
s3_endpoint_url: '',
@@ -64,6 +70,17 @@ export const DEFAULT_CONFIG_STATE: ConfigState = {
webdav_password: ''
}
function normalizeFileTypes(value: unknown): string[] {
const rawTypes =
typeof value === 'string'
? value.split(',')
: Array.isArray(value)
? value
: DEFAULT_PUBLIC_CONFIG.allowedFileTypes
const normalized = rawTypes.map((item) => String(item).trim()).filter(Boolean)
return normalized.length > 0 ? normalized : ['*']
}
export function readStoredConfig<T extends object = Partial<ConfigState>>(): T | null {
try {
const rawConfig = localStorage.getItem(STORAGE_KEYS.CONFIG)
@@ -76,10 +93,14 @@ export function readStoredConfig<T extends object = Partial<ConfigState>>(): T |
export function toPublicConfig(config: Partial<ConfigState> | null | undefined): Partial<PublicConfig> {
if (!config) return {}
const allowedFileTypes = normalizeFileTypes(config.allowedFileTypes ?? config.allowed_file_types)
return {
name: config.name,
description: config.description,
uploadSize: config.uploadSize,
allowedFileTypes,
allowed_file_types: allowedFileTypes,
expireStyle: config.expireStyle,
openUpload: config.openUpload,
max_save_seconds: config.max_save_seconds,
+24 -16
View File
@@ -1,24 +1,33 @@
<template>
<div
class="min-h-screen flex items-center justify-center p-4 overflow-hidden transition-colors duration-300"
class="relative flex min-h-screen flex-col items-center justify-center overflow-hidden p-4 font-sans transition-colors duration-700 sm:p-8"
:class="isDarkMode ? 'bg-zinc-950 text-zinc-100' : 'bg-[#f5f5f7] text-zinc-900'"
>
<div class="w-full max-w-md relative z-10">
<div class="relative z-10 w-full max-w-md">
<div
class="rounded-3xl shadow-2xl overflow-hidden border transform transition-all duration-300"
:class="[
class="relative overflow-hidden rounded-[2rem] border backdrop-blur-3xl transition-all duration-500 sm:rounded-[2.5rem]"
:class="
isDarkMode
? 'bg-gray-800 bg-opacity-50 backdrop-filter backdrop-blur-xl border-gray-700'
: 'bg-white border-gray-200'
]"
? 'border-white/10 bg-zinc-900/75 shadow-[0_24px_80px_-32px_rgba(255,255,255,0.18)]'
: 'border-white/70 bg-white/80 shadow-[0_24px_70px_-28px_rgba(24,24,27,0.18)]'
"
>
<div class="p-8">
<PageHeader :title="config.name" @title-click="toSend" />
<div
class="absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/20 to-transparent"
></div>
<div class="px-5 pb-8 pt-8 sm:px-8 sm:pb-10 sm:pt-12">
<PageHeader
:title="t('retrieve.title')"
:subtitle="t('retrieve.codeInput.placeholder')"
mode="retrieve"
@title-click="toSend"
/>
<RetrieveForm
v-model="code"
:input-status="inputStatus"
:error="!!error"
@submit="handleSubmit"
ref="retrieveFormRef"
/>
</div>
<PageFooter
@@ -56,8 +65,8 @@
</template>
<script setup lang="ts">
import { inject, onMounted, watch } from 'vue'
import { storeToRefs } from 'pinia'
import { onMounted, watch } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
import PageHeader from '@/components/common/PageHeader.vue'
import RetrieveForm from '@/components/common/RetrieveForm.vue'
@@ -67,13 +76,12 @@ import FileDetailModal from '@/components/common/FileDetailModal.vue'
import FileRecordList from '@/components/common/FileRecordList.vue'
import ContentPreviewModal from '@/components/common/ContentPreviewModal.vue'
import { useRetrieveFlow } from '@/composables'
import { useConfigStore } from '@/stores/configStore'
import { useInjectedDarkMode } from '@/composables'
const isDarkMode = inject('isDarkMode')
const isDarkMode = useInjectedDarkMode()
const { t } = useI18n()
const route = useRoute()
const router = useRouter()
const configStore = useConfigStore()
const { config } = storeToRefs(configStore)
const {
code,
inputStatus,
+132 -165
View File
@@ -1,113 +1,125 @@
<template>
<div
class="min-h-screen flex items-center justify-center p-4 overflow-hidden transition-colors duration-300"
class="relative flex min-h-screen flex-col items-center justify-center overflow-hidden p-4 font-sans transition-colors duration-700 sm:p-8"
:class="isDarkMode ? 'bg-zinc-950 text-zinc-100' : 'bg-[#f5f5f7] text-zinc-900'"
@paste.prevent="handlePaste"
>
<div
class="rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
:class="[
isDarkMode
? 'bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl border-gray-700'
: 'bg-white border-gray-200'
]"
>
<div class="p-8">
<PageHeader :title="config.name" @title-click="toRetrieve" />
<form @submit.prevent="handleSubmit" class="space-y-8">
<SendTypeSelector
:selected-type="sendType"
@update:selected-type="sendType = $event"
/>
<div class="relative z-10 w-full max-w-md">
<div
class="relative overflow-hidden rounded-[2rem] border backdrop-blur-3xl transition-all duration-500 sm:rounded-[2.5rem]"
:class="
isDarkMode
? 'border-white/10 bg-zinc-900/75 shadow-[0_24px_80px_-32px_rgba(255,255,255,0.18)]'
: 'border-white/70 bg-white/80 shadow-[0_24px_70px_-28px_rgba(24,24,27,0.18)]'
"
>
<div
class="absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/20 to-transparent"
></div>
<transition name="fade" mode="out-in">
<div v-if="sendType === 'file'" key="file" class="grid grid-cols-1 gap-8">
<FileUploadArea
class="payload-panel"
:selected-file="selectedFile"
:selected-files="selectedFiles"
:progress="uploadProgress"
:description="uploadDescription"
@file-selected="handleFileSelected"
@files-selected="handleFilesSelected"
@file-drop="handleFileDrop"
/>
</div>
<div v-else key="text" class="grid grid-cols-1 gap-8">
<TextInputArea
v-model="textContent"
class="payload-panel"
:placeholder="t('send.uploadArea.textInput')"
/>
</div>
</transition>
<ExpirationSelector
v-model:expiration-method="expirationMethod"
v-model:expiration-value="expirationValue"
:options="expirationOptions"
<div class="px-5 pb-7 pt-8 sm:px-8 sm:pb-10 sm:pt-12">
<PageHeader
:title="t('send.title')"
:subtitle="
sendType === 'file'
? t('send.uploadArea.placeholder')
: t('send.uploadArea.textInput')
"
mode="send"
@title-click="toRetrieve"
/>
<!-- 提交按钮 -->
<button
type="submit"
:disabled="isSubmitting"
class="w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:scale-105 hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
<form @submit.prevent="handleSubmit" class="space-y-6 sm:space-y-8">
<SendTypeSelector :selected-type="sendType" @update:selected-type="sendType = $event" />
<transition name="fade" mode="out-in">
<div v-if="sendType === 'file'" key="file" class="grid grid-cols-1 gap-8">
<FileUploadArea
class="payload-panel"
:selected-file="selectedFile"
:selected-files="selectedFiles"
:progress="uploadProgress"
:uploaded-bytes="uploadedBytes"
:total-bytes="totalBytes"
:upload-speed="uploadSpeed"
:upload-status="isSubmitting ? 'uploading' : 'idle'"
:description="uploadDescription"
:accepted-types="acceptedTypes"
@file-selected="handleFileSelected"
@files-selected="handleFilesSelected"
@file-drop="handleFileDrop"
/>
</div>
<div v-else key="text" class="grid grid-cols-1 gap-8">
<TextInputArea
v-model="textContent"
class="payload-panel"
:placeholder="t('send.uploadArea.textInput')"
/>
</div>
</transition>
<ExpirationSelector
v-model:expiration-method="expirationMethod"
v-model:expiration-value="expirationValue"
:options="expirationOptions"
/>
<button
type="submit"
:disabled="isSubmitting"
class="flex w-full items-center justify-center gap-2 rounded-xl py-3 text-sm font-semibold tracking-wide transition-all duration-300 sm:rounded-2xl sm:py-4 sm:text-base"
:class="
isSubmitting
? isDarkMode
? 'cursor-not-allowed border border-zinc-700/30 bg-zinc-800/50 text-zinc-500'
: 'cursor-not-allowed border border-slate-200/50 bg-slate-100 text-slate-400'
: isDarkMode
? 'bg-zinc-200 text-zinc-950 shadow-[0_10px_28px_-12px_rgba(255,255,255,0.45)] hover:-translate-y-0.5 hover:bg-white hover:shadow-[0_16px_34px_-14px_rgba(255,255,255,0.5)]'
: 'bg-zinc-800 text-white shadow-[0_10px_28px_-12px_rgba(24,24,27,0.35)] hover:-translate-y-0.5 hover:bg-zinc-900 hover:shadow-[0_16px_34px_-14px_rgba(24,24,27,0.42)]'
"
>
<LoaderCircleIcon v-if="isSubmitting" class="h-4 w-4 animate-spin sm:h-5 sm:w-5" />
<SendIcon v-else class="h-4 w-4 sm:h-5 sm:w-5" />
{{ isSubmitting ? t('send.submitting') : t('send.submit') }}
</button>
</form>
</div>
<div
class="flex items-center justify-between border-t px-5 py-3.5 transition-colors sm:px-8 sm:py-6"
:class="
isDarkMode ? 'border-zinc-800/60 bg-zinc-900/40' : 'border-slate-100 bg-slate-50/50'
"
>
<router-link
to="/"
class="group flex items-center gap-1.5 text-xs font-medium transition-colors sm:gap-2 sm:text-sm"
:class="
isDarkMode
? 'text-zinc-400 hover:text-zinc-100'
: 'text-slate-500 hover:text-zinc-950'
"
>
<span
class="absolute top-0 left-0 w-full h-full bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"
></span>
<span class="relative z-10 flex items-center justify-center text-lg">
<svg
v-if="isSubmitting"
class="w-6 h-6 mr-2 animate-spin"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
class="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
stroke-width="4"
></circle>
<path
class="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
></path>
</svg>
<SendIcon v-else class="w-6 h-6 mr-2" />
<span>{{ isSubmitting ? t('send.submitting') : t('send.submit') }}</span>
</span>
</button>
</form>
<div class="mt-6 text-center">
<router-link to="/" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
<CloudDownloadIcon
class="h-3.5 w-3.5 transition-transform group-hover:-translate-y-0.5 sm:h-4 sm:w-4"
/>
{{ t('send.needRetrieveFile') }}
</router-link>
<button
type="button"
@click="toggleDrawer"
class="group flex items-center gap-1.5 text-xs font-medium transition-colors sm:gap-2 sm:text-sm"
:class="
isDarkMode
? 'text-zinc-400 hover:text-zinc-100'
: 'text-slate-500 hover:text-zinc-950'
"
>
<HistoryIcon
class="h-3.5 w-3.5 transition-transform group-hover:-rotate-12 sm:h-4 sm:w-4"
/>
{{ t('send.sendRecords') }}
</button>
</div>
</div>
<div
class="px-8 py-4 bg-opacity-50 flex justify-between items-center"
:class="[isDarkMode ? 'bg-gray-800' : 'bg-gray-100']"
>
<span
class="text-sm flex items-center"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
>
<ShieldCheckIcon class="w-4 h-4 mr-1 text-green-400" />
{{ t('send.secureEncryption') }}
</span>
<button
@click="toggleDrawer"
class="text-sm hover:text-indigo-300 transition duration-300 flex items-center"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
>
{{ t('send.sendRecords') }}
<ClipboardListIcon class="w-4 h-4 ml-1" />
</button>
</div>
</div>
<SideDrawer :visible="showDrawer" :title="t('send.sendRecords')" @close="toggleDrawer">
@@ -131,14 +143,9 @@
</template>
<script setup lang="ts">
import { inject } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import {
SendIcon,
ClipboardListIcon,
ShieldCheckIcon
} from 'lucide-vue-next'
import { CloudDownloadIcon, HistoryIcon, LoaderCircleIcon, SendIcon } from 'lucide-vue-next'
import PageHeader from '@/components/common/PageHeader.vue'
import SendTypeSelector from '@/components/common/SendTypeSelector.vue'
import FileUploadArea from '@/components/common/FileUploadArea.vue'
@@ -147,13 +154,12 @@ import TextInputArea from '@/components/common/TextInputArea.vue'
import SideDrawer from '@/components/common/SideDrawer.vue'
import SentRecordList from '@/components/common/SentRecordList.vue'
import SentRecordDetailModal from '@/components/common/SentRecordDetailModal.vue'
import { useSendFlow } from '@/composables'
import { useInjectedDarkMode, useSendFlow } from '@/composables'
const isDarkMode = inject('isDarkMode')
const isDarkMode = useInjectedDarkMode()
const { t } = useI18n()
const router = useRouter()
const {
config,
sendType,
selectedFile,
selectedFiles,
@@ -161,6 +167,10 @@ const {
expirationMethod,
expirationValue,
uploadProgress,
uploadedBytes,
totalBytes,
uploadSpeed,
acceptedTypes,
showDrawer,
selectedRecord,
isSubmitting,
@@ -208,14 +218,21 @@ const toRetrieve = () => {
}
:deep(.payload-panel) {
height: 12rem;
min-height: 12rem;
height: 10rem;
min-height: 10rem;
}
:deep(.payload-panel textarea) {
height: 100%;
}
@media (min-width: 640px) {
:deep(.payload-panel) {
height: 12rem;
min-height: 12rem;
}
}
select option {
padding: 8px;
margin: 4px;
@@ -223,12 +240,13 @@ select option {
}
select option:checked {
background: linear-gradient(to right, rgb(99 102 241 / 0.5), rgb(168 85 247 / 0.5)) !important;
color: white !important;
background: rgb(99 102 241 / 0.12) !important;
color: rgb(79 70 229) !important;
}
.dark select option:checked {
background: linear-gradient(to right, rgb(99 102 241 / 0.7), rgb(168 85 247 / 0.7)) !important;
background: rgb(8 145 178 / 0.25) !important;
color: rgb(103 232 249) !important;
}
select option:hover {
@@ -236,57 +254,6 @@ select option:hover {
}
.dark select option:hover {
background-color: rgb(99 102 241 / 0.2);
}
/* 自定义滚动条样式 */
.custom-scrollbar {
scrollbar-width: thin;
scrollbar-color: rgba(156, 163, 175, 0.4) rgba(243, 244, 246, 0.3);
}
.custom-scrollbar::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: rgba(243, 244, 246, 0.3);
border-radius: 6px;
margin: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.6), rgba(168, 85, 247, 0.6));
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.2);
transition: all 0.3s ease;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(168, 85, 247, 0.8));
transform: scale(1.1);
}
.custom-scrollbar::-webkit-scrollbar-corner {
background: transparent;
}
/* 深色模式下的滚动条样式 */
.dark .custom-scrollbar {
scrollbar-color: rgba(75, 85, 99, 0.6) rgba(31, 41, 55, 0.4);
}
.dark .custom-scrollbar::-webkit-scrollbar-track {
background: rgba(31, 41, 55, 0.4);
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.7), rgba(168, 85, 247, 0.7));
border: 1px solid rgba(255, 255, 255, 0.1);
}
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
background-color: rgb(8 145 178 / 0.16);
}
</style>
+19 -27
View File
@@ -43,7 +43,7 @@
:title="t('admin.dashboard.totalFiles')"
:value="dashboardData.totalFiles"
:icon="FilesIcon"
icon-color="indigo"
icon-color="zinc"
>
<template #description>
{{ t('admin.dashboard.yesterdayShares', { count: dashboardData.yesterdayCount }) }}
@@ -54,7 +54,7 @@
:title="t('admin.dashboard.storageSpace')"
:value="dashboardData.storageUsedText"
:icon="HardDriveIcon"
icon-color="purple"
icon-color="zinc"
>
<template #description>
{{ t('admin.dashboard.todayIncrease', { count: dashboardData.todaySizeText }) }}
@@ -65,7 +65,7 @@
:title="t('admin.dashboard.todayShares')"
:value="dashboardData.todayCount"
:icon="UploadCloudIcon"
icon-color="green"
icon-color="zinc"
>
<template #description>
{{ t('admin.dashboard.yesterdayShares', { count: dashboardData.yesterdayCount }) }}
@@ -76,7 +76,7 @@
:title="t('admin.dashboard.totalRetrievals')"
:value="dashboardData.usedCount"
:icon="DownloadCloudIcon"
icon-color="blue"
icon-color="zinc"
>
<template #description>
{{ t('admin.dashboard.serverUptime') }} {{ dashboardData.sysUptimeText }}
@@ -95,10 +95,7 @@
{{ t('admin.dashboard.fileHealthDesc') }}
</p>
</div>
<ActivityIcon
class="h-5 w-5"
:class="[isDarkMode ? 'text-indigo-300' : 'text-indigo-500']"
/>
<ActivityIcon class="h-5 w-5" :class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-500']" />
</div>
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
@@ -106,19 +103,19 @@
:label="t('admin.dashboard.activeFileRatio')"
:value="dashboardData.activeRatio"
:detail="`${dashboardData.activeCount} / ${dashboardData.totalFiles}`"
tone="green"
tone="zinc"
/>
<MetricProgress
:label="t('admin.dashboard.fileShareRatio')"
:value="dashboardData.fileRatio"
:detail="t('admin.dashboard.binaryFiles', { count: dashboardData.fileCount })"
tone="indigo"
tone="zinc"
/>
<MetricProgress
:label="t('admin.dashboard.textShareRatio')"
:value="dashboardData.textRatio"
:detail="t('admin.dashboard.textShares', { count: dashboardData.textCount })"
tone="purple"
tone="zinc"
/>
</div>
@@ -214,7 +211,7 @@
:class="[isDarkMode ? 'bg-gray-700' : 'bg-gray-100']"
>
<div
class="h-full rounded-full bg-indigo-500"
class="h-full rounded-full bg-zinc-500"
:style="{ width: `${dashboardData.todaySizeRatio}%` }"
></div>
</div>
@@ -279,13 +276,15 @@ const { dashboardData, errorMessage, fetchDashboardData, isLoading, lastUpdatedT
})
const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text-gray-900'))
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'text-gray-500'))
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-zinc-400' : 'text-zinc-500'))
const versionText = computed(() => appVersion.value || t('admin.dashboard.versionPending'))
const panelClass = computed(() =>
isDarkMode.value ? 'bg-gray-800/80 border border-gray-700' : 'bg-white border border-gray-100'
isDarkMode.value
? 'border border-white/10 bg-white/[0.06] shadow-[0_22px_54px_-36px_rgba(255,255,255,0.22)] backdrop-blur-xl'
: 'border border-white/80 bg-white/70 shadow-[0_22px_54px_-36px_rgba(24,24,27,0.28)] backdrop-blur-xl'
)
const subtlePanelClass = computed(() =>
isDarkMode.value ? 'border-gray-700 bg-gray-900/30' : 'border-gray-100 bg-gray-50'
isDarkMode.value ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-zinc-50/70'
)
const maxSaveTimeText = computed(() => {
if (!dashboardData.maxSaveSeconds) return t('admin.dashboard.noSaveLimit')
@@ -352,13 +351,13 @@ const getHealthActionClass = (tone: DashboardHealthAction['tone']) => {
const darkClasses: Record<DashboardHealthAction['tone'], string> = {
danger: 'border-red-500/20 bg-red-500/10 text-red-200 hover:border-red-400/40',
warning: 'border-amber-500/20 bg-amber-500/10 text-amber-200 hover:border-amber-400/40',
success: 'border-emerald-500/20 bg-emerald-500/10 text-emerald-200 hover:border-emerald-400/40',
neutral: 'border-gray-700 bg-gray-900/30 text-gray-300 hover:border-gray-600'
success: 'border-zinc-500/20 bg-white/5 text-zinc-200 hover:border-zinc-400/40',
neutral: 'border-white/10 bg-white/[0.04] text-zinc-300 hover:border-white/15'
}
const lightClasses: Record<DashboardHealthAction['tone'], string> = {
danger: 'border-red-100 bg-red-50 text-red-700 hover:border-red-200',
warning: 'border-amber-100 bg-amber-50 text-amber-700 hover:border-amber-200',
success: 'border-emerald-100 bg-emerald-50 text-emerald-700 hover:border-emerald-200',
success: 'border-slate-200 bg-slate-50 text-slate-700 hover:border-slate-300',
neutral: 'border-gray-100 bg-gray-50 text-gray-700 hover:border-gray-200'
}
@@ -379,19 +378,12 @@ const MetricProgress = defineComponent({
value: { type: Number, required: true },
detail: { type: String, required: true },
tone: {
type: String as PropType<'green' | 'indigo' | 'purple'>,
type: String as PropType<'zinc'>,
required: true
}
},
setup(props) {
const toneClass = computed(() => {
const classes = {
green: 'bg-green-500',
indigo: 'bg-indigo-500',
purple: 'bg-purple-500'
}
return classes[props.tone]
})
const toneClass = computed(() => 'bg-zinc-500')
return () =>
h('div', { class: 'rounded-lg border p-4 border-gray-200/60 dark:border-gray-700' }, [
+93 -101
View File
@@ -59,17 +59,17 @@
<span class="relative block">
<SearchIcon
class="absolute left-3 top-3 h-4 w-4"
:class="[isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']"
/>
<input
v-model="params.keyword"
type="text"
:placeholder="t('fileManage.searchPlaceholder')"
class="w-full rounded-lg border py-2.5 pl-10 pr-4 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border py-2.5 pl-10 pr-4 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[
isDarkMode
? 'border-gray-600 bg-gray-700 text-white placeholder-gray-400'
: 'border-gray-300 bg-white text-gray-900 placeholder-gray-400'
: 'border-gray-300 bg-white text-zinc-950 placeholder-gray-400'
]"
@keyup.enter="handleSearch"
/>
@@ -91,7 +91,7 @@
</span>
<select
:value="params.status"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
@change="handleStatusFilterChange"
>
@@ -112,7 +112,7 @@
</span>
<select
:value="params.health"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
@change="handleHealthFilterSelect"
>
@@ -133,7 +133,7 @@
</span>
<select
:value="params.type"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
@change="handleTypeFilterChange"
>
@@ -150,7 +150,7 @@
</span>
<select
v-model="params.sortBy"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
@change="handleSearch"
>
@@ -167,7 +167,7 @@
</span>
<select
v-model="params.sortOrder"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
@change="handleSearch"
>
@@ -184,7 +184,7 @@
</span>
<select
:value="selectedViewPresetId"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
:disabled="isViewPresetLoading"
@change="handleViewPresetChange"
@@ -248,7 +248,7 @@
<label class="inline-flex items-center gap-2 text-sm" :class="[primaryTextClass]">
<input
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
class="h-4 w-4 rounded border-gray-300 text-zinc-600 focus:ring-zinc-500"
:checked="isAllCurrentPageSelected"
:disabled="isBatchActionRunning"
:indeterminate="isCurrentPagePartiallySelected"
@@ -372,18 +372,14 @@
:key="file.id"
class="transition-colors duration-200"
:class="[
selectedFileIds.has(file.id)
? isDarkMode
? 'bg-indigo-950/30'
: 'bg-indigo-50/70'
: '',
selectedFileIds.has(file.id) ? (isDarkMode ? 'bg-zinc-950/30' : 'bg-zinc-50/70') : '',
isDarkMode ? 'hover:bg-gray-700/70' : 'hover:bg-gray-50'
]"
>
<td class="px-6 py-4 whitespace-nowrap">
<input
type="checkbox"
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
class="h-4 w-4 rounded border-gray-300 text-zinc-600 focus:ring-zinc-500"
:checked="selectedFileIds.has(file.id)"
:disabled="isBatchActionRunning"
:aria-label="t('fileManage.selectFile', { name: file.displayName })"
@@ -438,7 +434,7 @@
<td class="px-6 py-4 whitespace-nowrap">
<span
class="inline-flex items-center rounded-full px-2.5 py-1 text-xs font-medium"
:class="[isDarkMode ? 'bg-gray-700 text-gray-300' : 'bg-gray-100 text-gray-800']"
:class="[isDarkMode ? 'bg-gray-700 text-zinc-300' : 'bg-gray-100 text-zinc-800']"
>
{{ file.displaySize }}
</span>
@@ -474,8 +470,8 @@
class="inline-flex items-center rounded-md px-3 py-1.5 transition-colors duration-200"
:class="[
isDarkMode
? 'bg-indigo-900/20 text-indigo-300 hover:bg-indigo-900/30'
: 'bg-indigo-50 text-indigo-700 hover:bg-indigo-100'
? 'bg-zinc-900/20 text-zinc-300 hover:bg-zinc-900/30'
: 'bg-zinc-50 text-zinc-700 hover:bg-zinc-100'
]"
@click="openFileDetail(file)"
>
@@ -489,8 +485,8 @@
class="inline-flex items-center rounded-md px-3 py-1.5 transition-colors duration-200"
:class="[
isDarkMode
? 'bg-gray-700 text-gray-300 hover:bg-gray-600'
: 'bg-gray-100 text-gray-700 hover:bg-gray-200'
? 'bg-gray-700 text-zinc-300 hover:bg-gray-600'
: 'bg-gray-100 text-zinc-700 hover:bg-gray-200'
]"
@click="openTextPreview(file)"
>
@@ -506,8 +502,8 @@
class="inline-flex items-center rounded-md px-3 py-1.5 transition-colors duration-200 disabled:cursor-not-allowed disabled:opacity-60"
:class="[
isDarkMode
? 'bg-emerald-900/20 text-emerald-300 hover:bg-emerald-900/30'
: 'bg-emerald-50 text-emerald-700 hover:bg-emerald-100'
? 'bg-zinc-900/20 text-zinc-300 hover:bg-zinc-900/30'
: 'bg-zinc-50 text-zinc-700 hover:bg-zinc-100'
]"
@click="downloadFile(file)"
>
@@ -523,8 +519,8 @@
class="inline-flex items-center rounded-md px-3 py-1.5 transition-colors duration-200"
:class="[
isDarkMode
? 'bg-blue-900/20 text-blue-300 hover:bg-blue-900/30'
: 'bg-blue-50 text-blue-600 hover:bg-blue-100'
? 'bg-zinc-900/20 text-zinc-300 hover:bg-zinc-900/30'
: 'bg-zinc-50 text-zinc-600 hover:bg-zinc-100'
]"
@click="openEditModal(file)"
>
@@ -563,16 +559,16 @@
<BaseModal :show="showFileDetailModal" size="xl" @close="closeFileDetail">
<template #header>
<div class="flex min-w-0 items-center space-x-3">
<div class="rounded-lg p-2" :class="[isDarkMode ? 'bg-indigo-500/10' : 'bg-indigo-50']">
<div class="rounded-lg p-2" :class="[isDarkMode ? 'bg-zinc-500/10' : 'bg-zinc-50']">
<FileTextIcon
class="h-5 w-5"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
:class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-600']"
/>
</div>
<div class="min-w-0">
<h3
class="truncate text-xl font-semibold leading-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ t('fileManage.detailTitle') }}
</h3>
@@ -588,7 +584,7 @@
<div class="flex min-w-0 items-start gap-3">
<div
class="rounded-lg p-3"
:class="[isDarkMode ? 'bg-gray-700 text-gray-300' : 'bg-gray-100 text-gray-700']"
:class="[isDarkMode ? 'bg-gray-700 text-zinc-300' : 'bg-gray-100 text-zinc-700']"
>
<FileTextIcon v-if="selectedFileDetail.isTextFile" class="h-5 w-5" />
<FileIcon v-else class="h-5 w-5" />
@@ -617,11 +613,7 @@
<span
v-if="selectedFileDetail.isPermanentFile"
class="inline-flex items-center rounded-full px-2.5 py-1 text-xs font-medium"
:class="
isDarkMode
? 'bg-emerald-900/30 text-emerald-300'
: 'bg-emerald-100 text-emerald-700'
"
:class="isDarkMode ? 'bg-zinc-700 text-zinc-200' : 'bg-slate-100 text-slate-700'"
>
{{ t('fileManage.permanent') }}
</span>
@@ -641,7 +633,7 @@
<div
class="rounded-lg border px-4 py-3"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-gray-50']"
:class="[isDarkMode ? 'border-white/10 bg-white/[0.04]' : 'border-gray-200 bg-gray-50']"
>
<div class="grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-center">
<div class="min-w-0">
@@ -744,7 +736,7 @@
v-model="detailMetadataForm.note"
rows="4"
maxlength="2000"
class="w-full resize-y rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full resize-y rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
:placeholder="t('fileManage.metadataNotePlaceholder')"
></textarea>
@@ -756,7 +748,7 @@
<input
v-model="detailMetadataForm.tagsText"
type="text"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-indigo-500"
class="w-full rounded-lg border px-3 py-2 text-sm focus:border-transparent focus:ring-2 focus:ring-zinc-500"
:class="[fieldClass]"
:placeholder="t('fileManage.metadataTagsPlaceholder')"
/>
@@ -803,7 +795,7 @@
v-for="reason in detailInsightReasonLabels"
:key="reason"
class="rounded-full px-2.5 py-1 text-xs font-medium"
:class="isDarkMode ? 'bg-gray-700 text-gray-300' : 'bg-white text-gray-600 shadow-sm'"
:class="isDarkMode ? 'bg-gray-700 text-zinc-300' : 'bg-white text-zinc-600 shadow-sm'"
>
{{ reason }}
</span>
@@ -848,7 +840,9 @@
v-for="item in detailOverviewItems"
:key="item.label"
class="rounded-lg border px-4 py-3"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
:class="[
isDarkMode ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-white/60'
]"
>
<p class="text-xs" :class="[mutedTextClass]">{{ item.label }}</p>
<p class="mt-1 break-words text-sm font-medium" :class="[primaryTextClass]">
@@ -867,7 +861,9 @@
v-for="item in detailPolicyItems"
:key="item.label"
class="rounded-lg border px-4 py-3"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
:class="[
isDarkMode ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-white/60'
]"
>
<p class="text-xs" :class="[mutedTextClass]">{{ item.label }}</p>
<p class="mt-1 break-words text-sm font-medium" :class="[primaryTextClass]">
@@ -883,7 +879,9 @@
</h4>
<div
class="rounded-lg border px-4 py-4"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
:class="[
isDarkMode ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-white/60'
]"
>
<div
v-for="(item, index) in selectedFileDetail.detailTimeline"
@@ -932,7 +930,9 @@
v-for="item in detailStorageItems"
:key="item.label"
class="grid gap-1 rounded-lg border px-4 py-3 sm:grid-cols-[160px_minmax(0,1fr)] sm:items-center"
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
:class="[
isDarkMode ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-white/60'
]"
>
<p class="text-xs" :class="[mutedTextClass]">{{ item.label }}</p>
<p
@@ -964,15 +964,12 @@
<BaseModal :show="showEditModal" size="lg" @close="closeEditModal">
<template #header>
<div class="flex items-center space-x-3">
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-indigo-500/10' : 'bg-indigo-50']">
<PencilIcon
class="w-5 h-5"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-zinc-500/10' : 'bg-zinc-50']">
<PencilIcon class="w-5 h-5" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-600']" />
</div>
<h3
class="text-xl font-semibold leading-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ t('fileManage.editFileInfo') }}
</h3>
@@ -1024,15 +1021,12 @@
<BaseModal :show="showBatchEditModal" size="lg" @close="closeBatchEditModal()">
<template #header>
<div class="flex items-center space-x-3">
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-indigo-500/10' : 'bg-indigo-50']">
<ClockIcon
class="w-5 h-5"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
/>
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-zinc-500/10' : 'bg-zinc-50']">
<ClockIcon class="w-5 h-5" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-600']" />
</div>
<h3
class="text-xl font-semibold leading-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ t('fileManage.batchEditTitle') }}
</h3>
@@ -1044,8 +1038,8 @@
class="rounded-lg border px-4 py-3 text-sm"
:class="[
isDarkMode
? 'border-indigo-500/20 bg-indigo-500/10 text-indigo-200'
: 'border-indigo-100 bg-indigo-50 text-indigo-700'
? 'border-zinc-500/20 bg-zinc-500/10 text-zinc-200'
: 'border-zinc-100 bg-zinc-50 text-zinc-700'
]"
>
{{ t('fileManage.batchEditSelected', { count: selectedCount }) }}
@@ -1089,8 +1083,8 @@
class="rounded-lg border px-4 py-3 text-sm"
:class="[
isDarkMode
? 'border-gray-700 bg-gray-700/50 text-gray-300'
: 'border-gray-200 bg-gray-50 text-gray-600'
? 'border-gray-700 bg-gray-700/50 text-zinc-300'
: 'border-gray-200 bg-gray-50 text-zinc-600'
]"
>
{{ t('fileManage.batchEditForeverHint') }}
@@ -1113,15 +1107,15 @@
<BaseModal :show="showTextPreview" size="lg" @close="closeTextPreview">
<template #header>
<div class="flex items-center space-x-3">
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-indigo-500/10' : 'bg-indigo-50']">
<div class="p-2 rounded-lg" :class="[isDarkMode ? 'bg-zinc-500/10' : 'bg-zinc-50']">
<FileTextIcon
class="w-5 h-5"
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
:class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-600']"
/>
</div>
<h3
class="text-xl font-semibold leading-6"
:class="[isDarkMode ? 'text-white' : 'text-gray-900']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-950']"
>
{{ previewFile?.displayName || t('fileManage.textPreview') }}
</h3>
@@ -1143,11 +1137,11 @@
<pre
v-else
class="whitespace-pre-wrap break-words text-sm font-mono"
:class="[isDarkMode ? 'text-gray-200' : 'text-gray-700']"
:class="[isDarkMode ? 'text-gray-200' : 'text-zinc-700']"
>{{ previewText }}</pre
>
</div>
<div class="mt-2 text-xs" :class="[isDarkMode ? 'text-gray-500' : 'text-gray-400']">
<div class="mt-2 text-xs" :class="[isDarkMode ? 'text-zinc-500' : 'text-zinc-400']">
{{ previewMetaText || t('fileManage.charCount', { count: previewText.length }) }}
</div>
@@ -1321,28 +1315,30 @@ const {
toggleFileSelection
} = useAdminFiles()
const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text-gray-900'))
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'text-gray-500'))
const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text-zinc-950'))
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-zinc-400' : 'text-zinc-500'))
const panelClass = computed(() =>
isDarkMode.value ? 'border-gray-700 bg-gray-800/80' : 'border-gray-100 bg-white'
isDarkMode.value
? 'border-white/10 bg-white/[0.06] shadow-[0_22px_54px_-36px_rgba(255,255,255,0.22)] backdrop-blur-xl'
: 'border-white/80 bg-white/70 shadow-[0_22px_54px_-36px_rgba(24,24,27,0.28)] backdrop-blur-xl'
)
const fieldClass = computed(() =>
isDarkMode.value
? 'border-gray-600 bg-gray-700 text-white'
: 'border-gray-300 bg-white text-gray-900'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400'
)
const detailActionClass = computed(() =>
isDarkMode.value
? 'border-gray-700 bg-gray-700/50 text-gray-300 hover:border-gray-600 hover:bg-gray-700'
: 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50'
? 'border-white/10 bg-white/[0.06] text-zinc-300 hover:border-white/15 hover:bg-white/10'
: 'border-zinc-200/80 bg-white/70 text-zinc-700 hover:border-zinc-300 hover:bg-zinc-50'
)
const detailPolicyActionClass = computed(() =>
isDarkMode.value
? 'border-gray-700 bg-gray-800/70 text-gray-200 hover:border-blue-500/40 hover:bg-blue-500/10'
: 'border-gray-200 bg-white text-gray-700 hover:border-blue-200 hover:bg-blue-50'
? 'border-white/10 bg-white/[0.06] text-zinc-200 hover:border-white/15 hover:bg-white/10'
: 'border-zinc-200/80 bg-white/70 text-zinc-700 hover:border-zinc-300 hover:bg-zinc-50'
)
const subtleSectionClass = computed(() =>
isDarkMode.value ? 'border-gray-700 bg-gray-900/30' : 'border-gray-200 bg-gray-50'
isDarkMode.value ? 'border-white/10 bg-white/[0.04]' : 'border-zinc-200/70 bg-zinc-50/70'
)
type DetailInfoItem = {
@@ -1479,15 +1475,13 @@ const summaryCards = computed(() => [
label: t('fileManage.totalFiles'),
value: summary.value.totalFiles,
icon: ArchiveIcon,
iconClass: isDarkMode.value
? 'bg-indigo-900/30 text-indigo-300'
: 'bg-indigo-50 text-indigo-600'
iconClass: isDarkMode.value ? 'bg-zinc-900/30 text-zinc-300' : 'bg-zinc-50 text-zinc-600'
},
{
label: t('fileManage.activeFiles'),
value: summary.value.activeCount,
icon: ActivityIcon,
iconClass: isDarkMode.value ? 'bg-green-900/30 text-green-300' : 'bg-green-50 text-green-600'
iconClass: isDarkMode.value ? 'bg-zinc-700 text-zinc-200' : 'bg-slate-100 text-slate-700'
},
{
label: t('fileManage.expiredFiles'),
@@ -1499,9 +1493,7 @@ const summaryCards = computed(() => [
label: t('fileManage.storageUsed'),
value: storageUsedText.value,
icon: HardDriveIcon,
iconClass: isDarkMode.value
? 'bg-purple-900/30 text-purple-300'
: 'bg-purple-50 text-purple-600'
iconClass: isDarkMode.value ? 'bg-zinc-900/30 text-zinc-300' : 'bg-zinc-50 text-zinc-600'
}
])
@@ -1644,13 +1636,13 @@ const formatFilterOptionLabel = (option: { label: string; count?: number }) => {
const getBatchEditModeClass = (value: AdminBatchEditMode) => {
if (batchEditForm.value.mode === value) {
return isDarkMode.value
? 'border-indigo-500 bg-indigo-500/20 text-indigo-200'
: 'border-indigo-500 bg-indigo-50 text-indigo-700'
? 'border-zinc-500 bg-zinc-500/20 text-zinc-200'
: 'border-zinc-500 bg-zinc-50 text-zinc-700'
}
return isDarkMode.value
? 'border-gray-700 bg-gray-700/50 text-gray-300 hover:border-gray-600 hover:bg-gray-700'
: 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50'
? 'border-gray-700 bg-gray-700/50 text-zinc-300 hover:border-gray-600 hover:bg-gray-700'
: 'border-zinc-200/70 bg-white/60 text-zinc-700 hover:border-gray-300 hover:bg-gray-50'
}
const getTypeLabel = (file: AdminFileViewItem) => {
@@ -1660,19 +1652,19 @@ const getTypeLabel = (file: AdminFileViewItem) => {
const getTypeBadgeClass = (file: AdminFileViewItem) => {
if (file.isChunkedFile) {
return isDarkMode.value ? 'bg-blue-900/30 text-blue-300' : 'bg-blue-100 text-blue-700'
return isDarkMode.value ? 'bg-zinc-900/30 text-zinc-300' : 'bg-zinc-100 text-zinc-700'
}
if (file.isTextFile) {
return isDarkMode.value ? 'bg-purple-900/30 text-purple-300' : 'bg-purple-100 text-purple-700'
return isDarkMode.value ? 'bg-zinc-900/30 text-zinc-300' : 'bg-zinc-100 text-zinc-700'
}
return isDarkMode.value ? 'bg-gray-700 text-gray-300' : 'bg-gray-100 text-gray-700'
return isDarkMode.value ? 'bg-gray-700 text-zinc-300' : 'bg-gray-100 text-zinc-700'
}
const getStatusBadgeClass = (file: AdminFileViewItem) => {
if (file.isExpiredFile) {
return isDarkMode.value ? 'bg-red-900/30 text-red-300' : 'bg-red-100 text-red-700'
}
return isDarkMode.value ? 'bg-green-900/30 text-green-300' : 'bg-green-100 text-green-700'
return isDarkMode.value ? 'bg-zinc-700 text-zinc-200' : 'bg-slate-100 text-slate-700'
}
const getInsightSeverityLabel = (severity: AdminFileInsightSeverity) =>
@@ -1684,17 +1676,17 @@ const getInsightActionLabel = (action: string) => t(`fileManage.insightActions.$
const getInsightPanelClass = (severity: AdminFileInsightSeverity) => {
const darkClasses: Record<AdminFileInsightSeverity, string> = {
success: 'border-emerald-500/20 bg-emerald-500/10',
success: 'border-zinc-500/20 bg-white/5',
warning: 'border-amber-500/20 bg-amber-500/10',
danger: 'border-red-500/20 bg-red-500/10',
info: 'border-blue-500/20 bg-blue-500/10',
neutral: 'border-gray-700 bg-gray-700/30'
info: 'border-zinc-500/20 bg-zinc-500/10',
neutral: 'border-white/10 bg-white/[0.04]'
}
const lightClasses: Record<AdminFileInsightSeverity, string> = {
success: 'border-emerald-100 bg-emerald-50',
success: 'border-slate-200 bg-slate-50',
warning: 'border-amber-100 bg-amber-50',
danger: 'border-red-100 bg-red-50',
info: 'border-blue-100 bg-blue-50',
info: 'border-zinc-100 bg-zinc-50',
neutral: 'border-gray-200 bg-gray-50'
}
@@ -1703,18 +1695,18 @@ const getInsightPanelClass = (severity: AdminFileInsightSeverity) => {
const getInsightBadgeClass = (severity: AdminFileInsightSeverity) => {
const darkClasses: Record<AdminFileInsightSeverity, string> = {
success: 'bg-emerald-900/40 text-emerald-200',
success: 'bg-zinc-700 text-zinc-200',
warning: 'bg-amber-900/40 text-amber-200',
danger: 'bg-red-900/40 text-red-200',
info: 'bg-blue-900/40 text-blue-200',
neutral: 'bg-gray-700 text-gray-300'
info: 'bg-zinc-900/40 text-zinc-200',
neutral: 'bg-gray-700 text-zinc-300'
}
const lightClasses: Record<AdminFileInsightSeverity, string> = {
success: 'bg-emerald-100 text-emerald-700',
success: 'bg-slate-100 text-slate-700',
warning: 'bg-amber-100 text-amber-700',
danger: 'bg-red-100 text-red-700',
info: 'bg-blue-100 text-blue-700',
neutral: 'bg-gray-100 text-gray-700'
info: 'bg-zinc-100 text-zinc-700',
neutral: 'bg-gray-100 text-zinc-700'
}
return isDarkMode.value ? darkClasses[severity] : lightClasses[severity]
@@ -1722,10 +1714,10 @@ const getInsightBadgeClass = (severity: AdminFileInsightSeverity) => {
const getTimelineDotClass = (severity: AdminFileInsightSeverity) => {
const classes: Record<AdminFileInsightSeverity, string> = {
success: 'bg-emerald-500',
success: 'bg-zinc-500',
warning: 'bg-amber-500',
danger: 'bg-red-500',
info: 'bg-blue-500',
info: 'bg-zinc-500',
neutral: isDarkMode.value ? 'bg-gray-500' : 'bg-gray-300'
}
+17 -15
View File
@@ -16,18 +16,20 @@
<div>
<div class="mx-auto h-16 w-16 relative">
<div
class="absolute inset-0 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full animate-spin-slow"
class="absolute inset-0 rounded-2xl"
:class="isDarkMode ? 'bg-white/10' : 'bg-zinc-950'"
></div>
<div
class="absolute -inset-2 bg-gradient-to-r from-cyan-500 via-purple-500 to-pink-500 rounded-full opacity-50 blur-md animate-pulse"
class="absolute -inset-2 rounded-[1.35rem] opacity-40 blur-md"
:class="isDarkMode ? 'bg-white/10' : 'bg-zinc-300'"
></div>
<div
:class="[
'absolute inset-1 rounded-full flex items-center justify-center',
isDarkMode ? 'bg-gray-800' : 'bg-white'
'absolute inset-1 rounded-[1rem] flex items-center justify-center',
isDarkMode ? 'bg-zinc-900' : 'bg-white'
]"
>
<BoxIcon :class="['h-8 w-8', isDarkMode ? 'text-cyan-400' : 'text-cyan-600']" />
<BoxIcon :class="['h-8 w-8', isDarkMode ? 'text-zinc-100' : 'text-zinc-600']" />
</div>
</div>
<h2
@@ -63,9 +65,9 @@
required
v-model="password"
:class="[
'appearance-none rounded-t-md relative block w-full px-4 py-3 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:border-cyan-500 focus:z-10 sm:text-sm backdrop-blur-sm',
'appearance-none rounded-t-md relative block w-full px-4 py-3 border transition-all duration-200 placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 focus:z-10 sm:text-sm backdrop-blur-sm',
isDarkMode
? 'bg-gray-800/50 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
? 'bg-gray-800/50 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500 focus:ring-zinc-500 focus:border-zinc-500'
: 'bg-white/50 border-gray-300 text-gray-900 hover:border-gray-400'
]"
placeholder="密码"
@@ -76,10 +78,10 @@
<button
type="submit"
:class="[
'group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md text-white transition-all duration-300 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-cyan-500 shadow-lg hover:shadow-cyan-500/50',
'group relative w-full flex justify-center py-3 px-4 border border-transparent text-sm font-medium rounded-md transition-all duration-300 transform hover:scale-[1.02] focus:outline-none focus:ring-2 focus:ring-offset-2 shadow-lg',
isDarkMode
? 'bg-gradient-to-r from-cyan-500 to-purple-500 hover:from-cyan-600 hover:to-purple-600'
: 'bg-gradient-to-r from-cyan-600 to-purple-600 hover:from-cyan-700 hover:to-purple-700',
? 'bg-zinc-200 text-zinc-950 hover:bg-zinc-100 focus:ring-zinc-500 hover:shadow-white/20'
: 'bg-zinc-800 text-white hover:bg-zinc-900 focus:ring-zinc-500 hover:shadow-zinc-500/30',
isLoading ? 'opacity-75 cursor-not-allowed' : ''
]"
:disabled="isLoading"
@@ -147,7 +149,7 @@ const submitLogin = async () => {
}
input:focus {
box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
box-shadow: 0 0 15px rgba(39, 39, 42, 0.18);
}
button:active:not(:disabled) {
@@ -156,8 +158,8 @@ button:active:not(:disabled) {
.cyber-grid {
background-image:
linear-gradient(transparent 95%, rgba(99, 102, 241, 0.1) 50%),
linear-gradient(90deg, transparent 95%, rgba(99, 102, 241, 0.1) 50%);
linear-gradient(transparent 95%, rgba(39, 39, 42, 0.08) 50%),
linear-gradient(90deg, transparent 95%, rgba(39, 39, 42, 0.08) 50%);
background-size: 30px 30px;
width: 100%;
height: 100%;
@@ -179,7 +181,7 @@ button:active:not(:disabled) {
position: absolute;
width: 100%;
height: 100%;
background-image: radial-gradient(circle at center, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
background-image: radial-gradient(circle at center, rgba(39, 39, 42, 0.08) 0%, transparent 50%);
animation: float 20s infinite linear;
}
@@ -203,7 +205,7 @@ button:active:not(:disabled) {
}
button:hover:not(:disabled) {
box-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
box-shadow: 0 0 25px rgba(39, 39, 42, 0.22);
}
.fade-enter-active,
+164 -110
View File
@@ -23,6 +23,14 @@ const {
toggleConfigFlag
} = useSystemConfig()
const updateAllowedFileTypes = (event: Event) => {
const target = event.target as HTMLInputElement
config.value.allowed_file_types = target.value
.split(',')
.map((item) => item.trim())
.filter(Boolean)
}
onMounted(() => {
void refreshConfig()
})
@@ -32,16 +40,16 @@ onMounted(() => {
<div class="p-6">
<div
class="sticky top-0 z-20 -mx-6 -mt-6 mb-6 border-b px-6 py-4 backdrop-blur"
:class="[isDarkMode ? 'border-gray-700 bg-gray-900/85' : 'border-gray-200 bg-gray-50/90']"
:class="[isDarkMode ? 'border-white/10 bg-[#101012]/85' : 'border-white/80 bg-white/70']"
>
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<div>
<h2 class="text-2xl font-bold" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
<h2 class="text-2xl font-bold" :class="[isDarkMode ? 'text-white' : 'text-zinc-800']">
{{ t('admin.settings.title') }}
</h2>
<p
class="mt-1 text-sm"
:class="[isDirty ? 'text-amber-500' : isDarkMode ? 'text-gray-400' : 'text-gray-500']"
:class="[isDirty ? 'text-amber-500' : isDarkMode ? 'text-zinc-400' : 'text-zinc-500']"
>
{{
isDirty ? t('manage.settings.unsavedChanges') : t('manage.settings.allChangesSaved')
@@ -82,12 +90,12 @@ onMounted(() => {
</div>
<div
class="space-y-6 rounded-lg shadow-md p-6"
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white']"
class="space-y-6 rounded-2xl border p-6 shadow-sm backdrop-blur-xl"
:class="[isDarkMode ? 'border-white/10 bg-white/[0.06]' : 'border-white/80 bg-white/70']"
>
<!-- 基本设置 -->
<section class="space-y-4">
<h3 class="text-lg font-medium mb-4" :class="[isDarkMode ? 'text-white' : 'text-gray-800']">
<h3 class="text-lg font-medium mb-4" :class="[isDarkMode ? 'text-white' : 'text-zinc-800']">
{{ t('admin.settings.basicSettings') }}
</h3>
@@ -96,18 +104,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('admin.settings.siteName') }}
</label>
<input
type="text"
v-model="config.name"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -115,18 +123,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('admin.settings.websiteDescription') }}
</label>
<input
type="text"
v-model="config.description"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -134,7 +142,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('admin.settings.adminPassword') }}
</label>
@@ -144,16 +152,16 @@ onMounted(() => {
minlength="6"
v-model="config.admin_token"
:placeholder="t('admin.settings.passwordPlaceholder')"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
<div
class="absolute inset-y-0 right-0 flex items-center pr-3 text-sm text-gray-400"
:class="[isDarkMode ? 'text-gray-500' : 'text-gray-400']"
class="absolute inset-y-0 right-0 flex items-center pr-3 text-sm text-zinc-400"
:class="[isDarkMode ? 'text-zinc-500' : 'text-zinc-400']"
>
<span class="text-xs">{{ t('admin.settings.passwordNote') }}</span>
</div>
@@ -163,18 +171,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('admin.settings.keywords') }}
</label>
<input
type="text"
v-model="config.keywords"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -183,17 +191,17 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.themeSelection') }}
</label>
<select
v-model="config.themesSelect"
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-indigo-500 focus:border-indigo-500 outline-none cursor-pointer"
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
? 'bg-gray-700 border-gray-600 text-white hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400'
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
style="
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');
@@ -207,18 +215,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.robotsFile') }}
</label>
<textarea
v-model="config.robotsText"
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-indigo-500 focus:border-indigo-500 outline-none"
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="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
></textarea>
</div>
@@ -229,18 +237,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.notificationTitle') }}
</label>
<input
type="text"
v-model="config.notify_title"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -248,18 +256,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.notificationContent') }}
</label>
<textarea
v-model="config.notify_content"
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-indigo-500 focus:border-indigo-500 outline-none"
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="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
></textarea>
</div>
@@ -269,7 +277,7 @@ onMounted(() => {
<div class="space-y-4">
<h3
class="text-lg font-medium mb-4"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-800']"
>
{{ t('manage.settings.storageSettings') }}
</h3>
@@ -277,7 +285,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.storagePath') }}
</label>
@@ -285,11 +293,11 @@ onMounted(() => {
type="text"
:placeholder="t('manage.settings.storagePathPlaceholder')"
v-model="config.storage_path"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -298,17 +306,17 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.storageMethod') }}
</label>
<select
v-model="config.file_storage"
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-indigo-500 focus:border-indigo-500 outline-none cursor-pointer"
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
? 'bg-gray-700 border-gray-600 text-white hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400'
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
style="
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');
@@ -332,7 +340,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
Webdav URL
</label>
@@ -340,11 +348,11 @@ onMounted(() => {
type="text"
:placeholder="t('manage.settings.webdavUrlPlaceholder')"
v-model="config.webdav_url"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -352,7 +360,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
Webdav Username
</label>
@@ -360,11 +368,11 @@ onMounted(() => {
type="text"
:placeholder="t('manage.settings.webdavUsernamePlaceholder')"
v-model="config.webdav_username"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -372,7 +380,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
Webdav Password
</label>
@@ -380,11 +388,11 @@ onMounted(() => {
type="password"
:placeholder="t('manage.settings.webdavPasswordPlaceholder')"
v-model="config.webdav_password"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -396,18 +404,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3AccessKeyId') }}
</label>
<input
type="text"
v-model="config.s3_access_key_id"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -415,18 +423,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3SecretAccessKey') }}
</label>
<input
type="password"
v-model="config.s3_secret_access_key"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -434,18 +442,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3BucketName') }}
</label>
<input
type="text"
v-model="config.s3_bucket_name"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -453,18 +461,18 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3EndpointUrl') }}
</label>
<input
type="text"
v-model="config.s3_endpoint_url"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -472,7 +480,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3RegionName') }}
</label>
@@ -480,11 +488,11 @@ onMounted(() => {
type="text"
v-model="config.s3_region_name"
:placeholder="t('manage.settings.autoPlaceholder')"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -492,17 +500,17 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3SignatureVersion') }}
</label>
<select
v-model="config.s3_signature_version"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400'
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
>
<option value="s3v2">{{ t('manage.settings.s3v2') }}</option>
@@ -513,18 +521,40 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3AddressingStyle') }}
</label>
<select
v-model="config.s3_addressing_style"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
>
<option value="auto">{{ t('manage.settings.s3AddressingAuto') }}</option>
<option value="path">{{ t('manage.settings.s3AddressingPath') }}</option>
<option value="virtual">{{ t('manage.settings.s3AddressingVirtual') }}</option>
</select>
</div>
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.s3Hostname') }}
</label>
<input
type="text"
v-model="config.s3_hostname"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
</div>
@@ -553,7 +583,7 @@ onMounted(() => {
<div class="mt-8">
<h3
class="text-lg font-medium mb-4"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-800']"
>
{{ t('manage.settings.uploadLimits') }}
</h3>
@@ -574,7 +604,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.fileSizeLimit') }}
</label>
@@ -582,20 +612,20 @@ onMounted(() => {
<input
type="number"
v-model="fileSize"
class="w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
<select
v-model="sizeUnit"
class="rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400'
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
>
<option value="KB">{{ t('manage.settings.fileSizeUnits.kb') }}</option>
@@ -605,10 +635,34 @@ onMounted(() => {
</div>
</div>
<div class="space-y-2 md:col-span-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.allowedFileTypes') }}
</label>
<input
type="text"
:value="config.allowed_file_types.join(', ')"
@input="updateAllowedFileTypes"
class="w-full rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
:placeholder="t('manage.settings.allowedFileTypesPlaceholder')"
/>
<p class="text-xs" :class="[isDarkMode ? 'text-zinc-400' : 'text-zinc-500']">
{{ t('manage.settings.allowedFileTypesHelp') }}
</p>
</div>
<div class="space-y-2">
<label
class="block text-sm font-medium mb-2"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.expirationType') }}
</label>
@@ -629,11 +683,11 @@ onMounted(() => {
:class="[
config.expireStyle.includes(style)
? isDarkMode
? 'bg-indigo-600 border-indigo-600 text-white'
: 'bg-indigo-600 border-indigo-600 text-white'
? 'bg-zinc-600 border-zinc-600 text-white'
: 'bg-zinc-600 border-zinc-600 text-white'
: isDarkMode
? 'bg-gray-700 border-gray-600 text-gray-300 hover:border-indigo-500'
: 'bg-white border-gray-300 text-gray-700 hover:border-indigo-500'
? 'bg-white/[0.06] border-white/10 text-zinc-300 hover:border-white/20 hover:bg-white/10'
: 'bg-white/70 border-zinc-200/80 text-zinc-700 hover:border-zinc-300 hover:bg-zinc-50'
]"
>
{{ t(`manage.settings.expiration.${style}`) }}
@@ -645,7 +699,7 @@ onMounted(() => {
<div class="space-y-2">
<label
class="block text-sm font-medium"
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-700']"
:class="[isDarkMode ? 'text-zinc-300' : 'text-zinc-700']"
>
{{ t('manage.settings.maxSaveTime') }}
</label>
@@ -653,20 +707,20 @@ onMounted(() => {
<input
type="number"
v-model="saveTime"
class="w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="w-24 rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400 hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400 placeholder-gray-500'
? 'border-white/10 bg-zinc-950/45 text-white placeholder-zinc-500 hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 placeholder-zinc-400 hover:border-zinc-300'
]"
/>
<select
v-model="saveTimeUnit"
class="rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none"
class="rounded-md shadow-sm px-4 py-2.5 transition-all duration-200 ease-in-out border focus:ring-2 focus:ring-zinc-500 focus:border-zinc-500 outline-none"
:class="[
isDarkMode
? 'bg-gray-700 border-gray-600 text-white hover:border-gray-500'
: 'border-gray-300 hover:border-gray-400'
? 'border-white/10 bg-zinc-950/45 text-white hover:border-white/20'
: 'border-zinc-200/80 bg-white/80 text-zinc-950 hover:border-zinc-300'
]"
>
<option value="秒">{{ t('common.second') }}</option>
@@ -691,7 +745,7 @@ onMounted(() => {
<div class="mt-8">
<h3
class="text-lg font-medium mb-4"
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
:class="[isDarkMode ? 'text-white' : 'text-zinc-800']"
>
{{ t('manage.settings.errorLimits') }}
</h3>