@@ -195,6 +195,7 @@ var got404 = false;
195195
196196var fetchedKey = false
197197var key = false
198+ var coverFetchableLocalhost = false
198199
199200 async function GetBeatSaverKey ( got404 ) {
200201 if ( ! got404 ) {
@@ -237,33 +238,38 @@ function fetchData() {
237238 try {
238239 raw = JSON . parse ( data . toString ( "utf-8" , 4 , data . readUIntBE ( 0 , 4 ) + 4 ) )
239240
240- raw . connected = connected
241- raw . fetchedKey = fetchedKey
242- raw . key = key
243241 sent = true ;
244242 if ( ! raw . configFetched ) {
245243 UpdateOverlayConfig ( true ) ;
246244 }
247245 if ( lastid != raw . id || got404 ) {
246+ coverFetchableLocalhost = got404 ? raw . coverFetchableLocalhost : false
248247 for ( let i = 0 ; i < srm . length ; i ++ ) {
249248 if ( srm [ i ] . hash . toLowerCase ( ) == raw . id . replace ( "custom_song_" , "" ) . toLowerCase ( ) ) {
250249 srm . splice ( i , 1 )
251250 }
252251 }
253252 GetBeatSaverKey ( got404 ) ;
254253 lastid = raw . id
255- fetch ( "http://" + config . ip + ":" + HttpPort + "/cover/base64" ) . then ( ( res2 ) => {
256- res2 . text ( ) . then ( ( text ) => {
257- if ( res2 . status == 404 ) {
258- coverBase64 = "" ;
259- got404 = true ;
260- } else {
261- coverBase64 = text ;
262- got404 = false ;
263- }
254+ if ( raw . coverFetchable ) {
255+ fetch ( "http://" + config . ip + ":" + HttpPort + "/cover/base64" ) . then ( ( res2 ) => {
256+ res2 . text ( ) . then ( ( text ) => {
257+ if ( res2 . status != 200 ) {
258+ coverBase64 = "" ;
259+ got404 = true ;
260+ coverFetchableLocalhost = false
261+ } else {
262+ coverBase64 = text ;
263+ coverFetchableLocalhost = true
264+ got404 = false ;
265+ }
266+ } )
264267 } )
265- } )
268+ }
266269 }
270+ raw . connected = connected
271+ raw . fetchedKey = fetchedKey
272+ raw . coverFetchableLocalhost = coverFetchableLocalhost
267273 } catch ( err ) {
268274 /*
269275 if(lastError != err.toString()) {
0 commit comments