1
0
Fork 1
mirror of https://github.com/zen-browser/desktop.git synced 2025-07-08 09:29:58 +02:00

fix: Fixed importing themes from a JSON file, b=(no-bug), c=common, mods

This commit is contained in:
Mr. M 2025-05-06 17:12:49 +02:00
parent 019779e425
commit 70b9f66f4c
No known key found for this signature in database
GPG key ID: 6292C4C8F8652B18
4 changed files with 4 additions and 30 deletions

View file

@ -207,17 +207,9 @@ var gZenMarketplaceManager = {
const content = await file.text();
const themes = JSON.parse(content);
const existingThemes = await ZenThemesCommon.getThemes();
const uniqueThemes = { ...themes, ...existingThemes };
console.log(`[ZenThemeMarketplaceParent:settings]: Importing ${Object.keys(themes).length} themes`);
await IOUtils.writeJSON(ZenThemesCommon.themesDataFile, uniqueThemes);
this.triggerThemeUpdate();
successBox.hidden = false;
let buttonIndex = await confirmRestartPrompt(true, 1, true, true);
if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
for (const theme of Object.values(themes)) {
theme.themeId = theme.id;
window.ZenInstallTheme(theme);
}
} catch (error) {
console.error('[ZenThemeMarketplaceParent:settings]: Error while importing themes:', error);
@ -558,7 +550,7 @@ var gZenMarketplaceManager = {
}
input.addEventListener(
'input',
'change',
ZenThemesCommon.debounce((event) => {
const value = event.target.value;