@@ -82,7 +82,7 @@ var relayInfo = {
8282 contact : "lux@fed.wtf" ,
8383 supported_nips : [ 1 , 2 , 4 , 5 , 9 , 11 , 12 , 15 , 16 , 17 , 20 , 22 , 33 , 40 , 42 ] ,
8484 software : "https://github.com/Spl0itable/nosflare" ,
85- version : "7.9.35 " ,
85+ version : "7.9.36 " ,
8686 icon : "https://raw.githubusercontent.com/Spl0itable/nosflare/main/images/flare.png" ,
8787 // Optional fields (uncomment as needed):
8888 // banner: "https://example.com/banner.jpg",
@@ -4842,7 +4842,9 @@ var _RelayWebSocket = class _RelayWebSocket {
48424842 host : attachment . host ,
48434843 // NIP-42: Generate new challenge after hibernation (old one is lost)
48444844 challenge : AUTH_REQUIRED ? this . generateAuthChallenge ( ) : void 0 ,
4845- authenticatedPubkeys : /* @__PURE__ */ new Set ( )
4845+ authenticatedPubkeys : /* @__PURE__ */ new Set ( ) ,
4846+ // Restore payment status from attachment (survives hibernation)
4847+ hasPaid : attachment . hasPaid
48464848 } ;
48474849 this . sessions . set ( attachment . sessionId , session ) ;
48484850 if ( AUTH_REQUIRED && session . challenge ) {
@@ -4864,7 +4866,7 @@ var _RelayWebSocket = class _RelayWebSocket {
48644866 bookmark : session . bookmark ,
48654867 host : session . host ,
48664868 doName : this . doName ,
4867- hasPaid : attachment . hasPaid
4869+ hasPaid : session . hasPaid
48684870 } ;
48694871 ws . serializeAttachment ( updatedAttachment ) ;
48704872 } catch ( error ) {
@@ -4983,14 +4985,7 @@ var _RelayWebSocket = class _RelayWebSocket {
49834985 return ;
49844986 }
49854987 if ( PAY_TO_RELAY_ENABLED ) {
4986- let hasPaid = await this . getCachedPaymentStatus ( event . pubkey ) ;
4987- if ( hasPaid === null ) {
4988- hasPaid = await hasPaidForRelay ( event . pubkey , this . env ) ;
4989- if ( hasPaid !== null ) {
4990- this . setCachedPaymentStatus ( event . pubkey , hasPaid ) ;
4991- }
4992- }
4993- if ( hasPaid === false ) {
4988+ if ( session . hasPaid === false ) {
49944989 const protocol = "https:" ;
49954990 const relayUrl = `${ protocol } //${ session . host } ` ;
49964991 console . error ( `Event denied. Pubkey ${ event . pubkey } has not paid for relay access.` ) ;
@@ -5185,6 +5180,13 @@ var _RelayWebSocket = class _RelayWebSocket {
51855180 return ;
51865181 }
51875182 session . authenticatedPubkeys . add ( authEvent . pubkey ) ;
5183+ if ( PAY_TO_RELAY_ENABLED ) {
5184+ const paid = await hasPaidForRelay ( authEvent . pubkey , this . env ) ;
5185+ if ( paid !== null ) {
5186+ session . hasPaid = paid ;
5187+ this . setCachedPaymentStatus ( authEvent . pubkey , paid ) ;
5188+ }
5189+ }
51885190 this . sendOK ( session . webSocket , authEvent . id , true , "" ) ;
51895191 } catch ( error ) {
51905192 console . error ( "Error handling AUTH:" , error ) ;
@@ -5213,7 +5215,8 @@ var _RelayWebSocket = class _RelayWebSocket {
52135215 bookmark : attachment . bookmark ,
52145216 host : attachment . host ,
52155217 challenge : AUTH_REQUIRED ? this . generateAuthChallenge ( ) : void 0 ,
5216- authenticatedPubkeys : /* @__PURE__ */ new Set ( )
5218+ authenticatedPubkeys : /* @__PURE__ */ new Set ( ) ,
5219+ hasPaid : attachment . hasPaid
52175220 } ;
52185221 this . sessions . set ( attachment . sessionId , session ) ;
52195222 }
0 commit comments