diff --git a/src/routes/(authed)/tools/adv-upload/+page.svelte b/src/routes/(authed)/tools/adv-upload/+page.svelte index 1735f59..8c95d2b 100644 --- a/src/routes/(authed)/tools/adv-upload/+page.svelte +++ b/src/routes/(authed)/tools/adv-upload/+page.svelte @@ -43,18 +43,21 @@ // Each country can target a different SFTP host (configured on the backend // via ADV_SFTP_COUNTRY_CONFIG). The selected country is sent with the upload. + // NOTE: only Thailand is enabled for now — other countries need their SFTP + // config (host/password/remote_dir) set on the backend before being added. + // To enable a country later, uncomment it here AND add it to ADV_SFTP_COUNTRY_CONFIG. const COUNTRIES = [ - { value: 'tha', label: 'Thailand (tha)' }, - { value: 'mys', label: 'Malaysia (mys)' }, - { value: 'aus', label: 'Australia (aus)' }, - { value: 'sgp', label: 'Singapore (sgp)' }, - { value: 'hkg', label: 'Hong Kong (hkg)' }, - { value: 'gbr', label: 'United Kingdom (gbr)' }, - { value: 'uae_dubai', label: 'UAE Dubai (uae_dubai)' }, - { value: 'ltu', label: 'Lithuania (ltu)' }, - { value: 'rou', label: 'Romania (rou)' }, - { value: 'lva', label: 'Latvia (lva)' }, - { value: 'est', label: 'Estonia (est)' } + { value: 'tha', label: 'Thailand (tha)' } + // { value: 'mys', label: 'Malaysia (mys)' }, + // { value: 'aus', label: 'Australia (aus)' }, + // { value: 'sgp', label: 'Singapore (sgp)' }, + // { value: 'hkg', label: 'Hong Kong (hkg)' }, + // { value: 'gbr', label: 'United Kingdom (gbr)' }, + // { value: 'uae_dubai', label: 'UAE Dubai (uae_dubai)' }, + // { value: 'ltu', label: 'Lithuania (ltu)' }, + // { value: 'rou', label: 'Romania (rou)' }, + // { value: 'lva', label: 'Latvia (lva)' }, + // { value: 'est', label: 'Estonia (est)' } ]; let selectedCountry = $state('tha'); @@ -91,6 +94,26 @@ let isAdbConnected = $derived(Boolean(AdbInstance.instance)); let pushingToMachine = $state(false); let pushProgress = $state({ current: 0, total: 0, name: '', percent: 0 }); + let connecting = $state(false); + + async function connectMachine() { + if (AdbInstance.instance) { + addNotification('INFO:Machine already connected'); + return; + } + connecting = true; + try { + await adb.connnectViaWebUSB(false); + addNotification( + AdbInstance.instance ? 'INFO:Machine connected' : 'WARN:No machine selected' + ); + } catch (error) { + console.error('[Adv] connect error:', error); + addNotification(`ERR:Connect failed: ${error instanceof Error ? error.message : 'unknown'}`); + } finally { + connecting = false; + } + } let generatingManifest = $state(false); @@ -372,8 +395,8 @@ uploading = false; - const successCount = files.filter((f) => f.status === 'success').length; - const errorCount = files.filter((f) => f.status === 'error').length; + const successCount = pendingFiles.filter((f) => f.status === 'success').length; + const errorCount = pendingFiles.filter((f) => f.status === 'error').length; if (errorCount === 0) { addNotification(`INFO:Uploaded ${successCount} adv video(s) successfully`); @@ -572,6 +595,18 @@ {isAdbConnected ? 'Machine connected' : 'Machine offline'} + {#if !isAdbConnected} + + {/if} + {#if files.length > 0}