Compare commits

...

12 commits

Author SHA1 Message Date
smartfrigde
7a3e6f5738 v3.0.5 2022-04-17 21:00:37 +02:00
smartfrigde
c8a6e1f726 Re-add the workflow 2022-04-17 20:59:49 +02:00
smartfrigde
03e45c272c Fix settings saving 2022-04-17 20:55:30 +02:00
smartfrigde
16531fa922 Make this mess more stable 2022-04-17 19:54:54 +02:00
smartfridge
5801aed6e6
Merge pull request #91 from ArmCord/dependabot/npm_and_yarn/electron-builder-23.0.3
Bump electron-builder from 22.14.13 to 23.0.3
2022-04-14 19:53:46 +02:00
dependabot[bot]
91abf2db70
Bump electron-builder from 22.14.13 to 23.0.3
Bumps [electron-builder](https://github.com/electron-userland/electron-builder/tree/HEAD/packages/electron-builder) from 22.14.13 to 23.0.3.
- [Release notes](https://github.com/electron-userland/electron-builder/releases)
- [Changelog](https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder/CHANGELOG.md)
- [Commits](https://github.com/electron-userland/electron-builder/commits/v23.0.3/packages/electron-builder)

---
updated-dependencies:
- dependency-name: electron-builder
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 17:53:35 +00:00
smartfridge
324d054f9f
Merge pull request #92 from ArmCord/dependabot/npm_and_yarn/electron-18.0.4
Bump electron from 18.0.1 to 18.0.4
2022-04-14 19:52:16 +02:00
smartfridge
559604c27c
Merge pull request #93 from ArmCord/dependabot/npm_and_yarn/types/node-17.0.24
Bump @types/node from 14.18.12 to 17.0.24
2022-04-14 19:51:51 +02:00
smartfridge
1c5556509b
Merge pull request #94 from ArmCord/dependabot/npm_and_yarn/electron-tabs-0.17.0
Bump electron-tabs from 0.15.0 to 0.17.0
2022-04-14 19:51:42 +02:00
dependabot[bot]
96e3b6d5de
Bump electron-tabs from 0.15.0 to 0.17.0
Bumps [electron-tabs](https://github.com/brrd/electron-tabs) from 0.15.0 to 0.17.0.
- [Release notes](https://github.com/brrd/electron-tabs/releases)
- [Commits](https://github.com/brrd/electron-tabs/compare/0.15.0...0.17.0)

---
updated-dependencies:
- dependency-name: electron-tabs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 17:49:56 +00:00
dependabot[bot]
b4aea6d2a1
Bump @types/node from 14.18.12 to 17.0.24
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.18.12 to 17.0.24.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 17:49:47 +00:00
dependabot[bot]
3eb6fee9b8
Bump electron from 18.0.1 to 18.0.4
Bumps [electron](https://github.com/electron/electron) from 18.0.1 to 18.0.4.
- [Release notes](https://github.com/electron/electron/releases)
- [Changelog](https://github.com/electron/electron/blob/main/docs/breaking-changes.md)
- [Commits](https://github.com/electron/electron/compare/v18.0.1...v18.0.4)

---
updated-dependencies:
- dependency-name: electron
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-14 17:49:38 +00:00
16 changed files with 1056 additions and 2111 deletions

37
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: Build/release
on: push
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v1
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 16
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.github_token }}
# skip npm run build as there's no script like that
skip_build: false
# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }} #disabled for now as it caused problems (nvm)
- name: Archive production builds
uses: actions/upload-artifact@v2
with:
name: dist folder
path: dist/**

2904
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "ArmCord",
"version": "3.1.0",
"version": "3.0.5",
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
"main": "ts-out/main.js",
"scripts": {
@ -23,10 +23,10 @@
"homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": {
"@types/electron-json-storage": "^4.5.0",
"@types/node": "^14.18.2",
"@types/node": "^17.0.24",
"copyfiles": "^2.4.1",
"electron": "^18.0.1",
"electron-builder": "^22.14.13",
"electron": "^18.0.4",
"electron-builder": "^22.5.1",
"husky": "^7.0.4",
"prettier": "^2.5.1",
"typescript": "^4.5.4"
@ -34,8 +34,7 @@
"dependencies": {
"electron-context-menu": "^3.1.2",
"electron-json-storage": "^4.5.0",
"electron-tabs": "^0.15.0",
"glasstron": "^0.1.1",
"electron-tabs": "^0.17.0",
"v8-compile-cache": "^2.3.0"
},
"build": {
@ -55,4 +54,4 @@
]
}
}
}
}

View file

@ -1,5 +1,5 @@
.info-3pQQBb:last-child:before {
content: "ArmCord Version: 3.1.0" !important;
content: "ArmCord Version: 3.0.5" !important;
height: auto;
line-height: 16px;
text-align: center;

View file

@ -1,5 +1,5 @@
/*CSS ONLY FOR INTERNAL USE (setup and loading)*/
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
@import url("https://armcord.smartfridge.space/logofont.css");
:root {
background-color: #2c2f33 !important;

View file

@ -1,4 +1,4 @@
@import url("https://kckarnige.github.io/femboi_owo/discord-font.css");
@import url("https://armcord.smartfridge.space/logofont.css");
:root {
--window-buttons: var(--header-secondary);
--cord-color: var(--header-primary);

View file

@ -88,7 +88,7 @@
content: "Cord";
color: var(--cord-color) !important;
font-weight: normal;
font-size: 14px;
font-size: 15px;
font-family: Discordinated;
}
.window-title:before {

View file

@ -22,7 +22,7 @@
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")
fetch("https://armcord.xyz/latest.json")
.then((response) => response.json())
.then((data) => {
if (data.version !== window.armcord.version) {

View file

@ -33,7 +33,7 @@ export function registerIpc() {
mainWindow.hide();
});
ipcMain.on("win-quit", (event, arg) => {
app.exit();
app.quit();
});
ipcMain.on("get-app-version", (event) => {
event.returnValue = getVersion();

View file

@ -1,5 +1,5 @@
// Modules to control application life and create native browser window
import {app, BrowserWindow, session} from "electron";
import {app, BrowserWindow, session, dialog} from "electron";
import * as path from "path";
import "v8-compile-cache";
import * as storage from "electron-json-storage";
@ -7,20 +7,17 @@ import {getConfigUnsafe, setup} from "./utils";
import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import {mainWindow, createCustomWindow, createNativeWindow, createGlasstronWindow, createTabsHost} from "./window";
import {createCustomWindow, createNativeWindow, createTabsHost} from "./window";
import "./shortcuts";
export var contentPath: string;
var channel: string;
export var settings: any;
export var customTitlebar: boolean;
export var tabs: boolean;
async function appendSwitch() {
if ((await getConfigUnsafe("windowStyle")) == "glasstron") {
console.log("Enabling transparency visuals.");
app.commandLine.appendSwitch("enable-transparent-visuals");
}
let isSingleInstance = app.requestSingleInstanceLock();
if (!isSingleInstance) {
app.quit();
}
appendSwitch();
storage.has("settings", function (error, hasKey) {
if (error) throw error;
@ -55,15 +52,8 @@ app.whenReady().then(async () => {
createNativeWindow();
break;
case "glasstron":
setTimeout(
createGlasstronWindow,
process.platform == "linux" ? 1000 : 0
// Electron has a bug on linux where it
// won't initialize properly when using
// transparency. To work around that, it
// is necessary to delay the window
// spawn function.
);
dialog.showErrorBox("Glasstron is unsupported.", "This build doesn't include Glasstron functionality, please edit windowStyle value in your settings.json to something different (default for example)")
app.quit()
break;
case "tabs":
createTabsHost();
@ -93,9 +83,6 @@ app.whenReady().then(async () => {
case "native":
createNativeWindow();
break;
case "glasstron":
createGlasstronWindow();
break;
default:
createCustomWindow();
break;

View file

@ -1,18 +1,17 @@
import {BrowserWindow, shell, ipcMain} from "electron";
import * as storage from "electron-json-storage";
import {BrowserWindow, shell, ipcMain, app} from "electron";
import {getConfigUnsafe, saveSettings, Settings} from "../utils";
import path from "path";
var settings: any;
var isAlreadyCreated: boolean = false;
storage.get("settings", function (error, data: any) {
if (error) throw error;
console.log(data);
settings = data;
});
var settingsWindow: BrowserWindow;
var instance: number = 0;
export function createSettingsWindow() {
if (isAlreadyCreated) {
settingsWindow.show();
console.log("Creating a settings window.");
instance = instance + 1;
if (instance > 1) {
if (settingsWindow) {
settingsWindow.show();
settingsWindow.restore();
}
} else {
settingsWindow = new BrowserWindow({
width: 500,
@ -37,10 +36,10 @@ export function createSettingsWindow() {
return {action: "deny"};
});
settingsWindow.loadURL(`file://${__dirname}/settings.html`);
settingsWindow.on("close", async (e) => {
e.preventDefault();
settingsWindow.hide();
settingsWindow.on("close", (event: Event) => {
ipcMain.removeHandler("getSetting");
ipcMain.removeAllListeners("saveSettings");
instance = 0;
});
isAlreadyCreated = true;
}
}

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<title>ArmCord Settings</title>
<style>
@import url("settings.css");
@import url("../content/css/settings.css");
</style>
</head>
@ -13,8 +13,6 @@
<select name="theme" id="theme" class="left">
<option value="default">Default</option>
<option value="native">Native</option>
<option value="glasstron">Glasstron (experimental)</option>
<option value="tabs">Tabs (experimental)</option>
</select>
<p class="header">ArmCord theme:</p>
</div>
@ -53,15 +51,7 @@
</select>
<p class="header">Client mod:</p>
</div>
<div class="switch">
<select name="blurType" id="blurType" class="left">
<option value="acrylic">Acrylic</option>
<option value="blurbehind">Blur Behind</option>
<option value="transparent">Transparent</option>
<option value="none">None</option>
</select>
<p class="header">Glasstron blur type:</p>
</div>
<button id="save" class="center">Save settings</button>
</body>
@ -73,20 +63,19 @@
document.getElementById("mod").value = await settings.get("mods");
document.getElementById("channel").value = await settings.get("channel");
document.getElementById("theme").value = await settings.get("windowStyle");
document.getElementById("blurType").value = await settings.get("blurType");
}
loadSettings();
document.getElementById("save").addEventListener("click", function () {
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
settings.save(
document.getElementById("theme").value,
document.getElementById("channel").value,
document.getElementById("csp").checked,
document.getElementById("tray").checked,
document.getElementById("patches").checked,
document.getElementById("mod").value,
document.getElementById("blurType").value
);
settings.save({
windowStyle: document.getElementById("theme").value,
channel: document.getElementById("channel").value,
armcordCSP: document.getElementById("csp").checked,
minimizeToTray: document.getElementById("tray").checked,
automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value,
blurType: "acrylic"
});
});
</script>
</html>

View file

@ -1,70 +0,0 @@
declare module "glasstron" {
export class BrowserWindow extends Electron.BrowserWindow {
getBlur(): Promise<boolean>;
setBlur(value: boolean): Promise<boolean>;
blurType: WindowsBlurType;
setVibrancy(vibrancy: MacOSVibrancy): void;
}
/**
* @deprecated
*/
export function init(): void;
/**
* @deprecated
*/
export function update(
window: Electron.BrowserWindow,
values: {
windows?: {
blurType: WindowsBlurType;
};
macos?: {
vibrancy: MacOSVibrancy;
};
linux?: {
requestBlur: boolean;
};
}
): void;
export class Hacks {
static injectOnElectron(): void;
static delayReadyEvent(): void;
}
export type WindowsBlurType = "acrylic" | "blurbehind" | "transparent" | "none";
export type MacOSVibrancy =
| (
| "appearance-based"
| "light"
| "dark"
| "titlebar"
| "selection"
| "menu"
| "popover"
| "sidebar"
| "medium-light"
| "ultra-dark"
| "header"
| "sheet"
| "window"
| "hud"
| "fullscreen-ui"
| "tooltip"
| "content"
| "under-window"
| "under-page"
)
| null;
}
declare module "glasstron/src/utils" {
class Utils {
static getSavePath(): string;
static copyToPath(innerFile: string, outerFilename?: string, flags?: number): void;
static removeFromPath(filename: string): void;
static isInPath(filename: string): boolean;
static getPlatform(): any;
static parseKeyValString(string: string, keyvalSeparator?: string, pairSeparator?: string): any;
static makeKeyValString(object: any, keyvalSeparator?: string, pairSeparator?: string): string;
}
export = Utils;
}

View file

@ -1,6 +1,6 @@
import * as storage from "electron-json-storage";
import * as fs from "fs";
import {app} from "electron";
import {app, dialog} from "electron";
import path from "path";
export var firstRun: boolean;
@ -21,9 +21,11 @@ export async function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
export async function checkIfConfigIsNew() {
if ((await getConfigUnsafe("automaticPatches")) == undefined) {
firstRun = true;
export async function checkIfConfigIsBroken() {
if (await getConfigUnsafe("0") == "d") {
console.log("Detected a corrupted config")
setup()
dialog.showErrorBox("Oops, something went wrong.", "ArmCord has detected that your configuration file is corrupted, please restart the app and set your settings again. If this issue persists, report it on the support server/Github issues.")
}
}
@ -88,7 +90,7 @@ export async function getConfigUnsafe(object: string) {
}
export function getVersion() {
//to-do better way of doing this
return "3.1.0";
return "3.0.5";
}
export async function injectJS(inject: string) {
const js = await (await fetch(`${inject}`)).text();

View file

@ -2,14 +2,14 @@
// I had to add most of the window creation code here to split both into seperete functions
// WHY? Because I can't use the same code for both due to annoying bug with value `frame` not responding to variables
// I'm sorry for this mess but I'm not sure how to fix it.
import {BrowserWindow, shell, app, ipcMain} from "electron";
import {BrowserWindow, shell, app, ipcMain, dialog} from "electron";
import path from "path";
import {contentPath} from "./main";
import {checkIfConfigIsNew, firstRun, getConfigUnsafe} from "./utils";
import {checkIfConfigIsBroken, firstRun, getConfigUnsafe} from "./utils";
import {registerIpc} from "./ipc";
import contextMenu from "electron-context-menu";
export let mainWindow: BrowserWindow;
import * as glasstron from "glasstron";
let guestWindows: BrowserWindow[] = [];
contextMenu({
@ -19,7 +19,7 @@ contextMenu({
});
function doAfterDefiningTheWindow() {
checkIfConfigIsNew();
checkIfConfigIsBroken()
registerIpc();
mainWindow.webContents.userAgent =
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36"; //fake useragent for screenshare to work
@ -37,7 +37,6 @@ function doAfterDefiningTheWindow() {
mainWindow.hide();
} else if (!(await getConfigUnsafe("minimizeToTray"))) {
e.preventDefault();
app.exit();
app.quit();
}
});
@ -96,28 +95,9 @@ export function createNativeWindow() {
});
doAfterDefiningTheWindow();
}
export function createGlasstronWindow() {
mainWindow = new glasstron.BrowserWindow({
width: 300,
height: 350,
title: "ArmCord",
darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"),
frame: true,
autoHideMenuBar: true,
webPreferences: {
preload: path.join(__dirname, "preload/preload.js"),
spellcheck: true
}
});
//@ts-expect-error
mainWindow.blurType = getConfigUnsafe("blurType");
//@ts-expect-error
mainWindow.setBlur(true);
doAfterDefiningTheWindow();
}
export function createTabsHost() {
dialog.showErrorBox("READ THIS BEFORE USING THE APP", "ArmCord Tabs are highly experimental and should be only used for strict testing purposes. Please don't ask for support, however you can still report bugs!")
guestWindows[1] = mainWindow;
mainWindow = new BrowserWindow({
width: 300,