Show ExifTool WASM download progress on upload queue rows.

Stream progress from the worker via axios, expose percent in the exiftool store, and format it on initializing metadata lines.
This commit is contained in:
2026-10-31 04:14:55 +01:00
parent 9696c85a8e
commit da2d020a45
5 changed files with 50 additions and 12 deletions
+11
View File
@@ -6,6 +6,7 @@ import type { ExiftoolWorkerOutMessage } from '@/types/workers/exiftoolWorkerOut
export const useExiftoolStore = defineStore('exiftool', () => {
const initStatus = ref<ExiftoolInitStatus>('idle');
const initErrorMessage = ref<string | null>(null);
const wasmDownloadPercent = ref<number | null>(null);
const worker = ref<Worker | null>(null);
@@ -35,6 +36,7 @@ export const useExiftoolStore = defineStore('exiftool', () => {
if (initStatus.value === 'idle') {
initStatus.value = 'loading';
initErrorMessage.value = null;
wasmDownloadPercent.value = 0;
initPromise = new Promise<void>((resolve, reject) => {
initPromiseResolve = resolve;
initPromiseReject = reject;
@@ -69,8 +71,15 @@ export const useExiftoolStore = defineStore('exiftool', () => {
const handleWorkerMessage = (event: MessageEvent<ExiftoolWorkerOutMessage>): void => {
const message = event.data;
if (message.type === 'wasm-download-progress') {
wasmDownloadPercent.value = message.percent;
return;
}
if (message.type === 'init-done') {
initStatus.value = 'ready';
wasmDownloadPercent.value = null;
initPromiseResolve?.();
initPromiseResolve = null;
initPromiseReject = null;
@@ -81,6 +90,7 @@ export const useExiftoolStore = defineStore('exiftool', () => {
if (message.type === 'init-error') {
console.error('[exiftool] init-error', message.message);
initStatus.value = 'error';
wasmDownloadPercent.value = null;
initErrorMessage.value = message.message;
initPromiseReject?.(new Error(message.message));
initPromiseResolve = null;
@@ -181,6 +191,7 @@ export const useExiftoolStore = defineStore('exiftool', () => {
return {
initStatus,
initErrorMessage,
wasmDownloadPercent,
initializeExiftool,
readMetadata,
stripAllMetadata
+1 -1
View File
@@ -5,7 +5,7 @@ import type { MetadataPreviewEntry } from '@/types/metadata/MetadataPreview';
import { makeKeyFromFile } from '@/utils/file/makeKeyFromFile';
const METADATA_IDLE_MESSAGE = 'Waiting to load metadata...';
const EXIFTOOL_INITIALIZING_MESSAGE = 'Initializing ExifTool. It may take a minute on slow networks...';
const EXIFTOOL_INITIALIZING_MESSAGE = 'Downloading ExifTool…';
const METADATA_PROCESSING_MESSAGE = 'Stripping metadata...';
const METADATA_READY_MESSAGE = 'Metadata stripped';
const METADATA_LOAD_ERROR_MESSAGE = 'Could not load image metadata';