Skip to content

Commit

Permalink
updater: Fix update URL (fixes #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikinkinen committed Nov 11, 2023
1 parent 80e5cf1 commit 4cbf5ce
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/lib/updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ const semverLt = require("semver/functions/lt");
class Updater {
constructor() {
this.cache = {};
this.updateUrl = `https://devices.ubuntu-touch.io/installer/${
packageInfo.package ? "?package=" + packageInfo.package : ""
}`;
this.updateUrl = "https://github.com/droidian-releng/droidian-installer/releases/download";
this.suffices = {
"AppImage": "linux_x86_64.AppImage",
"deb": "linux_amd64.deb",
"dmg": "mac_x64.dmg",
"exe": "win_x64.exe"
};
}

/**
Expand Down Expand Up @@ -69,7 +73,9 @@ class Updater {
*/
async isOutdated() {
const latest = await this.getLatestVersion();
return semverLt(packageInfo.version, latest) ? this.updateUrl : null;
const fullUrl = this.updateUrl +
`/${latest}/droidian-installer_${latest}_${this.suffices[packageInfo.package]}`;
return semverLt(packageInfo.version, latest) ? fullUrl : null;
}

/**
Expand All @@ -78,7 +84,9 @@ class Updater {
*/
async isPrerelease() {
const latest = await this.getLatestVersion();
return semverGt(packageInfo.version, latest) ? this.updateUrl : null;
const fullUrl = this.updateUrl +
`/${latest}/droidian-installer_${latest}_${this.suffices[packageInfo.package]}`;
return semverGt(packageInfo.version, latest) ? fullUrl : null;
}
}

Expand Down

0 comments on commit 4cbf5ce

Please sign in to comment.