diff --git a/main.c b/main.c index 9e1848d..25064d2 100644 --- a/main.c +++ b/main.c @@ -1777,16 +1777,37 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) { "Promise.all([gp,ip]).then(function(res){" "var gd=res[0],id=res[1];" "if(!gl)return;" - "if(!gd||gd.error||gd.status){" - "gl.innerHTML='

SM API nicht erreichbar — l\\u00e4uft ShadowMountPlus?

';}" - "else if(!gd.games||!gd.games.length){" - "if(_gpR<4){" - "gl.innerHTML='

Warte auf SM... ('+(_gpR+1)+'/4)

';" - "setTimeout(function(){loadGamePanel(_gpR+1);},4000);" + "var imgs=id&&id.images?id.images:[];" + /* if SM games API works and has data, show it; otherwise fall back to images */ + "if(gd&&!gd.error&&!gd.status&&gd.games&&gd.games.length){" + "_gpR=0;renderGamesList(gl,gd.games);" + "}else if(imgs.length){" + /* SM games DB empty: build game cards directly from the images list */ + "var h='';" + "imgs.forEach(function(img){" + "var parts=(img.path||'').split('/');" + "var fn=parts.pop()||img.path;" + "var mn=img.mounted" + "?'● aktiv'" + ":'○ inaktiv';" + "var ba=img.mounted" + "?(img.title_id?'':'')" + ":'';" + "var tid=img.title_id||'';" + "h+='
';" + "h+=(tid?'':\"\");" + "h+='
';" + "h+='
'+fn+'
';" + "h+=(tid?'
'+tid+'
':'');" + "h+='
'+img.path+'
';" + "h+='
';" + "h+='
'+mn+ba+'
';" + "});gl.innerHTML=h;" + "}else if(!gd||gd.error||gd.status){" + "gl.innerHTML='

SM API nicht erreichbar

';" "}else{" - "gl.innerHTML='

Keine Spiele — SM scan noch aktiv oder keine Spiele gemountet.
Images unten mounten → dann Refresh.

';" - "}}" - "else{_gpR=0;renderGamesList(gl,gd.games);}" + "gl.innerHTML='

Keine Spiele gefunden

';" + "}" "if(!il)return;" "if(!id||id.error||id.status){" "il.innerHTML='

'+(id&&id.error?id.error:'nicht erreichbar')+'

';return;}"