filter remotes on startup

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-09-24 20:28:01 +02:00
parent 82ae314fdc
commit c494d7db01
3 changed files with 15 additions and 9 deletions
+1 -7
View File
@@ -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)[] = []
+13 -1
View File
@@ -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`
}
+1 -1
View File
@@ -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) {