Fix theme store API

This commit is contained in:
mauro-balades 2024-08-28 10:05:48 +02:00
parent fb65629993
commit 845d26405b

View file

@ -95,8 +95,12 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
this.sendAsyncMessage("ZenThemeMarketplace:InstallTheme", { theme }); this.sendAsyncMessage("ZenThemeMarketplace:InstallTheme", { theme });
} }
getThemeAPIUrl(themeId) {
return `https://cdn.jsdelivr.net/gh/zen-browser/theme-store/themes/${themeId}/theme.json`;
}
async getThemeInfo(themeId) { async getThemeInfo(themeId) {
const url = `https://zen-browser.app/api/get-theme/${themeId}`; const url = this.getThemeAPIUrl(themeId);
console.info("ZTM: Fetching theme info from: ", url); console.info("ZTM: Fetching theme info from: ", url);
const data = await fetch(url, { const data = await fetch(url, {
mode: "no-cors", mode: "no-cors",
@ -109,7 +113,7 @@ export class ZenThemeMarketplaceChild extends JSWindowActorChild {
} catch (e) { } catch (e) {
console.error("ZTM: Error parsing theme info: ", e); console.error("ZTM: Error parsing theme info: ", e);
} }
} } else console.log(data.status);
return null; return null;
} }