📤 Datei hochladen
-
DickenDock Upload
+
{phase==='loading' &&
⏳ Link wird geprüft…
}
{phase==='error' && (() => { window.location.replace('https://www.google.de'); return
Weiterleitung…
; })()}
diff --git a/frontend/src/tools/dateien.jsx b/frontend/src/tools/dateien.jsx
index 1a72e57..8e7d8e8 100644
--- a/frontend/src/tools/dateien.jsx
+++ b/frontend/src/tools/dateien.jsx
@@ -170,6 +170,8 @@ function UploadShareManager({ toast }) {
const [busy, setBusy] = useState(false);
const [copied, setCopied] = useState(null);
const [sharePws, setSharePws] = useState({}); // {shareId: password} fĂĽr Passwort-Kopieren
+ const [shortUrls, setShortUrls] = useState({}); // {shareId: shortUrl}
+ const [shortening, setShortening] = useState(null); // shareId being shortened
const load = () => api('/upload-shares').then(d=>{ setShares(d.shares||[]); setFolder(d.folder); }).catch(()=>{});
useEffect(()=>{ load(); },[]);
@@ -200,6 +202,24 @@ function UploadShareManager({ toast }) {
toast('Entfernt');
};
+ const shorten = async (shareId, token) => {
+ setShortening(shareId);
+ const url = `${window.location.origin}/u/${token}`;
+ try {
+ // is.gd – kostenloser URL-Shortener, kein API-Key nötig
+ const r = await fetch(`https://is.gd/create.php?format=simple&url=${encodeURIComponent(url)}`);
+ const short = await r.text();
+ if (short.startsWith('http')) {
+ setShortUrls(p=>({...p,[shareId]:short.trim()}));
+ navigator.clipboard?.writeText(short.trim()).catch(()=>{});
+ toast('Kurz-URL erstellt & kopiert âś“');
+ } else {
+ toast('Shortener nicht verfĂĽgbar','error');
+ }
+ } catch { toast('Shortener nicht erreichbar','error'); }
+ setShortening(null);
+ };
+
const copyLink = (token) => {
const url = `${window.location.origin}/u/${token}`;
navigator.clipboard?.writeText(url).then(()=>{ setCopied(token); setTimeout(()=>setCopied(null),2000); }).catch(()=>{
@@ -324,6 +344,14 @@ function UploadShareManager({ toast }) {
)}
+ {shortUrls[s.id]
+ ?
+ :
+ }
>
)}
{!!s.is_active && (