fix: badge 1 Call statt 3, COMPLETE.BLURAY/UHD/remux filter, Cache-Button für Admins, Produktionsland
This commit is contained in:
@@ -40,6 +40,16 @@ const FSK_COLOR = fsk => {
|
||||
export default function Media({ toast, mobile }) {
|
||||
const [activeTool, setActiveTool] = useState('kino');
|
||||
const [modal, setModal] = useState(null);
|
||||
|
||||
// Admin-Status aus JWT lesen
|
||||
const isAdmin = (() => {
|
||||
try {
|
||||
const token = localStorage.getItem('sk_token');
|
||||
if (!token) return false;
|
||||
const payload = JSON.parse(atob(token.split('.')[1]));
|
||||
return payload.role === 'admin';
|
||||
} catch(_) { return false; }
|
||||
})();
|
||||
const chipScrollRef = useRef(null);
|
||||
const [chipScroll, setChipScroll] = useState({ left: false, right: true });
|
||||
|
||||
@@ -116,6 +126,27 @@ export default function Media({ toast, mobile }) {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isAdmin && (
|
||||
<div style={{ display:'flex', justifyContent:'flex-end', marginBottom:8 }}>
|
||||
<button onClick={async () => {
|
||||
if (!confirm('xREL-Cache leeren?')) return;
|
||||
try {
|
||||
const r = await fetch('/api/tools/media/xrel-cache', {
|
||||
method: 'DELETE',
|
||||
headers: { Authorization: 'Bearer ' + localStorage.getItem('sk_token') }
|
||||
});
|
||||
const d = await r.json();
|
||||
toast(`Cache geleert (${d.deleted} Einträge) ✓`);
|
||||
} catch(e) { toast('Fehler: ' + e.message, 'error'); }
|
||||
}} style={{
|
||||
fontSize: 10, fontFamily: 'monospace', cursor: 'pointer',
|
||||
background: 'rgba(255,107,157,0.1)', border: '1px solid rgba(255,107,157,0.25)',
|
||||
color: 'rgba(255,107,157,0.7)', borderRadius: 6, padding: '4px 10px',
|
||||
}}>
|
||||
🗑 xREL-Cache leeren
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<div style={{ ...S.card }}>
|
||||
<div style={{ display:'flex', alignItems:'center', gap:10, marginBottom:18, flexWrap:'wrap' }}>
|
||||
<div style={{ ...S.head, marginBottom:0 }}>{active?.label}</div>
|
||||
|
||||
Reference in New Issue
Block a user