Skip to content

Commit

Permalink
Ingore fullbundle assets
Browse files Browse the repository at this point in the history
  • Loading branch information
petrvecera committed Aug 4, 2024
1 parent 71cc442 commit 499a7ca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 7 additions & 1 deletion pages/api/appUpdateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const date = new Date(response.data.published_at);
let sigURL: string | undefined;
let zipURL: string | undefined;
response.data.assets.forEach((asset: { browser_download_url: string }) => {

// Filter out the full Bundle versions
const assets = response.data.assets.filter((asset: { browser_download_url: string }) => {
return !asset.browser_download_url.includes("full");
});

assets.forEach((asset: { browser_download_url: string }) => {
if (asset.browser_download_url.split(".").at(-1) === "zip") {
zipURL = asset.browser_download_url;
}
Expand Down
13 changes: 9 additions & 4 deletions pages/desktop-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,15 @@ export const getServerSideProps: GetServerSideProps<any> = async () => {
let downloadCount = 0;
let version = "";
if (response.status === 200) {
const assets = response.data.assets.filter(
(asset: { browser_download_url: string }) =>
asset.browser_download_url.split(".").at(-1) !== "sig",
);
const assets = response.data.assets.filter((asset: { browser_download_url: string }) => {
if (asset.browser_download_url.split(".").at(-1) === "sig") {
return false;
} else if (asset.browser_download_url.includes("full")) {
return false;
}

return true;
});
if (assets.length > 0) {
downloadCount = assets
.map((asset: { download_count: any }) => asset.download_count)
Expand Down

0 comments on commit 499a7ca

Please sign in to comment.