cameri / nostream

A Nostr Relay written in TypeScript
MIT License
741 stars 190 forks source link

Admission check endpoint #338

Closed medjedovicm closed 8 months ago

medjedovicm commented 1 year ago

Description

Created admission router and admission check controller which runs a check against the provided pubkey in the URL parameter and returns JSON with information if the user (pubkey) is admitted or not.

GET /admissions/check/:pubkey

Response:

{
  "userAdmitted": boolean
}

Related Issue

Closes #336

Motivation and Context

In our use case, we need to check if a user is admitted on our own relay before we let them log in. The user is redirected to the relay page (in the new tab) while we send a check request every 10 seconds or so, so we can automatically figure out when payment is done.

How Has This Been Tested?

Visited a new endpoint in the browser, looking for the response. As far as I am aware my changes do not affect any other parts of the code.

Screenshots (if appropriate):

image

Types of changes

Checklist:

medjedovicm commented 1 year ago

I'm sorry, I missed a crucial commit... I think this structure makes more sense. Another commit is coming with an addressed rate limits comment.

cameri commented 8 months ago

@medjedovicm ive fixed the integration tests, do you mind rebasing off the main branch to incorporate the fix into yours?

medjedovicm commented 8 months ago

@Cameri Yes sure, done.

coveralls commented 8 months ago

Pull Request Test Coverage Report for Build 7506254600


Totals Coverage Status
Change from base Build 7498690615: -0.4%
Covered Lines: 1309
Relevant Lines: 2357

đź’› - Coveralls
github-actions[bot] commented 8 months ago

:tada: This PR is included in version 2.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: