Merge branch 'canary' into dependabot/npm_and_yarn/electron-context-menu-3.1.0

This commit is contained in:
smartfridge 2021-05-20 18:13:52 +02:00 committed by GitHub
commit 70949d8414
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 197 additions and 69 deletions

View file

@ -73,6 +73,9 @@ function createWindow() {
}, },
}, },
]); ]);
appIcon.on("click", () => {
mainWindow.show()
});
appIcon.setContextMenu(contextMenu); appIcon.setContextMenu(contextMenu);
@ -98,9 +101,7 @@ function createWindow() {
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.whenReady().then(() => { app.whenReady().then(() => {
createWindow(); createWindow();
session.defaultSession.loadExtension( require("./utils/plugin.js");
`${require("electron").app.getAppPath()}/goosemod/`
);
session session
.fromPartition("some-partition") .fromPartition("some-partition")
.setPermissionRequestHandler((webContents, permission, callback) => { .setPermissionRequestHandler((webContents, permission, callback) => {

16
package-lock.json generated
View file

@ -9,7 +9,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"custom-electron-titlebar": "3.2.6", "custom-electron-titlebar": "3.2.6",
"electron-context-menu": "^3.1.0", "electron-context-menu": "^3.0.0",
"electron-localshortcut": "^3.2.1", "electron-localshortcut": "^3.2.1",
"electron-squirrel-startup": "^1.0.0", "electron-squirrel-startup": "^1.0.0",
"v8-compile-cache": "^2.3.0" "v8-compile-cache": "^2.3.0"
@ -21,7 +21,7 @@
"@electron-forge/maker-squirrel": "^6.0.0-beta.54", "@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54", "@electron-forge/maker-zip": "^6.0.0-beta.54",
"@electron-forge/publisher-github": "*", "@electron-forge/publisher-github": "*",
"electron": "*" "electron": "latest"
} }
}, },
"node_modules/@electron-forge/async-ora": { "node_modules/@electron-forge/async-ora": {
@ -2247,9 +2247,9 @@
} }
}, },
"node_modules/electron-context-menu": { "node_modules/electron-context-menu": {
"version": "3.1.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.0.tgz", "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.0.0.tgz",
"integrity": "sha512-U7Q7d0ovfA8UOt7RCYsJkQ7l6qKMKDg3W9kvL3gEecGfHVDcjybs695L5oTS7d+kv7C2qfADo/EY06Cl4zAh9A==", "integrity": "sha512-dF0INSIIpcwofaKAXtdSKkQl08s9j0SMF+Nsi6jGBam6kfx97cIOmJLUHYlBW56DQo05umts2pRIfbcDPHNh9g==",
"dependencies": { "dependencies": {
"cli-truncate": "^2.1.0", "cli-truncate": "^2.1.0",
"electron-dl": "^3.2.1", "electron-dl": "^3.2.1",
@ -8877,9 +8877,9 @@
} }
}, },
"electron-context-menu": { "electron-context-menu": {
"version": "3.1.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.1.0.tgz", "resolved": "https://registry.npmjs.org/electron-context-menu/-/electron-context-menu-3.0.0.tgz",
"integrity": "sha512-U7Q7d0ovfA8UOt7RCYsJkQ7l6qKMKDg3W9kvL3gEecGfHVDcjybs695L5oTS7d+kv7C2qfADo/EY06Cl4zAh9A==", "integrity": "sha512-dF0INSIIpcwofaKAXtdSKkQl08s9j0SMF+Nsi6jGBam6kfx97cIOmJLUHYlBW56DQo05umts2pRIfbcDPHNh9g==",
"requires": { "requires": {
"cli-truncate": "^2.1.0", "cli-truncate": "^2.1.0",
"electron-dl": "^3.2.1", "electron-dl": "^3.2.1",

View file

@ -1,11 +1,10 @@
{ {
"name": "armcord", "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.", "description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
"dist": "electron-builder",
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"package": "electron-forge package", "package": "electron-forge package",
"publish": "electron-forge publish", "publish": "electron-forge publish",
@ -44,7 +43,9 @@
"homepage": "https://github.com/smartfrigde/armcord#readme", "homepage": "https://github.com/smartfrigde/armcord#readme",
"config": { "config": {
"forge": { "forge": {
"packagerConfig": {}, "packagerConfig": {
"icon": "discord.png"
},
"makers": [ "makers": [
{ {
"name": "@electron-forge/maker-squirrel", "name": "@electron-forge/maker-squirrel",

View file

@ -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');
}
}
}

91
theme.html Normal file
View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ArmCord Theme Manager</title>
<style>
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
background-color: #2c2f33;
--header-secondary: #b9bbbe;
--header-primary: #fff;
--background-tertiary: #202225;
}
body {
color: white;
}
p {
color: white;
}
h1 {
font-size: 0px;
text-align: center;
transform: translateY(-105%);
}
.logo:before {
content: "ARM";
color: #7289da;
font-weight: normal;
font-family: Helvetica, sans-serif;
}
span {
text-align: center;
}
.logo {
color: #ffffff;
font-weight: normal;
font-family: Discordinated;
font-size: 32px;
text-align: center;
}
.container {
position: fixed;
top: 50%;
left: 50%;
color: #fff;
transform: translate(-50%, -50%);
}
button.back-btn {
position: absolute;
background-color: #7289da;
font-family: Whitney,"Helvetica Neue",Helvetica,Arial,sans-serif;
color: #ffffff;
padding: 4px;
border-radius: 5px;
width: 105px;
height: 25px;
margin-top: 5px;
margin-left: 5px;
text-align: center;
border-style: none;
outline: none;
}
button.back-btn:hover {
background-color: #687dc6;
border-style: none;
outline: none;
cursor: pointer;
}
button.back-btn:active {
background-color: #5c6fb1;
}
</style>
</head>
<body>
<a href="https://discord.com/app"><button class="back-btn">Back to Discord</button></a>
<p class="logo">Cord Theme Manager</p>
<div id="tm-list"></div>
</body>
</html>

23
utils/plugin.js Normal file
View file

@ -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);
}
});
});

View file

@ -1,6 +1,7 @@
{ {
"name": "GooseMod", "name": "GooseMod",
"version": "1.0", "version": "1.0",
"author": "AAGaming00",
"description": "Loads GooseMod, a discord client modification", "description": "Loads GooseMod, a discord client modification",
"background": { "background": {
"scripts": [ "scripts": [

25
utils/theme.js Normal file
View file

@ -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);
}
});
});

View file

@ -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.

View file

@ -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)

View file

@ -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');

View file

@ -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"
}