Merge pull request #67 from ArmCord/rewrite

ArmCord 3.0
This commit is contained in:
smartfridge 2022-01-15 22:23:27 +01:00 committed by GitHub
commit b2ed524934
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 2014 additions and 2902 deletions

2
.gitattributes vendored
View file

@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

4
.gitignore vendored
View file

@ -1,3 +1,5 @@
node_modules
out/
dist
dist
ts-out/
ts-out

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "mods/goosemod"]
path = mods/goosemod
url = https://github.com/GooseMod/Extension

172
LICENSE
View file

@ -1,172 +0,0 @@
Open Software License ("OSL") v. 3.0
This Open Software License (the "License") applies to any original work of
authorship (the "Original Work") whose owner (the "Licensor") has placed the
following licensing notice adjacent to the copyright notice for the Original
Work:
Licensed under the Open Software License version 3.0
1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free,
non-exclusive, sublicensable license, for the duration of the copyright, to do
the following:
a) to reproduce the Original Work in copies, either alone or as part of a
collective work;
b) to translate, adapt, alter, transform, modify, or arrange the Original
Work, thereby creating derivative works ("Derivative Works") based upon the
Original Work;
c) to distribute or communicate copies of the Original Work and Derivative
Works to the public, with the proviso that copies of Original Work or
Derivative Works that You distribute or communicate shall be licensed under
this Open Software License;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor grants You a worldwide, royalty-free,
non-exclusive, sublicensable license, under patent claims owned or controlled
by the Licensor that are embodied in the Original Work as furnished by the
Licensor, for the duration of the patents, to make, use, sell, offer for sale,
have made, and import the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred
form of the Original Work for making modifications to it and all available
documentation describing how to modify the Original Work. Licensor agrees to
provide a machine-readable copy of the Source Code of the Original Work along
with each copy of the Original Work that Licensor distributes. Licensor
reserves the right to satisfy this obligation by placing a machine-readable
copy of the Source Code in an information repository reasonably calculated to
permit inexpensive and convenient access by You for as long as Licensor
continues to distribute the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
of any contributors to the Original Work, nor any of their trademarks or
service marks, may be used to endorse or promote products derived from this
Original Work without express prior permission of the Licensor. Except as
expressly stated herein, nothing in this License grants any license to
Licensor's trademarks, copyrights, patents, trade secrets or any other
intellectual property. No patent license is granted to make, use, sell, offer
for sale, have made, or import embodiments of any patent claims other than the
licensed claims defined in Section 2. No license is granted to the trademarks
of Licensor even if such marks are included in the Original Work. Nothing in
this License shall be interpreted to prohibit Licensor from licensing under
terms different from this License any Original Work that Licensor otherwise
would have a right to license.
5) External Deployment. The term "External Deployment" means the use,
distribution, or communication of the Original Work or Derivative Works in any
way such that the Original Work or Derivative Works may be used by anyone
other than You, whether those works are distributed or communicated to those
persons or made available as an application intended for use over a network.
As an express condition for the grants of license hereunder, You must treat
any External Deployment by You of the Original Work or a Derivative Work as a
distribution under section 1(c).
6) Attribution Rights. You must retain, in the Source Code of any Derivative
Works that You create, all copyright, patent, or trademark notices from the
Source Code of the Original Work, as well as any notices of licensing and any
descriptive text identified therein as an "Attribution Notice." You must cause
the Source Code for any Derivative Works that You create to carry a prominent
Attribution Notice reasonably calculated to inform recipients that You have
modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
the copyright in and to the Original Work and the patent rights granted herein
by Licensor are owned by the Licensor or are sublicensed to You under the
terms of this License with the permission of the contributor(s) of those
copyrights and patent rights. Except as expressly stated in the immediately
preceding sentence, the Original Work is provided under this License on an "AS
IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without
limitation, the warranties of non-infringement, merchantability or fitness for
a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK
IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this
License. No license to the Original Work is granted by this License except
under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory,
whether in tort (including negligence), contract, or otherwise, shall the
Licensor be liable to anyone for any indirect, special, incidental, or
consequential damages of any character arising as a result of this License or
the use of the Original Work including, without limitation, damages for loss
of goodwill, work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses. This limitation of liability shall not
apply to the extent applicable law prohibits such limitation.
9) Acceptance and Termination. If, at any time, You expressly assented to this
License, that assent indicates your clear and irrevocable acceptance of this
License and all of its terms and conditions. If You distribute or communicate
copies of the Original Work or a Derivative Work, You must make a reasonable
effort under the circumstances to obtain the express assent of recipients to
the terms of this License. This License conditions your rights to undertake
the activities listed in Section 1, including your right to create Derivative
Works based upon the Original Work, and doing so without honoring these terms
and conditions is prohibited by copyright law and international treaty.
Nothing in this License is intended to affect copyright exceptions and
limitations (including "fair use" or "fair dealing"). This License shall
terminate immediately and You may no longer exercise any of the rights granted
to You by this License upon your failure to honor the conditions in Section
1(c).
10) Termination for Patent Action. This License shall terminate automatically
and You may no longer exercise any of the rights granted to You by this
License as of the date You commence an action, including a cross-claim or
counterclaim, against Licensor or any licensee alleging that the Original Work
infringes a patent. This termination provision shall not apply for an action
alleging patent infringement by combinations of the Original Work with other
software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
License may be brought only in the courts of a jurisdiction wherein the
Licensor resides or in which Licensor conducts its primary business, and under
the laws of that jurisdiction excluding its conflict-of-law provisions. The
application of the United Nations Convention on Contracts for the
International Sale of Goods is expressly excluded. Any use of the Original
Work outside the scope of this License or after its termination shall be
subject to the requirements and penalties of copyright or patent law in the
appropriate jurisdiction. This section shall survive the termination of this
License.
12) Attorneys' Fees. In any action to enforce the terms of this License or
seeking damages relating thereto, the prevailing party shall be entitled to
recover its costs and expenses, including, without limitation, reasonable
attorneys' fees and costs incurred in connection with such action, including
any appeal of such action. This section shall survive the termination of this
License.
13) Miscellaneous. If any provision of this License is held to be
unenforceable, such provision shall be reformed only to the extent necessary
to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License,
whether in upper or lower case, means an individual or a legal entity
exercising rights under, and complying with all of the terms of, this License.
For legal entities, "You" includes any entity that controls, is controlled by,
or is under common control with you. For purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the direction or
management of such entity, whether by contract or otherwise, or (ii) ownership
of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise
restricted or conditioned by this License or by law, and Licensor promises not
to interfere with or be responsible for such uses by You.
16) Modification of This License. This License is Copyright © 2005 Lawrence
Rosen. Permission is granted to copy, distribute, or communicate this License
without modification. Nothing in this License permits You to modify this
License as applied to the Original Work or to Derivative Works. However, You
may modify the text of this License and copy, distribute or communicate your
modified version (the "Modified License") and apply it to other original works
of authorship subject to the following conditions: (i) You may not indicate in
any way that your Modified License is the "Open Software License" or "OSL" and
you may not use those names in the name of your Modified License; (ii) You
must replace the notice specified in the first paragraph above with the notice
"Licensed under <insert your license name here>" or with a notice of your own
that is not confusingly similar to the notice in this License; and (iii) You
may not claim that your original works are open source software unless your
Modified License has been approved by Open Source Initiative (OSI) and You
comply with its license review and certification process.

View file

@ -1,36 +1,43 @@
<h1 align="center">
<img src="https://armcord.vercel.app/armcord_full_logo.png" width="720">
</h1>
ArmCord is a custom alternative Discord client made for people on lower-end devices and ARM architecture that want custom Discord experience. It uses [Cumcord](https://cumcord.com) for custom themes and plugins!
ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.
# Features
* **Standalone client** - ArmCord is built as standalone client, it doesn't rely on original Discord client.
* **Various mods built in** - Explore Cumcord/GooseMod/Flicker plugins and their features!
* **Made for Privacy** - ArmCord automatically blocks Discord's trackers.
* **Faster than normal Discord app** - ArmCord is using newer Electron than stock Discord app. This usually means increased performance and more stable experience.
* **Designed to work anywhere** - ArmCord was initially created in mind to run on Arm64 Linux devices. We soon expanded our support to more platforms. We plan to support every platform that [Electron supports](https://www.electronjs.org/docs/latest/tutorial/support#supported-platforms).
# How to run/install it?
Check releases tab for precompiled packages for Linux, Windows and Mac OS (experimental).
Alternatively you can run ArmCord from source (npm, nodejs required):
1.Run `npm install`
2.Run `npm start`
3.Compile/Package with `npm run make`
### Recommended:
Check releases tab for precompiled packages for Linux, Windows and Mac OS (experimental).
### Manual:
Alternatively you can run ArmCord from source (npm, nodejs required):
1.Clone ArmCord repo: `git clonehttps://github.com/ArmCord/ArmCord.git`
2.Run `npm install` to install dependencies
3.Compile/Package with `npm run package`
# FAQ
## 1.Will I get banned from using it?
-You are breaking Discord ToS since we are using Cumcord for themes and plugins. But no one ever got banned from using ArmCord or Cumcord. If you wish to remove Cumcord, you can find it in your mods folder.
-You are breaking Discord ToS if you decided to use client mods. But no one ever got banned from using ArmCord or any of the client mods included. If you wish to remove mods, check our documentation.
## 2.How does this work?
-We are using official web app and adding Cumcord it with some other tweaks.
-We are using official web app and adding some magic powder to make it all work!
## 3.Can I use this on other architectures or operating systems?
-Yes! ArmCord should work normally under Windows, ~~Mac OS~~ (Mac OS is broken see [#48](https://github.com/ArmCord/ArmCord/issues/48)), Linux as long as it has NodeJS, npm and Electron support.
## 4.Code is big spaghetti.
-I'm aware. I'm slowly rewriting everything.
# Credits
[ArmCord UI Elements and few features](https://github.com/kckarnige)
[Cumcord](https://github.com/Cumcord/Cumcord)
[GooseMod](https://github.com/GooseMod/GooseMod)
[GooseMod Extension](https://github.com/GooseMod/extension)
[electron-discord-webapp](https://github.com/SpacingBat3/electron-discord-webapp)
[custom-electron-titlebar](https://github.com/AlexTorresSk/custom-electron-titlebar)
[electron-localshortcut](https://github.com/parro-it/electron-localshortcut)
[custom-electron-titlebar (css only)](https://github.com/AlexTorresSk/custom-electron-titlebar)
[electron-builder](https://electron.build)

View file

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View file

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

View file

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View file

@ -1,2 +0,0 @@
npm run package
./dist/linux-unpacked/armcord

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 81 KiB

View file

@ -1,108 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>ArmCord</title>
<script>
window.onload = setTimeout(function() {
if (document.getElementById("ac-channel").innerHTML == "stable") {
window.location.href = "https://discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "canary") {
window.location.href = "https://canary.discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "ptb") {
window.location.href = "https://ptb.discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "foss") {
window.location.href = "https://dev.fosscord.com/app";
} else {
window.location.href = "https://discord.com/app";
};
}, 3000);
</script>
<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: #8e9297;
text-align: center;
font-weight: 100;
transform: translateY(-185%);
font-family: Whitney,Helvetica Neue,Helvetica,Arial,sans-serif;
text-rendering: optimizeLegibility;
font-style: italic;
}
h1 {
font-size: 0px;
text-align: center;
transform: translateY(-105%);
}
h1:before {
content: "ARM";
color: #7289da;
font-weight: normal;
font-family: Helvetica, sans-serif;
font-size: 32px;
}
h1:after {
content: "Cord";
color: #ffffff;
font-weight: normal;
font-family: Discordinated;
font-size: 32px;
}
span {
text-align: center;
}
.logo {
display: block;
margin-left: auto;
margin-right: auto;
max-height: 204px;
max-width: 204px;
transform: translateY(5%);
}
.container {
position: fixed;
top: 50%;
left: 50%;
color: #fff;
transform: translate(-50%, -50%);
}
#ac-channel {
display: none;
}
</style>
</head>
<body>
<div class="container">
<video autoplay loop class="logo">
<source src="https://discord.com/assets/3b0d96ed8113994f3d139088726cfecd.webm" type="video/webm">
</video>
<p>Loading...</p>
<h1></h1>
<p id="ac-channel"></p>
</div>
</body>
</html>

141
main.js
View file

@ -1,141 +0,0 @@
// Modules to control application life and create native browser window
const { app, BrowserWindow, session, Tray, Menu } = require("electron");
const path = require("path");
const contextMenu = require("electron-context-menu");
const os = require("os");
require("v8-compile-cache");
require("./utils/updater.js")
if (require("./utils/ArmCord.js").Titlebar === "native") {
var frame = true
} else {
var frame = false
}
if (os.type() == 'Linux'){
var iconformat = __dirname + "/ac_icon_transparent.png"
} else {
console.log("Running Non-Linux")
var iconformat = __dirname + "/ac_plug.ico";
}
contextMenu({
prepend: (defaultActions, parameters, browserWindow) => [
{
label: "Image",
// Only show it when right-clicking images
visible: parameters.mediaType === "image",
},
],
});
contextMenu.showSearchWithGoogle = false;
let mainWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: iconformat,
title: "ArmCord",
frame: frame,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
enableRemoteModule: true,
nodeIntegration: false,
},
});
var appIcon = new Tray(iconformat);
mainWindow.webContents.userAgent =
"Mozilla/5.0 (X12; Linux x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
mainWindow.loadFile("index.html");
mainWindow.focus();
mainWindow.webContents.on("new-window", function (e, url) {
e.preventDefault();
require("electron").shell.openExternal(url);
});
// Open the DevTools.
// mainWindow.webContents.openDevTools()
var contextMenu = Menu.buildFromTemplate([
{
label: "Show App",
click: function () {
mainWindow.show();
},
},
{
label: "Support Discord Server",
click: function () {
mainWindow.show();
mainWindow.loadURL("https://discord.gg/F25bc4RYDt");
},
},
{
label: "Quit",
click: function () {
mainWindow.destroy();
app.isQuiting = true;
app.quit();
},
},
]);
appIcon.on("click", () => {
mainWindow.show()
});
appIcon.setContextMenu(contextMenu);
// Emitted when the window is closed.
mainWindow.on("close", function (event) {
event.preventDefault();
mainWindow.hide();
});
mainWindow.on("show", function () {
//temporary fix
try {
appIcon();
} catch (error) {
//console.error(error);
// expected output: TypeError: appIcon is not a function
}
});
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow();
require("./utils/mod.js");
require("./utils/plugin.js");
session
.fromPartition("some-partition")
.setPermissionRequestHandler((webContents, permission, callback) => {
const url = webContents.getURL(); //unused?
if (permission === "notifications") {
// Approves the permissions request
callback(true);
}
if (permission === "microphone") {
// Approves the permissions request
callback(true);
}
if (!url.startsWith("discord://")) {
// Denies the permissions request
return callback(false);
}
});
app.on("activate", function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on("window-all-closed", function () {
if (process.platform !== "darwin") app.quit();
});

View file

@ -1,161 +0,0 @@
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
background-color: #2f3136;
user-select: none;
--header-secondary: #b9bbbe;
--header-primary: #fff;
--background-tertiary: #202225;
}
body {
color: white;
}
h1 {
font-size: 0;
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;
}
.disabled {
text-align: center;
font-weight: normal;
font-family: Helvetica, sans-serif;
}
.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;
left: 0;
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;
}
button#open-themes-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-right: 5px;
right: 0;
text-align: center;
border-style: none;
outline: none;
}
button#open-themes-btn:hover {
background-color: #687dc6;
border-style: none;
outline: none;
cursor: pointer;
}
button#open-themes-btn:active {
background-color: #5c6fb1;
}
#tm-list {
position: absolute;
top: 100px;
left: 50%;
transform: translateX(-50%);
}
#tm-disabled {
position: absolute;
top: 100px;
left: 50%;
transform: translateX(-50%);
}
#tm-list-item {
background: #23272a;
font-family: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif;
width: 100%;
border-radius: 5px;
padding: 10px 10px 18px;
width: 420px;
max-width: 820px;
}
#theme-name {
color: #7289da;
font-weight: 400;
font-size: 20px;
}
#theme-author {
color: #99aab5;
font-size: 12px;
}
#theme-description {
color: #b9bbbe;
font-size: 15px;
position: relative;
top: 8px;
width: 75%;
}
#ac-channel {
display: none;
}
::-webkit-scrollbar {
width: 0.4em;
background: transparent;
}
::-webkit-scrollbar-thumb {
background: #202225;
border-radius: 25px;
}

View file

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ArmCord Manager</title>
<link rel="stylesheet" href="manager.css">
</head>
<body>
<button class="back-btn">Back to Discord</button>
<button id="open-themes-btn">Themes Folder</button>
<p class="logo">Cord Manager</p>
<div id="tm-list"></div>
<p class="disabled">Disabled Themes:</p>
<div id="tm-disabled"></div>
<p id="ac-channel"></p>
</body>
</html>

View file

@ -1,42 +0,0 @@
const cspAllowAll = [
'connect-src',
'style-src',
'img-src',
'font-src'
];
const corsAllowUrls = [
'https://github.com/GooseMod/GooseMod/releases/download/dev/index.js',
'https://github-releases.githubusercontent.com/',
'https://api.goosemod.com/inject.js',
'https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js'
];
chrome.webRequest.onHeadersReceived.addListener(({ responseHeaders, url }) => {
let csp = responseHeaders.find((x) => x.name === 'content-security-policy');
if (csp) {
for (let p of cspAllowAll) {
csp.value = csp.value.replace(`${p}`, `${p} * blob: data:`); // * does not include data: URIs
}
// Fix Discord's broken CSP which disallows unsafe-inline due to having a nonce (which they don't even use?)
csp.value = csp.value.replace(/'nonce-.*?' /, '');
}
if (corsAllowUrls.some((x) => url.startsWith(x))) {
let cors = responseHeaders.find((x) => x.name === 'access-control-allow-origin');
cors.value = '*';
}
return {
responseHeaders
};
},
{
urls: [
'*://*.discord.com/*'
]
},
['blocking', 'responseHeaders']
);

View file

@ -1,9 +0,0 @@
const load = async () => {
console.log("[CCExt] Loading Cumcord...");
const response = await fetch("https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js");
const text = await response.text()
eval(text);
}
const el = document.createElement('script');
el.appendChild(document.createTextNode(`(${load.toString()})();`));
document.body.appendChild(el);

View file

@ -1,25 +0,0 @@
{
"name": "Cumcord for Web",
"description": "A heavy, throbbing, and easy to use cum expeller; now in your browser.",
"version": "0.0.1",
"author": "Drake",
"background": {
"scripts": [
"background.js"
]
},
"content_scripts": [
{
"matches": ["*://*.discord.com/*"],
"js": ["content.js"]
}
],
"permissions": [
"storage",
"webRequest",
"webRequestBlocking",
"*://*.discord.com/*"
],
"manifest_version": 2
}

2765
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,60 +1,46 @@
{
"name": "ArmCord",
"version": "2.7.0",
"description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.",
"main": "main.js",
"version": "2.9.9",
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
"main": "ts-out/main.js",
"scripts": {
"start": "./build.sh",
"test": "echo \"Error: no test specified\" && exit 1",
"package": "electron-builder --dir",
"make": "electron-builder",
"linux-build": "electron-builder --linux deb tar.gz rpm AppImage",
"windows-build": "electron-builder --windows nsis portable zip"
},
"author": "smartfrigde <smartfridge1337@protonmail.com>",
"license": "OSL-3.0",
"dependencies": {
"electron-context-menu": "^3.0.0",
"electron-dl": "^3.2.1",
"electron-localshortcut": "^3.2.1",
"electron-store": "^8.0.0",
"electron-updater": "^4.3.9",
"unzipper": "^0.10.1",
"v8-compile-cache": "^2.3.0"
},
"devDependencies": {
"electron": "^13.3.0",
"electron-builder": "^22.11.7"
"build": "tsc",
"watch": "tsc -w",
"start": "npm run build && npm run copy-files && electron ./ts-out/main.js",
"package": "npm run build && npm run copy-files && electron-builder",
"copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/** ts-out/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/smartfrigde/armcord.git"
"url": "git+https://github.com/armcord/armcord.git"
},
"author": "smartfrigde",
"license": "OSL-3.0",
"bugs": {
"url": "https://github.com/armcord/armcord/issues"
},
"homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": {
"electron": "^16.0.7",
"@types/electron-json-storage": "^4.5.0",
"@types/node": "^14.18.2",
"typescript": "^4.5.4",
"copyfiles": "^2.4.1",
"electron-builder": "^22.14.5"
},
"dependencies": {
"electron-json-storage": "^4.5.0",
"v8-compile-cache": "^2.3.0"
},
"keywords": [
"arm",
"discord",
"electron"
],
"build": {
"appId": "com.smartfridge.armcord",
"productName": "ArmCord",
"mac": {
"category": "Network",
"extraResources": [
"./mods/cumcord/*"
]
},
"win": {
"extraResources": [
"./mods/cumcord/*"
]
"category": "Network"
},
"linux": {
"category": "Network",
"extraResources": [
"./mods/cumcord/*"
],
"maintainer": "smartfridge1337@protonmail.com",
"maintainer": "smartfrigde@gmail.com",
"target": [
"deb",
"tar.gz",
@ -62,10 +48,5 @@
"AppImage"
]
}
},
"bugs": {
"url": "https://github.com/smartfrigde/armcord/issues",
"email": "smartfridge1337@protonmail.com"
},
"homepage": "https://github.com/smartfrigde/armcord#readme"
}
}

View file

@ -1,97 +0,0 @@
const { remote } = require("electron");
const currentWindow = remote.getCurrentWindow();
const ArmCord = require("./utils/ArmCord.js");
const electronLocalshortcut = require("electron-localshortcut");
require("./utils/theme.js");
require("./utils/bridge.js")
require('./utils/titlebar')
window.addEventListener("DOMContentLoaded", () => {
if (require("./utils/ArmCord.js").Titlebar == "native") {console.log("Using native titlebar")} else {
//todo
}
electronLocalshortcut.register(currentWindow, "F5", () => {
location.reload();
});
electronLocalshortcut.register(currentWindow, "F12", () => {
currentWindow.webContents.openDevTools();
});
electronLocalshortcut.register(currentWindow, "F1", () => {
require("shell").openExternal("https://support.discord.com/");
});
electronLocalshortcut.register(currentWindow, "F2", () => {
window.location.href = "https://discord.gg/invite/F25bc4RYDt";
});
electronLocalshortcut.register(currentWindow, "F4", () => {
currentWindow.loadFile("./manager.html");
});
require("./utils/capturer.js");
ArmCord.addStyle(`
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
--window-buttons: var(--header-secondary);
--cord-color: var(--header-primary);
--armcord-color: #7289da;
--titlebar-color: var(--background-tertiary);
}
.base-3dtUhz, .sidebar-2K8pFh {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
overflow: hidden;
border-top-left-radius: 8px;
}
div.menubar[role="menubar"] {
width: 0px;
}
.window-title:after {
content: "Cord";
color: var(--cord-color) !important;
font-weight: normal;
font-size: 14px;
font-family: Discordinated;
}
.window-title:before {
content: "ARM";
color: var(--armcord-color);
font-weight: normal;
font-size: 14px;
font-family: Helvetica, sans-serif;
}
.window-title {
font-size: 0px !important;
margin-left: initial !important;
transform: translate(10px, 0px);
}
.titlebar {
background: var(--titlebar-color) !important;
font-family: Verdana, Geneva, Tahoma, sans-serif;
}
.titlebar .window-controls-container .window-icon {
background: var(--window-buttons) !important;
}
.notice-3bPHh-.colorDefault-22HBa0 {
display: none;
}
`);
ArmCord.addStyle(
`.info-1VyQPT:last-child:before {
content: "ArmCord Version: ` +
ArmCord.Version +
`";
height: auto;
line-height: 16px;
text-align: center;
color: var(--text-muted);
font-size: 12px;
text-transform: none;
}`
);
document.getElementById("ac-channel").innerHTML = ArmCord.Channel;
});

View file

@ -0,0 +1,12 @@
.info-1VyQPT:last-child:before {
content: "ArmCord Version: 3.0.0"!important;
height: auto;
line-height: 16px;
text-align: center;
color: var(--text-muted);
font-size: 12px;
text-transform: none;
}
.notice-2HEN-u {
display: none;
}

111
src/content/css/setup.css Normal file
View file

@ -0,0 +1,111 @@
/*CSS ONLY FOR INTERNAL USE (setup and loading)*/
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
background-color: #2c2f33 !important;
--header-secondary: #b9bbbe !important;
--header-primary: #fff !important;
--background-tertiary: #202225 !important;
}
body {
background-color: #2c2f33;
color: white;
}
p {
color: white;
text-align: center;
font-weight: 100;
font-family: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif;
text-rendering: optimizeLegibility;
}
.logo {
font-size: 0px;
text-align: center;
transform: translateY(-105%);
}
.logo:before {
content: "ARM";
color: #7289da;
font-weight: normal;
font-family: Helvetica, sans-serif;
font-size: 32px;
}
.logo:after {
content: "Cord";
color: #ffffff;
font-weight: normal;
font-family: Discordinated;
font-size: 32px;
}
span {
text-align: center;
}
.logo {
display: block;
margin-left: auto;
margin-right: auto;
max-height: 204px;
max-width: 204px;
transform: translateY(5%);
}
.container {
position: fixed;
top: 50%;
left: 50%;
color: #fff;
transform: translate(-50%, -50%);
}
button#express {
margin-right: 84px;
}
button {
background-color: #7289da;
font-family: Whitney, "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #ffffff;
padding: 4px;
border-radius: 5px;
margin-top: 5px;
text-align: center;
border-style: none;
outline: none;
}
.setup-ask {
font-size: 20px;
}
button:hover {
background-color: #687dc6;
border-style: none;
outline: none;
cursor: pointer;
}
select {
-webkit-appearance: button;
-moz-appearance: button;
-webkit-padding-end: 20px;
-moz-padding-end: 20px;
-webkit-padding-start: 2px;
-moz-padding-start: 2px;
background-color: #2c2f33;
background-position: center right;
background-repeat: no-repeat;
border: 1px solid #aaa;
border-radius: 2px;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1);
color: #fff;
font-size: inherit;
margin: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.center {
text-align: center;
}

114
src/content/css/splash.css Normal file
View file

@ -0,0 +1,114 @@
/*MIT License
Copyright (c) 2021 GooseMod
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.*/
:root {
--background-primary: #282b30;
--background-secondary: rgba(255, 255, 255, 0.1);
--brand-experiment: #5865f2;
--header-primary: #fff;
--text-muted: #72767d;
}
@font-face {
font-family: Whitney;
font-weight: 400;
font-style: normal;
src: url(https://armcord.smartfridge.space/whitney_400.woff) format("woff");
}
html,
body {
-webkit-app-region: drag;
overflow: hidden;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: var(--background-primary);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
* {
font-family: "Whitney", sans-serif;
box-sizing: border-box;
-webkit-user-select: none;
cursor: default;
}
video {
width: 200px;
height: 150px;
object-fit: cover;
}
#text-splashscreen {
font-size: 7vw;
text-align: center;
color: var(--header-primary);
font-weight: 400;
font-style: italic;
font-size: 16px;
text-transform: uppercase;
width: 100%;
}
#bar-container,
#bar-fill {
width: 180px;
height: 8px;
border-radius: 4px;
visibility: hidden;
}
#bar-container {
background-color: var(--background-secondary);
position: relative;
margin-top: 12px;
}
#bar-fill {
background-color: var(--brand-experiment);
width: 0;
}
#debug {
position: absolute;
bottom: 6px;
right: 6px;
text-align: right;
font-size: 10px;
color: var(--text-muted);
white-space: pre;
}

View file

@ -1,26 +1,9 @@
const { remote } = require("electron");
var win = remote.BrowserWindow.getFocusedWindow();
const ArmCord = require("./ArmCord.js");
const css = `
.titleebar {
position: absolute;
top: 0;
left: 0;
right: 0;
box-sizing: border-box;
width: 100%;
font-size: 13px;
padding: 0 16px;
overflow: hidden;
flex-shrink: 0;
align-items: center;
justify-content: center;
user-select: none;
zoom: 1;
line-height: 22px;
height: 22px;
display: flex;
z-index: 99999;
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
:root {
--window-buttons: var(--header-secondary);
--cord-color: var(--header-primary);
--armcord-color: #7289da;
--titlebar-color: var(--background-tertiary);
}
.titlebar {
display: block;
@ -32,7 +15,7 @@ const css = `
zoom: 1;
box-sizing: border-box;
width: 100%;
clear:both;
clear: both;
height: 30px;
line-height: 30px;
background-color: #202225;
@ -42,10 +25,6 @@ const css = `
-webkit-user-select: none;
position: fixed;
z-index: 99999;
}
.appMount-3lHmkl{
}
.titlebar #window-title {
width: 30%;
@ -76,63 +55,54 @@ const css = `
}
.titlebar #window-controls-container #minimize:hover {
background-color: #99AAB5;
background-color: #99aab5;
}
.titlebar #window-controls-container #maximize:hover {
background-color: #99AAB5;
background-color: #99aab5;
}
.titlebar #window-controls-container #quit:hover {
background-color: #F04747;
background-color: #f04747;
}
.titlebar #window-controls-container #quit {
background-color: #f7f7f7;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
}
.titlebar #window-controls-container #minimize {
background-color: #f7f7f7;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 4.399V5.5H0V4.399h11z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
}
.titlebar #window-controls-container #maximize {
background-color: #f7f7f7;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E") no-repeat 50% 50%;
-webkit-mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf-8,%3Csvg width='11' height='11' viewBox='0 0 11 11' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 0v11H0V0h11zM9.899 1.101H1.1V9.9h8.8V1.1z' fill='%23000'/%3E%3C/svg%3E")
no-repeat 50% 50%;
}
.window-title:after {
content: "Cord";
color: var(--cord-color) !important;
font-weight: normal;
font-size: 14px;
font-family: Discordinated;
}
.window-title:before {
content: "ARM";
color: var(--armcord-color);
font-weight: normal;
font-size: 14px;
font-family: Helvetica, sans-serif;
}
.window-title {
font-size: 0px !important;
margin-left: initial !important;
transform: translate(10px, 0px);
}
.withFrame-haYltI {
height: 30px !important;
}
`;
document.addEventListener("DOMContentLoaded", function (event) {
var elem = document.createElement("div");
elem.innerHTML = `<nav class="titlebar">
<div class="window-title" id="window-title"></div>
<div id="window-controls-container">
<div id="minimize"></div>
<div id="maximize"></div>
<div id="quit"></div>
</div>
</nav>`;
document.body.appendChild(elem);
ArmCord.addStyle(css);
var minimize = document.querySelector("#minimize");
var maximize = document.querySelector("#maximize");
var quit = document.querySelector("#quit");
minimize.addEventListener("click", () => {
win.minimize();
});
maximize.addEventListener("click", () => {
if (win.isMaximized() == true) {
win.unmaximize();
} else {
win.maximize();
}
});
quit.addEventListener("click", () => {
win.close();
});
});

112
src/content/setup.html Normal file
View file

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link
rel="stylesheet"
href="https://cdn.metroui.org.ua/v4/css/metro-all.min.css"
/>
<meta charset="UTF-8" />
<title>ArmCord Setup</title>
<style>
@import url("css/setup.css");
</style>
</head>
<body>
<div class="container">
<h1 class="logo"></h1>
<div id="setup">
<p>Select what kind of setup you want to perform:</p>
<button id="express" class="center">Express setup</button>
<button id="full" class="center">Full setup</button>
</div>
</div>
<script>
function fade(element) {
var op = 1; // initial opacity
var timer = setInterval(function () {
if (op <= 0.1) {
clearInterval(timer);
element.style.display = "none";
}
element.style.opacity = op;
element.style.filter = "alpha(opacity=" + op * 100 + ")";
op -= op * 0.1;
}, 50);
}
if (window.navigator.onLine === false) {
document.getElementById("setup").innerHTML =
"You appear to be offline. Please connect to the internet and restart ArmCord Setup.";
} else {
console.log("Starting ArmCord Setup...");
document.getElementById("express").addEventListener("click", function () {
window.armcord.saveSettings(true, "stable", true, "cumcord");
fade(document.getElementById("setup"));
setTimeout(function () {
window.armcord.restart()
}, 5000);
})
document.getElementById("full").addEventListener("click", function () {
document.getElementById("setup").innerHTML = `
<p class="text-center setup-ask">Choose your Discord channel/instance:</p>
<div class="center">
<select name="channel" id="channel" class="dropdown-button">
<option value="stable">Stable</option>
<option value="canary">Canary</option>
<option value="ptb">PTB</option>
<option value="foss">Fosscord</option>
</select>
</div>
<p class="text-center setup-ask">Should ArmCord handle client mods installation?</p>
<div class="center">
<select name="csp" id="csp" class="dropdown-button">
<option value="true">Yes</option>
<option value="false">No</option>
</select>
</div>
<button id="next" class="center">Next</button>
`;
document
.getElementById("next")
.addEventListener("click", function () {
var branch = document.getElementById("channel").value;
var csp = document.getElementById("csp").value;
if (csp === "true") {
document.getElementById("setup").innerHTML = `
<p class="text-center setup-ask">Select a client mod you want to install:</p>
<div class="center">
<select name="mod" id="mod" class="dropdown-button">
<option value="cumcord">Cumcord</option>
<option value="goosemod">GooseMod</option>
<option value="flicker">Flicker (Heavily WIP)</option>
</select>
</div>
<p>Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation ;)</p>
<button id="next" class="center">Next</button>
`;
document
.getElementById("next")
.addEventListener("click", function () {
var mod = document.getElementById("mod").value;
window.armcord.saveSettings(true, branch, true, mod);
fade(document.getElementById("setup"));
setTimeout(function () {
window.armcord.restart();
}, 5000);
});
} else {
//saveSettings(customTitlebarSetting: boolean, channelSetting: string, armcordCSPSetting: boolean, modsSetting: string)
window.armcord.saveSettings(true, branch, true, "none");
fade(document.getElementById("setup"));
setTimeout(function () {
window.armcord.restart()
}, 5000);
}
});
});
}
</script>
</body>
</html>

68
src/content/splash.html Normal file
View file

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>ArmCord</title>
<style>
@import url("css/splash.css");
</style>
</head>
<body>
<div class="container">
<video autoplay loop class="logo" id="splashscreen-armcord">
<source
src="https://armcord.smartfridge.space/discord_loading.webm"
type="video/webm"
/>
</video>
<p id="text-splashscreen"></p>
</div>
</body>
<script>
const text = document.getElementById("text-splashscreen");
if (window.navigator.onLine === false) {
text.innerHTML =
"You appear to be offline. Please connect to the internet and try again.";
} else {
text.innerHTML = "Starting ArmCord...";
fetch("https://armcord.smartfridge.space/latest.json")
.then((response) => response.json())
.then((data) => {
if (data.version !== window.armcord.version) {
var elem = document.createElement("img");
elem.classList.add("logo");
elem.src = "https://armcord.smartfridge.space/update.webp";
document.body.prepend(elem);
document.getElementById("splashscreen-armcord").remove();
text.innerHTML =
"A new version of ArmCord is available. Please update to the latest version.";
} else {
console.log("ArmCord is up to date.")
}
});
setTimeout(() => {
window.armcord.splashEnd();
switch (window.armcord.channel) {
case "stable":
window.location.replace("https://discord.com/app");
break;
case "canary":
window.location.replace("https://canary.discord.com/app");
break;
case "ptb":
window.location.replace("https://ptb.discord.com/app");
break;
case "foss":
window.location.replace("https://dev.fosscord.com/app");
break;
case undefined:
window.location.replace("https://discord.com/app");
break;
default:
window.location.replace("https://discord.com/app");
}
}, 5000);
}
</script>
</html>

69
src/extensions/mods.ts Normal file
View file

@ -0,0 +1,69 @@
//https://github.com/GooseMod/GooseMod/wiki/Stuck-Updater-or-Blank-Window-Fix
/*
Copyright 2021 GooseMod
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.
*/
import electron from "electron";
import * as storage from "electron-json-storage";
const otherMods = {
generic: {
electronProxy: require("util").types.isProxy(electron), // Many modern mods overwrite electron with a proxy with a custom BrowserWindow (copied from PowerCord)
},
};
const unstrictCSP = () => {
console.log("Setting up CSP unstricter...");
const cspAllowAll = ["connect-src", "style-src", "img-src", "font-src"];
const corsAllowUrls = [
"https://github.com/GooseMod/GooseMod/releases/download/dev/index.js",
"https://github-releases.githubusercontent.com/",
"https://api.goosemod.com/inject.js",
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
"https://raw.githubusercontent.com/Cumcord/Cumcord/master/dist/build.js",
"https://raw.githubusercontent.com/FlickerMod/dist/main/build.js",
];
electron.session.defaultSession.webRequest.onHeadersReceived(
({ responseHeaders, url }, done) => {
let csp = responseHeaders!["content-security-policy"];
if (otherMods.generic.electronProxy) {
// Since patch v16, override other mod's onHeadersRecieved (Electron only allows 1 listener); because they rely on 0 CSP at all (GM just unrestricts some areas), remove it fully if we detect other mods
delete responseHeaders!["content-security-policy"];
csp = [];
}
if (csp) {
for (let p of cspAllowAll) {
csp[0] = csp[0].replace(`${p}`, `${p} * blob: data:`); // * does not include data: URIs
}
// Fix Discord's broken CSP which disallows unsafe-inline due to having a nonce (which they don't even use?)
csp[0] = csp[0].replace(/'nonce-.*?' /, "");
}
if (corsAllowUrls.some((x) => url.startsWith(x))) {
responseHeaders!["access-control-allow-origin"] = ["*"];
}
done({ responseHeaders });
}
);
};
storage.get("settings", function (error, data: any) {
if (error) throw error;
if (data.armcordCSP) {
unstrictCSP();
} else {
console.log(
"ArmCord CSP is disabled. The CSP should be managed by third-party plugin."
);
}
});

26
src/extensions/plugin.ts Normal file
View file

@ -0,0 +1,26 @@
import * as fs from 'fs';
import { app, session } from 'electron';
const userDataPath = app.getPath("userData");
const pluginFolder = userDataPath + "/plugins/";
if (!fs.existsSync(pluginFolder)) {
fs.mkdirSync(pluginFolder);
console.log("Created missing plugin folder");
}
app.whenReady().then(() => {
fs.readdirSync(pluginFolder).forEach((file) => {
try {
const manifest = fs.readFileSync(
`${userDataPath}/plugins/${file}/manifest.json`,
"utf8"
);
var pluginFile = JSON.parse(manifest);
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
console.log(
`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`,
"color:red"
);
} catch (err) {
console.error(err);
}
});
});

158
src/main.ts Normal file
View file

@ -0,0 +1,158 @@
// Modules to control application life and create native browser window
import { app, BrowserWindow, ipcMain, shell, desktopCapturer, session } from "electron";
import * as path from "path";
import "v8-compile-cache";
import * as storage from "electron-json-storage";
import { saveSettings, getVersion, setup } from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import "./shortcuts";
var contentPath: string = "null";
var frame: boolean;
var channel: string;
var titlebar: boolean;
export var mainWindow: BrowserWindow;
var settings: any;
storage.has("settings", function (error, hasKey) {
if (error) throw error;
if (!hasKey) {
console.log("First run of the ArmCord. Starting setup.");
setup();
contentPath = __dirname + "/content/setup.html";
} else {
console.log("ArmCord has been run before. Skipping setup.");
contentPath = __dirname + "/content/splash.html";
}
});
storage.get("settings", function (error, data: any) {
if (error) throw error;
console.log(data);
titlebar = data.customTitlebar;
channel = data.channel;
settings = data;
if ((titlebar = true)) {
frame = false;
} else {
frame = true;
}
});
function createWindow() {
mainWindow = new BrowserWindow({
width: 300,
height: 350,
title: "ArmCord",
icon: "./assets/ac_icon_transparent.png",
frame: frame,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js"),
},
});
ipcMain.on("get-app-path", (event, arg) => {
event.reply("app-path", app.getAppPath());
});
ipcMain.on("open-external-link", (event, href: string) => {
shell.openExternal(href);
});
ipcMain.on("win-maximize", (event, arg) => {
mainWindow.maximize();
});
ipcMain.on("win-isMaximized", (event, arg) => {
event.returnValue = mainWindow.isMaximized();
});
ipcMain.on("win-minimize", (event, arg) => {
mainWindow.minimize();
});
ipcMain.on("win-unmaximize", (event, arg) => {
mainWindow.unmaximize();
});
ipcMain.on("win-show", (event, arg) => {
mainWindow.show();
});
ipcMain.on("win-hide", (event, arg) => {
mainWindow.hide();
});
ipcMain.on("get-app-version", (event) => {
event.returnValue = getVersion();
});
ipcMain.on("splashEnd", (event, arg) => {
mainWindow.setSize(800, 600);
});
ipcMain.on("restart", (event, arg) => {
app.relaunch();
app.exit();
});
ipcMain.on("saveSettings", (event, ...args) => {
//@ts-ignore
saveSettings(...args);
});
ipcMain.on("channel", (event) => {
event.returnValue = channel;
});
ipcMain.on("clientmod", (event, arg) => {
event.returnValue = settings.mods;
});
ipcMain.on("setting-armcordCSP", (event) => {
storage.get("settings", function (error, data: any) {
if (error) throw error;
if (data.armcordCSP) {
event.returnValue = true;
} else {
event.returnValue = false;
}
});
});
ipcMain.handle("DESKTOP_CAPTURER_GET_SOURCES", (event, opts) =>
desktopCapturer.getSources(opts)
);
mainWindow.webContents.userAgent =
"Mozilla/5.0 (X11; Linux x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
shell.openExternal(url);
return { action: "deny" };
});
mainWindow.loadFile(contentPath);
}
app.whenReady().then(() => {
createWindow();
session
.fromPartition("some-partition")
.setPermissionRequestHandler((webContents, permission, callback) => {
const url = webContents.getURL(); //unused?
if (permission === "notifications") {
// Approves the permissions request
callback(true);
}
if (permission === "media") {
// Approves the permissions request
callback(true);
}
if (url.startsWith("discord://")) {
// Denies the permissions request
return callback(false);
}
if (url.startsWith("discord.com/science")) {
// Denies the permissions request
return callback(false);
}
if (url.startsWith("discord.com/tracing")) {
// Denies the permissions request
return callback(false);
}
});
app.on("activate", function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on("window-all-closed", function () {
if (process.platform !== "darwin") app.quit();
});

31
src/preload/bridge.ts Normal file
View file

@ -0,0 +1,31 @@
import { contextBridge, ipcRenderer } from "electron";
import { getDisplayMediaSelector } from "./capturer";
contextBridge.exposeInMainWorld("armcord", {
window: {
show: () => ipcRenderer.send("win-show"),
hide: () => ipcRenderer.send("win-hide"),
minimize: () => ipcRenderer.send("win-minimize"),
maximize: () => ipcRenderer.send("win-maximize"),
},
electron: process.versions.electron,
channel: ipcRenderer.sendSync("channel"),
version: ipcRenderer.sendSync("get-app-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector,
restart: () => ipcRenderer.send("restart"),
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args),
splashEnd: () => ipcRenderer.send("splashEnd"),
});
contextBridge.exposeInMainWorld("electron", {
//deprecated, used for legacy purposes, will be removed in future versions
window: {
show: () => ipcRenderer.send("win-show"),
hide: () => ipcRenderer.send("win-hide"),
minimize: () => ipcRenderer.send("win-minimize"),
maximize: () => ipcRenderer.send("win-maximize"),
},
electron: process.versions.electron,
warning: 'This is a deprecated API and will be removed in future versions (3.0.0 --> 3.1.0).',
version: ipcRenderer.sendSync("get-app-version", "app-version"),
});

View file

@ -1,9 +1,11 @@
//Fixed context isolation version https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.ts
//original https://github.com/electron/electron/issues/16513#issuecomment-602070250
const { desktopCapturer } = require('electron');
import { desktopCapturer } from 'electron';
import {addStyle, addScript} from '../utils';
const CANCEL_ID = 'desktop-capturer-selection__cancel';
const ArmCord = require("./ArmCord.js");
async function getDisplayMediaSelector() {
export async function getDisplayMediaSelector() {
const sources = await desktopCapturer.getSources({
types: ['screen', 'window'],
});
@ -108,7 +110,7 @@ window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve
try {
const selectionElem = document.createElement('div');
selectionElem.classList = ['desktop-capturer-selection'];
selectionElem.innerHTML = await window.electron.getDisplayMediaSelector();
selectionElem.innerHTML = await window.armcord.getDisplayMediaSelector();
document.body.appendChild(selectionElem);
document
.querySelectorAll('.desktop-capturer-selection__btn')
@ -144,9 +146,8 @@ window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve
`;
document.addEventListener("DOMContentLoaded", function(event) {
ArmCord.addScript(screenShareJS);
ArmCord.addStyle(screenShareCSS);
addScript(screenShareJS);
addStyle(screenShareCSS);
console.log("Capturer injected.")
});
exports.getDisplayMediaSelector = getDisplayMediaSelector;

49
src/preload/preload.ts Normal file
View file

@ -0,0 +1,49 @@
import "./bridge";
import "./capturer";
import * as fs from "fs";
import * as path from "path";
import { injectTitlebar } from "./titlebar";
import { sleep, addStyle } from "../utils";
import { ipcRenderer } from "electron";
const clientMods = {
goosemod: "https://api.goosemod.com/inject.js",
cumcord:
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
flicker: "https://raw.githubusercontent.com/FlickerMod/dist/main/build.js",
};
async function injectJS(inject: string) {
const js = await (await fetch(`${inject}`)).text();
const el = document.createElement("script");
el.appendChild(document.createTextNode(js));
document.body.appendChild(el);
}
console.log("ArmCord");
if (window.location.href.indexOf("splash.html") > -1) {
console.log("Skipping titlebar injection and client mod injection.");
} else {
injectTitlebar();
sleep(5000).then(() => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
switch (ipcRenderer.sendSync("clientmod")) {
case "goosemod":
injectJS(clientMods.goosemod);
console.log("Loading GooseMod...");
break;
case "cumcord":
injectJS(clientMods.cumcord);
console.log("Loading Cumcord...");
break;
case "flicker":
injectJS(clientMods.flicker);
console.log("Loading FlickerMod...");
break;
}
});
}

48
src/preload/titlebar.ts Normal file
View file

@ -0,0 +1,48 @@
import { ipcRenderer } from "electron";
import { addStyle } from "../utils";
import * as fs from "fs";
import * as path from "path";
export function injectTitlebar() {
document.addEventListener("DOMContentLoaded", function (event) {
var elem = document.createElement("div");
elem.innerHTML = `<nav class="titlebar">
<div class="window-title" id="window-title"></div>
<div id="window-controls-container">
<div id="minimize"></div>
<div id="maximize"></div>
<div id="quit"></div>
</div>
</nav>`;
elem.classList.add("withFrame-haYltI");
if (document.getElementById("app-mount") == null) {
document.body.appendChild(elem);
} else {
document.getElementById("app-mount")!.prepend(elem);
}
const cssPath = path.join(__dirname, "../", "/content/css/titlebar.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
var minimize = document.getElementById("minimize");
var maximize = document.getElementById("maximize");
var quit = document.getElementById("quit");
minimize!.addEventListener("click", () => {
ipcRenderer.send("win-minimize");
});
maximize!.addEventListener("click", () => {
if (ipcRenderer.sendSync("win-isMaximized") == true) {
ipcRenderer.send("win-unmaximize");
} else {
ipcRenderer.send("win-maximize");
}
});
quit!.addEventListener("click", () => {
ipcRenderer.send("win-hide");
});
});
}
export function removeTitlebar() {
document.querySelector("#titlebar")!.remove();
}

35
src/shortcuts.ts Normal file
View file

@ -0,0 +1,35 @@
import { Menu, MenuItem } from "electron";
import { mainWindow } from "./main";
const menu = new Menu();
menu.append(
new MenuItem({
label: "ArmCord" + process.env.npm_package_version,
submenu: [
{
role: "toggleDevTools",
accelerator:
process.platform === "darwin" ? "Ctrl+Cmd+I" : "Ctrl+Shift+I",
click: () => {
mainWindow.webContents.toggleDevTools();
},
},
{
role: "toggleDevTools",
accelerator: "F12",
click: () => {
mainWindow.webContents.toggleDevTools();
},
},
{
role: "reload",
accelerator:
"Ctrl+F5",
click: () => {
mainWindow.webContents.reload();
},
},
],
})
);
Menu.setApplicationMenu(menu);

30
src/tray.ts Normal file
View file

@ -0,0 +1,30 @@
import { app, Menu, Tray } from 'electron';
import {mainWindow} from './main';
let tray = null
app.whenReady().then(() => {
tray = new Tray('./assets/ac_plug.png')
const contextMenu = Menu.buildFromTemplate([
{
label: "Open ArmCord",
click: function () {
mainWindow.show();
},
},
{
label: "Support Discord Server",
click: function () {
mainWindow.show();
mainWindow.loadURL("https://discord.gg/F25bc4RYDt");
},
},
{
label: "Quit ArmCord",
click: function () {
app.quit();
},
},
]);
tray.setToolTip('ArmCord' + process.env.npm_package_version)
tray.setContextMenu(contextMenu)
})

58
src/utils.ts Normal file
View file

@ -0,0 +1,58 @@
import * as fs from "fs";
import * as storage from "electron-json-storage";
//utillity functions that are used all over the codebase or just too obscure to be put in the file used in
export function addStyle(styleString: string) {
const style = document.createElement("style");
style.textContent = styleString;
document.head.append(style);
}
export function addScript(scriptString: string) {
var script = document.createElement("script");
script.textContent = scriptString;
document.body.append(script);
}
export function setup() {
console.log("Setting up ArmCord settings.");
storage.set(
"settings",
{
customTitlebar: true,
channel: "stable",
firstRun: "done",
armcordCSP: true,
},
function (error) {
if (error) throw error;
}
);
}
export async function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export function saveSettings(
customTitlebarSetting: boolean,
channelSetting: string,
armcordCSPSetting: boolean,
modsSetting: string
) {
console.log("Setting up ArmCord settings.");
storage.set(
"settings",
{
customTitlebar: customTitlebarSetting,
channel: channelSetting,
firstRun: "done",
armcordCSP: armcordCSPSetting,
mods: modsSetting,
},
function (error) {
if (error) throw error;
}
);
}
export function getVersion() {
const pkgjson = fs.readFileSync("./package.json", "utf8");
return JSON.parse(pkgjson).version;
}

35
tsconfig.json Normal file
View file

@ -0,0 +1,35 @@
// Reference: https://www.typescriptlang.org/tsconfig
{
"include": ["src/**/*"], // This makes it so that the compiler won't compile anything outside of "src".
//"exclude": ["src/**/*.test.ts"], // Exclude .test.ts files since they're for Jest only.
"compilerOptions": {
// Project Structure //
"rootDir": "src", // rootDir only affects the STRUCTURE of the folders, not what gets compiled. For extra measure, make sure the structure conforms to "src".
"outDir": "ts-out", // Likewise, outDir only chooses which folder to compile to. Prevent the compiler from creating JS files right next to source files.
"moduleResolution": "node", // Specify how the compiler resolves modules, like going for node_modules first then searching elsewhere. The official docs just say to use this instead of classic.
// Type Settings //
"strict": true, // Enables all strict checks possible.
"noImplicitReturns": false, // Makes sure you don't accidentally return something + undefined.
"noFallthroughCasesInSwitch": true, // Prevents accidentally forgetting to break every switch case. Of course, if you know what you're doing, feel free to add a @ts-ignore, which also signals that it's not a mistake.
"forceConsistentCasingInFileNames": true, // Make import paths case-sensitive. "./tEst" is no longer the same as "./test".
"esModuleInterop": true, // Enables compatibility with Node.js' module system since the entire export can be whatever you want. allowSyntheticDefaultImports doesn't address runtime issues and is made redundant by this setting.
"resolveJsonModule": true, // Allows you to import JSON files just like how you can require() them. Do note that if you're accessing any JSON files outside of src, it'll mess up dist.
"lib": ["ES2020", "DOM"], // Specifies what common libraries you have access to. If you're working in Node.js, you'll want to leave out the DOM library. But do make sure to include "@types/node" because otherwise, variables like "console" won't be defined.
// Output //
"module": "CommonJS", // Compiles ES6 imports to require() syntax.
"removeComments": false,
"sourceMap": true, // Used for displaying the original source when debugging in webpack. Allows you to set breakpoints directly on TypeScript code for VSCode's debugger.
// Library Building //
"declaration": false, // Exports declaration files in addition, used for exporting a module.
"declarationMap": false, // Allows the user to go to the source file when hitting a go-to-implementation key like F12 in VSCode for example.
//"declarationDir": "typings", // declarationDir allows you to separate the compiled code from the declaration files, used in conjunction with package.json's "types" property.
// Web Compatibility //
"target": "ES2020", // ES2017 supports async/await, reducing the amount of compiled code, especially for async-heavy projects. ES2020 is from the Node 14 base (https://github.com/tsconfig/bases/blob/master/bases/node14.json)
"downlevelIteration": false, // This flag adds extra support when targeting ES3, but adds extra bloat otherwise.
"importHelpers": false // Reduce the amount of bloat that comes from downlevelIteration (when polyfills are redeclared).
}
}

View file

@ -1,24 +0,0 @@
exports.Version = require("../package.json").version;
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.Titlebar = require(settingsFile).titlebar;
exports.addStyle = function(styleString) {
const style = document.createElement('style');
style.textContent = styleString;
document.head.append(style);
};
exports.addScript = function (scriptString) {
var script = document.createElement("script");
script.textContent = scriptString;
document.body.append(script);
};

View file

@ -1,19 +0,0 @@
const { contextBridge, remote } = require("electron");
const currentWindow = remote.getCurrentWindow();
const {getDisplayMediaSelector} = require('./capturer')
const ArmCord = require("./ArmCord.js");
const version = require("../package.json").version;
contextBridge.exposeInMainWorld("electron", {
window: {
show: () => currentWindow.show(),
hide: () => currentWindow.hide(),
minimize: () => currentWindow.minimize(),
maximize: () => currentWindow.maximize(),
on : () => currentWindow.on(),
},
electron: process.versions.electron,
version: version,
ArmCord: ArmCord,
getDisplayMediaSelector: getDisplayMediaSelector,
});

View file

@ -1,22 +0,0 @@
const fs = require("fs");
const { app, session } = require("electron");
const path = require ('path');
const execPath = path.dirname (process.execPath);
app.whenReady().then(() => {
fs.readdirSync(`${execPath}/resources/mods/`).forEach((file) => {
try {
const manifest = fs.readFileSync(
`${execPath}/resources/mods/${file}/manifest.json`,
"utf8"
);
var pluginFile = JSON.parse(manifest);
session.defaultSession.loadExtension(`${execPath}/resources/mods/${file}`);
console.log(
`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`,
"color:red"
);
} catch (err) {
console.error(err);
}
});
});

View file

@ -1,24 +0,0 @@
const fs = require("fs");
const { app, session } = require("electron");
const electron = require("electron");
const userDataPath = (electron.app || electron.remote.app).getPath("userData");
const pluginFolder = userDataPath + "/plugins/";
app.whenReady().then(() => {
fs.readdirSync(pluginFolder).forEach((file) => {
try {
const manifest = fs.readFileSync(
`${userDataPath}/plugins/${file}/manifest.json`,
"utf8"
);
var pluginFile = JSON.parse(manifest);
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
console.log(
`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`,
"color:red"
);
} catch (err) {
console.error(err);
}
});
});

View file

@ -1,53 +0,0 @@
const fs = require("fs");
const {shell} = require('electron');
const electron = require("electron");
const ArmCord = require("./ArmCord.js");
const userDataPath = (electron.app || electron.remote.app).getPath("userData");
const themeFolder = userDataPath + "/themes/";
if (!fs.existsSync(themeFolder)) {
fs.mkdirSync(themeFolder);
console.log("Created theme folder");
}
window.addEventListener("DOMContentLoaded", () => {
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 = `<div id="tm-list-item"><div id="theme-name">${themeFile.name}</div><div id="theme-author">By ${themeFile.author}</div><div id="theme-description">${themeFile.description}</div></div><br><br>`;
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");
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);
var html = `<div id="tm-list-item"><div id="theme-name">${themeFile.name}</div><div id="theme-author">By ${themeFile.author}</div><div id="theme-description">${themeFile.description}</div></div><br><br>`;
document.getElementById("tm-list").innerHTML = html + document.getElementById("tm-list").innerHTML;
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
} catch (err) {
console.error(err);
}
});
document.getElementById("open-themes-btn").onclick = function () {shell.openPath(`${userDataPath}/themes`);};
document.getElementsByClassName("back-btn")[0].onclick = function () {
if (document.getElementById("ac-channel").innerHTML == "stable") {
window.location.href = "https://discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "canary") {
window.location.href = "https://canary.discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "ptb") {
window.location.href = "https://ptb.discord.com/app";
} else if (document.getElementById("ac-channel").innerHTML == "foss") {
window.location.href = "https://dev.fosscord.com/app";
} else {
window.location.href = "https://discord.com/app";
};
};
});

View file

@ -1,22 +0,0 @@
const { app, autoUpdater } = require('electron')
const server = "https://download.smartfridge.space"
const url = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL({ url })
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'ArmCord Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) autoUpdater.quitAndInstall()
})
})
autoUpdater.on('error', message => {
console.error('There was a problem updating the application')
console.error(message)
})