enable remaining backends
Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
+21
-4
@@ -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',
|
||||
|
||||
+4
-36
@@ -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<any>)
|
||||
|
||||
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<any>)
|
||||
|
||||
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<any>)
|
||||
|
||||
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 */
|
||||
|
||||
+50
-5
@@ -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',
|
||||
]
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ export default function OptionsSection({
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
key={option.FieldName}
|
||||
key={option.Name}
|
||||
delay={500}
|
||||
content={
|
||||
<div className="flex flex-col w-full gap-1 overflow-y-auto max-w-52 max-h-80 overscroll-y-none">
|
||||
@@ -206,7 +206,7 @@ export default function OptionsSection({
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
{option.FieldName}
|
||||
{option.Name}
|
||||
</Chip>
|
||||
</Tooltip>
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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() {
|
||||
|
||||
+6
-12
@@ -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<any[]>([])
|
||||
|
||||
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(() => {
|
||||
|
||||
Reference in New Issue
Block a user