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",
"type": "shell",
"command": "NODE_OPTIONS=--openssl-legacy-provider wrangler build",
"command": "wrangler build",
"problemMatcher": [],
"group": {
"kind": "build",
@ -16,7 +16,7 @@
{
"label": "dev",
"type": "shell",
"command": "NODE_OPTIONS=--openssl-legacy-provider wrangler dev",
"command": "wrangler dev",
"problemMatcher": [],
"group": {
"kind": "test",
@ -26,7 +26,7 @@
{
"label": "publish",
"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
router.get('/:type/:id', async request => {
const { query } = request
const url = new URL(request.url)
let { type, id } = request.params
if (!['track', 'album', 'playlist'].includes(type)) {
@ -142,7 +141,7 @@ router.get('/:type/:id', async request => {
return await track(id, format, tagging)
case 'album':
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" }
]
vars = { ARL = "amogus" }
compatibility_date = "2021-11-21"
compatibility_date = "2021-12-03"