import { Signal, useSignal } from "@preact/signals"; import Button from "@/components/Button.tsx"; import FileInfo from "@/components/FileInfo.tsx"; import { CloseIcon, CopyIcon, DownloadIcon, ShareIcon } from "@/components/Icons.tsx"; import InputField from "@/components/InputField.tsx"; import type { FileMetadata } from "@/src/file_crypto.ts"; import { download_blob } from "@/src/files.ts"; import { delete_file, download_file, share_file, unshare_file } from "@/src/files_api.ts"; import { create_share, share_link } from "@/src/share_crypto.ts"; export interface HubShare { // Has the link secret, so it only exists in this browser link: string; } export interface HubFile { id: string; uploaded_at: string; // Size of the encrypted file, shown when the metadata can't be read stored_size: number; // As stored on the server, needed to encrypt it again for a share link encrypted_metadata: string; // null when it can't be decrypted with this key metadata: FileMetadata | null; share: HubShare | null; } type FileAction = "download" | "delete" | "share" | "unshare"; const DATE_FORMAT = new Intl.DateTimeFormat(undefined, { dateStyle: "medium" }); interface ShareLinkProps { name: string; link: string; copied: boolean; on_copy: (link: string) => void; } function ShareLink(props: ShareLinkProps) { return (
Only you can open what you store here. Add some files on the left to get started.
{error.value}
}