mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
switch to electron-is-dev
This commit is contained in:
parent
ac1d090ead
commit
9f6a25801f
7 changed files with 17 additions and 6 deletions
|
@ -50,6 +50,7 @@
|
||||||
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24",
|
"arrpc": "github:OpenAsar/arrpc#c62ec6a04c8d870530aa6944257fe745f6c59a24",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"electron-context-menu": "^4.0.0",
|
"electron-context-menu": "^4.0.0",
|
||||||
|
"electron-is-dev": "^3.0.1",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"v8-compile-cache": "^2.4.0",
|
"v8-compile-cache": "^2.4.0",
|
||||||
"ws": "^8.17.0"
|
"ws": "^8.17.0"
|
||||||
|
|
|
@ -17,6 +17,9 @@ importers:
|
||||||
electron-context-menu:
|
electron-context-menu:
|
||||||
specifier: ^4.0.0
|
specifier: ^4.0.0
|
||||||
version: 4.0.0
|
version: 4.0.0
|
||||||
|
electron-is-dev:
|
||||||
|
specifier: ^3.0.1
|
||||||
|
version: 3.0.1
|
||||||
extract-zip:
|
extract-zip:
|
||||||
specifier: ^2.0.1
|
specifier: ^2.0.1
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import {app, dialog} from "electron";
|
import {app, dialog} from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import isDev from "electron-is-dev";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import type {Settings} from "../types/settings.d.js";
|
import type {Settings} from "../types/settings.d.js";
|
||||||
import {getWindowStateLocation} from "./windowState.js";
|
import {getWindowStateLocation} from "./windowState.js";
|
||||||
|
@ -10,7 +11,7 @@ export function checkForDataFolder(): void {
|
||||||
console.log("Found armcord-data folder. Running in portable mode.");
|
console.log("Found armcord-data folder. Running in portable mode.");
|
||||||
app.setPath("userData", dataPath);
|
app.setPath("userData", dataPath);
|
||||||
}
|
}
|
||||||
if (path.join(app.getPath("appData"), "ArmCord")) {
|
if (path.join(app.getPath("appData"), "ArmCord") && !isDev) {
|
||||||
console.log("Found existing ArmCord folder.");
|
console.log("Found existing ArmCord folder.");
|
||||||
app.setPath("userData", path.join(app.getPath("appData"), "ArmCord"));
|
app.setPath("userData", path.join(app.getPath("appData"), "ArmCord"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import {app} from "electron";
|
import {app} from "electron";
|
||||||
|
import isDev from "electron-is-dev";
|
||||||
|
|
||||||
export function getVersion(): string {
|
export function getVersion(): string {
|
||||||
if ((app.getVersion() == process.versions.electron) == true) {
|
if (isDev) {
|
||||||
return "3.3.0";
|
return "0.0.0";
|
||||||
}
|
}
|
||||||
return app.getVersion();
|
return app.getVersion();
|
||||||
}
|
}
|
||||||
export function getDisplayVersion(): string {
|
export function getDisplayVersion(): string {
|
||||||
if ((app.getVersion() == process.versions.electron) == true) {
|
if (isDev) {
|
||||||
return "Dev Build";
|
return "Dev Build";
|
||||||
}
|
}
|
||||||
return app.getVersion();
|
return app.getVersion();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {BrowserWindow} from "electron";
|
import {BrowserWindow, ipcMain} from "electron";
|
||||||
import {iconPath} from "../main.js";
|
import {iconPath} from "../main.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import isDev from "electron-is-dev";
|
||||||
|
|
||||||
export let splashWindow: BrowserWindow;
|
export let splashWindow: BrowserWindow;
|
||||||
export async function createSplashWindow(): Promise<void> {
|
export async function createSplashWindow(): Promise<void> {
|
||||||
|
@ -19,5 +20,8 @@ export async function createSplashWindow(): Promise<void> {
|
||||||
preload: path.join(import.meta.dirname, "preload.mjs")
|
preload: path.join(import.meta.dirname, "preload.mjs")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
ipcMain.on("isDev", (event) => {
|
||||||
|
event.returnValue = isDev;
|
||||||
|
});
|
||||||
await splashWindow.loadFile(path.join(import.meta.dirname, "splash.html"));
|
await splashWindow.loadFile(path.join(import.meta.dirname, "splash.html"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ contextBridge.exposeInMainWorld("internal", {
|
||||||
restart: () => ipcRenderer.send("restart"),
|
restart: () => ipcRenderer.send("restart"),
|
||||||
installState: ipcRenderer.sendSync("modInstallState") as string,
|
installState: ipcRenderer.sendSync("modInstallState") as string,
|
||||||
version: ipcRenderer.sendSync("get-app-version", "app-version") as string,
|
version: ipcRenderer.sendSync("get-app-version", "app-version") as string,
|
||||||
|
isDev: ipcRenderer.sendSync("isDev") as string,
|
||||||
getLang: (toGet: string) =>
|
getLang: (toGet: string) =>
|
||||||
ipcRenderer.invoke("getLang", toGet).then((result: string) => {
|
ipcRenderer.invoke("getLang", toGet).then((result: string) => {
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
window.internal.restart();
|
window.internal.restart();
|
||||||
} else {
|
} else {
|
||||||
text.innerHTML = await internal.getLang("loading_screen_start");
|
text.innerHTML = await internal.getLang("loading_screen_start");
|
||||||
if (window.internal.version === "3.3.0") {
|
if (internal.isDev) {
|
||||||
console.log("Running a development build of ArmCord. Skipping updater.");
|
console.log("Running a development build of ArmCord. Skipping updater.");
|
||||||
} else {
|
} else {
|
||||||
const response = await fetch("https://armcord.app/latest.json");
|
const response = await fetch("https://armcord.app/latest.json");
|
||||||
|
|
Loading…
Reference in a new issue