Skip to content

Commit d9c0cb7

Browse files
authored
Merge pull request #19 from MillhioreF/master
Fix extension being completely broken due to URL changes
2 parents 236a003 + e05d269 commit d9c0cb7

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

extension/injected.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ window.Worker = class Worker extends oldWorker {
1818

1919
var newBlobStr = `
2020
var Module = {
21-
WASM_BINARY_URL: 'https://cvp.twitch.tv/${version}/wasmworker.min.wasm',
21+
WASM_BINARY_URL: 'https://static.twitchcdn.net/assets/wasmworker.min-${version}.wasm',
2222
WASM_CACHE_MODE: true
2323
}
2424
2525
${ functions }
2626
27-
importScripts('https://cvp.twitch.tv/${version}/wasmworker.min.js');
27+
importScripts('https://static.twitchcdn.net/assets/wasmworker.min-${version}.js');
2828
`
2929
super(URL.createObjectURL(new Blob([newBlobStr])));
3030
}

extension/lib.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function getFuncsForInjection (usePerformanceFix) {
1717
}
1818

1919
function stripAds (textStr) {
20-
var haveAdTags = textStr.includes('#EXT-X-SCTE35-OUT');
20+
var haveAdTags = textStr.includes('#EXT-X-SCTE35-OUT') || textStr.includes('stitched-ad');
2121

2222
if (haveAdTags) {
2323
self._wasAd = true;
@@ -42,9 +42,10 @@ function getFuncsForInjection (usePerformanceFix) {
4242
// So let's reuse the last stream chunk. This will most likely buffer/be glitchy.
4343
// We manually increase the sequence number.
4444
// TODO: Find better solution?
45-
textStr = self._lastStreamChunk;
4645
if (textStr === undefined) {
4746
textStr = '';
47+
} else if (self._lastStreamChunk !== undefined) {
48+
textStr = self._lastStreamChunk;
4849
}
4950
var currSeq = parseInt(getSeqNr(textStr));
5051
if (self._lastSeq === undefined) {
@@ -224,5 +225,5 @@ function getWasmBinaryVersion (twitchBlobUrl) {
224225
var req = new XMLHttpRequest();
225226
req.open('GET', twitchBlobUrl, false);
226227
req.send();
227-
return req.responseText.match(/tv\/(.*)\/wasmworker/)[1];
228+
return req.responseText.match(/wasmworker\.min\-(.*)\.js/)[1];
228229
}

0 commit comments

Comments
 (0)