mirror of
https://github.com/imgfloat/client.git
synced 2026-02-05 03:59:26 +00:00
Rename domain var
This commit is contained in:
13
src/main.js
13
src/main.js
@@ -9,6 +9,8 @@ const INITIAL_WINDOW_WIDTH_PX = 960;
|
|||||||
const INITIAL_WINDOW_HEIGHT_PX = 640;
|
const INITIAL_WINDOW_HEIGHT_PX = 640;
|
||||||
const LOCAL_DOMAIN = "http://localhost:8080";
|
const LOCAL_DOMAIN = "http://localhost:8080";
|
||||||
const DEFAULT_DOMAIN = "https://imgfloat.kruhlmann.dev";
|
const DEFAULT_DOMAIN = "https://imgfloat.kruhlmann.dev";
|
||||||
|
const RUNTIME_DOMAIN = resolveDefaultDomain();
|
||||||
|
let ELECTRON_WINDOW;
|
||||||
|
|
||||||
function normalizeDomain(domain) {
|
function normalizeDomain(domain) {
|
||||||
return domain?.trim()?.replace(/\/+$/, "");
|
return domain?.trim()?.replace(/\/+$/, "");
|
||||||
@@ -22,10 +24,6 @@ function resolveDefaultDomain() {
|
|||||||
return normalizeDomain(buildTimeDomain);
|
return normalizeDomain(buildTimeDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
const runtimeDefaultDomain = resolveDefaultDomain();
|
|
||||||
|
|
||||||
let ELECTRON_WINDOW;
|
|
||||||
|
|
||||||
function createWindowOptionsForPlatform(platform) {
|
function createWindowOptionsForPlatform(platform) {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case "darwin":
|
case "darwin":
|
||||||
@@ -66,6 +64,9 @@ function createWindow(version) {
|
|||||||
const windowOptions = createWindowOptionsForPlatform(process.platform);
|
const windowOptions = createWindowOptionsForPlatform(process.platform);
|
||||||
const win = new BrowserWindow(windowOptions);
|
const win = new BrowserWindow(windowOptions);
|
||||||
win.setMenu(null);
|
win.setMenu(null);
|
||||||
|
win.setFullScreenable(false)
|
||||||
|
win.setFullScreen(false)
|
||||||
|
win.setResizable(false)
|
||||||
win.setTitle(`Imgfloat Client v${version}`);
|
win.setTitle(`Imgfloat Client v${version}`);
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
@@ -96,10 +97,10 @@ ipcMain.handle("save-domain", (_, domain) => {
|
|||||||
|
|
||||||
ipcMain.handle("load-domain", () => {
|
ipcMain.handle("load-domain", () => {
|
||||||
const store = readStore(STORE_PATH);
|
const store = readStore(STORE_PATH);
|
||||||
return normalizeDomain(store.lastDomain) || runtimeDefaultDomain;
|
return normalizeDomain(store.lastDomain) || RUNTIME_DOMAIN;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("load-default-domain", () => runtimeDefaultDomain);
|
ipcMain.handle("load-default-domain", () => RUNTIME_DOMAIN);
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
if (process.env.CI) {
|
if (process.env.CI) {
|
||||||
|
|||||||
Reference in New Issue
Block a user