feat: MakerWorld Debug-Screenshot + bessere Fehlerdiagnose bei fehlgeschlagenem Abruf

This commit is contained in:
2026-07-11 02:28:48 +02:00
parent 59cced35be
commit ae13d1b239
2 changed files with 62 additions and 8 deletions

View File

@@ -214,6 +214,9 @@ function MakerworldTab({ toast }) {
const [savingCookie, setSavingCookie] = useState(false);
const [showCookieFallback, setShowCookieFallback] = useState(false);
const [debugImgUrl, setDebugImgUrl] = useState(null);
const [loadingScreenshot, setLoadingScreenshot] = useState(false);
const load = () => {
setLoading(true);
api('/tools/makerworld/stats').then(setState).catch(()=>{}).finally(()=>setLoading(false));
@@ -268,6 +271,20 @@ function MakerworldTab({ toast }) {
} catch(e) { toast?.(e.message,'error'); }
};
const viewDebugScreenshot = async () => {
setLoadingScreenshot(true);
try {
const token = localStorage.getItem('sk_token');
const res = await fetch('/api/tools/makerworld/debug-screenshot', {
headers: token ? { 'Authorization': 'Bearer '+token } : {},
});
if (!res.ok) { toast?.('Kein Debug-Screenshot vorhanden','error'); return; }
const blob = await res.blob();
setDebugImgUrl(URL.createObjectURL(blob));
} catch(e) { toast?.(e.message,'error'); }
finally { setLoadingScreenshot(false); }
};
const submitCode = async () => {
if (!codeInput.trim()) return;
setSubmittingCode(true);
@@ -393,11 +410,20 @@ function MakerworldTab({ toast }) {
</div>
)}
{state?.error && d && (
{state?.error && (
<div style={{...S.card,borderColor:'rgba(248,113,113,0.3)',background:'rgba(248,113,113,0.06)'}}>
<div style={{color:'#f87171',fontFamily:'monospace',fontSize:11}}>
Letzter Abruf fehlgeschlagen ({state.error}) zeige zuletzt bekannten Stand.
<div style={{color:'#f87171',fontFamily:'monospace',fontSize:11,marginBottom:8}}>
{state.error}{d ? ' — zeige zuletzt bekannten Stand.' : ''}
</div>
<button onClick={viewDebugScreenshot} disabled={loadingScreenshot}
style={{...S.btn('#888888'),opacity:loadingScreenshot?0.5:1}}>
{loadingScreenshot?'…':'🖼 Debug-Screenshot ansehen'}
</button>
{debugImgUrl && (
<div style={{marginTop:10}}>
<img src={debugImgUrl} alt="Debug-Screenshot" style={{width:'100%',borderRadius:8,border:'1px solid rgba(255,255,255,0.1)'}}/>
</div>
)}
</div>
)}