diff --git a/main.js b/main.js index dd0ff40..0b97d8d 100644 --- a/main.js +++ b/main.js @@ -73,6 +73,9 @@ function createWindow() { }, }, ]); + appIcon.on("click", () => { + mainWindow.show() + }); appIcon.setContextMenu(contextMenu); @@ -98,9 +101,7 @@ function createWindow() { // Some APIs can only be used after this event occurs. app.whenReady().then(() => { createWindow(); - session.defaultSession.loadExtension( - `${require("electron").app.getAppPath()}/goosemod/` - ); + require("./utils/plugin.js"); session .fromPartition("some-partition") .setPermissionRequestHandler((webContents, permission, callback) => { diff --git a/package-lock.json b/package-lock.json index f9e7019..dd2997d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "license": "MIT", "dependencies": { "custom-electron-titlebar": "3.2.6", - "electron-context-menu": "^3.1.0", + "electron-context-menu": "^3.0.0", "electron-localshortcut": "^3.2.1", "electron-squirrel-startup": "^1.0.0", "v8-compile-cache": "^2.3.0" @@ -21,7 +21,7 @@ "@electron-forge/maker-squirrel": "^6.0.0-beta.54", "@electron-forge/maker-zip": "^6.0.0-beta.54", "@electron-forge/publisher-github": "*", - "electron": "*" + "electron": "latest" } }, "node_modules/@electron-forge/async-ora": { @@ -2247,9 +2247,9 @@ } }, "node_modules/electron-context-menu": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.0.tgz", - "integrity": "sha512-U7Q7d0ovfA8UOt7RCYsJkQ7l6qKMKDg3W9kvL3gEecGfHVDcjybs695L5oTS7d+kv7C2qfADo/EY06Cl4zAh9A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.0.0.tgz", + "integrity": "sha512-dF0INSIIpcwofaKAXtdSKkQl08s9j0SMF+Nsi6jGBam6kfx97cIOmJLUHYlBW56DQo05umts2pRIfbcDPHNh9g==", "dependencies": { "cli-truncate": "^2.1.0", "electron-dl": "^3.2.1", @@ -8877,9 +8877,9 @@ } }, "electron-context-menu": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.0.tgz", - "integrity": "sha512-U7Q7d0ovfA8UOt7RCYsJkQ7l6qKMKDg3W9kvL3gEecGfHVDcjybs695L5oTS7d+kv7C2qfADo/EY06Cl4zAh9A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.0.0.tgz", + "integrity": "sha512-dF0INSIIpcwofaKAXtdSKkQl08s9j0SMF+Nsi6jGBam6kfx97cIOmJLUHYlBW56DQo05umts2pRIfbcDPHNh9g==", "requires": { "cli-truncate": "^2.1.0", "electron-dl": "^3.2.1", diff --git a/package.json b/package.json index 7921e30..f30fa58 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,10 @@ { "name": "armcord", - "version": "2.4.0", + "version": "2.5.0", "description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.", "main": "main.js", "scripts": { "start": "electron-forge start", - "dist": "electron-builder", "test": "echo \"Error: no test specified\" && exit 1", "package": "electron-forge package", "publish": "electron-forge publish", @@ -44,7 +43,9 @@ "homepage": "https://github.com/smartfrigde/armcord#readme", "config": { "forge": { - "packagerConfig": {}, + "packagerConfig": { + "icon": "discord.png" + }, "makers": [ { "name": "@electron-forge/maker-squirrel", diff --git a/renderer.js b/renderer.js deleted file mode 100644 index d2ec9f5..0000000 --- a/renderer.js +++ /dev/null @@ -1,55 +0,0 @@ -// This file is required by the index.html file and will -// be executed in the renderer process for that window. -// All of the Node.js APIs are available in this process. -const remote = require('electron').remote; - -const win = remote.getCurrentWindow(); /* Note this is different to the -html global `window` variable */ - -// When document has loaded, initialise -document.onreadystatechange = (event) => { - if (document.readyState == "complete") { - handleWindowControls(); - - document.getElementById('electron-ver').innerHTML = `${process.versions.electron}` - } -}; - -window.onbeforeunload = (event) => { - /* If window is reloaded, remove win event listeners - (DOM element listeners get auto garbage collected but not - Electron win listeners as the win is not dereferenced unless closed) */ - win.removeAllListeners(); -} - -function handleWindowControls() { - // Make minimise/maximise/restore/close buttons work when they are clicked - document.getElementById('min-button').addEventListener("click", event => { - win.minimize(); - }); - - document.getElementById('max-button').addEventListener("click", event => { - win.maximize(); - }); - - document.getElementById('restore-button').addEventListener("click", event => { - win.unmaximize(); - }); - - document.getElementById('close-button').addEventListener("click", event => { - win.close(); - }); - - // Toggle maximise/restore buttons when maximisation/unmaximisation occurs - toggleMaxRestoreButtons(); - win.on('maximize', toggleMaxRestoreButtons); - win.on('unmaximize', toggleMaxRestoreButtons); - - function toggleMaxRestoreButtons() { - if (win.isMaximized()) { - document.body.classList.add('maximized'); - } else { - document.body.classList.remove('maximized'); - } - } -} \ No newline at end of file diff --git a/theme.html b/theme.html new file mode 100644 index 0000000..c035ebc --- /dev/null +++ b/theme.html @@ -0,0 +1,91 @@ + + +
+ +Cord Theme Manager
+ + + diff --git a/utils/plugin.js b/utils/plugin.js new file mode 100644 index 0000000..d569d67 --- /dev/null +++ b/utils/plugin.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const { app, session } = require("electron"); +const pluginFolder = __dirname + "/plugins/"; +app.whenReady().then(() => { +fs.readdirSync(pluginFolder).forEach((file) => { + console.log(file); + try { + const manifest = fs.readFileSync( + `${__dirname}/plugins/${file}/manifest.json`, + "utf8" + ); + var pluginFile = JSON.parse(manifest); + console.log(pluginFile); + session.defaultSession.loadExtension(`${__dirname}/plugins/${file}/`); + console.log( + `%cLoaded ${pluginFile.name} made by ${pluginFile.author}`, + "color:red" + ); + } catch (err) { + console.error(err); + } +}); +}); diff --git a/goosemod/CSP.js b/utils/plugins/goosemod/CSP.js similarity index 100% rename from goosemod/CSP.js rename to utils/plugins/goosemod/CSP.js diff --git a/goosemod/LICENSE b/utils/plugins/goosemod/LICENSE similarity index 100% rename from goosemod/LICENSE rename to utils/plugins/goosemod/LICENSE diff --git a/goosemod/gm.js b/utils/plugins/goosemod/gm.js similarity index 100% rename from goosemod/gm.js rename to utils/plugins/goosemod/gm.js diff --git a/goosemod/manifest.json b/utils/plugins/goosemod/manifest.json similarity index 93% rename from goosemod/manifest.json rename to utils/plugins/goosemod/manifest.json index 5d71e59..f073a57 100644 --- a/goosemod/manifest.json +++ b/utils/plugins/goosemod/manifest.json @@ -1,6 +1,7 @@ { "name": "GooseMod", "version": "1.0", + "author": "AAGaming00", "description": "Loads GooseMod, a discord client modification", "background": { "scripts": [ diff --git a/utils/theme.js b/utils/theme.js new file mode 100644 index 0000000..b58dc05 --- /dev/null +++ b/utils/theme.js @@ -0,0 +1,25 @@ +const fs = require("fs"); +const armcord = require("./armcord.js"); +const themeFolder = __dirname + "/themes/"; +window.addEventListener("DOMContentLoaded", () => { + fs.readdirSync(themeFolder).forEach((file) => { + console.log(file); + try { + const manifest = fs.readFileSync(`${__dirname}/themes/${file}/manifest.json`, "utf8"); + var themeFile = JSON.parse(manifest); + console.log(themeFile.theme); + console.log(themeFile) + const theme = fs.readFileSync(`${__dirname}/themes/${file}/${themeFile.theme}`, "utf8"); + if (themeFile.theme.endsWith(".scss")) { + console.log( + `%cCouldn't load ${themeFile.name} made by ${themeFile.author}. ArmCord doesn't support scss files if you want to have this theme ported feel free to reach out https://discord.gg/F25bc4RYDt `, + "color:red; font-weight: bold; font-size: 50px;color: red;" + ); + } + armcord.addStyle(theme); + console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red"); + } catch (err) { + console.error(err); + } + }); +}); diff --git a/utils/themes/GT-RevertRebrand-main/LICENSE b/utils/themes/GT-RevertRebrand-main/LICENSE new file mode 100644 index 0000000..3cf6dad --- /dev/null +++ b/utils/themes/GT-RevertRebrand-main/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 GooseNest + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/utils/themes/GT-RevertRebrand-main/README.md b/utils/themes/GT-RevertRebrand-main/README.md new file mode 100644 index 0000000..3fb7430 --- /dev/null +++ b/utils/themes/GT-RevertRebrand-main/README.md @@ -0,0 +1,3 @@ +# GT-RevertRebrand ArmCord + +Reverts Discord's 2021 rebrand (font, colors, reactions, mentions, loading screen, home icon, reply ping color, and more) diff --git a/utils/themes/GT-RevertRebrand-main/RevertRebrand.theme.css b/utils/themes/GT-RevertRebrand-main/RevertRebrand.theme.css new file mode 100644 index 0000000..c342047 --- /dev/null +++ b/utils/themes/GT-RevertRebrand-main/RevertRebrand.theme.css @@ -0,0 +1,9 @@ +/** + * @name Revert Rebrand + * @author GooseNest + * @description Reverts Discord's 2021 rebrand (font, colors, reactions, mentions, loading screen, home icon, reply ping color, and more) + * @invite neMncS2 + * @version 3.0 +*/ + +@import url('https://Goose-Nest.github.io/GT-RevertRebrand/src/main.css'); \ No newline at end of file diff --git a/utils/themes/GT-RevertRebrand-main/manifest.json b/utils/themes/GT-RevertRebrand-main/manifest.json new file mode 100644 index 0000000..9af1803 --- /dev/null +++ b/utils/themes/GT-RevertRebrand-main/manifest.json @@ -0,0 +1,8 @@ +{ + "name": "Revert Rebrand", + "description": "Reverts Discord's 2021 rebrand (font, colors, reactions, mentions, loading screen, home icon, reply ping color, and more)", + "version": "3.0", + "author": "GooseNest", + "license": "MIT", + "theme": "RevertRebrand.theme.css" +} \ No newline at end of file