Small bugfixes
This commit is contained in:
parent
87de0a8d06
commit
57ff15ee68
|
@ -3,9 +3,12 @@ import electron from "electron";
|
|||
export default class {
|
||||
static remove() {
|
||||
electron.session.defaultSession.webRequest.onHeadersReceived(function(details, callback) {
|
||||
if (!details.responseHeaders["content-security-policy-report-only"] && !details.responseHeaders["content-security-policy"]) return callback({cancel: false});
|
||||
delete details.responseHeaders["content-security-policy-report-only"];
|
||||
delete details.responseHeaders["content-security-policy"];
|
||||
const headers = Object.keys(details.responseHeaders);
|
||||
for (let h = 0; h < headers.length; h++) {
|
||||
const key = headers[h];
|
||||
if (key.toLowerCase().indexOf("content-security-policy") !== 0) continue;
|
||||
delete details.responseHeaders[key];
|
||||
}
|
||||
callback({cancel: false, responseHeaders: details.responseHeaders});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ export default class AddonManager {
|
|||
if (!meta.author) meta.author = Strings.Addons.unknownAuthor;
|
||||
if (!meta.version) meta.version = "???";
|
||||
if (!meta.description) meta.description = Strings.Addons.noDescription;
|
||||
meta.id = meta.name;
|
||||
meta.id = path.basename(filename).replace(self.extension, "").replace(/ /g, "-");
|
||||
meta.filename = path.basename(filename);
|
||||
meta.added = stats.atimeMs;
|
||||
meta.modified = stats.mtimeMs;
|
||||
|
|
|
@ -13,7 +13,10 @@ const Anchor = WebpackModules.getByDisplayName("Anchor");
|
|||
|
||||
const Developers = [
|
||||
/* Zerebos#7790 */
|
||||
"249746236008169473"
|
||||
"249746236008169473",
|
||||
|
||||
/* Strencher#1044 */
|
||||
"415849376598982656"
|
||||
];
|
||||
|
||||
const DeveloperBadge = function DeveloperBadge({type, size = 16}) {
|
||||
|
|
|
@ -120,7 +120,7 @@ export default new class PluginManager extends AddonManager {
|
|||
|
||||
window.global = window;
|
||||
window.module = module;
|
||||
window.__filename = path.basename(module.filename);
|
||||
window.__filename = module.filename;
|
||||
window.__dirname = this.addonFolder;
|
||||
const wrapped = `(${vm.compileFunction(fileContent, ["exports", "require", "module", "__filename", "__dirname"]).toString()})`;
|
||||
const final = `${wrapped}(window.module.exports, window.require, window.module, window.__filename, window.__dirname)\n//# sourceURL=betterdiscord://plugins/${window.__filename}`;
|
||||
|
|
|
@ -66,14 +66,14 @@ export default new class ThemeManager extends AddonManager {
|
|||
addTheme(idOrAddon) {
|
||||
const addon = typeof(idOrAddon) == "string" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;
|
||||
if (!addon) return;
|
||||
DOMManager.injectTheme(addon.id, addon.css);
|
||||
DOMManager.injectTheme(addon.id + "-theme-container", addon.css);
|
||||
Toasts.show(Strings.Addons.enabled.format({name: addon.name, version: addon.version}));
|
||||
}
|
||||
|
||||
removeTheme(idOrAddon) {
|
||||
const addon = typeof(idOrAddon) == "string" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;
|
||||
if (!addon) return;
|
||||
DOMManager.removeTheme(addon.id);
|
||||
DOMManager.removeTheme(addon.id + "-theme-container");
|
||||
Toasts.show(Strings.Addons.disabled.format({name: addon.name, version: addon.version}));
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue