File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -654,11 +654,24 @@ async function startPolling(): Promise<void> {
654654 } catch { }
655655 const prevIds = new Set ( prev . map ( ( g ) => g . appid ) ) ;
656656
657+ const nowSec = Date . now ( ) / 1000 ;
658+ const merged = [ ...result ] ;
659+ for ( const p of prev ) {
660+ if ( p . until > nowSec && ! merged . some ( ( g ) => g . appid === p . appid ) ) merged . push ( p ) ;
661+ }
662+
657663 try {
658- await withTimeout ( saveFreeWeekendCache ( { payload : JSON . stringify ( result ) } ) , 3000 , 0 ) ;
664+ await withTimeout ( saveFreeWeekendCache ( { payload : JSON . stringify ( merged ) } ) , 3000 , 0 ) ;
659665 } catch { }
660- log ( `Weekend scan complete — ${ result . length } game(s) playable for free` ) ;
661-
666+ log ( `Weekend scan complete — ${ merged . length } game(s) playable for free` ) ;
667+
668+ let notify = true ;
669+ try {
670+ const sraw = await withTimeout ( loadSettings ( ) , 2000 , '' ) ;
671+ if ( sraw ) notify = ( { ...DEFAULTS , ...JSON . parse ( sraw ) } as Settings ) . notifyOnGrab ;
672+ } catch { }
673+ if ( ! notify ) return ;
674+
662675 for ( const g of result ) {
663676 if ( prevIds . has ( g . appid ) ) continue ;
664677 if ( isAlreadyInLibrary ( g . appid ) ) continue ;
You can’t perform that action at this time.
0 commit comments