Compare commits

...

6 commits

Author SHA1 Message Date
smartfridge
33c2c1b81f
Merge branch 'main' into rewrite 2022-01-15 22:23:20 +01:00
smartfrigde
1debbe60fe Getting ready for 3.0 2022-01-15 22:21:51 +01:00
smartfrigde
521278cf00 Titlebar, client mod, Discord, everything loads 2022-01-15 19:31:51 +01:00
smartfridge
b54df99c86
Merge pull request #65 from hanatic/patch-1
Fixed broken link in README
2021-12-22 15:09:28 +01:00
hanatic
d0aef2f7a9
Fixed broken link in README
All it needed was a line break, for some reason. The more you know.
2021-12-22 13:38:45 +00:00
KayoticCarnige
4adfb6998c
Update README.md 2021-11-14 14:19:26 -05:00
17 changed files with 4247 additions and 335 deletions

4
.gitignore vendored
View file

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

View file

@ -1,37 +1,43 @@
### THIS IS EXPERIMENTAL REWRITE CODE
<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)

BIN
build/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

3929
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,14 @@
{
"name": "armcord",
"version": "3.0.0",
"name": "ArmCord",
"version": "2.9.9",
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
"main": "dist/main.js",
"main": "ts-out/main.js",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"start": "npm run build && npm run copy-files && electron ./dist/main.js",
"copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css dist/ && copyfiles package.json dist/ && copyfiles assets/** dist/"
"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",
@ -20,15 +21,32 @@
},
"homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": {
"electron": "^16.0.5"
},
"dependencies": {
"electron": "^16.0.7",
"@types/electron-json-storage": "^4.5.0",
"@types/node": "^14.18.2",
"copyfiles": "^2.4.1",
"electron-json-storage": "^4.5.0",
"typescript": "^4.5.4",
"v8-compile-cache": "^2.3.0",
"ws": "^8.4.0"
"copyfiles": "^2.4.1",
"electron-builder": "^22.14.5"
},
"dependencies": {
"electron-json-storage": "^4.5.0",
"v8-compile-cache": "^2.3.0"
},
"build": {
"appId": "com.smartfridge.armcord",
"productName": "ArmCord",
"mac": {
"category": "Network"
},
"linux": {
"category": "Network",
"maintainer": "smartfrigde@gmail.com",
"target": [
"deb",
"tar.gz",
"rpm",
"AppImage"
]
}
}
}

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

View file

@ -5,122 +5,104 @@
--armcord-color: #7289da;
--titlebar-color: var(--background-tertiary);
}
.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;
}
.titlebar {
display: block;
top: 0;
left: 0;
right: 0;
flex-shrink: 0;
overflow: hidden;
zoom: 1;
box-sizing: border-box;
width: 100%;
clear:both;
height: 30px;
line-height: 30px;
background-color: #202225;
-webkit-app-region: drag;
width: 100%;
user-select: none;
-webkit-user-select: none;
position: fixed;
z-index: 99999;
}
.appMount-3lHmkl{
}
.titlebar #window-title {
width: 30%;
height: 100%;
line-height: 30px;
float: left;
padding: 0 0 0 1em;
}
.titlebar #window-controls-container {
float: right;
width: 150px;
height: 100%;
line-height: 30px;
background-color: #202225;
-webkit-app-region: no-drag;
}
.titlebar #window-controls-container #minimize,
.titlebar #window-controls-container #maximize,
.titlebar #window-controls-container #quit {
float: left;
height: 100%;
width: 33%;
text-align: center;
color: #f7f7f7;
cursor: default;
}
.titlebar #window-controls-container #minimize:hover {
background-color: #99AAB5;
}
.titlebar #window-controls-container #maximize:hover {
background-color: #99AAB5;
}
.titlebar #window-controls-container #quit:hover {
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%;
}
.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%;
}
.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%;
}
.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: 23px !important;
}
.titlebar {
display: block;
top: 0;
left: 0;
right: 0;
flex-shrink: 0;
overflow: hidden;
zoom: 1;
box-sizing: border-box;
width: 100%;
clear: both;
height: 30px;
line-height: 30px;
background-color: #202225;
-webkit-app-region: drag;
width: 100%;
user-select: none;
-webkit-user-select: none;
position: fixed;
z-index: 99999;
}
.titlebar #window-title {
width: 30%;
height: 100%;
line-height: 30px;
float: left;
padding: 0 0 0 1em;
}
.titlebar #window-controls-container {
float: right;
width: 150px;
height: 100%;
line-height: 30px;
background-color: #202225;
-webkit-app-region: no-drag;
}
.titlebar #window-controls-container #minimize,
.titlebar #window-controls-container #maximize,
.titlebar #window-controls-container #quit {
float: left;
height: 100%;
width: 33%;
text-align: center;
color: #f7f7f7;
cursor: default;
}
.titlebar #window-controls-container #minimize:hover {
background-color: #99aab5;
}
.titlebar #window-controls-container #maximize:hover {
background-color: #99aab5;
}
.titlebar #window-controls-container #quit:hover {
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%;
}
.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%;
}
.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%;
}
.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;
}

View file

@ -22,24 +22,7 @@
</div>
</div>
<script>
function discord(){
switch (window.armcord.channel) {
case "stable":
window.location.href = "https://discord.com/app";
break;
case "canary":
window.location.href = "https://canary.discord.com/app";
break;
case "ptb":
window.location.href = "https://ptb.discord.com/app";
break;
case "foss":
window.location.href = "https://dev.fosscord.com/app";
break;
default:
window.location.href = "https://discord.com/app";
}
}
function fade(element) {
var op = 1; // initial opacity
var timer = setInterval(function () {
@ -58,6 +41,13 @@
"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>
@ -90,7 +80,7 @@
<select name="mod" id="mod" class="dropdown-button">
<option value="cumcord">Cumcord</option>
<option value="goosemod">GooseMod</option>
<option value="flicker">Flicker (WIP)</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>
@ -103,8 +93,7 @@
window.armcord.saveSettings(true, branch, true, mod);
fade(document.getElementById("setup"));
setTimeout(function () {
window.armcord.splashEnd();
discord();
window.armcord.restart();
}, 5000);
});
} else {
@ -112,8 +101,7 @@
window.armcord.saveSettings(true, branch, true, "none");
fade(document.getElementById("setup"));
setTimeout(function () {
window.armcord.splashEnd();
discord();
window.armcord.restart()
}, 5000);
}
});

View file

@ -26,25 +26,43 @@
"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) {
window.armcord.splashEnd();
switch (window.armcord.channel) {
case "stable":
window.location.href = "https://discord.com/app";
window.location.replace("https://discord.com/app");
break;
case "canary":
window.location.href = "https://canary.discord.com/app";
window.location.replace("https://canary.discord.com/app");
break;
case "ptb":
window.location.href = "https://ptb.discord.com/app";
window.location.replace("https://ptb.discord.com/app");
break;
case "foss":
window.location.href = "https://dev.fosscord.com/app";
window.location.replace("https://dev.fosscord.com/app");
break;
case undefined:
window.location.replace("https://discord.com/app");
break;
default:
window.location.href = "https://discord.com/app";
}}, 5000);
window.location.replace("https://discord.com/app");
}
}, 5000);
}
</script>
</html>

View file

@ -1,49 +1,50 @@
// Modules to control application life and create native browser window
import { app, BrowserWindow, ipcMain, shell, desktopCapturer } from "electron";
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 } from "./utils";
import { saveSettings, getVersion, setup } from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
var isSetup = null;
import "./shortcuts";
var contentPath: string = "null";
var frame: boolean;
var channel: string;
var titlebar: boolean;
export var mainWindow: BrowserWindow;
var settings: any;
storage.keys(function (error, keys) {
if (error) throw error;
for (var key of keys) {
console.log("There is a key called: " + key);
}
});
storage.has("settings", function (error, hasKey) {
if (error) throw error;
if (!hasKey) {
console.log("First run of the ArmCord. Starting setup.");
isSetup = true;
// setup(); will be done at setup
setup();
contentPath = __dirname + "/content/setup.html";
} else {
console.log("ArmCord has been run before. Skipping setup.");
isSetup = false;
contentPath = __dirname + "/content/splash.html";
}
});
storage.get("settings", function (error, data: any) {
if (error) throw error;
console.log(data);
frame = data.customTitlebar;
console.log(frame);
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"),
@ -74,27 +75,28 @@ function createWindow() {
mainWindow.hide();
});
ipcMain.on("get-app-version", (event) => {
event.returnValue = process.env.npm_package_version;
event.returnValue = getVersion();
});
ipcMain.on("splashEnd", (event, arg) => {
mainWindow.setSize(800, 600);
});
ipcMain.on("channel", (event) => {
storage.get("settings", function (error, data: any) {
if (error) throw error;
event.returnValue = data.channel;
});
ipcMain.on("restart", (event, arg) => {
app.relaunch();
app.exit();
});
ipcMain.on("saveSettings", (event, ...args) => {
//@ts-ignore
saveSettings(...args);
});
ipcMain.on('clientmod' , (event, arg) => {
storage.get("settings", function (error, data: any) {
if (error) throw error;
event.returnValue = data.mods;
});
})
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;
@ -110,16 +112,42 @@ function createWindow() {
);
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.on("new-window", function (e, url) {
e.preventDefault();
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();
});

View file

@ -1,20 +1,31 @@
import { contextBridge, ipcRenderer } from 'electron';
import {getDisplayMediaSelector} from './capturer';
import { contextBridge, ipcRenderer } from "electron";
import { getDisplayMediaSelector } from "./capturer";
console.log(ipcRenderer.send('channel'))
contextBridge.exposeInMainWorld("armcord", {
window: {
show: () => ipcRenderer.send('win-show'),
hide: () => ipcRenderer.send('win-hide'),
minimize: () => ipcRenderer.send('win-minimize'),
maximize: () => ipcRenderer.send('win-maximize'),
show: () => ipcRenderer.send("win-show"),
hide: () => ipcRenderer.send("win-hide"),
minimize: () => ipcRenderer.send("win-minimize"),
maximize: () => ipcRenderer.send("win-maximize"),
},
electron: process.versions.electron,
version: ipcRenderer.send('get-app-version', 'app-version'),
channel: ipcRenderer.sendSync("channel"),
version: ipcRenderer.sendSync("get-app-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector,
saveSettings: (...args: any) => ipcRenderer.send('saveSettings', ...args),
splashEnd: () => ipcRenderer.send('splashEnd'),
channel: ipcRenderer.send('channel')
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
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,12 +1,10 @@
import "./capturer";
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";
declare global {
interface Window {
splash: any;
}
}
const clientMods = {
goosemod: "https://api.goosemod.com/inject.js",
@ -29,18 +27,23 @@ if (window.location.href.indexOf("splash.html") > -1) {
console.log("Skipping titlebar injection and client mod injection.");
} else {
injectTitlebar();
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;
}
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;
}
});
}

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

View file

@ -1,4 +1,4 @@
import { app, Menu, Tray, ipcRenderer } from 'electron';
import { app, Menu, Tray } from 'electron';
import {mainWindow} from './main';
let tray = null
app.whenReady().then(() => {
@ -24,6 +24,7 @@ app.whenReady().then(() => {
},
},
]);
tray.setToolTip('ArmCord' + process.env.npm_package_version)
tray.setContextMenu(contextMenu)
})

View file

@ -1,29 +1,58 @@
import * as storage from 'electron-json-storage';
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);
};
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) {
export function setup() {
console.log("Setting up ArmCord settings.");
storage.set('settings', { customTitlebar: customTitlebarSetting, channel: channelSetting, firstRun: 'done', armcordCSP: armcordCSPSetting, mods: modsSetting }, function(error) {
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;
}

View file

@ -5,7 +5,7 @@
"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": "dist", // Likewise, outDir only chooses which folder to compile to. Prevent the compiler from creating JS files right next to source files.
"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 //