feat: Implement S2A account cleaner management and a global application configuration context, with supporting backend API.

This commit is contained in:
2026-01-31 02:24:08 +08:00
parent 92383f2f20
commit 634b493524
4 changed files with 251 additions and 91 deletions

View File

@@ -108,6 +108,30 @@ export default function Cleaner() {
}
}
// 计算下次清理时间
const getNextCleanTime = (): string => {
if (!cleanEnabled) return '未启用'
if (!status?.last_clean_time || status.last_clean_time === '0001-01-01T00:00:00Z') {
return '即将执行'
}
try {
const lastTime = new Date(status.last_clean_time)
const nextTime = new Date(lastTime.getTime() + cleanInterval * 1000)
// 如果下次时间已过,说明即将执行
if (nextTime <= new Date()) {
return '即将执行'
}
return nextTime.toLocaleString('zh-CN', {
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
})
} catch {
return '未知'
}
}
if (loading) {
return (
<div className="flex items-center justify-center h-64">
@@ -193,6 +217,9 @@ export default function Cleaner() {
<p className="text-2xl font-bold text-slate-900 dark:text-slate-100">
{formatInterval(cleanInterval)}
</p>
<p className="text-xs text-slate-400 dark:text-slate-500 mt-1">
: {getNextCleanTime()}
</p>
</div>
<div className="h-12 w-12 rounded-xl bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center">
<Clock className="h-6 w-6 text-blue-500" />