diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-05 16:37:30 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-05 16:37:30 +0200 |
commit | 2c3fe9bd9ef10ddf25db800c78a4bc6108a9bbaf (patch) | |
tree | 8bc2d04b2f0841df0aa4c791dcf5b56e0d2e90e4 /api/client_test | |
parent | :bug: fix bundle setup (diff) | |
download | server-2c3fe9bd9ef10ddf25db800c78a4bc6108a9bbaf.tar.xz |
:sparkles: auto register guest account
Diffstat (limited to 'api/client_test')
-rw-r--r-- | api/client_test/index.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/api/client_test/index.html b/api/client_test/index.html index ebe92e4c..7aa4490a 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html @@ -39,6 +39,16 @@ // TODO: remote auth // window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, ""); localStorage.removeItem("gatewayURL"); + const token = JSON.parse(localStorage.getItem("token")); + if (!token) { + fetch(`${window.GLOBAL_ENV.API_ENDPOINT}/auth/register`, { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ username: "Anonymous", consent: true }) + }) + .then((x) => x.json()) + .then((x) => localStorage.setItem("token", `"${x.token}"`)); + } localStorage.setItem( "DeveloperOptionsStore", |