mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-07 21:49:58 +02:00
feat: Fixed disable all mods not working, b=no-bug, c=mods
This commit is contained in:
parent
f6da5047c2
commit
3b8202f207
2 changed files with 19 additions and 18 deletions
|
@ -64,32 +64,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
async #rebuildModsStylesheet() {
|
async #rebuildModsStylesheet() {
|
||||||
const shouldBeEnabled = !Services.prefs.getBoolPref('zen.themes.disable-all', false);
|
const mods = await this.#getEnabledMods();
|
||||||
if (shouldBeEnabled) {
|
|
||||||
const mods = await this.#getEnabledMods();
|
|
||||||
|
|
||||||
await this.#writeStylesheet(mods);
|
await this.#writeStylesheet(mods);
|
||||||
|
|
||||||
const modsWithPreferences = await Promise.all(
|
const modsWithPreferences = await Promise.all(
|
||||||
mods.map(async (mod) => {
|
mods.map(async (mod) => {
|
||||||
const preferences = await this.getModPreferences(mod);
|
const preferences = await this.getModPreferences(mod);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: mod.name,
|
name: mod.name,
|
||||||
enabled: mod.enabled,
|
enabled: mod.enabled,
|
||||||
preferences,
|
preferences,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.#setDefaults(modsWithPreferences);
|
this.#setDefaults(modsWithPreferences);
|
||||||
this.#writeToDom(modsWithPreferences);
|
this.#writeToDom(modsWithPreferences);
|
||||||
}
|
|
||||||
|
|
||||||
await this.#insertStylesheet();
|
await this.#insertStylesheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
async #getEnabledMods() {
|
async #getEnabledMods() {
|
||||||
|
if (Services.prefs.getBoolPref('zen.themes.disable-all', false)) {
|
||||||
|
console.log('[ZenMods]: Mods are disabled by user preference.');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const modsObject = await this.getMods();
|
const modsObject = await this.getMods();
|
||||||
const mods = Object.values(modsObject).filter(
|
const mods = Object.values(modsObject).filter(
|
||||||
(mod) => mod.enabled === undefined || mod.enabled
|
(mod) => mod.enabled === undefined || mod.enabled
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"brandShortName": "Zen",
|
"brandShortName": "Zen",
|
||||||
"brandFullName": "Zen Browser",
|
"brandFullName": "Zen Browser",
|
||||||
"release": {
|
"release": {
|
||||||
"displayVersion": "1.14.1b",
|
"displayVersion": "1.14.2b",
|
||||||
"github": {
|
"github": {
|
||||||
"repo": "zen-browser/desktop"
|
"repo": "zen-browser/desktop"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue