Fix Failing Themes Links
Some checks are pending
Test / Test (push) Waiting to run

This commit is contained in:
thororen1234 2025-06-16 16:59:13 -04:00
parent 7989e81e6c
commit 71e80b7a7a
No known key found for this signature in database

View file

@ -415,11 +415,20 @@ function ThemesTab() {
}
async function refreshOnlineThemes() {
const themes = await Promise.all(settings.themeLinks.map(async link => {
const css = await fetch(link).then(res => res.text());
return { ...getThemeInfo(css, link), link };
}));
setOnlineThemes(themes);
const themes = await Promise.all(
settings.themeLinks.map(async link => {
try {
const res = await fetch(link);
if (!res.ok) throw new Error(`Failed to fetch ${link}`);
const css = await res.text();
return { ...getThemeInfo(css, link), link };
} catch (err) {
console.warn(`Theme fetch failed for ${link}:`, err);
return null;
}
})
);
setOnlineThemes(themes.filter(theme => theme !== null));
}
function onThemeLinkEnabledChange(link: string, enabled: boolean) {