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
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
|
@ -9,14 +9,9 @@
|
|||
"request": "launch",
|
||||
"name": "Debug ArmCord via NPM",
|
||||
"runtimeExecutable": "npm",
|
||||
"runtimeArgs": [
|
||||
"start",
|
||||
"debug",
|
||||
],
|
||||
"runtimeArgs": ["start", "debug"],
|
||||
"port": 9229,
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
},
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
144
package.json
144
package.json
|
@ -1,76 +1,76 @@
|
|||
{
|
||||
"name": "ArmCord",
|
||||
"version": "3.1.0",
|
||||
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
|
||||
"main": "ts-out/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
||||
"watch": "tsc -w",
|
||||
"start": "npm run build && electron ./ts-out/main.js",
|
||||
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",
|
||||
"package": "npm run build && electron-builder",
|
||||
"packageQuick": "npm run build && electron-builder --dir",
|
||||
"format": "prettier --write src/**/*",
|
||||
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
||||
"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"
|
||||
"name": "ArmCord",
|
||||
"version": "3.1.0",
|
||||
"description": "ArmCord is a custom client designed to enhance your Discord experience while keeping everything lightweight.",
|
||||
"main": "ts-out/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
||||
"watch": "tsc -w",
|
||||
"start": "npm run build && electron ./ts-out/main.js",
|
||||
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",
|
||||
"package": "npm run build && electron-builder",
|
||||
"packageQuick": "npm run build && electron-builder --dir",
|
||||
"format": "prettier --write src *.json",
|
||||
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
|
||||
"prepare": "git config --local core.hooksPath .hooks/"
|
||||
},
|
||||
"files": [
|
||||
"!*",
|
||||
"assets",
|
||||
"node_modules",
|
||||
"ts-out",
|
||||
"package.json",
|
||||
"LICENSE"
|
||||
],
|
||||
"appId": "com.smartfridge.armcord",
|
||||
"productName": "ArmCord",
|
||||
"mac": {
|
||||
"category": "Network"
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/armcord/armcord.git"
|
||||
},
|
||||
"linux": {
|
||||
"icon": "build/icon.icns",
|
||||
"category": "Network",
|
||||
"maintainer": "smartfridge@vivaldi.net",
|
||||
"target": [
|
||||
"deb",
|
||||
"tar.gz",
|
||||
"rpm",
|
||||
"AppImage"
|
||||
]
|
||||
}
|
||||
},
|
||||
"packageManager": "pnpm@7.13.4"
|
||||
"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": [
|
||||
"!*",
|
||||
"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 {createSettingsWindow} from "./settings/main";
|
||||
import os from "os";
|
||||
import fs from "fs"
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
export function registerIpc() {
|
||||
ipcMain.on("get-app-path", (event, arg) => {
|
||||
|
|
|
@ -52,7 +52,7 @@ app.whenReady().then(async () => {
|
|||
}
|
||||
}
|
||||
await init();
|
||||
await installModLoader()
|
||||
await installModLoader();
|
||||
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
||||
if (permission === "notifications") {
|
||||
// Approves the permissions request
|
||||
|
|
85
src/utils.ts
85
src/utils.ts
|
@ -1,10 +1,10 @@
|
|||
import * as fs from "fs";
|
||||
import {app, dialog, session} from "electron";
|
||||
import path from "path";
|
||||
import fetch from "cross-fetch"
|
||||
import extract from "extract-zip"
|
||||
import util from "util"
|
||||
const streamPipeline = util.promisify(require('stream').pipeline)
|
||||
import fetch from "cross-fetch";
|
||||
import extract from "extract-zip";
|
||||
import util from "util";
|
||||
const streamPipeline = util.promisify(require("stream").pipeline);
|
||||
export var firstRun: boolean;
|
||||
export var contentPath: string;
|
||||
export var transparency: boolean;
|
||||
|
@ -77,7 +77,6 @@ export function getDisplayVersion() {
|
|||
}
|
||||
}
|
||||
export async function injectJS(inject: string) {
|
||||
|
||||
const js = await (await fetch(`${inject}`)).text();
|
||||
|
||||
const el = document.createElement("script");
|
||||
|
@ -125,7 +124,7 @@ export async function injectElectronFlags() {
|
|||
console.log("No performance modes set");
|
||||
}
|
||||
if ((await getConfig("windowStyle")) == "transparent" && process.platform === "win32") {
|
||||
import("@pyke/vibe").then(vibe => {
|
||||
import("@pyke/vibe").then((vibe) => {
|
||||
console.log("Transparent mode enabled");
|
||||
vibe.setup(app);
|
||||
transparency = true;
|
||||
|
@ -287,65 +286,65 @@ export async function checkIfConfigExists() {
|
|||
// Mods
|
||||
async function updateModBundle() {
|
||||
try {
|
||||
console.log("Downloading mod bundle")
|
||||
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
||||
while (!fs.existsSync(distFolder)){
|
||||
//waiting
|
||||
console.log("Downloading mod bundle");
|
||||
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
||||
while (!fs.existsSync(distFolder)) {
|
||||
//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 async function installModLoader() {
|
||||
if (await getConfig("mods") == "none") {
|
||||
modInstallState = "none"
|
||||
if ((await getConfig("mods")) == "none") {
|
||||
modInstallState = "none";
|
||||
import("./extensions/plugin");
|
||||
console.log("[Mod loader] Skipping")
|
||||
console.log("[Mod loader] Skipping");
|
||||
} else {
|
||||
const pluginFolder = app.getPath("userData") + "/plugins/";
|
||||
if (!fs.existsSync(pluginFolder + "loader")) {
|
||||
try {
|
||||
modInstallState = "installing"
|
||||
modInstallState = "installing";
|
||||
var zipPath = app.getPath("temp") + "/" + "loader.zip";
|
||||
if (!fs.existsSync(pluginFolder)) {
|
||||
fs.mkdirSync(pluginFolder);
|
||||
console.log("[Mod loader] Created missing plugin folder");
|
||||
}
|
||||
var loaderZip = await fetch("https://armcord.xyz/loader.zip")
|
||||
if (!loaderZip.ok) throw new Error(`unexpected response ${loaderZip.statusText}`)
|
||||
await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath))
|
||||
await extract(zipPath, { dir: path.join(app.getPath("userData"), "plugins") })
|
||||
modInstallState = "modDownload"
|
||||
updateModBundle()
|
||||
var loaderZip = await fetch("https://armcord.xyz/loader.zip");
|
||||
if (!loaderZip.ok) throw new Error(`unexpected response ${loaderZip.statusText}`);
|
||||
await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath));
|
||||
await extract(zipPath, {dir: path.join(app.getPath("userData"), "plugins")});
|
||||
modInstallState = "modDownload";
|
||||
updateModBundle();
|
||||
import("./extensions/plugin");
|
||||
modInstallState = "done"
|
||||
} catch(e) {
|
||||
console.log("[Mod loader] Failed to install modloader")
|
||||
console.error(e)
|
||||
modInstallState = "done";
|
||||
} catch (e) {
|
||||
console.log("[Mod loader] Failed to install modloader");
|
||||
console.error(e);
|
||||
dialog.showErrorBox(
|
||||
"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."
|
||||
);
|
||||
}
|
||||
} else {
|
||||
modInstallState = "modDownload"
|
||||
updateModBundle()
|
||||
modInstallState = "modDownload";
|
||||
updateModBundle();
|
||||
import("./extensions/plugin");
|
||||
modInstallState = "done"
|
||||
modInstallState = "done";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
setConfig,
|
||||
setLang,
|
||||
setWindowState,
|
||||
transparency,
|
||||
transparency
|
||||
} from "./utils";
|
||||
import {registerIpc} from "./ipc";
|
||||
import {setMenu} from "./menu";
|
||||
|
@ -51,9 +51,9 @@ contextMenu({
|
|||
});
|
||||
async function doAfterDefiningTheWindow() {
|
||||
if (transparency && process.platform === "win32") {
|
||||
import("@pyke/vibe").then(vibe => {
|
||||
import("@pyke/vibe").then((vibe) => {
|
||||
vibe.applyEffect(mainWindow, "acrylic");
|
||||
vibe.forceTheme(mainWindow, 'dark');
|
||||
vibe.forceTheme(mainWindow, "dark");
|
||||
mainWindow.show();
|
||||
});
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ async function doAfterDefiningTheWindow() {
|
|||
}
|
||||
mainWindow.webContents.setWindowOpenHandler(({url}) => {
|
||||
// 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:"))) {
|
||||
shell.openExternal(url);
|
||||
|
@ -206,7 +206,7 @@ async function doAfterDefiningTheWindow() {
|
|||
console.log(contentPath);
|
||||
if ((await getConfig("inviteWebsocket")) == true) {
|
||||
//@ts-ignore
|
||||
import("arrpc")
|
||||
import("arrpc");
|
||||
//await startServer();
|
||||
}
|
||||
if (firstRun) {
|
||||
|
|
|
@ -31,4 +31,4 @@
|
|||
"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).
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue