efixler / scrape

Web Scraping Service
Mozilla Public License 2.0
6 stars 4 forks source link

Token entry on homepage #37

Closed efixler closed 3 months ago

efixler commented 3 months ago

What's Here

This PR updates the homepage (aka test console) to require a valid token for API usage, building on the UX introduced in the prior PRs:

Here's a screenshot of the token entry widget:

image

Tokens may be saved to local storage, in which case they'll be pre-loaded for future sessions.


The prior (where API access via the homepage was provided by short-lived token passed from the server) is preserved and can be enabled via the -public-home flag. This mode is useful for development and may also be useful in production environments where route authentication is handled upstream from this service.

NB: The commits for this PR are showing some unrelated prior commits. This has to do with some fork sync confusion. The diff, however, is correct.

Steps to Test

Building this release

Without Go on your machine

In the branch root: make docker-build

With Go 1.22.x on your machine

In the branch root: make

Running the Server

You'll need a signing key to start the server, and a corresponding token to access functionality from the test console.

Here's a signing key for testing:

bCdcAT8EBvQXo7A50c4cSbkTc2gMvpVoMYrVaOpuKmM=

With Go

./build/scrape-server -signing-key [insert signing key from above here]

With Docker

Testing Functionality