Add "Current Status" to index page #1

merged
opened by vielle.dev targeting main

The main change is that the site will call /xrpc/_health and display a status based on the response

  • Offline: The endpoint threw an error (either due to CORS or it could not connect. We aren't able to tell which one it is, so treat them the same)
  • Some Issues: The endpoint returned a non 2xx response. This shouldn't happen but it still COULD, so we should have an edge case for it. Hovering the status will show the response body.
  • Online: The endpoint returned a 2xx status code. Hovering the status will show the response body

Other changes:

  • PDS is a constant at the top of the file. I would just remove the PDS prefix entirely, since this should just be deployed in front of a PDS on the same domain, but I used file:/// to test it and I wanted my testing to work lol. Added so ppl using this code (if allowed) can tweak it for their PDS easily. Would also allow a PDS domain migration with a single endpoint change.
  • Move the await on the fetch call in getKatprotoUsers. calling await on the fetch call makes more sense.
  • If getKatprotoUsers throws an error, just console.warn it. This is to avoid it interupting other functions. It should be fine, but better safe than sorry.
  • Apply formatting by prettier. I couldn't be bothered to turn it of so I'm leaving it in the PR unless u hate it lolol
0
by vielle.dev 1 comment
expand 1 commit
20a57caf
add current status
pull request successfully merged
sign up or login to add to the discussion
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:4zht3z4caxwrw3dlsybodywc/sh.tangled.repo.pull/3m4vpm65ax622