From 5f8704480b114dee9e122df82cb465858e0b3e8b Mon Sep 17 00:00:00 2001 From: Suvojit Ghosh Date: Mon, 22 Aug 2022 14:01:16 +0530 Subject: [PATCH] temporary fix (messy) --- main/binaries.js | 5 +---- main/commands.js | 9 +++++++++ main/index.js | 2 +- main/models.js | 0 next.config.js | 7 +++++++ package.json | 14 ++++++-------- renderer/pages/index.jsx | 8 ++++++-- 7 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 main/commands.js create mode 100644 main/models.js create mode 100644 next.config.js diff --git a/main/binaries.js b/main/binaries.js index 92c9e79..fdade09 100644 --- a/main/binaries.js +++ b/main/binaries.js @@ -5,10 +5,7 @@ const { getPlatform } = require("./getPlatform"); const IS_PROD = process.env.NODE_ENV === "production"; -const binariesPath = - IS_PROD && isPackaged // the path to a bundled electron app. - ? path.join(rootPath, "./Contents", "./Resources", "./bin") - : path.join(rootPath, "./resources", getPlatform(), "./bin"); +const binariesPath = path.join("./resources", getPlatform(), "./bin"); const execPath = path.resolve(path.join(binariesPath, "./upscayl")); const modelsPath = path.resolve(path.join(binariesPath, "./models")); diff --git a/main/commands.js b/main/commands.js new file mode 100644 index 0000000..49b87e5 --- /dev/null +++ b/main/commands.js @@ -0,0 +1,9 @@ +const commands = { + SELECT_FILE: "Select a File", + SELECT_FOLDER: "Select a Folder", + UPSCAYL: "Upscale the Image", + UPSCAYL_DONE: "Upscaling Done", + UPSCAYL_PROGRESS: "Send Progress from Main to Renderer", +}; + +module.exports = commands; diff --git a/main/index.js b/main/index.js index 9b32550..313b495 100644 --- a/main/index.js +++ b/main/index.js @@ -19,7 +19,7 @@ const { } = require("electron"); const isDev = require("electron-is-dev"); const prepareNext = require("electron-next"); -const commands = require("../constants/commands"); +const commands = require("./commands"); const sharp = require("sharp"); // Prepare the renderer once the app is ready diff --git a/main/models.js b/main/models.js new file mode 100644 index 0000000..e69de29 diff --git a/next.config.js b/next.config.js new file mode 100644 index 0000000..63618cd --- /dev/null +++ b/next.config.js @@ -0,0 +1,7 @@ +module.exports = { + experimental: { + images: { + unoptimized: true + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index 3e26e81..3b407df 100644 --- a/package.json +++ b/package.json @@ -26,16 +26,11 @@ "appId": "com.tgs963.upscayl", "asar": true, "extraFiles": [ - { - "from": "resources/linux/bin", - "to": "Resources/bin", - "filter": [ - "**/*" - ] - } + "constants", + "resources" ], "linux": { - "publish":[ + "publish": [ "github" ], "target": [ @@ -44,6 +39,9 @@ "rpm", "flatpak", "snap" + ], + "asarUnpack": [ + "**/node_modules/sharp/**" ] }, "snap": { diff --git a/renderer/pages/index.jsx b/renderer/pages/index.jsx index bde24b7..407857f 100644 --- a/renderer/pages/index.jsx +++ b/renderer/pages/index.jsx @@ -1,10 +1,14 @@ import { useState, useEffect, useRef } from "react"; -import commands from "../../constants/commands"; +import commands from "../../main/commands"; import { ReactCompareSlider, ReactCompareSliderImage, } from "react-compare-slider"; +import Animated from '../public/loading.svg' +import Image from 'next/image' + + const Home = () => { const [imagePath, SetImagePath] = useState(""); const [upscaledImagePath, setUpscaledImagePath] = useState(""); @@ -190,7 +194,7 @@ const Home = () => { {progress.length > 0 && (
- Loading +

{progress}