diff --git a/electron/binaries.ts b/electron/binaries.ts index f0a90f7..d3808d1 100644 --- a/electron/binaries.ts +++ b/electron/binaries.ts @@ -5,14 +5,14 @@ */ import { join, dirname, resolve } from "path"; -import getPlatform from "./getPlatform"; +import { getArch, getPlatform } from "./getDeviceSpecs"; import isDev from "electron-is-dev"; import { app } from "electron"; const appRootDir = app.getAppPath(); const binariesPath = isDev - ? join(appRootDir, "resources", getPlatform()!, "bin") + ? join(appRootDir, "resources", getPlatform()!, getArch()!, "bin") : join(dirname(appRootDir), "bin"); const execPath = (execName) => diff --git a/electron/getDeviceSpecs.ts b/electron/getDeviceSpecs.ts new file mode 100644 index 0000000..5c6ab9b --- /dev/null +++ b/electron/getDeviceSpecs.ts @@ -0,0 +1,32 @@ +"use strict"; + +import { platform, arch } from "os"; + +export const getPlatform = () => { + switch (platform()) { + case "aix": + case "freebsd": + case "linux": + case "openbsd": + case "android": + return "linux"; + case "darwin": + case "sunos": + return "mac"; + case "win32": + return "win"; + } +}; + +export const getArch = () => { + switch (arch()) { + case "x64": + return "x64"; + case "x32": + return "x86"; + case "arm": + return "arm"; + case "arm64": + return "arm64"; + } +}; diff --git a/electron/getPlatform.ts b/electron/getPlatform.ts deleted file mode 100644 index 0defecc..0000000 --- a/electron/getPlatform.ts +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; - -import { platform } from "os"; - -const getPlatform = () => { - switch (platform()) { - case "aix": - case "freebsd": - case "linux": - case "openbsd": - case "android": - return "linux"; - case "darwin": - case "sunos": - return "mac"; - case "win32": - return "win"; - } -}; - -export default getPlatform; diff --git a/electron/index.ts b/electron/index.ts index bbf525f..bee192d 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -1,6 +1,6 @@ // Native import { autoUpdater } from "electron-updater"; -import getPlatform from "./getPlatform"; +import { getPlatform } from "./getDeviceSpecs"; import { join, parse } from "path"; import log from "electron-log"; import { format } from "url"; @@ -61,7 +61,7 @@ let mainWindow: BrowserWindow | null = null; app.on("ready", async () => { await prepareNext("./renderer"); - log.info("🚀 UPSCAYL EXEC PATH: ", execPath("")); + log.info("🚀 UPSCAYL EXEC PATH: ", execPath("realesrgan")); log.info("🚀 MODELS PATH: ", modelsPath); mainWindow = new BrowserWindow({ diff --git a/electron/preload.ts b/electron/preload.ts index 9ebdddc..5935364 100644 --- a/electron/preload.ts +++ b/electron/preload.ts @@ -1,5 +1,5 @@ import { ipcRenderer, contextBridge } from "electron"; -import getPlatform from "./getPlatform"; +import { getPlatform } from "./getDeviceSpecs"; // 'ipcRenderer' will be available in index.js with the method 'window.electron' contextBridge.exposeInMainWorld("electron", { diff --git a/electron/utils/getArguments.ts b/electron/utils/getArguments.ts index 7b2787c..2717012 100644 --- a/electron/utils/getArguments.ts +++ b/electron/utils/getArguments.ts @@ -1,4 +1,4 @@ -import getPlatform from "../getPlatform"; +import { getPlatform } from "../getDeviceSpecs"; const slash: string = getPlatform() === "win" ? "\\" : "/"; export const getSingleImageArguments = ( diff --git a/package.json b/package.json index 078aa96..ad731d1 100644 --- a/package.json +++ b/package.json @@ -54,12 +54,11 @@ "build": { "productName": "Upscayl", "appId": "org.upscayl.app", - "artifactName": "${name}-${version}-${os}-${arch}.${ext}", + "artifactName": "${name}-${version}-${os}.${ext}", "asar": true, - "afterSign": "scripts/notarize.js", "extraFiles": [ { - "from": "resources/${os}/${arch}/bin", + "from": "resources/${os}/bin", "to": "resources/bin", "filter": [ "**/*" diff --git a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx index 2bae1d5..2032e5e 100644 --- a/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx +++ b/renderer/components/upscayl-tab/config/LeftPaneImageSteps.tsx @@ -107,7 +107,6 @@ function LeftPaneImageSteps({ }, [currentModel]); const getUpscaleResolution = useCallback(() => { - console.log("running"); const newDimensions = { width: dimensions.width, height: dimensions.height, diff --git a/renderer/pages/index.tsx b/renderer/pages/index.tsx index 8ee82d5..585a489 100644 --- a/renderer/pages/index.tsx +++ b/renderer/pages/index.tsx @@ -24,8 +24,12 @@ import { UpscaylCloudModal } from "../components/UpscaylCloudModal"; const Home = () => { // STATES const [os, setOs] = useState<"linux" | "mac" | "win" | undefined>(undefined); - const [imagePath, SetImagePath] = useState(""); - const [upscaledImagePath, setUpscaledImagePath] = useState(""); + const [imagePath, SetImagePath] = useState( + "/Users/macbook-air/Downloads/wp9454111_upscayl_4x_realesrgan-x4plus.png" + ); + const [upscaledImagePath, setUpscaledImagePath] = useState( + "/Users/macbook-air/Downloads/wp9454111_upscayl_4x_realesrgan-x4plus.png" + ); const [outputPath, setOutputPath] = useState(""); const [scaleFactor] = useState(4); const [progress, setProgress] = useState(""); @@ -106,6 +110,8 @@ const Home = () => { window.electron.on(commands.UPSCAYL_PROGRESS, (_, data: string) => { if (data.length > 0 && data.length < 10) { setProgress(data); + } else if (data.includes("converting")) { + setProgress("Scaling and converting image..."); } handleErrors(data); logit(`🚧 UPSCAYL_PROGRESS: `, data); @@ -645,13 +651,7 @@ const Home = () => { Original {

{ + console.log(e.currentTarget); + }} alt="Upscayl" style={{ objectFit: "contain", diff --git a/resources/linux/x64/bin/upscayl-realesrgan b/resources/linux/bin/upscayl-realesrgan similarity index 100% rename from resources/linux/x64/bin/upscayl-realesrgan rename to resources/linux/bin/upscayl-realesrgan diff --git a/resources/mac/arm64/bin/upscayl-realesrgan b/resources/mac/arm64/bin/upscayl-realesrgan deleted file mode 100755 index 23ea066..0000000 Binary files a/resources/mac/arm64/bin/upscayl-realesrgan and /dev/null differ diff --git a/resources/mac/x64/bin/upscayl-realesrgan b/resources/mac/bin/upscayl-realesrgan similarity index 100% rename from resources/mac/x64/bin/upscayl-realesrgan rename to resources/mac/bin/upscayl-realesrgan diff --git a/resources/win/x64/bin/upscayl-realesrgan.exe b/resources/win/bin/upscayl-realesrgan.exe similarity index 100% rename from resources/win/x64/bin/upscayl-realesrgan.exe rename to resources/win/bin/upscayl-realesrgan.exe