This commit is contained in:
smartfridge 2021-11-01 11:47:32 +01:00
parent 06460a9d44
commit 64c6c1f118
19 changed files with 1343 additions and 466 deletions

3
.gitmodules vendored Normal file
View File

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

View File

@ -19,8 +19,10 @@ Alternatively you can run ArmCord from source (npm, nodejs required):
-We are using official web app and adding GooseMod to it with some other tweaks.
## 3.Can I use this on other architectures or operating systems?
-Yes! ArmCord should work normally under Windows, Mac OS, Linux as long as it has NodeJS, npm and Electron support.
-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. This branch is mostly fixes only.
# Credits
[ArmCord UI Elements and few features](https://github.com/kckarnige)

BIN
ac_icon_transparent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
ac_plug.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

BIN
ac_plug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

View File

@ -11,10 +11,10 @@ if (require("./utils/ArmCord.js").Titlebar === "native") {
}
if (os.type() == 'Linux'){
var iconformat = __dirname + "/discord.png"
} else { //test this
var iconformat = __dirname + "/ac_icon_transparent.png"
} else {
console.log("Running Non-Linux")
var iconformat = __dirname + "/discord.ico";
var iconformat = __dirname + "/ac_plug.ico";
}
contextMenu({
@ -105,7 +105,7 @@ function createWindow() {
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
createWindow();
//require("./utils/csp.js");
require("./utils/mod.js");
require("./utils/plugin.js");
session
.fromPartition("some-partition")

View File

@ -0,0 +1,42 @@
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']
);

9
mods/cumcord/content.js Normal file
View File

@ -0,0 +1,9 @@
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

@ -0,0 +1,25 @@
{
"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
}

1625
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"description": "ArmCord is a Discord client made for ARM Linux that allows you to customize your experience.",
"main": "main.js",
"scripts": {
"start": "electron .",
"start": "./build.sh",
"test": "echo \"Error: no test specified\" && exit 1",
"package": "electron-builder --dir",
"make": "electron-builder",
@ -14,15 +14,21 @@
"author": "smartfrigde <smartfridge1337@protonmail.com>",
"license": "OSL-3.0",
"dependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"custom-electron-titlebar": "3.2.7",
"electron-context-menu": "^3.0.0",
"electron-dl": "^3.2.1",
"electron-localshortcut": "^3.2.1",
"electron-store": "^8.0.0",
"rollup": "^2.58.0",
"rollup-plugin-terser": "^7.0.2",
"unzipper": "^0.10.1",
"v8-compile-cache": "^2.3.0"
},
"devDependencies": {
"electron": "latest",
"electron": "^13.3.0",
"electron-builder": "^22.11.7"
},
"repository": {
@ -41,6 +47,7 @@
"category": "Network"
},
"linux": {
"extraResources": ["./mods/cumcord/*"],
"maintainer": "smartfridge1337@protonmail.com",
"target": [
"deb",

View File

@ -4,6 +4,7 @@ const customTitlebar = require("custom-electron-titlebar");
const electronLocalshortcut = require("electron-localshortcut");
const ArmCord = require("./utils/ArmCord.js");
require("./utils/theme.js");
require("./utils/bridge.js")
window.addEventListener("DOMContentLoaded", () => {
if (require("./utils/ArmCord.js").Titlebar === "native") {console.log("Using native titlebar")} else {
new customTitlebar.Titlebar({
@ -21,7 +22,7 @@ window.addEventListener("DOMContentLoaded", () => {
require("shell").openExternal("https://support.discord.com/");
});
electronLocalshortcut.register(currentWindow, "F2", () => {
window.location.href = "/invite/F25bc4RYDt";
window.location.href = "https://discord.gg/invite/F25bc4RYDt";
});
electronLocalshortcut.register(currentWindow, "F4", () => {
currentWindow.loadFile("./manager.html");

13
utils/bridge.js Normal file
View File

@ -0,0 +1,13 @@
const { contextBridge, remote, desktopCapturer } = require("electron");
const currentWindow = remote.getCurrentWindow();
contextBridge.exposeInMainWorld("electron", {
window: {
show: () => currentWindow.show(),
hide: () => currentWindow.hide(),
minimize: () => currentWindow.minimize(),
maximize: () => currentWindow.maximize(),
},
version: process.versions.electron,
desktopCapturer: desktopCapturer,
});

23
utils/mod.js Normal file
View File

@ -0,0 +1,23 @@
const fs = require("fs");
const { app, session } = require("electron");
const electron = 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

@ -3,50 +3,7 @@ const { app, session } = require("electron");
const electron = require("electron");
const userDataPath = (electron.app || electron.remote.app).getPath("userData");
const pluginFolder = userDataPath + "/plugins/";
if (!fs.existsSync(pluginFolder)) {
fs.mkdirSync(pluginFolder);
console.log("Created plugin folder")
try {
console.log("Attempting to download GooseMod Extension")
const https = require("https");
function download(url, dest, cb) {
const file = fs.createWriteStream(dest);
const request = https
.get(url, function (response) {
response.pipe(file);
file.on("finish", function () {
file.close(cb); // close() is async, call cb after close completes.
});
})
.on("error", function (err) {
// Handle errors
fs.unlink(dest); // Delete the file async. (But we don't check the result)
if (cb) cb(err.message);
});
}
// Download latest archive from GitHub to temp folder
const dest = userDataPath + "/Cache/GooseMod.zip";
const url =
"https://codeload.github.com/GooseMod/Extension/zip/refs/heads/main";
download(url, dest, function () {
console.log("Downloaded, attempting to install.");
const unzip = require("unzipper")
fs.createReadStream(dest).pipe(unzip.Extract({ path: pluginFolder }));
electron.dialog.showMessageBox({
title: "ArmCord",
type: "warning",
message: "ArmCord has installed GooseMod onto your client.",
detail:
"If you wish to use it restart your ArmCord completely using tray icon. It should appear in next session. GooseMod is reccomended to every user of ArmCord due to various improvements and bugfixes it ships with. You won't be able to load themes or see any of ArmCord specific CSS patches including fixed font logo at the top.",
});
});
}
catch (e){
console.error(`GooseMod failed to download. Error: ${e}`)
}
}
app.whenReady().then(() => {
fs.readdirSync(pluginFolder).forEach((file) => {
try {