refactoring & fixes

- added duration check to vimeo module
- fixed quality picking in vimeo module for progressive video type
- dropping requests from ie users instead of redirecting
- probably something else but i forgot to be honest
This commit is contained in:
wukko
2023-02-09 20:45:17 +06:00
parent c7a9723847
commit 3432c91482
21 changed files with 479 additions and 453 deletions

View File

@@ -43,16 +43,14 @@ export function createStream(obj) {
export function verifyStream(ip, id, hmac, exp) {
try {
let streamInfo = streamCache.get(id);
if (streamInfo) {
let ghmac = sha256(`${id},${streamInfo.service},${ip},${exp}`, salt);
if (hmac == ghmac && exp.toString() == streamInfo.exp && ghmac == streamInfo.hmac && ip == streamInfo.ip && exp > Math.floor(new Date().getTime())) {
return streamInfo;
} else {
return { error: 'Unauthorized', status: 401 };
}
} else {
if (!streamInfo) {
return { error: 'this stream token does not exist', status: 400 };
}
let ghmac = sha256(`${id},${streamInfo.service},${ip},${exp}`, salt);
if (hmac == ghmac && exp.toString() == streamInfo.exp && ghmac == streamInfo.hmac && ip == streamInfo.ip && exp > Math.floor(new Date().getTime())) {
return streamInfo;
}
return { error: 'Unauthorized', status: 401 };
} catch (e) {
return { status: 500, body: { status: "error", text: "Internal Server Error" } };
}