diff --git a/apps/app-frontend/src/components/ui/download-manager/store-verification.ts b/apps/app-frontend/src/components/ui/download-manager/store-verification.ts deleted file mode 100644 index 458e7a25216..00000000000 --- a/apps/app-frontend/src/components/ui/download-manager/store-verification.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { Channel, invoke } from '@tauri-apps/api/core' -import { computed, ref } from 'vue' - -export interface StoreVerification { - checked: number - repaired: number - issues: { sha512: string; message: string }[] -} - -export const storeVerificationReport = ref(null) - -export const storeVerificationTask = ref<{ - id: string - status: 'running' | 'succeeded' | 'failed' - current: number - total: number - rate: number - lastRead: number -} | null>(null) - -export const verifyingStore = computed(() => storeVerificationTask.value?.status === 'running') - -export async function verifyStore(): Promise { - if (verifyingStore.value) throw new Error('Content verification is already running') - const task = { - id: `store-verification-${crypto.randomUUID()}`, - status: 'running' as const, - current: 0, - total: 0, - rate: 0, - lastRead: performance.now(), - } - storeVerificationTask.value = task - storeVerificationReport.value = null - let previousBytes = 0 - let previousTime = performance.now() - const onProgress = new Channel<[number, number]>() - onProgress.onmessage = ([current, total]) => { - const active = storeVerificationTask.value - if (!active || active.id !== task.id || active.status !== 'running') return - const now = performance.now() - active.current = current - active.total = total - if (current > previousBytes) { - active.rate = ((current - previousBytes) * 1000) / Math.max(1, now - previousTime) - active.lastRead = now - } - previousBytes = current - previousTime = now - } - try { - const report = await invoke('plugin:settings|store_verify', { - repair: true, - onProgress, - }) - storeVerificationReport.value = report - storeVerificationTask.value!.status = report.issues.length ? 'failed' : 'succeeded' - return report - } catch (error) { - storeVerificationTask.value!.status = 'failed' - throw error - } finally { - storeVerificationTask.value!.rate = 0 - } -} diff --git a/apps/app-frontend/src/components/ui/download-manager/use-download-manager.ts b/apps/app-frontend/src/components/ui/download-manager/use-download-manager.ts index 47d5c38b724..b2c83360f87 100644 --- a/apps/app-frontend/src/components/ui/download-manager/use-download-manager.ts +++ b/apps/app-frontend/src/components/ui/download-manager/use-download-manager.ts @@ -37,7 +37,6 @@ import { sharedInstancePublishes, type SharedInstancePublishTask, } from './shared-instance-publishes' -import { storeVerificationTask } from './store-verification' import { useInstallJobDisplay } from './use-install-job-display' export interface DownloadManagerJob { @@ -67,19 +66,6 @@ export interface DownloadManagerJob { busy: boolean } -const verificationMessages = defineMessages({ - verifying: { id: 'app.download-manager.verifying', defaultMessage: 'Verifying' }, - title: { id: 'app.settings.resource-management.store.title', defaultMessage: 'Content storage' }, - complete: { - id: 'app.settings.resource-management.store.verified', - defaultMessage: 'Verification complete', - }, - failed: { - id: 'app.settings.resource-management.store.attention', - defaultMessage: 'Some files still need attention', - }, -}) - const fileMessages = defineMessages({ preparing: { id: 'app.file-download.preparing', defaultMessage: 'Preparing download…' }, waiting: { id: 'app.file-download.waiting', defaultMessage: 'Waiting for the server…' }, @@ -196,10 +182,6 @@ export function useDownloadManager() { }), ) - const verificationRows = computed(() => { - const task = storeVerificationTask.value - return task ? [buildVerificationRow(task)] : [] - }) const fileRows = computed(() => [...externalFileDownloads.value.values()].map(buildFileRow)) const debugExportRows = computed(() => [...debugInfoExports.value.values()].map(buildDebugExportRow), @@ -209,7 +191,6 @@ export function useDownloadManager() { ) const allRows = computed(() => [ ...rows.value, - ...verificationRows.value, ...fileRows.value, ...debugExportRows.value, ...publishRows.value, @@ -400,44 +381,6 @@ export function useDownloadManager() { } } - function buildVerificationRow( - task: NonNullable, - ): DownloadManagerJob { - const progress = task.total ? Math.min(0.99, task.current / task.total) : 0 - const rate = task.status === 'running' && now.value - task.lastRead < 2000 ? task.rate : 0 - - return { - id: task.id, - instanceId: null, - status: task.status, - paused: false, - canceling: false, - canPause: false, - canCancel: false, - canRetry: false, - title: formatMessage(verificationMessages.title), - iconUrl: null, - text: formatMessage( - task.status === 'running' - ? verificationMessages.verifying - : task.status === 'succeeded' - ? verificationMessages.complete - : verificationMessages.failed, - ), - progress, - overallProgress: task.status === 'succeeded' ? 1 : progress, - progressLabel: - task.status === 'running' - ? `${formatBytes(task.current)} / ${formatBytes(task.total)} · ${display.formatRate(rate) || '0 B/s'}` - : '', - waiting: task.total === 0 || task.current >= task.total, - eta: '', - canCopyDetails: false, - copied: false, - busy: false, - } - } - function newestFirst(a: DownloadManagerJob, b: DownloadManagerJob) { return (b.finishedAt ?? '').localeCompare(a.finishedAt ?? '') } @@ -572,10 +515,6 @@ export function useDownloadManager() { if (publish.status !== 'running') sharedInstancePublishes.value.delete(id) return } - if (storeVerificationTask.value?.id === id) { - if (storeVerificationTask.value.status !== 'running') storeVerificationTask.value = null - return - } const job = jobs.value.get(id) if (!job || job.status === 'queued' || job.status === 'running') return await runAction(id, async () => { diff --git a/apps/app-frontend/src/features/settings/system/resource-management-settings/content-storage.vue b/apps/app-frontend/src/features/settings/system/resource-management-settings/content-storage.vue index 97c657f059f..6bdabd8af1d 100644 --- a/apps/app-frontend/src/features/settings/system/resource-management-settings/content-storage.vue +++ b/apps/app-frontend/src/features/settings/system/resource-management-settings/content-storage.vue @@ -1,7 +1,6 @@