diff --git a/main.js b/main.js index 5d0d731..2d872c6 100644 --- a/main.js +++ b/main.js @@ -98,7 +98,7 @@ const serverFetchTimedOut = (url, options = {}, time = 1000) => { async function checkForUpdates() { try { - const GITHUB_API_RELEASES = 'https://api.github.com/repos/openuc2/imswitch/releases/latest'; + const GITHUB_API_RELEASES = 'https://api.github.com/repos/openuc2/imswitchinstaller/releases/latest'; const CURRENT_VERSION_TAG = 'current-version-tag'; // Define your current version tag const response = await axios.get(GITHUB_API_RELEASES); @@ -114,7 +114,7 @@ async function checkForUpdates() { const userResponse = await dialog.showMessageBox({ type: 'info', title: 'Update Available', - message: 'A new version of the application is available.', + message: 'A new version of the ImSwitch Installer is available.', detail: `The latest version is ${latestVersionTag}. Would you like to download it?`, buttons: ['Yes', 'No'], defaultId: 0, @@ -628,7 +628,7 @@ function setupMambaEnv(win) { miniforgePath = path.join(homeDir, "miniforge"); mambaPath = path.join(miniforgePath, "condabin", "mamba"); pipPath = path.join(miniforgePath, "Scripts", "pip"); // Adjust for Windows if necessary - imswitchPath = path.join(miniforgePath, "site-packages", "imswitch"); + imswitchPath = path.join(miniforgePath, "Lib", "site-packages", "imswitch"); } else { miniforgePath = path.join(homeDir, "miniforge"); mambaPath = path.join(miniforgePath, "bin", "mamba"); @@ -934,7 +934,7 @@ ipcMain.on("updateImSwitch", function () { var miniforgePath = path.join(homeDir, "miniforge"); var pipPath = path.join(miniforgePath, "bin", "pip"); if (os.platform == "win32") { - pipPath = path.join(miniforgePath, "condabin", "pip"); + pipPath = path.join(miniforgePath, "Scripts", "pip"); // Adjust for Windows if necessary } /* Install UC2-REST and ImSwitch from github master @@ -942,21 +942,29 @@ ipcMain.on("updateImSwitch", function () { if (fs.existsSync(path.join(miniforgePath))) { win.webContents.send("updateStatus", "Updating ImSwitch from Source..."); runCommand( - `${pipPath}`, - [`install`, `https://github.com/openUC2/UC2-REST/archive/master.zip`], - win - ) - //runCommand(`${mambaPath} create -n ${envName} -y`) - .then(() => { - win.webContents.send( - "updateStatus", - "Installing UC2-ImSwitch packages with pip. This may take a while..." - ); - return runCommand( - `${pipPath}`, - [`install`, `https://github.com/openUC2/ImSwitch/archive/master.zip`], - win - ); - }); + `${pipPath}`, + [`install`, `https://github.com/openUC2/UC2-REST/archive/master.zip`], + win + ) + .then(() => { + win.webContents.send( + "updateStatus", + "Installing UC2-ImSwitch packages with pip. This may take a while..." + ); + return runCommand( + `${pipPath}`, + [`install`, `https://github.com/openUC2/ImSwitch/archive/master.zip`], + win + ); + }) + .then(() => { + win.webContents.send("updateStatus", "Setup complete!"); + win.loadFile("pages/index.html"); + }) + .catch((error) => { + console.log("An error occurred during setup:", error); + win.webContents.send("updateStatus", "An error occurred during setup."); + }); + } }); diff --git a/yarn.lock b/yarn.lock index 881fe4d..c0d3627 100644 --- a/yarn.lock +++ b/yarn.lock @@ -473,14 +473,6 @@ resolved "https://registry.npmjs.org/@types/node/-/node-16.18.3.tgz" integrity sha512-jh6m0QUhIRcZpNv7Z/rpN+ZWXOicUUQbSoWks7Htkbb9IjFQj4kzcX/xFCkjstCj5flMsN8FiSvt+q+Tcs4Llg== -"@types/plist@^3.0.1": - version "3.0.5" - resolved "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz" - integrity sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA== - dependencies: - "@types/node" "*" - xmlbuilder ">=11.0.1" - "@types/responselike@^1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz" @@ -488,11 +480,6 @@ dependencies: "@types/node" "*" -"@types/verror@^1.10.3": - version "1.10.9" - resolved "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz" - integrity sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ== - "@types/yargs-parser@*": version "21.0.3" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz" @@ -766,11 +753,6 @@ asar@^3.1.0: optionalDependencies: "@types/glob" "^7.1.1" -assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz" @@ -901,7 +883,7 @@ buffer-from@^1.0.0: resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer@^5.1.0, buffer@^5.5.0: +buffer@^5.5.0: version "5.7.1" resolved "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -1179,18 +1161,6 @@ core-util-is@~1.0.0: resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - -crc@^3.8.0: - version "3.8.0" - resolved "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz" - integrity sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ== - dependencies: - buffer "^5.1.0" - cross-spawn-windows-exe@^1.1.0, cross-spawn-windows-exe@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/cross-spawn-windows-exe/-/cross-spawn-windows-exe-1.2.0.tgz" @@ -1366,20 +1336,6 @@ dmg-builder@23.6.0: optionalDependencies: dmg-license "^1.0.11" -dmg-license@^1.0.11: - version "1.0.11" - resolved "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz" - integrity sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q== - dependencies: - "@types/plist" "^3.0.1" - "@types/verror" "^1.10.3" - ajv "^6.10.0" - crc "^3.8.0" - iconv-corefoundation "^1.1.7" - plist "^3.0.4" - smart-buffer "^4.0.2" - verror "^1.10.0" - doctrine@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" @@ -1736,11 +1692,6 @@ extract-zip@^2.0.0: optionalDependencies: "@types/yauzl" "^2.9.1" -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" @@ -2259,14 +2210,6 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -iconv-corefoundation@^1.1.7: - version "1.1.7" - resolved "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz" - integrity sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ== - dependencies: - cli-truncate "^2.1.0" - node-addon-api "^1.6.3" - iconv-lite@^0.6.2: version "0.6.3" resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz" @@ -2932,11 +2875,6 @@ node-abi@^3.0.0: dependencies: semver "^7.3.5" -node-addon-api@^1.6.3: - version "1.7.2" - resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz" - integrity sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg== - node-addon-api@^3.1.0: version "3.2.1" resolved "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz" @@ -3665,7 +3603,7 @@ slice-ansi@^4.0.0: astral-regex "^2.0.0" is-fullwidth-code-point "^3.0.0" -smart-buffer@^4.0.2, smart-buffer@^4.2.0: +smart-buffer@^4.2.0: version "4.2.0" resolved "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== @@ -4040,15 +3978,6 @@ vanilla-picker@^2.12.2: dependencies: "@sphinxxxx/color-conversion" "^2.2.2" -verror@^1.10.0: - version "1.10.1" - resolved "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz" - integrity sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - wcwidth@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz" @@ -4125,7 +4054,7 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -xmlbuilder@^15.1.1, xmlbuilder@>=11.0.1: +xmlbuilder@^15.1.1: version "15.1.1" resolved "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz" integrity sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==