From df571930cfeb6bf8b040e6ed2193feab7a6b2a02 Mon Sep 17 00:00:00 2001 From: smartfridge <37928912+smartfrigde@users.noreply.github.com> Date: Thu, 15 Jul 2021 15:45:56 +0200 Subject: [PATCH] updates --- manager.html | 2 ++ package.json | 2 +- settings.json | 3 --- utils/ArmCord.js | 13 +++++++++++-- utils/plugin.js | 2 +- utils/theme.js | 9 ++++++++- 6 files changed, 23 insertions(+), 8 deletions(-) delete mode 100644 settings.json diff --git a/manager.html b/manager.html index 7d2c2bf..c900b99 100644 --- a/manager.html +++ b/manager.html @@ -11,6 +11,8 @@
+

Disabled Themes:

+

\ No newline at end of file diff --git a/package.json b/package.json index 12c855a..8b10b11 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "armcord", + "name": "ArmCord", "version": "2.5.0", "description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.", "main": "main.js", diff --git a/settings.json b/settings.json deleted file mode 100644 index c791259..0000000 --- a/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "channel": "stable" -} \ No newline at end of file diff --git a/utils/ArmCord.js b/utils/ArmCord.js index 1d1c514..097cc55 100644 --- a/utils/ArmCord.js +++ b/utils/ArmCord.js @@ -1,6 +1,15 @@ exports.Version = require("../package.json").version; - -exports.Channel = require("../settings.json").channel; +const fs = require("fs"); +const electron = require("electron"); +const userDataPath = (electron.app || electron.remote.app).getPath("userData"); +const settingsFile= userDataPath + "/settings.json"; +if (!fs.existsSync(settingsFile)) { + fs.writeFile(settingsFile, "{}", (err) => { + if (err) throw err; +}); + console.log("Created settings.json file"); +} +exports.Channel = require(settingsFile).channel; exports.addStyle = function(styleString) { const style = document.createElement('style'); diff --git a/utils/plugin.js b/utils/plugin.js index 14af4a5..726cd43 100644 --- a/utils/plugin.js +++ b/utils/plugin.js @@ -39,7 +39,7 @@ if (!fs.existsSync(pluginFolder)) { type: "warning", message: "ArmCord has installed GooseMod onto your client.", detail: - "If you wish to use it restart your ArmCord completely using tray icon. It should appear in next session. GooseMod is reccomended to every user of ArmCord due to various improvements and bugfixes it ships with.", + "If you wish to use it restart your ArmCord completely using tray icon. It should appear in next session. GooseMod is reccomended to every user of ArmCord due to various improvements and bugfixes it ships with. You won't be able to load themes or see any of ArmCord specific CSS patches including fixed font logo at the top.", }); }); } diff --git a/utils/theme.js b/utils/theme.js index da5bacf..3a52b0d 100644 --- a/utils/theme.js +++ b/utils/theme.js @@ -9,9 +9,16 @@ if (!fs.existsSync(themeFolder)) { console.log("Created theme folder"); } window.addEventListener("DOMContentLoaded", () => { - console.log("Theme Module Loaded"); + console.log("Theme Module Loaded"); // I KNOW THIS IS A MESS BUT IT'S WORKING MESS, XOXO fs.readdirSync(themeFolder).forEach((file) => { try { + if (file.includes('DISABLED')) { + console.log(`Skipping ${file}.`) + const manifest = fs.readFileSync(`${userDataPath}/themes/${file}/manifest.json`, "utf8"); + var themeFile = JSON.parse(manifest); + var html = `
${themeFile.name}
By ${themeFile.author}
${themeFile.description}


`; + document.getElementById("tm-disabled").innerHTML = html + document.getElementById("tm-disabled").innerHTML; + } const manifest = fs.readFileSync(`${userDataPath}/themes/${file}/manifest.json`, "utf8"); var themeFile = JSON.parse(manifest); const theme = fs.readFileSync(`${userDataPath}/themes/${file}/${themeFile.theme}`, "utf8");