Skip to content

Commit ea19225

Browse files
committed
Move archive listing handler under lyrion.org/downloads/archive-listing
1 parent 4254892 commit ea19225

5 files changed

Lines changed: 25 additions & 14 deletions

File tree

docs/downloads/listing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ title: Downloads Archive
1717
// get list of objects with given prefix
1818
let releaseData = [];
1919
try {
20-
const response = await fetch('https://lms-downloads-handler.lyrion.workers.dev/' + prefix);
20+
const response = await fetch('archive-listing/' + prefix);
2121
releaseData = await response.json();
2222
}
2323
catch(e) {

tools/downloads-handler/package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/downloads-handler/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
"devDependencies": {
1111
"@cloudflare/workers-types": "^4.20251014.0",
1212
"typescript": "^5.9.3",
13-
"wrangler": "^4.44.0"
13+
"wrangler": "^4.45.0"
1414
}
1515
}

tools/downloads-handler/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ const corsHeaders = {
2121
"Access-Control-Max-Age": "86400",
2222
}
2323

24+
const urlPrefix = 'downloads/archive-listing/';
2425

2526
export default {
2627
async fetch(request, env): Promise<Response> {
2728
const url = new URL(request.url)
28-
const prefix = url.pathname.slice(1)
29+
const prefix = url.pathname.slice(1).replace(urlPrefix, '')
2930

3031
if (!prefix) {
3132
return Response.redirect('https://lyrion.org/getting-started')

tools/downloads-handler/wrangler.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ name = "lms-downloads-handler"
22
main = "src/index.ts"
33
compatibility_date = "2024-04-05"
44
compatibility_flags = ["nodejs_compat"]
5+
workers_dev = true
6+
preview_urls = false
57

68
[observability]
79
enabled = true
810
head_sampling_rate = 1
911

12+
[[routes]]
13+
pattern="*.lyrion.org/downloads/archive-listing/*"
14+
zone_name="lyrion.org"
15+
16+
[[routes]]
17+
pattern="lyrion.org/downloads/archive-listing/*"
18+
zone_name="lyrion.org"
19+
1020
[[r2_buckets]]
1121
binding = 'DOWNLOADS_BUCKET'
1222
bucket_name = 'downloads'

0 commit comments

Comments
 (0)