did other shit for subdomain

This commit is contained in:
uh wot 2021-08-13 23:20:43 +02:00
parent 32b0da6ff0
commit 11cb4574e7
Signed by: uhwot
GPG Key ID: CB2454984587B781
3 changed files with 11 additions and 9 deletions

4
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ async function handler(type, request) {
}
}
var tagging = url.searchParams.get('t')
let tagging = url.searchParams.get('t')
tagging = tagging === 'true' || tagging === '1'
switch (type) {
@ -59,7 +59,7 @@ async function handler(type, request) {
return await track(id, format, access_token, tagging)
case 'album':
case 'playlist':
return await m3u8(type, id, format, access_token, tagging)
return await m3u8(type, id, format, access_token, tagging, url.host)
}
}
@ -215,7 +215,7 @@ function track_url(json, format, url_func) {
return url_func(md5_origin, format, id.toString(), media_version)
}
async function m3u8(type, id, format, access_token, tagging) {
async function m3u8(type, id, format, access_token, tagging, host) {
const response = await fetch(`https://api.deezer.com/${type}/${id}?access_token=${access_token}&limit=-1`)
const json = await response.json()
if (json.error !== undefined) {
@ -228,7 +228,7 @@ async function m3u8(type, id, format, access_token, tagging) {
if (track.id < 0) { // user-uploaded track
format = 'misc'
}
let result = `https://dz.uhwot.workers.dev/track/${track.id}?f=${format}&t=${+ tagging}`
let result = `https://${host}/track/${track.id}?f=${format}&t=${+ tagging}`
list += `#EXTINF:${track.duration},${track.title}\n${result}\n`
}

View File

@ -3,8 +3,10 @@ type = "webpack"
webpack_config = "webpack.config.js"
account_id = "03479b0523a52b140e0dabac40cb0fc8"
workers_dev = true
route = "dz.uhwot.gq/*"
zone_id = "b6b4cc9fc2fc2eb654b912119e8ab72d"
kv_namespaces = [
{ binding = "KV", id = "974c0967a84e415daa054bbbcc7f80c6", preview_id = "cfcc6491f3484cbca664913836635113" }
]
]
[env.production]
route = "dz.uhwot.gq/*"
zone_id = "b6b4cc9fc2fc2eb654b912119e8ab72d"