mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Fix npm format script (#261)
This commit is contained in:
parent
c5ce910940
commit
ed775cbf31
7 changed files with 126 additions and 132 deletions
11
.vscode/launch.json
vendored
11
.vscode/launch.json
vendored
|
@ -9,14 +9,9 @@
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "Debug ArmCord via NPM",
|
"name": "Debug ArmCord via NPM",
|
||||||
"runtimeExecutable": "npm",
|
"runtimeExecutable": "npm",
|
||||||
"runtimeArgs": [
|
"runtimeArgs": ["start", "debug"],
|
||||||
"start",
|
|
||||||
"debug",
|
|
||||||
],
|
|
||||||
"port": 9229,
|
"port": 9229,
|
||||||
"skipFiles": [
|
"skipFiles": ["<node_internals>/**"]
|
||||||
"<node_internals>/**"
|
}
|
||||||
]
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
144
package.json
144
package.json
|
@ -1,76 +1,76 @@
|
||||||
{
|
{
|
||||||
"name": "ArmCord",
|
"name": "ArmCord",
|
||||||
"version": "3.1.0",
|
"version": "3.1.0",
|
||||||
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
|
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
|
||||||
"main": "ts-out/main.js",
|
"main": "ts-out/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"start": "npm run build && electron ./ts-out/main.js",
|
"start": "npm run build && electron ./ts-out/main.js",
|
||||||
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",
|
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",
|
||||||
"package": "npm run build && electron-builder",
|
"package": "npm run build && electron-builder",
|
||||||
"packageQuick": "npm run build && electron-builder --dir",
|
"packageQuick": "npm run build && electron-builder --dir",
|
||||||
"format": "prettier --write src/**/*",
|
"format": "prettier --write src *.json",
|
||||||
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
||||||
"prepare": "git config --local core.hooksPath .hooks/"
|
"prepare": "git config --local core.hooksPath .hooks/"
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "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": {
|
|
||||||
"@types/node": "^18.11.9",
|
|
||||||
"@types/ws": "^8.5.3",
|
|
||||||
"chalk-cli": "^5.0.0",
|
|
||||||
"copyfiles": "^2.4.1",
|
|
||||||
"electron": "^21.3.0",
|
|
||||||
"electron-builder": "^23.6.0",
|
|
||||||
"prettier": "^2.7.1",
|
|
||||||
"typescript": "^4.9.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@pyke/vibe": "github:pykeio/vibe#11984868ce9e007859ed91ff159c7f7f0a34e7ae",
|
|
||||||
"arrpc": "file:src/arrpc",
|
|
||||||
"cross-fetch": "^3.1.5",
|
|
||||||
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
|
||||||
"extract-zip": "^2.0.1",
|
|
||||||
"v8-compile-cache": "^2.3.0",
|
|
||||||
"ws": "^8.11.0"
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"nsis": {
|
|
||||||
"include": "build/installer.nsh"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"repository": {
|
||||||
"!*",
|
"type": "git",
|
||||||
"assets",
|
"url": "git+https://github.com/armcord/armcord.git"
|
||||||
"node_modules",
|
|
||||||
"ts-out",
|
|
||||||
"package.json",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
|
||||||
"appId": "com.smartfridge.armcord",
|
|
||||||
"productName": "ArmCord",
|
|
||||||
"mac": {
|
|
||||||
"category": "Network"
|
|
||||||
},
|
},
|
||||||
"linux": {
|
"author": "smartfrigde",
|
||||||
"icon": "build/icon.icns",
|
"license": "OSL-3.0",
|
||||||
"category": "Network",
|
"bugs": {
|
||||||
"maintainer": "smartfridge@vivaldi.net",
|
"url": "https://github.com/armcord/armcord/issues"
|
||||||
"target": [
|
},
|
||||||
"deb",
|
"homepage": "https://github.com/armcord/armcord#readme",
|
||||||
"tar.gz",
|
"devDependencies": {
|
||||||
"rpm",
|
"@types/node": "^18.11.9",
|
||||||
"AppImage"
|
"@types/ws": "^8.5.3",
|
||||||
]
|
"chalk-cli": "^5.0.0",
|
||||||
}
|
"copyfiles": "^2.4.1",
|
||||||
},
|
"electron": "^21.3.0",
|
||||||
"packageManager": "pnpm@7.13.4"
|
"electron-builder": "^23.6.0",
|
||||||
|
"prettier": "^2.7.1",
|
||||||
|
"typescript": "^4.9.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@pyke/vibe": "github:pykeio/vibe#11984868ce9e007859ed91ff159c7f7f0a34e7ae",
|
||||||
|
"arrpc": "file:src/arrpc",
|
||||||
|
"cross-fetch": "^3.1.5",
|
||||||
|
"electron-context-menu": "github:ArmCord/electron-context-menu",
|
||||||
|
"extract-zip": "^2.0.1",
|
||||||
|
"v8-compile-cache": "^2.3.0",
|
||||||
|
"ws": "^8.11.0"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"nsis": {
|
||||||
|
"include": "build/installer.nsh"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"!*",
|
||||||
|
"assets",
|
||||||
|
"node_modules",
|
||||||
|
"ts-out",
|
||||||
|
"package.json",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"appId": "com.smartfridge.armcord",
|
||||||
|
"productName": "ArmCord",
|
||||||
|
"mac": {
|
||||||
|
"category": "Network"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"icon": "build/icon.icns",
|
||||||
|
"category": "Network",
|
||||||
|
"maintainer": "smartfridge@vivaldi.net",
|
||||||
|
"target": [
|
||||||
|
"deb",
|
||||||
|
"tar.gz",
|
||||||
|
"rpm",
|
||||||
|
"AppImage"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@7.13.4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
import {customTitlebar} from "./main";
|
import {customTitlebar} from "./main";
|
||||||
import {createSettingsWindow} from "./settings/main";
|
import {createSettingsWindow} from "./settings/main";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import fs from "fs"
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
export function registerIpc() {
|
export function registerIpc() {
|
||||||
ipcMain.on("get-app-path", (event, arg) => {
|
ipcMain.on("get-app-path", (event, arg) => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ app.whenReady().then(async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await init();
|
await init();
|
||||||
await installModLoader()
|
await installModLoader();
|
||||||
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
||||||
if (permission === "notifications") {
|
if (permission === "notifications") {
|
||||||
// Approves the permissions request
|
// Approves the permissions request
|
||||||
|
|
85
src/utils.ts
85
src/utils.ts
|
@ -1,10 +1,10 @@
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import {app, dialog, session} from "electron";
|
import {app, dialog, session} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fetch from "cross-fetch"
|
import fetch from "cross-fetch";
|
||||||
import extract from "extract-zip"
|
import extract from "extract-zip";
|
||||||
import util from "util"
|
import util from "util";
|
||||||
const streamPipeline = util.promisify(require('stream').pipeline)
|
const streamPipeline = util.promisify(require("stream").pipeline);
|
||||||
export var firstRun: boolean;
|
export var firstRun: boolean;
|
||||||
export var contentPath: string;
|
export var contentPath: string;
|
||||||
export var transparency: boolean;
|
export var transparency: boolean;
|
||||||
|
@ -77,7 +77,6 @@ export function getDisplayVersion() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function injectJS(inject: string) {
|
export async function injectJS(inject: string) {
|
||||||
|
|
||||||
const js = await (await fetch(`${inject}`)).text();
|
const js = await (await fetch(`${inject}`)).text();
|
||||||
|
|
||||||
const el = document.createElement("script");
|
const el = document.createElement("script");
|
||||||
|
@ -125,7 +124,7 @@ export async function injectElectronFlags() {
|
||||||
console.log("No performance modes set");
|
console.log("No performance modes set");
|
||||||
}
|
}
|
||||||
if ((await getConfig("windowStyle")) == "transparent" && process.platform === "win32") {
|
if ((await getConfig("windowStyle")) == "transparent" && process.platform === "win32") {
|
||||||
import("@pyke/vibe").then(vibe => {
|
import("@pyke/vibe").then((vibe) => {
|
||||||
console.log("Transparent mode enabled");
|
console.log("Transparent mode enabled");
|
||||||
vibe.setup(app);
|
vibe.setup(app);
|
||||||
transparency = true;
|
transparency = true;
|
||||||
|
@ -287,65 +286,65 @@ export async function checkIfConfigExists() {
|
||||||
// Mods
|
// Mods
|
||||||
async function updateModBundle() {
|
async function updateModBundle() {
|
||||||
try {
|
try {
|
||||||
console.log("Downloading mod bundle")
|
console.log("Downloading mod bundle");
|
||||||
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
||||||
while (!fs.existsSync(distFolder)){
|
while (!fs.existsSync(distFolder)) {
|
||||||
//waiting
|
//waiting
|
||||||
|
}
|
||||||
|
var name: string = await getConfig("mods");
|
||||||
|
const clientMods = {
|
||||||
|
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
|
||||||
|
cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
|
||||||
|
shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
|
||||||
|
};
|
||||||
|
var bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text();
|
||||||
|
fs.writeFileSync(distFolder + "bundle.js", bundle, "utf-8");
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[Mod loader] Failed to install mods");
|
||||||
|
console.error(e);
|
||||||
|
dialog.showErrorBox(
|
||||||
|
"Oops, something went wrong.",
|
||||||
|
"ArmCord couldn't install mods, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
var name: string = await getConfig("mods")
|
|
||||||
const clientMods = {
|
|
||||||
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
|
|
||||||
cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
|
|
||||||
shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
|
|
||||||
};
|
|
||||||
var bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text()
|
|
||||||
fs.writeFileSync(distFolder + "bundle.js", bundle, "utf-8");
|
|
||||||
} catch (e) {
|
|
||||||
console.log("[Mod loader] Failed to install mods")
|
|
||||||
console.error(e)
|
|
||||||
dialog.showErrorBox(
|
|
||||||
"Oops, something went wrong.",
|
|
||||||
"ArmCord couldn't install mods, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
export var modInstallState: string;
|
export var modInstallState: string;
|
||||||
export async function installModLoader() {
|
export async function installModLoader() {
|
||||||
if (await getConfig("mods") == "none") {
|
if ((await getConfig("mods")) == "none") {
|
||||||
modInstallState = "none"
|
modInstallState = "none";
|
||||||
import("./extensions/plugin");
|
import("./extensions/plugin");
|
||||||
console.log("[Mod loader] Skipping")
|
console.log("[Mod loader] Skipping");
|
||||||
} else {
|
} else {
|
||||||
const pluginFolder = app.getPath("userData") + "/plugins/";
|
const pluginFolder = app.getPath("userData") + "/plugins/";
|
||||||
if (!fs.existsSync(pluginFolder + "loader")) {
|
if (!fs.existsSync(pluginFolder + "loader")) {
|
||||||
try {
|
try {
|
||||||
modInstallState = "installing"
|
modInstallState = "installing";
|
||||||
var zipPath = app.getPath("temp") + "/" + "loader.zip";
|
var zipPath = app.getPath("temp") + "/" + "loader.zip";
|
||||||
if (!fs.existsSync(pluginFolder)) {
|
if (!fs.existsSync(pluginFolder)) {
|
||||||
fs.mkdirSync(pluginFolder);
|
fs.mkdirSync(pluginFolder);
|
||||||
console.log("[Mod loader] Created missing plugin folder");
|
console.log("[Mod loader] Created missing plugin folder");
|
||||||
}
|
}
|
||||||
var loaderZip = await fetch("https://armcord.xyz/loader.zip")
|
var loaderZip = await fetch("https://armcord.xyz/loader.zip");
|
||||||
if (!loaderZip.ok) throw new Error(`unexpected response ${loaderZip.statusText}`)
|
if (!loaderZip.ok) throw new Error(`unexpected response ${loaderZip.statusText}`);
|
||||||
await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath))
|
await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath));
|
||||||
await extract(zipPath, { dir: path.join(app.getPath("userData"), "plugins") })
|
await extract(zipPath, {dir: path.join(app.getPath("userData"), "plugins")});
|
||||||
modInstallState = "modDownload"
|
modInstallState = "modDownload";
|
||||||
updateModBundle()
|
updateModBundle();
|
||||||
import("./extensions/plugin");
|
import("./extensions/plugin");
|
||||||
modInstallState = "done"
|
modInstallState = "done";
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.log("[Mod loader] Failed to install modloader")
|
console.log("[Mod loader] Failed to install modloader");
|
||||||
console.error(e)
|
console.error(e);
|
||||||
dialog.showErrorBox(
|
dialog.showErrorBox(
|
||||||
"Oops, something went wrong.",
|
"Oops, something went wrong.",
|
||||||
"ArmCord couldn't install internal mod loader, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
"ArmCord couldn't install internal mod loader, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
modInstallState = "modDownload"
|
modInstallState = "modDownload";
|
||||||
updateModBundle()
|
updateModBundle();
|
||||||
import("./extensions/plugin");
|
import("./extensions/plugin");
|
||||||
modInstallState = "done"
|
modInstallState = "done";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
setConfig,
|
setConfig,
|
||||||
setLang,
|
setLang,
|
||||||
setWindowState,
|
setWindowState,
|
||||||
transparency,
|
transparency
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
import {registerIpc} from "./ipc";
|
import {registerIpc} from "./ipc";
|
||||||
import {setMenu} from "./menu";
|
import {setMenu} from "./menu";
|
||||||
|
@ -51,9 +51,9 @@ contextMenu({
|
||||||
});
|
});
|
||||||
async function doAfterDefiningTheWindow() {
|
async function doAfterDefiningTheWindow() {
|
||||||
if (transparency && process.platform === "win32") {
|
if (transparency && process.platform === "win32") {
|
||||||
import("@pyke/vibe").then(vibe => {
|
import("@pyke/vibe").then((vibe) => {
|
||||||
vibe.applyEffect(mainWindow, "acrylic");
|
vibe.applyEffect(mainWindow, "acrylic");
|
||||||
vibe.forceTheme(mainWindow, 'dark');
|
vibe.forceTheme(mainWindow, "dark");
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ async function doAfterDefiningTheWindow() {
|
||||||
}
|
}
|
||||||
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
||||||
// Allow about:blank (used by Vencord QuickCss popup)
|
// Allow about:blank (used by Vencord QuickCss popup)
|
||||||
if (url === "about:blank") return { action: "allow" };
|
if (url === "about:blank") return {action: "allow"};
|
||||||
|
|
||||||
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
|
@ -206,7 +206,7 @@ async function doAfterDefiningTheWindow() {
|
||||||
console.log(contentPath);
|
console.log(contentPath);
|
||||||
if ((await getConfig("inviteWebsocket")) == true) {
|
if ((await getConfig("inviteWebsocket")) == true) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
import("arrpc")
|
import("arrpc");
|
||||||
//await startServer();
|
//await startServer();
|
||||||
}
|
}
|
||||||
if (firstRun) {
|
if (firstRun) {
|
||||||
|
|
Loading…
Reference in a new issue