don't get nor renew cookie/token stuff on m3u8 playlists

This commit is contained in:
uh wot 2021-11-10 00:41:36 +01:00
parent 1a802e7654
commit ecd5fd3f8b
Signed by: uhwot
GPG Key ID: CB2454984587B781
2 changed files with 32 additions and 29 deletions

2
dist/worker.js vendored

File diff suppressed because one or more lines are too long

View File

@ -69,6 +69,8 @@ async function handler(type, request) {
const url = new URL(request.url) const url = new URL(request.url)
const id = url.pathname.split('/')[2] const id = url.pathname.split('/')[2]
// cookie/token stuff isn't needed for m3u8 playlists
if (type === 'track') {
if (id[0] !== '-') { // checks if not user-upped track if (id[0] !== '-') { // checks if not user-upped track
license_token = await KV.get('license_token') license_token = await KV.get('license_token')
checkForm = await KV.get('checkForm') checkForm = await KV.get('checkForm')
@ -101,6 +103,7 @@ async function handler(type, request) {
await KV.put('access_token', access_token, { expirationTtl: parseInt(json.expires) }) await KV.put('access_token', access_token, { expirationTtl: parseInt(json.expires) })
} }
} }
}
format = url.searchParams.get('f') format = url.searchParams.get('f')
if (format === null) { if (format === null) {