π Upscayl - #1 Free and Open Source AI Image Upscaler for Linux, MacOS and Windows.
TypeScript aielectronesrgangigapixelgigapixel-imagesimageimage-upscalingtopazupscaleupscalerimageupscayl
Fix build
Nayam Amarshe523d035ecd77
diff --git a/.gitignore b/.gitignoreindex 0d6c31d..74645ea 100644--- a/.gitignore+++ b/.gitignore@@ -16,7 +16,9 @@/renderer/out/# production-/dist+/dist/+/export/electron+/export/common# misc.DS_Storediff --git a/common/feature-flags.ts b/common/feature-flags.tsnew file mode 100644index 0000000..b2466c4--- /dev/null+++ b/common/feature-flags.ts@@ -0,0 +1,7 @@+type FeatureFlags = {+ APP_STORE_BUILD: boolean;+};++export const featureFlags: FeatureFlags = {+ APP_STORE_BUILD: true,+};diff --git a/electron/index.ts b/electron/index.tsindex 1502784..0b7dc60 100644--- a/electron/index.ts+++ b/electron/index.ts@@ -1,7 +1,7 @@import prepareNext from "electron-next";import { autoUpdater } from "electron-updater";import log from "electron-log";-import { app, ipcMain, protocol, net } from "electron";+import { app, ipcMain, protocol } from "electron";import COMMAND from "./constants/commands";import logit from "./utils/logit";import openFolder from "./commands/open-folder";@@ -18,7 +18,7 @@ import batchUpscayl from "./commands/batch-upscayl";import doubleUpscayl from "./commands/double-upscayl";import autoUpdate from "./commands/auto-update";import sharp from "sharp";-import { getPlatform } from "./utils/get-device-specs";+import { featureFlags } from "../common/feature-flags";// INITIALIZATIONlog.initialize({ preload: true });@@ -51,7 +51,8 @@ app.on("window-all-closed", () => {});// ! ENABLE THIS FOR MACOS APP STORE BUILD-if (getPlatform() === "mac") {+if (featureFlags.APP_STORE_BUILD) {+ logit("π APP STORE BUILD ENABLED");app.commandLine.appendSwitch("in-process-gpu");}@@ -73,4 +74,6 @@ ipcMain.on(COMMAND.FOLDER_UPSCAYL, batchUpscayl);ipcMain.on(COMMAND.DOUBLE_UPSCAYL, doubleUpscayl);-// autoUpdater.on("update-downloaded", autoUpdate);+if (!featureFlags.APP_STORE_BUILD) {+ autoUpdater.on("update-downloaded", autoUpdate);+}diff --git a/electron/main-window.ts b/electron/main-window.tsindex 8336adc..65cd1a1 100644--- a/electron/main-window.ts+++ b/electron/main-window.ts@@ -2,23 +2,14 @@ import { BrowserWindow, shell } from "electron";import { getPlatform } from "./utils/get-device-specs";import { join } from "path";import COMMAND from "./constants/commands";-import {- overwrite,- setCustomModelsFolderPath,- setFolderPath,- setImagePath,- setOutputFolderPath,- setOverwrite,- setCompression,- setSaveOutputFolder,- fetchLocalStorage,-} from "./utils/config-variables";+import { fetchLocalStorage } from "./utils/config-variables";import electronIsDev from "electron-is-dev";import { format } from "url";let mainWindow: BrowserWindow | undefined;const createMainWindow = () => {+ console.log("π DIRNAME", __dirname);mainWindow = new BrowserWindow({icon: join(__dirname, "build", "icon.png"),width: 1300,diff --git a/export/build/background.png b/export/build/background.pngnew file mode 100644index 0000000..2a17807Binary files /dev/null and b/export/build/background.png differdiff --git a/export/build/icon.icns b/export/build/icon.icnsnew file mode 100644index 0000000..9cd9699Binary files /dev/null and b/export/build/icon.icns differdiff --git a/main/build/icon.png b/export/build/icon.pngsimilarity index 100%rename from main/build/icon.pngrename to export/build/icon.pngdiff --git a/main/build/icon.icns b/main/build/icon.icnsdeleted file mode 100644index e89f9e8..0000000Binary files a/main/build/icon.icns and /dev/null differdiff --git a/main/utils/listener/customModelsSelect.js b/main/utils/listener/customModelsSelect.jsdeleted file mode 100644index ae9290a..0000000--- a/main/utils/listener/customModelsSelect.js+++ /dev/null@@ -1,48 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-function default_1({ mainWindow, customModelsFolderPath, logit, slash, getModels, }) {- electron_1.ipcMain.handle(commands_1.default.SELECT_CUSTOM_MODEL_FOLDER, (event, message) => __awaiter(this, void 0, void 0, function* () {- const { canceled, filePaths: folderPaths } = yield electron_1.dialog.showOpenDialog({- properties: ["openDirectory"],- title: "Select Custom Models Folder",- defaultPath: customModelsFolderPath,- });- if (canceled) {- logit("π« Select Custom Models Folder Operation Cancelled");- return null;- }- else {- customModelsFolderPath = folderPaths[0];- if (!folderPaths[0].endsWith(slash + "models") &&- !folderPaths[0].endsWith(slash + "models" + slash)) {- logit("β Invalid Custom Models Folder Detected: Not a 'models' folder");- const options = {- type: "error",- title: "Invalid Folder",- message: "Please make sure that the folder name is 'models' and nothing else.",- buttons: ["OK"],- };- electron_1.dialog.showMessageBoxSync(options);- return null;- }- mainWindow.webContents.send(commands_1.default.CUSTOM_MODEL_FILES_LIST, getModels(customModelsFolderPath));- logit("π Custom Folder Path: ", customModelsFolderPath);- return customModelsFolderPath;- }- }));-}-exports.default = default_1;diff --git a/main/utils/listener/doubleUpscayl.js b/main/utils/listener/doubleUpscayl.jsdeleted file mode 100644index 3af7ba9..0000000--- a/main/utils/listener/doubleUpscayl.js+++ /dev/null@@ -1,139 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-const path_1 = require("path");-const upscayl_1 = require("../../upscayl");-const getArguments_1 = require("../getArguments");-const jimp_1 = __importDefault(require("jimp"));-function default_1({ mainWindow, slash, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, quality, defaultModels, }) {- electron_1.ipcMain.on(commands_1.default.DOUBLE_UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {- const model = payload.model;- let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");- let outputDir = payload.outputPath;- if (saveOutputFolder === true && outputFolderPath) {- outputDir = outputFolderPath;- }- const gpuId = payload.gpuId;- const saveImageAs = payload.saveImageAs;- const isDefaultModel = defaultModels.includes(model);- // COPY IMAGE TO TMP FOLDER- const fullfileName = payload.imagePath.split(slash).slice(-1)[0];- const fileName = (0, path_1.parse)(fullfileName).name;- const outFile = outputDir +- slash +- fileName +- "_upscayl_16x_" +- model +- "." +- saveImageAs;- let scale = "4";- if (model.includes("x2")) {- scale = "2";- }- else if (model.includes("x3")) {- scale = "3";- }- else {- scale = "4";- }- // UPSCALE- let upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleArguments)(inputDir, fullfileName, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);- childProcesses.push(upscayl);- stopped = false;- let failed = false;- let isAlpha = false;- let failed2 = false;- const onData = (data) => {- // CONVERT DATA TO STRING- data = data.toString();- // SEND UPSCAYL PROGRESS TO RENDERER- mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);- // IF PROGRESS HAS ERROR, UPSCAYL FAILED- if (data.includes("invalid gpu") || data.includes("failed")) {- failed = true;- }- if (data.includes("has alpha channel")) {- isAlpha = true;- }- };- const onError = (data) => {- data.toString();- // SEND UPSCAYL PROGRESS TO RENDERER- mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);- // SET FAILED TO TRUE- failed = true;- return;- };- const onData2 = (data) => {- // CONVERT DATA TO STRING- data = data.toString();- // SEND UPSCAYL PROGRESS TO RENDERER- mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);- // IF PROGRESS HAS ERROR, UPSCAYL FAILED- if (data.includes("invalid gpu") || data.includes("failed")) {- failed2 = true;- }- };- const onError2 = (data) => {- data.toString();- // SEND UPSCAYL PROGRESS TO RENDERER- mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_PROGRESS, data);- // SET FAILED TO TRUE- failed2 = true;- return;- };- const onClose2 = (code) => __awaiter(this, void 0, void 0, function* () {- if (!failed2 && !stopped) {- logit("π― Done upscaling");- logit("β» Scaling and converting now...");- const originalImage = yield jimp_1.default.read(inputDir + slash + fullfileName);- try {- const newImage = yield jimp_1.default.read(isAlpha ? outFile + ".png" : outFile);- try {- newImage- .scaleToFit(originalImage.getWidth() * parseInt(payload.scale), originalImage.getHeight() * parseInt(payload.scale))- .quality(100 - quality)- .write(isAlpha ? outFile + ".png" : outFile);- mainWindow.setProgressBar(-1);- mainWindow.webContents.send(commands_1.default.DOUBLE_UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);- }- catch (error) {- logit("β Error converting to PNG: ", error);- onError(error);- }- }- catch (error) {- logit("β Error reading original image metadata", error);- onError(error);- }- }- });- upscayl.process.stderr.on("data", onData);- upscayl.process.on("error", onError);- upscayl.process.on("close", (code) => {- // IF NOT FAILED- if (!failed && !stopped) {- // UPSCALE- let upscayl2 = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getDoubleUpscaleSecondPassArguments)(isAlpha, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);- childProcesses.push(upscayl2);- upscayl2.process.stderr.on("data", onData2);- upscayl2.process.on("error", onError2);- upscayl2.process.on("close", onClose2);- }- });- }));-}-exports.default = default_1;diff --git a/main/utils/listener/folderUpscayl.js b/main/utils/listener/folderUpscayl.jsdeleted file mode 100644index e421037..0000000--- a/main/utils/listener/folderUpscayl.js+++ /dev/null@@ -1,72 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-const upscayl_1 = require("../../upscayl");-const getArguments_1 = require("../getArguments");-const fs_1 = __importDefault(require("fs"));-function default_1({ mainWindow, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, defaultModels, }) {- electron_1.ipcMain.on(commands_1.default.FOLDER_UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {- // GET THE MODEL- const model = payload.model;- const gpuId = payload.gpuId;- const saveImageAs = payload.saveImageAs;- const scale = payload.scale;- // GET THE IMAGE DIRECTORY- let inputDir = payload.batchFolderPath;- // GET THE OUTPUT DIRECTORY- let outputDir = payload.outputPath;- if (saveOutputFolder === true && outputFolderPath) {- outputDir = outputFolderPath;- }- if (!fs_1.default.existsSync(outputDir)) {- fs_1.default.mkdirSync(outputDir, { recursive: true });- }- const isDefaultModel = defaultModels.includes(model);- // UPSCALE- const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getBatchArguments)(inputDir, outputDir, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, gpuId, saveImageAs, scale), logit);- childProcesses.push(upscayl);- stopped = false;- let failed = false;- const onData = (data) => {- data = data.toString();- mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());- if (data.includes("invalid gpu") || data.includes("failed")) {- logit("β INVALID GPU OR INVALID FILES IN FOLDER - FAILED");- failed = true;- upscayl.kill();- }- };- const onError = (data) => {- mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_PROGRESS, data.toString());- failed = true;- upscayl.kill();- return;- };- const onClose = () => {- if (!failed && !stopped) {- logit("π― Done upscaling");- mainWindow.webContents.send(commands_1.default.FOLDER_UPSCAYL_DONE, outputDir);- }- else {- upscayl.kill();- }- };- upscayl.process.stderr.on("data", onData);- upscayl.process.on("error", onError);- upscayl.process.on("close", onClose);- }));-}-exports.default = default_1;diff --git a/main/utils/listener/getModelsList.js b/main/utils/listener/getModelsList.jsdeleted file mode 100644index c09a604..0000000--- a/main/utils/listener/getModelsList.js+++ /dev/null@@ -1,26 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-function default_1({ mainWindow, customModelsFolderPath, logit, getModels, }) {- electron_1.ipcMain.on(commands_1.default.GET_MODELS_LIST, (event, payload) => __awaiter(this, void 0, void 0, function* () {- if (payload) {- customModelsFolderPath = payload;- logit("π Custom Models Folder Path: ", customModelsFolderPath);- mainWindow.webContents.send(commands_1.default.CUSTOM_MODEL_FILES_LIST, getModels(payload));- }- }));-}-exports.default = default_1;diff --git a/main/utils/listener/imageUpscayl.js b/main/utils/listener/imageUpscayl.jsdeleted file mode 100644index 8df33e9..0000000--- a/main/utils/listener/imageUpscayl.js+++ /dev/null@@ -1,118 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-const path_1 = require("path");-const upscayl_1 = require("../../upscayl");-const jimp_1 = __importDefault(require("jimp"));-const getArguments_1 = require("../getArguments");-const fs_1 = __importDefault(require("fs"));-function default_1({ mainWindow, slash, logit, childProcesses, stopped, modelsPath, customModelsFolderPath, saveOutputFolder, outputFolderPath, quality, defaultModels, folderPath, }) {- electron_1.ipcMain.on(commands_1.default.UPSCAYL, (event, payload) => __awaiter(this, void 0, void 0, function* () {- const model = payload.model;- const gpuId = payload.gpuId;- const saveImageAs = payload.saveImageAs;- let inputDir = (payload.imagePath.match(/(.*)[\/\\]/)[1] || "");- let outputDir = folderPath || payload.outputPath;- if (saveOutputFolder === true && outputFolderPath) {- outputDir = outputFolderPath;- }- const isDefaultModel = defaultModels.includes(model);- const fullfileName = payload.imagePath.replace(/^.*[\\\/]/, "");- const fileName = (0, path_1.parse)(fullfileName).name;- const fileExt = (0, path_1.parse)(fullfileName).ext;- let scale = "4";- if (model.includes("x2")) {- scale = "2";- }- else if (model.includes("x3")) {- scale = "3";- }- else {- scale = "4";- }- const outFile = outputDir +- slash +- fileName +- "_upscayl_" +- payload.scale +- "x_" +- model +- "." +- saveImageAs;- // UPSCALE- if (fs_1.default.existsSync(outFile)) {- // If already upscayled, just output that file- logit("β Already upscayled at: ", outFile);- mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, outFile);- }- else {- const upscayl = (0, upscayl_1.spawnUpscayl)("realesrgan", (0, getArguments_1.getSingleImageArguments)(inputDir, fullfileName, outFile, isDefaultModel ? modelsPath : customModelsFolderPath !== null && customModelsFolderPath !== void 0 ? customModelsFolderPath : modelsPath, model, scale, gpuId, saveImageAs), logit);- childProcesses.push(upscayl);- stopped = false;- let isAlpha = false;- let failed = false;- const onData = (data) => {- logit("image upscayl: ", data.toString());- mainWindow.setProgressBar(parseFloat(data.slice(0, data.length)) / 100);- data = data.toString();- mainWindow.webContents.send(commands_1.default.UPSCAYL_PROGRESS, data.toString());- if (data.includes("invalid gpu") || data.includes("failed")) {- logit("β INVALID GPU OR FAILED");- failed = true;- }- if (data.includes("has alpha channel")) {- logit("π’ INCLUDES ALPHA CHANNEL, CHANGING OUTFILE NAME!");- isAlpha = true;- }- };- const onError = (data) => {- mainWindow.webContents.send(commands_1.default.UPSCAYL_PROGRESS, data.toString());- failed = true;- return;- };- const onClose = () => __awaiter(this, void 0, void 0, function* () {- if (!failed && !stopped) {- logit("π― Done upscaling");- logit("β» Scaling and converting now...");- const originalImage = yield jimp_1.default.read(inputDir + slash + fullfileName);- try {- const newImage = yield jimp_1.default.read(isAlpha ? outFile + ".png" : outFile);- try {- newImage- .scaleToFit(originalImage.getWidth() * parseInt(payload.scale), originalImage.getHeight() * parseInt(payload.scale))- .quality(100 - quality)- .write(isAlpha ? outFile + ".png" : outFile);- mainWindow.setProgressBar(-1);- mainWindow.webContents.send(commands_1.default.UPSCAYL_DONE, isAlpha ? outFile + ".png" : outFile);- }- catch (error) {- logit("β Error converting to PNG: ", error);- onError(error);- }- }- catch (error) {- logit("β Error reading original image metadata", error);- onError(error);- }- }- });- upscayl.process.stderr.on("data", onData);- upscayl.process.on("error", onError);- upscayl.process.on("close", onClose);- }- }));-}-exports.default = default_1;diff --git a/main/utils/listener/selectFile.js b/main/utils/listener/selectFile.jsdeleted file mode 100644index 1fcc9d5..0000000--- a/main/utils/listener/selectFile.js+++ /dev/null@@ -1,61 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-function default_1({ mainWindow, imagePath, logit }) {- return electron_1.ipcMain.handle(commands_1.default.SELECT_FILE, () => __awaiter(this, void 0, void 0, function* () {- const { canceled, filePaths } = yield electron_1.dialog.showOpenDialog({- properties: ["openFile", "multiSelections"],- title: "Select Image",- defaultPath: imagePath,- });- if (canceled) {- logit("π« File Operation Cancelled");- return null;- }- else {- imagePath = filePaths[0];- let isValid = false;- // READ SELECTED FILES- filePaths.forEach((file) => {- // log.log("Files in Folder: ", file);- if (file.endsWith(".png") ||- file.endsWith(".jpg") ||- file.endsWith(".jpeg") ||- file.endsWith(".webp") ||- file.endsWith(".JPG") ||- file.endsWith(".PNG") ||- file.endsWith(".JPEG") ||- file.endsWith(".WEBP")) {- isValid = true;- }- });- if (!isValid) {- logit("β Invalid File Detected");- const options = {- type: "error",- title: "Invalid File",- message: "The selected file is not a valid image. Make sure you select a '.png', '.jpg', or '.webp' file.",- };- electron_1.dialog.showMessageBoxSync(mainWindow, options);- return null;- }- logit("π Selected File Path: ", filePaths[0]);- // CREATE input AND upscaled FOLDER- return filePaths[0];- }- }));-}-exports.default = default_1;diff --git a/main/utils/listener/selectFolder.js b/main/utils/listener/selectFolder.jsdeleted file mode 100644index 407a130..0000000--- a/main/utils/listener/selectFolder.js+++ /dev/null@@ -1,34 +0,0 @@-"use strict";-var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }- return new (P || (P = Promise))(function (resolve, reject) {- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }- step((generator = generator.apply(thisArg, _arguments || [])).next());- });-};-var __importDefault = (this && this.__importDefault) || function (mod) {- return (mod && mod.__esModule) ? mod : { "default": mod };-};-Object.defineProperty(exports, "__esModule", { value: true });-const electron_1 = require("electron");-const commands_1 = __importDefault(require("../../commands"));-function default_1({ folderPath, logit }) {- electron_1.ipcMain.handle(commands_1.default.SELECT_FOLDER, (event, message) => __awaiter(this, void 0, void 0, function* () {- const { canceled, filePaths: folderPaths } = yield electron_1.dialog.showOpenDialog({- properties: ["openDirectory"],- defaultPath: folderPath,- });- if (canceled) {- logit("π« Select Folder Operation Cancelled");- return null;- }- else {- folderPath = folderPaths[0];- logit("π Selected Folder Path: ", folderPath);- return folderPaths[0];- }- }));-}-exports.default = default_1;diff --git a/next.config.js b/next.config.jsindex 4ce82dc..cc99621 100644--- a/next.config.js+++ b/next.config.js@@ -6,6 +6,9 @@ const nextConfig = {images: {unoptimized: true,},+ experimental: {+ externalDir: true,+ },};module.exports = nextConfig;diff --git a/package.json b/package.jsonindex cfa00ef..0d354d0 100644--- a/package.json+++ b/package.json@@ -29,7 +29,7 @@"KDE","Gnome"],- "main": "main/index.js",+ "main": "export/electron/index.js","scripts": {"clean": "rimraf dist renderer/.next renderer/out","start": "tsc && electron .",@@ -180,7 +180,7 @@"target": ["nsis"],- "icon": "main/build/icon.png"+ "icon": "build/icon.png"},"nsis": {"allowToChangeInstallationDirectory": true,@@ -189,7 +189,7 @@"perMachine": true},"files": [- "main",+ "export","renderer/out"]},diff --git a/renderer/components/settings-tab/index.tsx b/renderer/components/settings-tab/index.tsxindex 452477f..5e1ce1c 100644--- a/renderer/components/settings-tab/index.tsx+++ b/renderer/components/settings-tab/index.tsx@@ -21,7 +21,7 @@ import OverwriteToggle from "./OverwriteToggle";import { UpscaylCloudModal } from "../UpscaylCloudModal";import { ResetSettings } from "./ResetSettings";import ProcessImageToggle from "./ProcessImageToggle";-import { FLAGS } from "@/utils/flags";+import { featureFlags } from "@common/feature-flags";interface IProps {batchMode: boolean;@@ -190,7 +190,7 @@ function SettingsTab({target="_blank">Read Wiki Guide</a>- {!FLAGS.APP_STORE_BUILD && <DonateButton />}+ {!featureFlags.APP_STORE_BUILD && <DonateButton />}</div><LogAreadiff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsxindex 064a62f..b7bf9cf 100644--- a/renderer/pages/index.tsx+++ b/renderer/pages/index.tsx@@ -20,7 +20,7 @@ import {} from "../atoms/userSettingsAtom";import useLog from "../components/hooks/useLog";import { UpscaylCloudModal } from "../components/UpscaylCloudModal";-import { FLAGS } from "@/utils/flags";+import { featureFlags } from "@common/feature-flags";const Home = () => {// STATES@@ -505,7 +505,7 @@ const Home = () => {)}{/* HEADER */}<Header version={version} />- {!dontShowCloudModal && !FLAGS.APP_STORE_BUILD && (+ {!dontShowCloudModal && !featureFlags.APP_STORE_BUILD && (<buttonclassName="mb-5 rounded-btn p-1 mx-5 bg-success shadow-lg shadow-success/40 text-slate-50 animate-pulse text-sm"onClick={() => {diff --git a/renderer/tsconfig.json b/renderer/tsconfig.jsonindex 2edf7be..0b3a9ce 100644--- a/renderer/tsconfig.json+++ b/renderer/tsconfig.json@@ -19,6 +19,12 @@"@common/*": ["../common/*"]}},- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "../app.module.ts"],+ "include": [+ "next-env.d.ts",+ "**/*.ts",+ "**/*.tsx",+ "../app.module.ts",+ "../common/**/*"+ ],"exclude": ["node_modules"]}diff --git a/renderer/utils/flags.ts b/renderer/utils/flags.tsdeleted file mode 100644index ffd630e..0000000--- a/renderer/utils/flags.ts+++ /dev/null@@ -1,3 +0,0 @@-export const FLAGS = {- APP_STORE_BUILD: true,-};diff --git a/tsconfig.json b/tsconfig.jsonindex c0e89d3..2fd5e61 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -1,107 +1,15 @@{"compilerOptions": {- /* Visit https://aka.ms/tsconfig to read more about this file */-- /* Projects */- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */-- /* Language and Environment */- "target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */- "jsx": "preserve" /* Specify what JSX code is generated. */,- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */-- /* Modules */- "module": "commonjs" /* Specify what module code is generated. */,- "rootDir": "./electron" /* Specify the root folder within your source files. */,- // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */- "rootDirs": [- "./electron",- "./renderer"- ] /* Allow multiple folders to be treated as one when resolving modules. */,- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */- // "types": [], /* Specify type package names to be included without being referenced in a source file. */- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */- // "resolveJsonModule": true, /* Enable importing .json files. */- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */-- /* JavaScript Support */- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */-- /* Emit */- // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */- // "declarationMap": true, /* Create sourcemaps for d.ts files. */- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */- "outDir": "./main" /* Specify an output folder for all emitted files. */,- // "removeComments": true, /* Disable emitting comments. */- // "noEmit": true, /* Disable emitting files from a compilation. */- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */- // "newLine": "crlf", /* Set the newline character for emitting files. */- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */-- /* Interop Constraints */- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,-- /* Type Checking */- "strict": true /* Enable all strict type-checking options. */,- "noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */,- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */-- /* Completeness */- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */- "skipLibCheck": true /* Skip type checking all .d.ts files. */+ "target": "es2016",+ "module": "commonjs",+ "rootDir": "./",+ "outDir": "./export",+ "esModuleInterop": true,+ "forceConsistentCasingInFileNames": true,+ "strict": true,+ "noImplicitAny": false,+ "skipLibCheck": true},+ "include": ["./electron/**/*", "./common/**/*"],"exclude": ["node_modules", "public", "renderer"]}