-
Notifications
You must be signed in to change notification settings - Fork 48
Add Per os download section #3784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Baalmart
merged 7 commits into
airqo-platform:staging
from
BwanikaRobert:Per-OS-download-section
Jul 10, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1e37a85
Add per-OS download section
2097efb
feat: add platform-aware download page with dynamic GitHub release fe…
b593eba
Merge remote-tracking branch 'upstream/staging' into staging
ed1674d
Merge branch 'staging' into Per-OS-download-section
369174b
fix: guard mobile UA detection, handle clipboard errors, and detect m…
af0c75f
increase the size limit to characer for the new features
82d7d0b
update changelog
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { NextResponse } from 'next/server'; | ||
|
|
||
| interface GitHubAsset { | ||
| name: string; | ||
| browser_download_url: string; | ||
| } | ||
|
|
||
| interface GitHubRelease { | ||
| tag_name: string; | ||
| assets: GitHubAsset[]; | ||
| } | ||
|
|
||
| export const revalidate = 3600; | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| const res = await fetch( | ||
| 'https://api.github.com/repos/airqo-platform/AirQo-frontend/releases?per_page=20', | ||
| { | ||
| headers: { | ||
| Accept: 'application/vnd.github+json', | ||
| ...(process.env.GITHUB_TOKEN | ||
| ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } | ||
| : {}), | ||
| }, | ||
| next: { revalidate: 3600 }, | ||
| } | ||
| ); | ||
|
|
||
| if (!res.ok) { | ||
| return NextResponse.json({ error: 'Failed to fetch releases' }, { status: 502 }); | ||
| } | ||
|
|
||
| const releases: GitHubRelease[] = await res.json(); | ||
|
|
||
| // Desktop releases are identified by having a .exe asset (v0.x.y series) | ||
| const desktop = releases.find((r) => r.assets.some((a) => a.name.endsWith('.exe'))); | ||
|
|
||
| if (!desktop) { | ||
| return NextResponse.json({ error: 'No desktop release found' }, { status: 404 }); | ||
| } | ||
|
|
||
| const find = (match: (name: string) => boolean) => | ||
| desktop.assets.find((a) => match(a.name))?.browser_download_url ?? null; | ||
|
|
||
| return NextResponse.json({ | ||
| version: desktop.tag_name, | ||
| windows: { | ||
| exe: find((n) => n.endsWith('.exe')), | ||
| }, | ||
| mac: { | ||
| arm64Dmg: find((n) => n.includes('arm64') && n.endsWith('.dmg')), | ||
| arm64Zip: find((n) => n.includes('arm64') && n.endsWith('.zip')), | ||
| intelDmg: find((n) => !n.includes('arm64') && n.endsWith('.dmg')), | ||
| intelZip: find((n) => !n.includes('arm64') && n.endsWith('.zip')), | ||
| }, | ||
| linux: { | ||
| appImage: find((n) => n.endsWith('.AppImage')), | ||
| deb: find((n) => n.endsWith('.deb')), | ||
| }, | ||
| }); | ||
| } catch { | ||
| return NextResponse.json({ error: 'Internal error' }, { status: 500 }); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Log errors in the catch block before returning 500.
The catch block silently swallows the error with no logging. In production, if this route starts returning 500s, there's no way to diagnose the root cause (e.g., GitHub API outage, parse failure, network timeout). Bind the error and log it.
🔧 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents