Add Internal Use Endpoints

2025-12-15 22:05:51 -08:00
parent 285da14135
commit 7b82f0043c

17
Internal-Use-Endpoints.md Normal file

@@ -0,0 +1,17 @@
### /dynamic/icons/*
Methods: GET | [Function](https://git.enstrayed.com/enstrayed/enstrayedapi/src/commit/a5c3db32d338be9de4d96f166cccd97c25efeec1/routes/dynamic.js#L3)
Returns the requested icon (stored in <code>website/dynamic/icons</code>) in any color (hex) specified in the URL. Example: <code>/dynamic/icon/github/00ff00</code> will return the GitHub logo in neon green.
### /api/auth/callback
Methods: GET | [Function](https://git.enstrayed.com/enstrayed/enstrayedapi/src/commit/a5c3db32d338be9de4d96f166cccd97c25efeec1/routes/auth.js#L57)
This is the endpoint used by ECLS to finish the login flow. It will write the newly created token to the <code>APIToken</code> cookie as well as performing the action set by <code>state</code>, see below.
### /api/auth/login
Methods: GET | [Function](https://git.enstrayed.com/enstrayed/enstrayedapi/src/commit/a5c3db32d338be9de4d96f166cccd97c25efeec1/routes/auth.js#L23)
Redirects the user to ECLS to login. The <code>state</code> parameter can be used to specify how the login flow will behave. The accepted "states" are:
* <code>redirect</code> - Redirects the user to a page after logging in. This paramter requires the <code>destination</code> paramter to also be set with the URL the user will be redirected to.
* <code>display</code> - Displays the generated token to the user after login. Currently, this still writes the new token to the <code>APIToken</code> cookie, though this is planned to change.
* <code>close</code> - This will close the page after logging in. This requires the page to be opened with JavaScript otherwise it will not automatically close.