mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Compare commits
2 commits
e518c0f04e
...
410c899c84
Author | SHA1 | Date | |
---|---|---|---|
|
410c899c84 | ||
|
fa24b7996f |
5 changed files with 39 additions and 14 deletions
|
@ -7,7 +7,7 @@
|
|||
"no": "Nie",
|
||||
"next": "Dalej",
|
||||
"setup_question4": "Wybierz modyfikację klienta którą chcesz zainstalować:",
|
||||
"setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszą dokumentację.",
|
||||
"setup_question4_clientmodnotice": "Dlaczego nie wszystkie na raz? Posiadanie wielu modyfikacji może spowodować wiele błędów. Jeśli jednak nalegasz możesz sprawdzić naszego Discorda.",
|
||||
"loading_screen_start": "Ładowanie ArmCord…",
|
||||
"loading_screen_offline": "Wydaje nam się, że nie jesteś połączony z Internetem. Połącz się z internetem i spróbuj ponownie.",
|
||||
"setup_question1_answer1": "Ekspresowa konfiguracja",
|
||||
|
@ -24,9 +24,9 @@
|
|||
"settings-theme-default": "Domyślny",
|
||||
"settings-theme-native": "Natywny",
|
||||
"settings-patches": "Automatyczne łatki",
|
||||
"settings-invitewebsocket": "Wsparcie linków discord.gg",
|
||||
"settings-prfmMode": "Performance mode:",
|
||||
"settings-prfmMode-performance": "Performance",
|
||||
"settings-prfmMode-battery": "Battery",
|
||||
"settings-none": "None"
|
||||
"settings-invitewebsocket": "Websocket dla zaproszeń",
|
||||
"settings-prfmMode": "Tryb wydajności:",
|
||||
"settings-prfmMode-performance": "Wydajny",
|
||||
"settings-prfmMode-battery": "Bateria",
|
||||
"settings-none": "Nic/Brak"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//ipc stuff
|
||||
import {app, ipcMain, shell, desktopCapturer} from "electron";
|
||||
import {createTabsGuest, mainWindow} from "./window";
|
||||
import {setConfigBulk, getVersion, getConfig} from "./utils";
|
||||
import {setConfigBulk, getVersion, getConfig, setLang} from "./utils";
|
||||
import {customTitlebar, tabs} from "./main";
|
||||
import {createSettingsWindow} from "./settings/main";
|
||||
export function registerIpc() {
|
||||
|
@ -11,6 +11,9 @@ export function registerIpc() {
|
|||
ipcMain.on("openTab", (event, number: number) => {
|
||||
createTabsGuest(number);
|
||||
});
|
||||
ipcMain.on("setLang", (event, lang: string) => {
|
||||
setLang(lang);
|
||||
});
|
||||
ipcMain.on("open-external-link", (event, href: string) => {
|
||||
shell.openExternal(href);
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@ contextBridge.exposeInMainWorld("armcord", {
|
|||
electron: process.versions.electron,
|
||||
channel: ipcRenderer.sendSync("channel"),
|
||||
openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
|
||||
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
||||
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
||||
getDisplayMediaSelector: getDisplayMediaSelector,
|
||||
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
||||
|
|
|
@ -4,11 +4,15 @@ import "./patch";
|
|||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import {injectTitlebar} from "./titlebar";
|
||||
import {sleep, addStyle, injectJS} from "../utils";
|
||||
import {sleep, addStyle, injectJS, addScript} from "../utils";
|
||||
import {ipcRenderer} from "electron";
|
||||
import {injectTabs} from "./tabs";
|
||||
var version = ipcRenderer.sendSync("get-app-version", "app-version");
|
||||
|
||||
async function updateLang() {
|
||||
addScript(`function getDiscordLang() {
|
||||
{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}}
|
||||
getDiscordLang();`);
|
||||
}
|
||||
declare global {
|
||||
interface Window {
|
||||
armcord: any;
|
||||
|
@ -30,7 +34,7 @@ if (window.location.href.indexOf("splash.html") > -1) {
|
|||
if (ipcRenderer.sendSync("tabs")) {
|
||||
injectTabs();
|
||||
}
|
||||
sleep(5000).then(() => {
|
||||
sleep(5000).then(async () => {
|
||||
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
|
||||
addStyle(fs.readFileSync(cssPath, "utf8"));
|
||||
|
||||
|
@ -38,14 +42,17 @@ if (window.location.href.indexOf("splash.html") > -1) {
|
|||
case "goosemod":
|
||||
injectJS(clientMods.goosemod);
|
||||
console.log("Loading GooseMod...");
|
||||
await updateLang();
|
||||
break;
|
||||
case "cumcord":
|
||||
injectJS(clientMods.cumcord);
|
||||
console.log("Loading Cumcord...");
|
||||
await updateLang();
|
||||
break;
|
||||
case "flicker":
|
||||
injectJS(clientMods.flicker);
|
||||
console.log("Loading FlickerMod...");
|
||||
await updateLang();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
22
src/utils.ts
22
src/utils.ts
|
@ -1,7 +1,7 @@
|
|||
import * as fs from "fs";
|
||||
import {app, dialog} from "electron";
|
||||
import path from "path";
|
||||
import { defaultMaxListeners } from "events";
|
||||
import {defaultMaxListeners} from "events";
|
||||
export var firstRun: boolean;
|
||||
export var isSetup: boolean;
|
||||
export var contentPath: string;
|
||||
|
@ -88,8 +88,8 @@ export async function injectElectronFlags() {
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
const presets = {
|
||||
'performance': `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance
|
||||
'battery': '--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu' // Known to have better battery life for Chromium?
|
||||
performance: `--enable-gpu-rasterization --enable-zero-copy --ignore-gpu-blocklist --enable-hardware-overlays=single-fullscreen,single-on-top,underlay --enable-features=EnableDrDc,CanvasOopRasterization,BackForwardCache:TimeToLiveInBackForwardCacheInSeconds/300/should_ignore_blocklists/true/enable_same_site/true,ThrottleDisplayNoneAndVisibilityHiddenCrossOriginIframes,UseSkiaRenderer,WebAssemblyLazyCompilation --disable-features=Vulkan --force_high_performance_gpu`, // Performance
|
||||
battery: "--enable-features=TurnOffStreamingMediaCachingOnBattery --force_low_power_gpu" // Known to have better battery life for Chromium?
|
||||
};
|
||||
switch (await getConfig("performanceMode")) {
|
||||
case "performance":
|
||||
|
@ -104,6 +104,20 @@ export async function injectElectronFlags() {
|
|||
console.log("No performance modes set");
|
||||
}
|
||||
}
|
||||
export async function setLang(language: string) {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const storagePath = path.join(userDataPath, "/storage/");
|
||||
const langConfigFile = storagePath + "lang.json";
|
||||
if (!fs.existsSync(langConfigFile)) {
|
||||
fs.writeFileSync(langConfigFile, "{}", "utf-8");
|
||||
}
|
||||
let rawdata = fs.readFileSync(langConfigFile, "utf-8");
|
||||
let parsed = JSON.parse(rawdata);
|
||||
parsed["lang"] = language;
|
||||
let toSave = JSON.stringify(parsed);
|
||||
fs.writeFileSync(langConfigFile, toSave, "utf-8");
|
||||
}
|
||||
|
||||
//ArmCord Settings/Storage manager
|
||||
|
||||
export interface Settings {
|
||||
|
@ -113,7 +127,7 @@ export interface Settings {
|
|||
minimizeToTray: boolean;
|
||||
automaticPatches: boolean;
|
||||
mods: string;
|
||||
performanceMode: string,
|
||||
performanceMode: string;
|
||||
blurType: string;
|
||||
inviteWebsocket: boolean;
|
||||
doneSetup: boolean;
|
||||
|
|
Loading…
Reference in a new issue