1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-12 09:03:00 +01:00

Fix empty window

This commit is contained in:
Nayam Amarshe 2023-09-13 18:44:46 +05:30
parent c952a330cc
commit 00ce2772db
3 changed files with 22 additions and 14 deletions

View File

@ -24,21 +24,24 @@ log.initialize({ preload: true });
sharp.cache(false); sharp.cache(false);
logit("🚃 App Path: ", app.getAppPath()); logit("🚃 App Path: ", app.getAppPath());
app.whenReady().then(async () => { app.on("ready", async () => {
await prepareNext("./renderer"); await prepareNext("./renderer");
createMainWindow();
log.info("🚀 UPSCAYL EXEC PATH: ", execPath("realesrgan")); app.whenReady().then(() => {
log.info("🚀 MODELS PATH: ", modelsPath); protocol.registerFileProtocol("file", (request, callback) => {
const pathname = decodeURI(request.url.replace("file:///", ""));
protocol.handle("file:", (request) => { callback(pathname);
const pathname = decodeURI(request.url);
return net.fetch(pathname);
}); });
});
createMainWindow();
if (!electronIsDev) { if (!electronIsDev) {
autoUpdater.checkForUpdates(); autoUpdater.checkForUpdates();
} }
log.info("🚀 UPSCAYL EXEC PATH: ", execPath("realesrgan"));
log.info("🚀 MODELS PATH: ", modelsPath);
}); });
// Quit the app once all windows are closed // Quit the app once all windows are closed

View File

@ -13,8 +13,9 @@ import {
setSaveOutputFolder, setSaveOutputFolder,
} from "./utils/config-variables"; } from "./utils/config-variables";
import electronIsDev from "electron-is-dev"; import electronIsDev from "electron-is-dev";
import { format } from "url";
let mainWindow: BrowserWindow | null; let mainWindow: BrowserWindow | undefined;
const createMainWindow = () => { const createMainWindow = () => {
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
@ -36,10 +37,12 @@ const createMainWindow = () => {
const url = electronIsDev const url = electronIsDev
? "http://localhost:8000" ? "http://localhost:8000"
: (new URL("file:///").pathname = join( : format({
__dirname, pathname: join(__dirname, "../renderer/out/index.html"),
"../renderer/out/index.html" protocol: "file:",
)).toString(); slashes: true,
});
mainWindow.loadURL(url); mainWindow.loadURL(url);
mainWindow.webContents.setWindowOpenHandler(({ url }) => { mainWindow.webContents.setWindowOpenHandler(({ url }) => {

View File

@ -50,7 +50,8 @@
"publish-linux-app": "tsc && npm run build && electron-builder -l --publish always", "publish-linux-app": "tsc && npm run build && electron-builder -l --publish always",
"publish-win-app": "tsc && npm run build && electron-builder -w --publish always", "publish-win-app": "tsc && npm run build && electron-builder -w --publish always",
"publish-mac-universal-app": "tsc && npm run build && electron-builder --mac --universal --publish always", "publish-mac-universal-app": "tsc && npm run build && electron-builder --mac --universal --publish always",
"publish-mac-app": "tsc && npm run build && electron-builder --mac --x64 --publish always" "publish-mac-app": "tsc && npm run build && electron-builder --mac --x64 --publish always",
"publish-mac-arm-app": "tsc && npm run build && electron-builder --mac --arm64 --publish always"
}, },
"build": { "build": {
"productName": "Upscayl", "productName": "Upscayl",
@ -99,6 +100,7 @@
"entitlementsInherit": "resources/entitlements.mac.plist", "entitlementsInherit": "resources/entitlements.mac.plist",
"notarize": false, "notarize": false,
"gatekeeperAssess": false, "gatekeeperAssess": false,
"mergeASARs": false,
"target": [ "target": [
{ {
"target": "dmg", "target": "dmg",