@@ -465,14 +465,17 @@ window.Spicetify = {
465
465
// Filter out non-webpack scripts
466
466
. filter ( ( script ) => [ "extensions" , "spicetify" , "helper" , "theme" ] . every ( ( str ) => ! script . src ?. includes ( str ) ) ) ;
467
467
468
+ //console.time("sanitize");
468
469
await Promise . all (
469
470
scripts . map ( async ( script ) => {
470
471
try {
471
472
const res = await fetch ( script . src ) ;
472
473
const text = await res . text ( ) ;
474
+ // remove every string from the content
475
+ const sanitizedText = text . replace ( / ( [ " ' ` ] ) (?: \\ .| [ ^ \\ \1] ) * ?\1/ g, "" ) ;
473
476
const src = script . src . split ( "/" ) . pop ( ) ;
474
477
console . log ( `[spicetifyWrapper] Waiting for ${ src } ` ) ;
475
- for ( const pack of text . match ( / (?< ! [ " ' ` ] ) (?: , | { ) ( \d + ) : ? \( ., ., ./ g) . map ( ( str ) => str . slice ( 0 , - 7 ) . slice ( 1 ) ) ) {
478
+ for ( const pack of sanitizedText . match ( / (?< ! [ " ' ` ] ) (?: , | { ) ( \d + ) : ? \( ., ., ./ g) . map ( ( str ) => str . slice ( 0 , - 7 ) . slice ( 1 ) ) ) {
476
479
//console.debug(`[spicetifyWrapper] Waiting for ${pack} of ${src}`);
477
480
while ( ! require . m || ! Object . keys ( require . m ) . includes ( pack ) ) {
478
481
await new Promise ( ( r ) => setTimeout ( r , 100 ) ) ;
@@ -485,6 +488,7 @@ window.Spicetify = {
485
488
} )
486
489
) . then ( ( ) => {
487
490
console . log ( "[spicetifyWrapper] All required webpack modules loaded" ) ;
491
+ //console.timeEnd("sanitize");
488
492
chunks = Object . entries ( require . m ) ;
489
493
cache = Object . keys ( require . m ) . map ( ( id ) => require ( id ) ) ;
490
494
0 commit comments