Skip to content

Commit 7d0a3f1

Browse files
committed
feat: add nip45.enabled test and docs
1 parent 73c33f9 commit 7d0a3f1

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ The settings below are listed in alphabetical order by name. Please keep this ta
132132
| nip05.mode | NIP-05 verification mode: `enabled` requires verification, `passive` verifies without blocking, `disabled` does nothing. Defaults to `disabled`. |
133133
| nip05.verifyExpiration | Time in milliseconds before a successful NIP-05 verification expires and needs re-checking. Defaults to 604800000 (1 week). |
134134
| nip05.verifyUpdateFrequency | Minimum interval in milliseconds between re-verification attempts for a given author. Defaults to 86400000 (24 hours). |
135+
| nip45.enabled | Enable or disable NIP-45 COUNT handling. Defaults to true. |
135136
| paymentProcessors.lnbits.baseURL | Base URL of your Lnbits instance. |
136137
| paymentProcessors.lnbits.callbackBaseURL | Public-facing Nostream's Lnbits Callback URL. (e.g. https://relay.your-domain.com/callbacks/lnbits) |
137138
| paymentProcessors.lnurl.invoiceURL | [LUD-06 Pay Request](https://github.com/lnurl/luds/blob/luds/06.md) provider URL. (e.g. https://getalby.com/lnurlp/your-username) |

test/unit/handlers/count-message-handler.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,5 +129,20 @@ describe('CountMessageHandler', () => {
129129
'error: unable to count events',
130130
])
131131
})
132+
133+
it('returns CLOSED when COUNT is disabled in settings', async () => {
134+
handler = new CountMessageHandler(webSocket, eventRepository, () => ({ nip45: { enabled: false } }) as Settings)
135+
136+
const message = [MessageType.COUNT, 'q1', {}] as any
137+
138+
await handler.handleMessage(message)
139+
140+
expect(eventRepository.countByFilters).to.not.have.been.called
141+
expect(webSocketOnMessageStub).to.have.been.calledOnceWithExactly([
142+
MessageType.CLOSED,
143+
'q1',
144+
'COUNT is disabled by relay configuration',
145+
])
146+
})
132147
})
133148
})

0 commit comments

Comments
 (0)