Update background.js

Removed personal info from redirect url.
This commit is contained in:
saucettv 2021-05-20 00:39:02 +01:00 committed by GitHub
parent 849321861b
commit 8bbf309bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,18 @@
function stripUnusedParams(str, params) {
if (!params) {
params = [ 'token', 'sig' ];
}
var tempUrl = new URL('https://localhost/' + str);
for (var i = 0; i < params.length; i++) {
tempUrl.searchParams.delete(params[i]);
}
return tempUrl.pathname.substring(1) + tempUrl.search;
}
function onPlaylistBeforeRequest(details) {
details.url = stripUnusedParams(details.url, null);
// (hls\/|vod\/)(.+?)$
const match = /(hls|vod)\/(.+?)$/gim.exec(details.url);
@ -42,4 +55,4 @@ function onPlaylistBeforeRequest(details) {
onBeforeSendHeaders,
{ urls: ["https://api.ttv.lol/playlist/*", "https://api.ttv.lol/vod/*"] },
["blocking", "requestHeaders"]
);
);