-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efe2955
commit 700a9d3
Showing
7 changed files
with
320 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
'website': minor | ||
--- | ||
|
||
The website now includes routes for downloading the latest binaries. |
32 changes: 32 additions & 0 deletions
32
apps/website/pages/api/downloads/hostd/latest/[platform].ts
This file contains 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,32 @@ | ||
import { getHostdLatestRelease } from '../../../../../content/releases' | ||
import fetch from 'node-fetch' | ||
|
||
export const config = { | ||
api: { | ||
responseLimit: false, | ||
}, | ||
} | ||
|
||
const daemon = 'hostd' | ||
|
||
export default async function handler(req, res) { | ||
const { platform } = req.query | ||
|
||
try { | ||
const latest = await getHostdLatestRelease() | ||
const fileName = `${daemon}_${platform}.zip` | ||
const githubUrl = `https://github.com/SiaFoundation/${daemon}/releases/download/${latest.tag_name}/${fileName}` | ||
|
||
const response = await fetch(githubUrl) | ||
|
||
if (!response.ok) throw new Error(`Failed to fetch ${githubUrl}`) | ||
|
||
res.setHeader('Content-Type', 'application/zip') | ||
res.setHeader('Content-Disposition', `attachment; filename=${fileName}`) | ||
|
||
response.body.pipe(res) | ||
} catch (error) { | ||
console.error('Error fetching the file:', error) | ||
res.status(500).send('Internal Server Error') | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
apps/website/pages/api/downloads/renterd/latest/[platform].ts
This file contains 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,32 @@ | ||
import { getRenterdLatestRelease } from '../../../../../content/releases' | ||
import fetch from 'node-fetch' | ||
|
||
export const config = { | ||
api: { | ||
responseLimit: false, | ||
}, | ||
} | ||
|
||
const daemon = 'renterd' | ||
|
||
export default async function handler(req, res) { | ||
const { platform } = req.query | ||
|
||
try { | ||
const latest = await getRenterdLatestRelease() | ||
const fileName = `${daemon}_${platform}.zip` | ||
const githubUrl = `https://github.com/SiaFoundation/${daemon}/releases/download/${latest.tag_name}/${fileName}` | ||
|
||
const response = await fetch(githubUrl) | ||
|
||
if (!response.ok) throw new Error(`Failed to fetch ${githubUrl}`) | ||
|
||
res.setHeader('Content-Type', 'application/zip') | ||
res.setHeader('Content-Disposition', `attachment; filename=${fileName}`) | ||
|
||
response.body.pipe(res) | ||
} catch (error) { | ||
console.error('Error fetching the file:', error) | ||
res.status(500).send('Internal Server Error') | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
apps/website/pages/api/downloads/walletd/latest/[platform].ts
This file contains 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,32 @@ | ||
import { getWalletdLatestRelease } from '../../../../../content/releases' | ||
import fetch from 'node-fetch' | ||
|
||
export const config = { | ||
api: { | ||
responseLimit: false, | ||
}, | ||
} | ||
|
||
const daemon = 'walletd' | ||
|
||
export default async function handler(req, res) { | ||
const { platform } = req.query | ||
|
||
try { | ||
const latest = await getWalletdLatestRelease() | ||
const fileName = `${daemon}_${platform}.zip` | ||
const githubUrl = `https://github.com/SiaFoundation/${daemon}/releases/download/${latest.tag_name}/${fileName}` | ||
|
||
const response = await fetch(githubUrl) | ||
|
||
if (!response.ok) throw new Error(`Failed to fetch ${githubUrl}`) | ||
|
||
res.setHeader('Content-Type', 'application/zip') | ||
res.setHeader('Content-Disposition', `attachment; filename=${fileName}`) | ||
|
||
response.body.pipe(res) | ||
} catch (error) { | ||
console.error('Error fetching the file:', error) | ||
res.status(500).send('Internal Server Error') | ||
} | ||
} |
Oops, something went wrong.