Upload-Freigabe: DickenDock-Text entfernt, Kurz-URL Button via is.gd

This commit is contained in:
2026-06-06 01:36:31 +02:00
parent 1c118206b3
commit 96acfd9f8e
2 changed files with 29 additions and 1 deletions

View File

@@ -2934,7 +2934,7 @@ function PublicUpload({ token }) {
<div style={{...C.page,fontFamily:"'Courier New',monospace"}}> <div style={{...C.page,fontFamily:"'Courier New',monospace"}}>
<div style={C.card}> <div style={C.card}>
<h1 style={{fontSize:18,color:'#4ecdc4',margin:'0 0 4px'}}>📤 Datei hochladen</h1> <h1 style={{fontSize:18,color:'#4ecdc4',margin:'0 0 4px'}}>📤 Datei hochladen</h1>
<p style={{color:'rgba(255,255,255,0.35)',fontSize:12,marginBottom:18}}>DickenDock Upload</p>
{phase==='loading' && <div style={C.infoBox}> Link wird geprüft</div>} {phase==='loading' && <div style={C.infoBox}> Link wird geprüft</div>}
{phase==='error' && (() => { window.location.replace('https://www.google.de'); return <div style={C.msg('error')}>Weiterleitung</div>; })()} {phase==='error' && (() => { window.location.replace('https://www.google.de'); return <div style={C.msg('error')}>Weiterleitung</div>; })()}

View File

@@ -170,6 +170,8 @@ function UploadShareManager({ toast }) {
const [busy, setBusy] = useState(false); const [busy, setBusy] = useState(false);
const [copied, setCopied] = useState(null); const [copied, setCopied] = useState(null);
const [sharePws, setSharePws] = useState({}); // {shareId: password} für Passwort-Kopieren 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(()=>{}); const load = () => api('/upload-shares').then(d=>{ setShares(d.shares||[]); setFolder(d.folder); }).catch(()=>{});
useEffect(()=>{ load(); },[]); useEffect(()=>{ load(); },[]);
@@ -200,6 +202,24 @@ function UploadShareManager({ toast }) {
toast('Entfernt'); 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 copyLink = (token) => {
const url = `${window.location.origin}/u/${token}`; const url = `${window.location.origin}/u/${token}`;
navigator.clipboard?.writeText(url).then(()=>{ setCopied(token); setTimeout(()=>setCopied(null),2000); }).catch(()=>{ navigator.clipboard?.writeText(url).then(()=>{ setCopied(token); setTimeout(()=>setCopied(null),2000); }).catch(()=>{
@@ -324,6 +344,14 @@ function UploadShareManager({ toast }) {
<button onClick={()=>{ navigator.clipboard?.writeText(sharePws[s.id]).then(()=>toast('Passwort kopiert ✓')).catch(()=>toast(sharePws[s.id])); }} <button onClick={()=>{ navigator.clipboard?.writeText(sharePws[s.id]).then(()=>toast('Passwort kopiert ✓')).catch(()=>toast(sharePws[s.id])); }}
style={{...S.btn('#ffe66d',true),fontSize:10,padding:'4px 10px'}}>🔑 PW</button> style={{...S.btn('#ffe66d',true),fontSize:10,padding:'4px 10px'}}>🔑 PW</button>
)} )}
{shortUrls[s.id]
? <button onClick={()=>{ navigator.clipboard?.writeText(shortUrls[s.id]).then(()=>toast('Kurz-URL kopiert ✓')).catch(()=>{}); }}
style={{...S.btn('#4ecdc4',true),fontSize:10,padding:'4px 10px'}}>🔗 Kurz</button>
: <button onClick={()=>shorten(s.id,s.token)} disabled={shortening===s.id}
style={{background:'rgba(255,255,255,0.05)',border:'1px solid rgba(255,255,255,0.15)',borderRadius:6,color:'rgba(255,255,255,0.5)',cursor:shortening===s.id?'default':'pointer',fontFamily:'monospace',fontSize:10,padding:'4px 10px'}}>
{shortening===s.id?'…':'🔗↓'}
</button>
}
</> </>
)} )}
{!!s.is_active && ( {!!s.is_active && (