attempt to fix the weird issue with authorization

This commit is contained in:
wukko 2023-06-22 20:24:01 +06:00
parent 0848923cc7
commit 038c07c1b8
3 changed files with 6 additions and 6 deletions

View file

@ -28,7 +28,7 @@
"litecoin": "ltc1qvp0xhrk2m7pa6p6z844qcslfyxv4p3vf95rhna" "litecoin": "ltc1qvp0xhrk2m7pa6p6z844qcslfyxv4p3vf95rhna"
}, },
"links": { "links": {
"boosty": "https://boosty.to/wukko" "boosty": "https://boosty.to/wukko/donate"
} }
}, },
"links": { "links": {

View file

@ -29,7 +29,7 @@
"ErrorCouldntFetch": "i couldn't find anything about this link. check if it works and try again! some content may be region restricted, so keep that in mind.", "ErrorCouldntFetch": "i couldn't find anything about this link. check if it works and try again! some content may be region restricted, so keep that in mind.",
"ErrorLengthLimit": "i can't process videos longer than {s} minutes, so pick something shorter instead!", "ErrorLengthLimit": "i can't process videos longer than {s} minutes, so pick something shorter instead!",
"ErrorBadFetch": "something went wrong when i tried getting info about your link. are you sure it works? check if it does, and try again.", "ErrorBadFetch": "something went wrong when i tried getting info about your link. are you sure it works? check if it does, and try again.",
"ErrorNoInternet": "there's no internet or {appName} api is down. check your connection and try again.", "ErrorNoInternet": "there's no internet or {appName} api is temporarily unavailable. check your connection and try again.",
"ErrorCantConnectToServiceAPI": "i couldn't connect to the service api. maybe it's down, or {appName} got blocked. try again, but if error persists, {ContactLink}.", "ErrorCantConnectToServiceAPI": "i couldn't connect to the service api. maybe it's down, or {appName} got blocked. try again, but if error persists, {ContactLink}.",
"ErrorEmptyDownload": "i don't see anything i could download by your link. try a different one!", "ErrorEmptyDownload": "i don't see anything i could download by your link. try a different one!",
"ErrorLiveVideo": "this is a live video, i am yet to learn how to look into future. wait for the stream to finish and try again!", "ErrorLiveVideo": "this is a live video, i am yet to learn how to look into future. wait for the stream to finish and try again!",

View file

@ -44,9 +44,9 @@ export function createStream(obj) {
export function verifyStream(ip, id, hmac, exp) { export function verifyStream(ip, id, hmac, exp) {
try { try {
if (id.length === 21) { if (id.toString().length === 21) {
let streamInfo = streamCache.get(id); let streamInfo = streamCache.get(id.toString());
if (!streamInfo) return { error: 'this stream token does not exist', status: 400 }; if (!streamInfo) return { error: "requested stream does not exist", status: 400 };
let ghmac = sha256(`${id},${ip},${streamInfo.service},${exp}`, streamSalt); let ghmac = sha256(`${id},${ip},${streamInfo.service},${exp}`, streamSalt);
if (String(hmac) === ghmac && String(exp) === String(streamInfo.exp) && ghmac === String(streamInfo.hmac) if (String(hmac) === ghmac && String(exp) === String(streamInfo.exp) && ghmac === String(streamInfo.hmac)
@ -54,7 +54,7 @@ export function verifyStream(ip, id, hmac, exp) {
return streamInfo; return streamInfo;
} }
} }
return { error: "i couldn't verify whether you have access to this stream. try again or refresh the page!", status: 401 }; return { error: "i couldn't verify whether you have access to this download. try again or refresh the page!", status: 401 };
} catch (e) { } catch (e) {
return { status: 500, body: { status: "error", text: "Internal Server Error" } }; return { status: 500, body: { status: "error", text: "Internal Server Error" } };
} }