Upload-Freigabe: Tab umbenannt, SQLite-boolean fix, Entfernen-Button fuer deaktivierte Links
This commit is contained in:
@@ -63,6 +63,13 @@ router.delete('/:id', authenticate, (req, res) => {
|
|||||||
res.json({ ok:true });
|
res.json({ ok:true });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.delete('/:id/remove', authenticate, (req, res) => {
|
||||||
|
const s = db.prepare('SELECT * FROM upload_shares WHERE id=? AND user_id=?').get(req.params.id, req.user.id);
|
||||||
|
if (!s) return res.status(404).json({ error:'Nicht gefunden' });
|
||||||
|
db.prepare('DELETE FROM upload_shares WHERE id=?').run(s.id);
|
||||||
|
res.json({ ok:true });
|
||||||
|
});
|
||||||
|
|
||||||
router.get('/logs', authenticate, (req, res) => {
|
router.get('/logs', authenticate, (req, res) => {
|
||||||
if (!canUseUploadShare(req.user.id)) return res.status(403).json({ error:'Keine Berechtigung' });
|
if (!canUseUploadShare(req.user.id)) return res.status(403).json({ error:'Keine Berechtigung' });
|
||||||
const logs = db.prepare(`
|
const logs = db.prepare(`
|
||||||
|
|||||||
@@ -195,6 +195,11 @@ function UploadShareManager({ toast }) {
|
|||||||
await api(`/upload-shares/${id}`, { method:'DELETE' });
|
await api(`/upload-shares/${id}`, { method:'DELETE' });
|
||||||
load(); toast('Link deaktiviert');
|
load(); toast('Link deaktiviert');
|
||||||
};
|
};
|
||||||
|
const removeShare = async id => {
|
||||||
|
await api(`/upload-shares/${id}/remove`, { method:'DELETE' });
|
||||||
|
setShares(p => p.filter(s => s.id !== id));
|
||||||
|
toast('Entfernt');
|
||||||
|
};
|
||||||
|
|
||||||
const copyLink = (token) => {
|
const copyLink = (token) => {
|
||||||
const url = `${window.location.origin}/u/${token}`;
|
const url = `${window.location.origin}/u/${token}`;
|
||||||
@@ -222,7 +227,7 @@ function UploadShareManager({ toast }) {
|
|||||||
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between',marginBottom:12,flexWrap:'wrap',gap:8}}>
|
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between',marginBottom:12,flexWrap:'wrap',gap:8}}>
|
||||||
<div>
|
<div>
|
||||||
<div style={{color:'#fff',fontFamily:'monospace',fontSize:14,fontWeight:700}}>
|
<div style={{color:'#fff',fontFamily:'monospace',fontSize:14,fontWeight:700}}>
|
||||||
📤 Upload-Ordner
|
📤 Upload-Freigabe
|
||||||
</div>
|
</div>
|
||||||
{folder && <div style={{color:'rgba(255,255,255,0.35)',fontFamily:'monospace',fontSize:10,marginTop:2}}>
|
{folder && <div style={{color:'rgba(255,255,255,0.35)',fontFamily:'monospace',fontSize:10,marginTop:2}}>
|
||||||
Dateien landen in: 📁 {folder.name}
|
Dateien landen in: 📁 {folder.name}
|
||||||
@@ -310,7 +315,7 @@ function UploadShareManager({ toast }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{display:'flex',gap:5,flexShrink:0}}>
|
<div style={{display:'flex',gap:5,flexShrink:0}}>
|
||||||
{s.is_active && !expired && (
|
{!!s.is_active && !expired && (
|
||||||
<>
|
<>
|
||||||
<button onClick={()=>copyLink(s.token)}
|
<button onClick={()=>copyLink(s.token)}
|
||||||
style={{...S.btn(copied===s.token?'#4ecdc4':'#ffe66d',copied!==s.token),fontSize:10,padding:'4px 10px'}}>
|
style={{...S.btn(copied===s.token?'#4ecdc4':'#ffe66d',copied!==s.token),fontSize:10,padding:'4px 10px'}}>
|
||||||
@@ -322,8 +327,11 @@ function UploadShareManager({ toast }) {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{s.is_active && (
|
{!!s.is_active && (
|
||||||
<button onClick={()=>deactivate(s.id)} style={{...S.btn('#ff6b9d',true),fontSize:10,padding:'4px 10px'}}>✕</button>
|
<button onClick={()=>deactivate(s.id)} style={{...S.btn('#ff6b9d',true),fontSize:10,padding:'4px 10px'}}>Deaktivieren</button>
|
||||||
|
)}
|
||||||
|
{!s.is_active && (
|
||||||
|
<button onClick={()=>removeShare(s.id)} style={{...S.btn('#ff6b9d',true),fontSize:10,padding:'4px 10px'}}>✕ Entfernen</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -527,7 +535,7 @@ export default function Dateien({ toast, mobile }) {
|
|||||||
['own','Dateien', null],
|
['own','Dateien', null],
|
||||||
['shared','Geteilt mit mir', sharedCnt||null],
|
['shared','Geteilt mit mir', sharedCnt||null],
|
||||||
['sharedByMe','Geteilt von mir', byMeCnt||null],
|
['sharedByMe','Geteilt von mir', byMeCnt||null],
|
||||||
['upload','📤 Upload-Ordner', null],
|
['upload','📤 Upload-Freigabe', null],
|
||||||
].map(([k,l,cnt])=>(
|
].map(([k,l,cnt])=>(
|
||||||
<button key={k} onClick={()=>{setTab(k);setSearch('');setCurrentFolderId(null);setFolderPath([]);}} style={{
|
<button key={k} onClick={()=>{setTab(k);setSearch('');setCurrentFolderId(null);setFolderPath([]);}} style={{
|
||||||
padding:'6px 14px',borderRadius:20,fontFamily:'monospace',fontSize:11,cursor:'pointer',
|
padding:'6px 14px',borderRadius:20,fontFamily:'monospace',fontSize:11,cursor:'pointer',
|
||||||
|
|||||||
Reference in New Issue
Block a user