From 1b3f1f4ae90b67fd6b981dccfa154846e44e5990 Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Fri, 5 Jun 2026 20:47:39 +0300 Subject: [PATCH] add `link` functionality to create public links (closes #213) --- lib/rclone/constants.ts | 31 +++++++++++++++++++++++ src/components/navigator/FileList.tsx | 17 +++++++++++-- src/components/navigator/FilePanel.tsx | 20 ++++++++++++++- src/pages/Commander.tsx | 34 ++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 3 deletions(-) diff --git a/lib/rclone/constants.ts b/lib/rclone/constants.ts index b15e6d5..0dd6e6c 100644 --- a/lib/rclone/constants.ts +++ b/lib/rclone/constants.ts @@ -113,6 +113,37 @@ export const SUPPORTS_ABOUT = [ 'local', ] as const +export const SUPPORTS_LINK = [ + 'b2', + 'box', + 'drive', + 'dropbox', + 'fichier', + 'filescom', + 'gofile', + 'imagekit', + 'internetarchive', + 'jottacloud', + 'koofr', + 'mailru', + 'mega', + 'onedrive', + 'pikpak', + 'pixeldrain', + 'premiumizeme', + 'pcloud', + 's3', + 'seafile', + 'storj', + 'sugarsync', + 'yandex', +] as const + +export function supportsPublicLink(backendType?: string | null): boolean { + if (!backendType) return false + return SUPPORTS_LINK.includes(backendType.toLowerCase() as any) +} + export const CANNOT_PERSIST_EMPTY_FOLDERS = [ 's3', 'gcs', diff --git a/src/components/navigator/FileList.tsx b/src/components/navigator/FileList.tsx index 590308c..fafcf06 100644 --- a/src/components/navigator/FileList.tsx +++ b/src/components/navigator/FileList.tsx @@ -1,6 +1,6 @@ import { Button, Checkbox, Listbox, ListboxItem, cn } from '@heroui/react' import { platform } from '@tauri-apps/plugin-os' -import { DownloadIcon, EyeIcon, PencilIcon, StarIcon, Trash2Icon } from 'lucide-react' +import { DownloadIcon, EyeIcon, PencilIcon, Share2Icon, StarIcon, Trash2Icon } from 'lucide-react' import { useCallback } from 'react' import { formatBytes } from '../../../lib/format.ts' import FileIcon from './FileIcon' @@ -24,6 +24,7 @@ export default function FileList({ favoritedKeys, onToggleFavorite, onDownload, + onShare, onRename, onDelete, listHeight, @@ -44,6 +45,7 @@ export default function FileList({ favoritedKeys?: Record onToggleFavorite?: (entry: Entry, isFavorited: boolean) => void onDownload?: (entry: Entry) => void + onShare?: (entry: Entry) => void onRename?: (entry: Entry) => void onDelete?: (entry: Entry) => void listHeight: number @@ -162,7 +164,7 @@ export default function FileList({ } const gridCols = showPreviewColumn - ? 'grid-cols-[2.5rem_1fr_6rem_9rem_9rem]' + ? 'grid-cols-[2.5rem_1fr_6rem_9rem_11rem]' : 'grid-cols-[2.5rem_1fr_6rem_9rem_2.5rem]' return ( @@ -298,6 +300,17 @@ export default function FileList({ )} + {onShare && ( + + )} {onRename && (