diff --git a/web/src/components/CloudSharePanel.tsx b/web/src/components/CloudSharePanel.tsx index f9a43dd..6df6c75 100644 --- a/web/src/components/CloudSharePanel.tsx +++ b/web/src/components/CloudSharePanel.tsx @@ -71,6 +71,20 @@ export default function CloudSharePanel() { setTimeout(() => setCopied(false), 1500); }; + const canShare = typeof navigator !== "undefined" && typeof navigator.share === "function"; + + const share = async (url: string, fileName: string) => { + try { + await navigator.share({ + title: `AnyDrop — ${fileName}`, + text: "File shared via AnyDrop", + url, + }); + } catch { + // User canceled the share sheet, or the browser rejected — nothing to do. + } + }; + return (
{stage.shareUrl}
diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsx
index 5e33718..a13cc72 100644
--- a/web/src/pages/Settings.tsx
+++ b/web/src/pages/Settings.tsx
@@ -509,6 +509,22 @@ function SharedLinksSection() {
setTimeout(() => setCopiedId((v) => (v === item.id ? null : v)), 1500);
};
+ const canShare = typeof navigator !== "undefined" && typeof navigator.share === "function";
+
+ const onShare = async (item: LinkItem) => {
+ if (!item.keyFrag) return;
+ const url = `${window.location.origin}/r/${item.id}#k=${item.keyFrag}`;
+ try {
+ await navigator.share({
+ title: `AnyDrop — ${item.filename ?? "Encrypted file"}`,
+ text: "File shared via AnyDrop",
+ url,
+ });
+ } catch {
+ // User canceled — no-op.
+ }
+ };
+
return (