diff --git a/lib/menu.ts b/lib/menu.ts index 573c011..2137747 100644 --- a/lib/menu.ts +++ b/lib/menu.ts @@ -19,7 +19,6 @@ import { unmountRemote, } from './rclone/api' import { compareVersions, getRcloneVersion } from './rclone/common' -import { SUPPORTED_BACKENDS } from './rclone/constants' import { dialogGetMountPlugin, needsMountPlugin } from './rclone/mount' import { usePersistedStore, useStore } from './store' import { showDefaultTray, showLoadingTray } from './tray' @@ -50,12 +49,7 @@ async function parseRemotes(remotes: string[]) { } const remoteInfo = await getRemote(remote).catch(null) - console.log('[parseRemotes] remoteInfo', remoteInfo) - - if (!remoteInfo || !SUPPORTED_BACKENDS.includes(remoteInfo?.type)) { - console.log('[parseRemotes] skipping remote not supported', remote) - continue - } + console.log('[parseRemotes] remoteInfo', remoteInfo?.provider, remoteInfo?.type) const submenuItems: (MenuItem | Submenu | PredefinedMenuItem)[] = [] diff --git a/main.ts b/main.ts index 8f3eb88..83d7012 100644 --- a/main.ts +++ b/main.ts @@ -13,6 +13,7 @@ import { isDirectoryEmpty } from './lib/fs' import { validateLicense } from './lib/license' import notify from './lib/notify' import { + getRemote, listJobs, listRemotes, mountRemote, @@ -23,6 +24,7 @@ import { startSync, } from './lib/rclone/api' import { compareVersions } from './lib/rclone/common' +import { SUPPORTED_BACKENDS } from './lib/rclone/constants' import { initRclone } from './lib/rclone/init' import { usePersistedStore, useStore } from './lib/store' import { initTray, showDefaultTray, showLoadingTray } from './lib/tray' @@ -307,7 +309,17 @@ async function startRclone() { console.log('[startRclone] listing remotes') const remotes = await listRemotes() console.log('[startRclone] got remotes') - useStore.setState({ remotes: remotes }) + + const remotesInfo = await Promise.all( + remotes.map(async (remote) => await getRemote(remote).catch(() => null)) + ) + const supportedRemotes = remotes.filter( + (_, index) => remotesInfo[index] && SUPPORTED_BACKENDS.includes(remotesInfo[index]!.type) + ) + + console.log(`[startRclone] skipped ${remotes.length - supportedRemotes.length} remotes`) + + useStore.setState({ remotes: supportedRemotes }) // console.log('childProcess', JSON.stringify(childProcess)) // prints `pid` } diff --git a/src/components/RemoteOptionsSection.tsx b/src/components/RemoteOptionsSection.tsx index b36745d..7adb014 100644 --- a/src/components/RemoteOptionsSection.tsx +++ b/src/components/RemoteOptionsSection.tsx @@ -68,7 +68,7 @@ export default function RemoteOptionsSection({ for (const remote of uniqueRemotes) { const remoteInfo = await getRemote(remote) - console.log('[Copy] remoteInfo', remoteInfo) + console.log('[Copy] remoteInfo', remoteInfo?.provider, remoteInfo?.type) if (remoteInfo.type === 's3') { if (remoteInfo.provider) {