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 { showDefaultTray, showLoadingTray } from './tray'
|
||||||
import { lockWindows, openFullWindow, openWindow, unlockWindows } from './window'
|
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[]) {
|
async function parseRemotes(remotes: string[]) {
|
||||||
console.log('[parseRemotes] remotes', remotes)
|
console.log('[parseRemotes] remotes', remotes)
|
||||||
|
|
||||||
@@ -216,10 +236,7 @@ async function parseRemotes(remotes: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!remoteConfig?.disabledActions?.includes('tray-cleanup')) {
|
if (!remoteConfig?.disabledActions?.includes('tray-cleanup')) {
|
||||||
if (
|
if (remoteInfo?.provider && SUPPORTS_CLEANUP.includes(remoteInfo.provider)) {
|
||||||
remoteInfo?.provider &&
|
|
||||||
['s3', 'b2', 'box', 'drive', 'onedrive'].includes(remoteInfo.provider)
|
|
||||||
) {
|
|
||||||
const cleanupMenuItem = await MenuItem.new({
|
const cleanupMenuItem = await MenuItem.new({
|
||||||
id: `cleanup-${remote}`,
|
id: `cleanup-${remote}`,
|
||||||
text: 'Cleanup',
|
text: 'Cleanup',
|
||||||
|
|||||||
+4
-36
@@ -837,52 +837,20 @@ export async function getConfigFlags() {
|
|||||||
return copyFlags
|
return copyFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSftpFlags() {
|
export async function getServeFlags(type: string) {
|
||||||
console.log('[getSftpFlags]')
|
console.log('[getServeFlags] ', type)
|
||||||
|
|
||||||
const r = await fetch('http://localhost:5572/options/info', {
|
const r = await fetch('http://localhost:5572/options/info', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getAuthHeader(),
|
headers: getAuthHeader(),
|
||||||
}).then((res) => res.json() as Promise<any>)
|
}).then((res) => res.json() as Promise<any>)
|
||||||
|
|
||||||
const sftpFlags = r.sftp.map((flag: any) => ({
|
const serveFlags = r[type].map((flag: any) => ({
|
||||||
...flag,
|
...flag,
|
||||||
FieldName: flag.Name,
|
FieldName: flag.Name,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
return sftpFlags.sort((a: any, b: any) => a.Name.localeCompare(b.Name))
|
return serveFlags.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))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SERVE */
|
/* SERVE */
|
||||||
|
|||||||
+50
-5
@@ -18,19 +18,64 @@ export const RCLONE_CONF_REGEX = /[\/\\]rclone\.conf$/
|
|||||||
export const DOUBLE_BACKSLASH_REGEX = /\\\\/g
|
export const DOUBLE_BACKSLASH_REGEX = /\\\\/g
|
||||||
|
|
||||||
export const SUPPORTED_BACKENDS = [
|
export const SUPPORTED_BACKENDS = [
|
||||||
'sftp',
|
'azureblob',
|
||||||
's3',
|
'azurefiles',
|
||||||
'b2',
|
'b2',
|
||||||
|
'box',
|
||||||
'drive',
|
'drive',
|
||||||
'dropbox',
|
'dropbox',
|
||||||
|
'sftp',
|
||||||
|
's3',
|
||||||
'ftp',
|
'ftp',
|
||||||
'azurefiles',
|
|
||||||
'azureblob',
|
|
||||||
'gcs',
|
'gcs',
|
||||||
'protondrive',
|
'protondrive',
|
||||||
'box',
|
|
||||||
'webdav',
|
'webdav',
|
||||||
'onedrive',
|
'onedrive',
|
||||||
'http',
|
'http',
|
||||||
'storj',
|
'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.show()
|
||||||
await w.setFocus()
|
await w.setFocus()
|
||||||
|
|
||||||
|
if (platform() === 'linux') {
|
||||||
|
await w.setResizable(false)
|
||||||
|
await w.setResizable(true)
|
||||||
|
}
|
||||||
|
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +121,11 @@ export async function openWindow({
|
|||||||
|
|
||||||
useStore.setState({ firstWindow: false })
|
useStore.setState({ firstWindow: false })
|
||||||
|
|
||||||
|
if (platform() === 'linux') {
|
||||||
|
await w.setResizable(false)
|
||||||
|
await w.setResizable(true)
|
||||||
|
}
|
||||||
|
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,6 +166,11 @@ export async function openSmallWindow({
|
|||||||
|
|
||||||
useStore.setState({ firstWindow: false })
|
useStore.setState({ firstWindow: false })
|
||||||
|
|
||||||
|
if (platform() === 'linux') {
|
||||||
|
await w.setResizable(false)
|
||||||
|
await w.setResizable(true)
|
||||||
|
}
|
||||||
|
|
||||||
return w
|
return w
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ export default function OptionsSection({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
key={option.FieldName}
|
key={option.Name}
|
||||||
delay={500}
|
delay={500}
|
||||||
content={
|
content={
|
||||||
<div className="flex flex-col w-full gap-1 overflow-y-auto max-w-52 max-h-80 overscroll-y-none">
|
<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
|
) : undefined
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{option.FieldName}
|
{option.Name}
|
||||||
</Chip>
|
</Chip>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -83,13 +83,12 @@ export default function RemoteOptionsSection({
|
|||||||
)
|
)
|
||||||
.map((o) => {
|
.map((o) => {
|
||||||
const newName = `s3_${o.Name}`
|
const newName = `s3_${o.Name}`
|
||||||
const newFieldName = o.FieldName ? `S3${o.FieldName}` : `s3_ ${o.Name}`
|
|
||||||
if (addedKeys.has(newName)) return null
|
if (addedKeys.has(newName)) return null
|
||||||
addedKeys.add(newName)
|
addedKeys.add(newName)
|
||||||
return {
|
return {
|
||||||
...o,
|
...o,
|
||||||
Name: newName,
|
Name: newName,
|
||||||
FieldName: newFieldName,
|
FieldName: newName,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
@@ -103,15 +102,12 @@ export default function RemoteOptionsSection({
|
|||||||
.filter((o) => !IGNORED_OPTIONS.includes(o.Name) && !!o.Help)
|
.filter((o) => !IGNORED_OPTIONS.includes(o.Name) && !!o.Help)
|
||||||
.map((o) => {
|
.map((o) => {
|
||||||
const newName = `${remoteInfo.type}_${o.Name}`
|
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
|
if (addedKeys.has(newName)) return null
|
||||||
addedKeys.add(newName)
|
addedKeys.add(newName)
|
||||||
return {
|
return {
|
||||||
...o,
|
...o,
|
||||||
Name: newName,
|
Name: newName,
|
||||||
FieldName: newFieldName,
|
FieldName: newName,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|||||||
@@ -38,6 +38,30 @@ const SUPPORTS_PURGE = [
|
|||||||
'onedrive',
|
'onedrive',
|
||||||
'protondrive',
|
'protondrive',
|
||||||
'webdav',
|
'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() {
|
export default function Delete() {
|
||||||
|
|||||||
+6
-12
@@ -13,10 +13,8 @@ import {
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import {
|
import {
|
||||||
getCurrentGlobalFlags,
|
getCurrentGlobalFlags,
|
||||||
getDlnaFlags,
|
|
||||||
getFilterFlags,
|
getFilterFlags,
|
||||||
getFtpFlags,
|
getServeFlags,
|
||||||
getSftpFlags,
|
|
||||||
getVfsFlags,
|
getVfsFlags,
|
||||||
startServe,
|
startServe,
|
||||||
} from '../../lib/rclone/api'
|
} from '../../lib/rclone/api'
|
||||||
@@ -26,7 +24,7 @@ import { triggerTrayRebuild } from '../../lib/tray'
|
|||||||
import type { FlagValue } from '../../types/rclone'
|
import type { FlagValue } from '../../types/rclone'
|
||||||
import OptionsSection from '../components/OptionsSection'
|
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() {
|
export default function Serve() {
|
||||||
const remotes = useStore((state) => state.remotes)
|
const remotes = useStore((state) => state.remotes)
|
||||||
@@ -55,14 +53,10 @@ export default function Serve() {
|
|||||||
|
|
||||||
const [currentGlobalOptions, setCurrentGlobalOptions] = useState<any[]>([])
|
const [currentGlobalOptions, setCurrentGlobalOptions] = useState<any[]>([])
|
||||||
|
|
||||||
const getAvailableOptions =
|
const getAvailableOptions = async () => {
|
||||||
type === 'dlna'
|
if (!type) return []
|
||||||
? getDlnaFlags
|
return getServeFlags(type)
|
||||||
: type === 'ftp'
|
}
|
||||||
? getFtpFlags
|
|
||||||
: type === 'sftp'
|
|
||||||
? getSftpFlags
|
|
||||||
: () => Promise.resolve([])
|
|
||||||
|
|
||||||
// biome-ignore lint/correctness/useExhaustiveDependencies: when unlocking, we don't want to re-run the effect
|
// biome-ignore lint/correctness/useExhaustiveDependencies: when unlocking, we don't want to re-run the effect
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user