From 6ec402c6e9eaa857ca0fb599e81f6d748f7d585b Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Mon, 6 Oct 2025 19:35:25 +0200 Subject: [PATCH] enable remaining backends Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- lib/menu.ts | 25 +++++++++-- lib/rclone/api.ts | 40 ++---------------- lib/rclone/constants.ts | 55 ++++++++++++++++++++++--- lib/window.ts | 15 +++++++ src/components/OptionsSection.tsx | 4 +- src/components/RemoteOptionsSection.tsx | 8 +--- src/pages/Delete.tsx | 24 +++++++++++ src/pages/Serve.tsx | 18 +++----- 8 files changed, 124 insertions(+), 65 deletions(-) diff --git a/lib/menu.ts b/lib/menu.ts index 2137747..eabb817 100644 --- a/lib/menu.ts +++ b/lib/menu.ts @@ -24,6 +24,26 @@ import { usePersistedStore, useStore } from './store' import { showDefaultTray, showLoadingTray } from './tray' import { lockWindows, openFullWindow, openWindow, unlockWindows } from './window' +const SUPPORTS_CLEANUP = [ + 's3', + 'b2', + 'box', + 'drive', + 'onedrive', + 'internetarchive', + 'jottacloud', + 'mailru', + 'mega', + 'oos', + 'pcloud', + 'pikpak', + 'putio', + 'qingstor', + 'protondrive', + 'seafile', + 'yandex', +] + async function parseRemotes(remotes: string[]) { console.log('[parseRemotes] remotes', remotes) @@ -216,10 +236,7 @@ async function parseRemotes(remotes: string[]) { } if (!remoteConfig?.disabledActions?.includes('tray-cleanup')) { - if ( - remoteInfo?.provider && - ['s3', 'b2', 'box', 'drive', 'onedrive'].includes(remoteInfo.provider) - ) { + if (remoteInfo?.provider && SUPPORTS_CLEANUP.includes(remoteInfo.provider)) { const cleanupMenuItem = await MenuItem.new({ id: `cleanup-${remote}`, text: 'Cleanup', diff --git a/lib/rclone/api.ts b/lib/rclone/api.ts index ef7b3a8..d2e35ee 100644 --- a/lib/rclone/api.ts +++ b/lib/rclone/api.ts @@ -837,52 +837,20 @@ export async function getConfigFlags() { return copyFlags } -export async function getSftpFlags() { - console.log('[getSftpFlags]') +export async function getServeFlags(type: string) { + console.log('[getServeFlags] ', type) const r = await fetch('http://localhost:5572/options/info', { method: 'POST', headers: getAuthHeader(), }).then((res) => res.json() as Promise) - const sftpFlags = r.sftp.map((flag: any) => ({ + const serveFlags = r[type].map((flag: any) => ({ ...flag, FieldName: flag.Name, })) - return sftpFlags.sort((a: any, b: any) => a.Name.localeCompare(b.Name)) -} - -export async function getFtpFlags() { - console.log('[getFtpFlags]') - - const r = await fetch('http://localhost:5572/options/info', { - method: 'POST', - headers: getAuthHeader(), - }).then((res) => res.json() as Promise) - - const ftpFlags = r.ftp.map((flag: any) => ({ - ...flag, - FieldName: flag.Name, - })) - - return ftpFlags.sort((a: any, b: any) => a.Name.localeCompare(b.Name)) -} - -export async function getDlnaFlags() { - console.log('[getDlnaFlags]') - - const r = await fetch('http://localhost:5572/options/info', { - method: 'POST', - headers: getAuthHeader(), - }).then((res) => res.json() as Promise) - - const dlnaFlags = r.dlna.map((flag: any) => ({ - ...flag, - FieldName: flag.Name, - })) - - return dlnaFlags.sort((a: any, b: any) => a.Name.localeCompare(b.Name)) + return serveFlags.sort((a: any, b: any) => a.Name.localeCompare(b.Name)) } /* SERVE */ diff --git a/lib/rclone/constants.ts b/lib/rclone/constants.ts index 654508c..ee91a90 100644 --- a/lib/rclone/constants.ts +++ b/lib/rclone/constants.ts @@ -18,19 +18,64 @@ export const RCLONE_CONF_REGEX = /[\/\\]rclone\.conf$/ export const DOUBLE_BACKSLASH_REGEX = /\\\\/g export const SUPPORTED_BACKENDS = [ - 'sftp', - 's3', + 'azureblob', + 'azurefiles', 'b2', + 'box', 'drive', 'dropbox', + 'sftp', + 's3', 'ftp', - 'azurefiles', - 'azureblob', 'gcs', 'protondrive', - 'box', 'webdav', 'onedrive', 'http', 'storj', + 'gphotos', + 'netstorage', + 'oos', + 'swift', + 'compress', + 'union', + 'hasher', + 'combine', + 'chunker', + 'memory', + 'crypt', + 'alias', + 'cache', + 'local', + 'hdfs', + 'cloudinary', + 'doi', + 'filelu', + 'filescom', + 'imagekit', + 'internetarchive', + 'koofr', + 'linkbox', + 'mega', + 'opendrive', + 'pixeldrain', + 'seafile', + 'sia', + 'smb', + 'ulozto', + 'gofile', + 'qingstor', + 'filefabric', + 'quatrix', + 'sugarsync', + 'hidrive', + 'jottacloud', + 'mailru', + 'pcloud', + 'pikpak', + 'premiumizeme', + 'putio', + 'sharefile', + 'yandex', + 'zoho', ] diff --git a/lib/window.ts b/lib/window.ts index e7a64f5..8807fb3 100644 --- a/lib/window.ts +++ b/lib/window.ts @@ -69,6 +69,11 @@ export async function openFullWindow({ await w.show() await w.setFocus() + if (platform() === 'linux') { + await w.setResizable(false) + await w.setResizable(true) + } + return w } @@ -116,6 +121,11 @@ export async function openWindow({ useStore.setState({ firstWindow: false }) + if (platform() === 'linux') { + await w.setResizable(false) + await w.setResizable(true) + } + return w } @@ -156,6 +166,11 @@ export async function openSmallWindow({ useStore.setState({ firstWindow: false }) + if (platform() === 'linux') { + await w.setResizable(false) + await w.setResizable(true) + } + return w } diff --git a/src/components/OptionsSection.tsx b/src/components/OptionsSection.tsx index 97706bb..0146cf3 100644 --- a/src/components/OptionsSection.tsx +++ b/src/components/OptionsSection.tsx @@ -123,7 +123,7 @@ export default function OptionsSection({ return ( @@ -206,7 +206,7 @@ export default function OptionsSection({ ) : undefined } > - {option.FieldName} + {option.Name} ) diff --git a/src/components/RemoteOptionsSection.tsx b/src/components/RemoteOptionsSection.tsx index 7adb014..a81260e 100644 --- a/src/components/RemoteOptionsSection.tsx +++ b/src/components/RemoteOptionsSection.tsx @@ -83,13 +83,12 @@ export default function RemoteOptionsSection({ ) .map((o) => { const newName = `s3_${o.Name}` - const newFieldName = o.FieldName ? `S3${o.FieldName}` : `s3_ ${o.Name}` if (addedKeys.has(newName)) return null addedKeys.add(newName) return { ...o, Name: newName, - FieldName: newFieldName, + FieldName: newName, } }) .filter(Boolean) @@ -103,15 +102,12 @@ export default function RemoteOptionsSection({ .filter((o) => !IGNORED_OPTIONS.includes(o.Name) && !!o.Help) .map((o) => { const newName = `${remoteInfo.type}_${o.Name}` - const newFieldName = o.FieldName - ? `${remoteInfo.type.toUpperCase()}${o.FieldName}` - : `${remoteInfo.type}_${o.Name}` if (addedKeys.has(newName)) return null addedKeys.add(newName) return { ...o, Name: newName, - FieldName: newFieldName, + FieldName: newName, } }) .filter(Boolean) diff --git a/src/pages/Delete.tsx b/src/pages/Delete.tsx index 7959377..88d98f1 100644 --- a/src/pages/Delete.tsx +++ b/src/pages/Delete.tsx @@ -38,6 +38,30 @@ const SUPPORTS_PURGE = [ 'onedrive', 'protondrive', 'webdav', + 'netstorage', + 'sharefile', + 'filescom', + 'gofile', + 'hdfs', + 'hifile', + 'imagekit', + 'jottacloud', + 'koofr', + 'mailru', + 'mega', + 'swift', + 'pikpak', + 'pcloud', + 'pixeldrain', + 'putio', + 'premiumizeme', + 'quatrix', + 'seafile', + 'sugarsync', + 'storj', + 'webdav', + 'yandex', + 'zoho', ] export default function Delete() { diff --git a/src/pages/Serve.tsx b/src/pages/Serve.tsx index 01b0a5c..14803b0 100644 --- a/src/pages/Serve.tsx +++ b/src/pages/Serve.tsx @@ -13,10 +13,8 @@ import { import { useEffect, useState } from 'react' import { getCurrentGlobalFlags, - getDlnaFlags, getFilterFlags, - getFtpFlags, - getSftpFlags, + getServeFlags, getVfsFlags, startServe, } from '../../lib/rclone/api' @@ -26,7 +24,7 @@ import { triggerTrayRebuild } from '../../lib/tray' import type { FlagValue } from '../../types/rclone' import OptionsSection from '../components/OptionsSection' -const SERVE_TYPES = ['dlna', 'ftp', 'sftp'] as const +const SERVE_TYPES = ['dlna', 'ftp', 'sftp', 'http', 'nfs', 'restic', 's3', 'webdav'] as const export default function Serve() { const remotes = useStore((state) => state.remotes) @@ -55,14 +53,10 @@ export default function Serve() { const [currentGlobalOptions, setCurrentGlobalOptions] = useState([]) - const getAvailableOptions = - type === 'dlna' - ? getDlnaFlags - : type === 'ftp' - ? getFtpFlags - : type === 'sftp' - ? getSftpFlags - : () => Promise.resolve([]) + const getAvailableOptions = async () => { + if (!type) return [] + return getServeFlags(type) + } // biome-ignore lint/correctness/useExhaustiveDependencies: when unlocking, we don't want to re-run the effect useEffect(() => {