Open flrgh opened 1 year ago
Because this is primarily used from mobile I think it'd be best if we could return all the necessary info from one API request instead of three (/access/pending/by-token/:token
+ /ip/addr
+ /ip/info/:addr
), in order to keep latency from extra request round-trips low. Lemme know whenever you want to work on this one, and I'll pair with you on making the necessary API updates for this.
Here's the current abomination:
The goal is to replace this with something nicer. It's a form that is primarily viewed on mobile, so UX-wise that means...
We can bake the data into the response (that's how it works now--templated html) OR you can just use the API:
GET /access/pending/by-token/{token}
returns info on the pending request:...and
GET /ip/info/{addr}
can be used to gather additional IP address info for display:One feature of the current form is that the server checks if the request to
/answer
(to load the form) came from the same IP address as the request that needs approval, and if so, the following message is added to the rendered html:It's helpful to see this when approving a request, so it would be nice to preserve the feature in the new frontend. Without changing any backend APIs, the most straightforward way to do this is to use the
/ip/addr
API endpoint to fetch your IP address and then cross-reference this againstrequest.addr
from the/access/pending/by-token/{token}
response.