Skip to content

Commit

Permalink
Fix download on both pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacksore committed Sep 21, 2024
1 parent 4e8b599 commit 921b703
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
6 changes: 3 additions & 3 deletions apps/api/src/handlers/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ app.get("/latest/canary", async (c) => {

// get the latest canary build for each platform
const downloads = files.objects
.filter((file) => file?.key !== "canary/latest.json")
.map((file) => {
const platform = file.key.split("/")[1].split("-")[2];
return {
name: file.key,
url: `https://artifacts.overlayed.dev/${file.key}`,
platform: platform.replace(".zip", ""),
platform: platform.slice(0, -4),
};
})
.filter((file) => file.name !== "canary/latest.json");
});

return c.json(
{
Expand Down
20 changes: 15 additions & 5 deletions apps/api/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export async function getStars({
}
}

const CDN_URL = "https://artifacts.overlayed.dev";

export async function getPlatformDownloads({
authToken,
}: {
Expand All @@ -73,12 +75,20 @@ export async function getPlatformDownloads({
// fetch all releases from github
try {
const releases = await getLatestRelease(authToken);
const latestVersion = releases.tag_name.substring(1);

const versions = releases.assets
.map((asset) => ({
name: asset.name,
url: asset.browser_download_url,
platform: filenameToPlatform(asset.name),
const versions = [
{
file: `Overlayed_${latestVersion}_amd64.AppImage`,
platform: "linux",
},
{ file: `Overlayed_${latestVersion}_universal.dmg`, platform: "mac" },
{ file: `Overlayed_${latestVersion}_x64_en-US.msi`, platform: "windows" },
]
.map((item) => ({
name: `${item.file}`,
url: `${CDN_URL}/stable/v${latestVersion}/${item.file}`,
platform: item.platform,
}))
.filter((asset) => asset.name.match(/\.(dmg|msi|AppImage)$/));

Expand Down
4 changes: 0 additions & 4 deletions apps/web/plugins/proxy-middleware.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export default (paths) => {
? createMockedProxy((pathname) => shouldFilterReq(paths, pathname))
: createProxy((pathname) => shouldFilterReq(paths, pathname));

console.log(
"[🌐 Mocked Proxy] Enabled, will resolve /latest/stable to /stable-mock.json",
);

return {
name: "proxy",
hooks: {
Expand Down

0 comments on commit 921b703

Please sign in to comment.