Fix PWA-Reload: __BUILD_TIME__ und version.txt aus selber Quelle; Fix QuickLinkIcon custom icons

This commit is contained in:
2026-06-04 09:36:30 +02:00
parent 8946152012
commit 414fba39c7
4 changed files with 52 additions and 52 deletions

View File

@@ -455,17 +455,22 @@ function QuickLinksCarousel({ links }) {
function QuickLinkIcon({ l }) {
const [imgOk, setImgOk] = useState(true);
// Favicon-URL bauen: gespeicherten Wert nehmen oder aus URL ableiten
// Favicon nur wenn kein eigenes Icon gesetzt (Standard-🔗) oder bereits eine URL gespeichert ist
const useDefaultFavicon = !l.icon || l.icon === '🔗';
const faviconUrl = (() => {
if (l.icon && l.icon.startsWith('http')) return l.icon;
try {
const host = new URL(l.url).hostname;
return `https://www.google.com/s2/favicons?sz=64&domain=${host}`;
} catch { return null; }
if (useDefaultFavicon) {
try {
const host = new URL(l.url).hostname;
return `https://www.google.com/s2/favicons?sz=64&domain=${host}`;
} catch { return null; }
}
return null;
})();
const showEmoji = !faviconUrl || !imgOk;
const fallbackEmoji = l.icon && !l.icon.startsWith('http') ? l.icon : '🔗';
const showImg = !!faviconUrl && imgOk;
const showEmoji = !showImg;
const emoji = (l.icon && !l.icon.startsWith('http')) ? l.icon : '🔗';
return (
<a href={l.url} target="_blank" rel="noopener noreferrer"
@@ -473,10 +478,10 @@ function QuickLinkIcon({ l }) {
padding:'4px 2px', background:'rgba(255,255,255,0.04)',
border:'1px solid rgba(255,255,255,0.08)', borderRadius:10,
textDecoration:'none', height:48, width:'100%', boxSizing:'border-box', cursor:'pointer' }}>
{!showEmoji
{showImg
? <img src={faviconUrl} alt="" style={{width:18,height:18,objectFit:'contain'}}
onError={() => setImgOk(false)}/>
: <span style={{ fontSize:16 }}>{fallbackEmoji}</span>
: <span style={{ fontSize:16 }}>{emoji}</span>
}
<span style={{ color:'rgba(255,255,255,0.65)', fontSize:8, fontFamily:'monospace',
maxWidth:52, overflow:'hidden', textOverflow:'ellipsis', whiteSpace:'nowrap' }}>{l.title}</span>