getting host without parsing url

This commit is contained in:
uh wot 2021-12-03 20:10:49 +01:00
parent c5e2d749e9
commit 1160a0e1ba
Signed by: uhwot
GPG Key ID: CB2454984587B781
4 changed files with 6 additions and 7 deletions

6
.vscode/tasks.json vendored
View File

@ -6,7 +6,7 @@
{ {
"label": "build", "label": "build",
"type": "shell", "type": "shell",
"command": "NODE_OPTIONS=--openssl-legacy-provider wrangler build", "command": "wrangler build",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {
"kind": "build", "kind": "build",
@ -16,7 +16,7 @@
{ {
"label": "dev", "label": "dev",
"type": "shell", "type": "shell",
"command": "NODE_OPTIONS=--openssl-legacy-provider wrangler dev", "command": "wrangler dev",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {
"kind": "test", "kind": "test",
@ -26,7 +26,7 @@
{ {
"label": "publish", "label": "publish",
"type": "shell", "type": "shell",
"command": "NODE_OPTIONS=--openssl-legacy-provider wrangler publish" "command": "wrangler publish"
} }
] ]
} }

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -69,7 +69,6 @@ let sid
let access_token let access_token
router.get('/:type/:id', async request => { router.get('/:type/:id', async request => {
const { query } = request const { query } = request
const url = new URL(request.url)
let { type, id } = request.params let { type, id } = request.params
if (!['track', 'album', 'playlist'].includes(type)) { if (!['track', 'album', 'playlist'].includes(type)) {
@ -142,7 +141,7 @@ router.get('/:type/:id', async request => {
return await track(id, format, tagging) return await track(id, format, tagging)
case 'album': case 'album':
case 'playlist': case 'playlist':
return await m3u8(type, id, format, tagging, url.host) return await m3u8(type, id, format, tagging, request.headers.get('host'))
} }
}) })

View File

@ -7,4 +7,4 @@ kv_namespaces = [
{ binding = "KV", id = "974c0967a84e415daa054bbbcc7f80c6", preview_id = "cfcc6491f3484cbca664913836635113" } { binding = "KV", id = "974c0967a84e415daa054bbbcc7f80c6", preview_id = "cfcc6491f3484cbca664913836635113" }
] ]
vars = { ARL = "amogus" } vars = { ARL = "amogus" }
compatibility_date = "2021-11-21" compatibility_date = "2021-12-03"