From 00a8490082365023bdf3e04a848229cb9d840064 Mon Sep 17 00:00:00 2001 From: Zuxxied Date: Mon, 21 Oct 2024 02:25:58 -0400 Subject: [PATCH] automatic logging in --- static/js/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/static/js/index.js b/static/js/index.js index cc06d05..09bfacb 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -247,7 +247,12 @@ class Game extends GameBasic { if (this.entities.length == 0) this.entities = [this.player]; } async init() { - let tok = new URL(window.location).searchParams.get('token'); + let u = new URL(window.location); + let tok = u.searchParams.get('token'); + if (!tok) tok = window.localStorage.getItem('tok'); + window.localStorage.setItem('tok',tok); + window.history.replaceState(null, '', window.location.pathname); + super.init(); let that = this;