mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Move away from using webpack for gettign lang
This commit is contained in:
parent
4613f77f30
commit
7b25fc70c9
3 changed files with 5 additions and 6 deletions
|
@ -7,6 +7,7 @@
|
||||||
"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",
|
||||||
"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/**/*",
|
||||||
|
|
|
@ -15,7 +15,6 @@ contextBridge.exposeInMainWorld("armcord", {
|
||||||
},
|
},
|
||||||
electron: process.versions.electron,
|
electron: process.versions.electron,
|
||||||
channel: ipcRenderer.sendSync("channel"),
|
channel: ipcRenderer.sendSync("channel"),
|
||||||
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
|
||||||
setPingCount: (pingCount: number) => ipcRenderer.send("setPing", pingCount),
|
setPingCount: (pingCount: number) => ipcRenderer.send("setPing", pingCount),
|
||||||
setTrayIcon: (favicon: string) => ipcRenderer.send("sendTrayIcon", favicon),
|
setTrayIcon: (favicon: string) => ipcRenderer.send("sendTrayIcon", favicon),
|
||||||
getLang: (toGet: string) =>
|
getLang: (toGet: string) =>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "./patch";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import {injectHummusTitlebar, injectTitlebar} from "./titlebar";
|
import {injectHummusTitlebar, injectTitlebar} from "./titlebar";
|
||||||
import {sleep, addStyle, injectJS, addScript} from "../utils";
|
import {sleep, addStyle, injectJS} from "../utils";
|
||||||
import {ipcRenderer} from "electron";
|
import {ipcRenderer} from "electron";
|
||||||
import {injectMobileStuff} from "./mobile";
|
import {injectMobileStuff} from "./mobile";
|
||||||
var version = ipcRenderer.sendSync("displayVersion");
|
var version = ipcRenderer.sendSync("displayVersion");
|
||||||
|
@ -13,10 +13,9 @@ async function updateLang() {
|
||||||
if (window.location.href.indexOf("setup.html") > -1) {
|
if (window.location.href.indexOf("setup.html") > -1) {
|
||||||
console.log("Setup, skipping lang update");
|
console.log("Setup, skipping lang update");
|
||||||
} else {
|
} else {
|
||||||
// addScript(`function getDiscordLang() {
|
const value = `; ${document.cookie}`;
|
||||||
// {const _w=webpackChunkdiscord_app;let lang;_w.push([[Symbol()],{},e=>{for(const k in e.c){const m=e.c[k].exports;const mDef=m?.default&&m.__esModule?m.default:m;if(mDef?._chosenLocale&&!lang)lang=mDef}}]);_w.pop();window.armcord.setLang(lang._chosenLocale);return lang._chosenLocale;void 0}}
|
const parts: any = value.split(`; locale=`);
|
||||||
// getDiscordLang();`);
|
if (parts.length === 2) ipcRenderer.send("setLang", parts.pop().split(";").shift());
|
||||||
// haha get patched kid
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
declare global {
|
declare global {
|
||||||
|
|
Loading…
Reference in a new issue