console debug messages

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-11-01 02:51:01 +01:00
parent 0f939f87ee
commit 82f3438c0e
+70 -7
View File
@@ -67,15 +67,18 @@ try {
} }
async function waitForHydration() { async function waitForHydration() {
console.log('waiting for store hydration') console.log('[waitForHydration] waiting for store hydration')
await new Promise((resolve) => setTimeout(resolve, 50)) await new Promise((resolve) => setTimeout(resolve, 50))
if (!usePersistedStore.persist.hasHydrated()) { if (!usePersistedStore.persist.hasHydrated()) {
await waitForHydration() await waitForHydration()
} }
console.log('store hydrated') console.log('[waitForHydration] store hydrated')
} }
async function validateInstance() { async function validateInstance() {
console.log('[validateInstance]')
const isOnline = navigator.onLine const isOnline = navigator.onLine
if (!isOnline && platform() !== 'linux') { if (!isOnline && platform() !== 'linux') {
@@ -119,9 +122,13 @@ async function validateInstance() {
} }
async function checkAlreadyRunning() { async function checkAlreadyRunning() {
console.log('[checkAlreadyRunning]')
try { try {
const rcPort = 5572 const rcPort = 5572
const running = await invoke<boolean>('is_rclone_running', { port: rcPort }) const running = await invoke<boolean>('is_rclone_running', { port: rcPort })
console.log('[checkAlreadyRunning] running', running)
if (running) { if (running) {
const confirmed = await ask( const confirmed = await ask(
'Rclone is already running on this system.\n\nPlease stop it before launching Rclone UI.', 'Rclone is already running on this system.\n\nPlease stop it before launching Rclone UI.',
@@ -132,8 +139,14 @@ async function checkAlreadyRunning() {
cancelLabel: 'Exit UI', cancelLabel: 'Exit UI',
} }
) )
console.log('[checkAlreadyRunning] confirmed', confirmed)
if (confirmed) { if (confirmed) {
console.log('[checkAlreadyRunning] closing rclone')
if (platform() === 'windows') { if (platform() === 'windows') {
console.log('[checkAlreadyRunning] windows, showing message')
await message( await message(
"If you're on Windows, you might notice a few powershell/terminal windows opening and closing.\n\nThis is normal and expected, imagine we are playing whack-a-mole with the rclone process to close it.", "If you're on Windows, you might notice a few powershell/terminal windows opening and closing.\n\nThis is normal and expected, imagine we are playing whack-a-mole with the rclone process to close it.",
{ {
@@ -144,14 +157,16 @@ async function checkAlreadyRunning() {
) )
} }
const result = await invoke('stop_rclone_processes') const result = await invoke('stop_rclone_processes')
console.log('stop_rclone_processes', result) console.log('[checkAlreadyRunning] stop_rclone_processes', result)
await new Promise((resolve) => setTimeout(resolve, 1000)) await new Promise((resolve) => setTimeout(resolve, 1000))
} else { } else {
console.log('[checkAlreadyRunning] exiting')
await exit(0) await exit(0)
} }
} }
} catch (err) { } catch (err) {
console.error('Failed to check rclone process:', err) console.error('[checkAlreadyRunning] error', err)
Sentry.captureException(err)
} }
} }
@@ -164,7 +179,10 @@ async function startRclone() {
useStore.setState({ rcloneLoaded: true }) useStore.setState({ rcloneLoaded: true })
useStore.setState({ remotes: remotes }) useStore.setState({ remotes: remotes })
return return
} catch {} } catch (error) {
console.error('[startRclone] error', error)
Sentry.captureException(error)
}
let rclone: Awaited<ReturnType<typeof initRclone>> | null = null let rclone: Awaited<ReturnType<typeof initRclone>> | null = null
@@ -532,33 +550,52 @@ async function handleTask(task: ScheduledTask) {
} }
async function checkVersion() { async function checkVersion() {
console.log('[checkVersion]')
try { try {
console.log('[checkVersion] fetching meta.json')
const metaJson = await fetch( const metaJson = await fetch(
'https://raw.githubusercontent.com/rclone-ui/rclone-ui/refs/heads/main/meta.json' 'https://raw.githubusercontent.com/rclone-ui/rclone-ui/refs/heads/main/meta.json'
) )
console.log('[checkVersion] meta.json fetched')
const metaJsonData = await metaJson.json() const metaJsonData = await metaJson.json()
console.log('[checkVersion] meta.json parsed')
const { minimumVersion, okVersion } = metaJsonData const { minimumVersion, okVersion } = metaJsonData
console.log('[checkVersion] minimumVersion', minimumVersion)
console.log('[checkVersion] okVersion', okVersion)
const currentVersion = await getUiVersion() const currentVersion = await getUiVersion()
console.log('[checkVersion] currentVersion', currentVersion)
if ( if (
compareVersions(currentVersion, minimumVersion) >= 0 && compareVersions(currentVersion, minimumVersion) >= 0 &&
compareVersions(currentVersion, okVersion) >= 0 compareVersions(currentVersion, okVersion) >= 0
) { ) {
console.log('[checkVersion] currentVersion is up to date')
return return
} }
console.log('[checkVersion] checking for update')
const receivedUpdate = await check({ const receivedUpdate = await check({
allowDowngrades: true, allowDowngrades: true,
timeout: 30000, timeout: 30000,
}) })
console.log('[checkVersion] update check complete')
if (!receivedUpdate) { if (!receivedUpdate) {
console.log('[checkVersion] no update found')
return return
} }
if (compareVersions(currentVersion, minimumVersion) < 0) { if (compareVersions(currentVersion, minimumVersion) < 0) {
console.log('[checkVersion] currentVersion is outdated')
const confirmed = await ask( const confirmed = await ask(
'You are running an outdated version of Rclone UI. Please update to the latest version.', 'You are running an outdated version of Rclone UI. Please update to the latest version.',
{ {
@@ -570,19 +607,28 @@ async function checkVersion() {
) )
if (!confirmed) { if (!confirmed) {
console.log('[checkVersion] user cancelled update')
return await exit(0) return await exit(0)
} }
console.log('[checkVersion] downloading and installing update')
await receivedUpdate.downloadAndInstall() await receivedUpdate.downloadAndInstall()
console.log('[checkVersion] update downloaded and installed')
await message('Rclone UI has been updated. Please restart the application.', { await message('Rclone UI has been updated. Please restart the application.', {
title: 'Update Complete', title: 'Update Complete',
kind: 'info', kind: 'info',
okLabel: 'Restart', okLabel: 'Restart',
}) })
console.log('[checkVersion] relaunching app')
await getCurrentWindow().emit('relaunch-app') await getCurrentWindow().emit('relaunch-app')
} else if (compareVersions(currentVersion, okVersion) < 0) { } else if (compareVersions(currentVersion, okVersion) < 0) {
console.log('[checkVersion] checking for update')
const confirmed = await ask( const confirmed = await ask(
'You are running an outdated version of Rclone UI. Please update to the latest version.', 'You are running an outdated version of Rclone UI. Please update to the latest version.',
{ {
@@ -594,30 +640,47 @@ async function checkVersion() {
) )
if (!confirmed) { if (!confirmed) {
console.log('[checkVersion] user cancelled update')
return return
} }
console.log('[checkVersion] downloading and installing update')
await receivedUpdate.downloadAndInstall() await receivedUpdate.downloadAndInstall()
console.log('[checkVersion] update downloaded and installed')
await message('Rclone UI has been updated. Please restart the application.', { await message('Rclone UI has been updated. Please restart the application.', {
title: 'Update Complete', title: 'Update Complete',
kind: 'info', kind: 'info',
okLabel: 'Restart', okLabel: 'Restart',
}) })
console.log('[checkVersion] relaunching app')
await getCurrentWindow().emit('relaunch-app') await getCurrentWindow().emit('relaunch-app')
} }
} catch {} } catch (error) {
console.error('[checkVersion] error', error)
Sentry.captureException(error)
}
} }
async function checkTraySupport() { async function checkTraySupport() {
console.log('[checkTraySupport] platform', platform())
let traySupported = false let traySupported = false
try { try {
traySupported = await invoke<boolean>('is_tray_supported') traySupported = await invoke<boolean>('is_tray_supported')
} catch {} } catch (error) {
console.error('[checkTraySupport] error', error)
Sentry.captureException(error)
}
if (!traySupported) { if (!traySupported) {
console.log('[checkTraySupport] tray not supported')
const confirmed = await ask( const confirmed = await ask(
'Your desktop environment does not appear to have a tray/menubar.\n\nRclone UI requires a tray to run. Do you still wish to continue?', 'Your desktop environment does not appear to have a tray/menubar.\n\nRclone UI requires a tray to run. Do you still wish to continue?',
{ {