Fixes settings buttons and modal size

This commit is contained in:
Zack Rauen 2020-10-19 23:45:32 -04:00
parent 707c3848ef
commit 37cec0ef7e
3 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,6 @@
import {Config} from "data";
import Utilities from "./utilities";
import Logger from "./logger";
const fs = require("fs");
const path = require("path");
const releaseChannel = DiscordNative.globals ? DiscordNative.globals.releaseChannel : DiscordNative.app ? DiscordNative.app.getReleaseChannel() : "stable";
@ -48,9 +49,9 @@ export default new class DataStore {
let customcss = "";
let favoriteEmotes = {};
try {customcss = oldData.bdcustomcss ? atob(oldData.bdcustomcss) : "";}
catch (e) {console.error(e);} // eslint-disable-line no-console
catch (e) {Logger.stacktrace("DataStore:convertOldData", "Error decoding custom css", e);}
try {favoriteEmotes = oldData.bdfavemotes ? JSON.parse(atob(oldData.bdfavemotes)) : {};}
catch (e) {console.error(e);} // eslint-disable-line no-console
catch (e) {Logger.stacktrace("DataStore:convertOldData", "Error decoding favorite emotes", e);}
for (const channel of channels) {
if (!fs.existsSync(path.resolve(this.baseFolder, channel))) fs.mkdirSync(path.resolve(this.baseFolder, channel));
const channelData = oldData.settings[channel];
@ -70,8 +71,8 @@ export default new class DataStore {
setChannelData(channel, "settings", newSettings); // settingsCookie
setChannelData(channel, "emotes", newEmotes); // emotes (from settingsCookie)
setChannelData(channel, "plugins", channelData.plugins); // pluginCookie
setChannelData(channel, "themes", channelData.themes); // themeCookie
setChannelData(channel, "plugins", channelData.plugins || {}); // pluginCookie
setChannelData(channel, "themes", channelData.themes || {}); // themeCookie
setChannelData(channel, "misc", {favoriteEmotes}); // favorite emotes
fs.writeFileSync(path.resolve(this.baseFolder, channel, "custom.css"), customcss); // customcss
}

View File

@ -97,8 +97,8 @@ export default class PublicServersConnection {
static get windowOptions() {
return {
width: 380,
height: 450,
width: 490,
height: 500,
backgroundColor: "#282b30",
show: true,
resizable: true,

View File

@ -110,7 +110,7 @@ export default class AddonList extends React.Component {
matches = matches || addon.description.toLocaleLowerCase().includes(this.state.query);
if (!matches) return null;
}
const hasSettings = addon.type && typeof(addon.instance.getSettingsPanel) === "function";
const hasSettings = addon.instance && typeof(addon.instance.getSettingsPanel) === "function";
const getSettings = hasSettings && addon.instance.getSettingsPanel.bind(addon.instance);
return <ErrorBoundary><AddonCard editAddon={this.editAddon.bind(this, addon.id)} deleteAddon={this.deleteAddon.bind(this, addon.id)} showReloadIcon={showReloadIcon} key={addon.id} enabled={addonState[addon.id]} addon={addon} onChange={onChange} reload={reload} hasSettings={hasSettings} getSettingsPanel={getSettings} /></ErrorBoundary>;
})}