Fixed an issue with session keys not updating properly.

This commit is contained in:
Ada Werefox 2024-03-10 19:42:37 +00:00
parent fcf1ecf669
commit ecd9967525
2 changed files with 5 additions and 5 deletions

View File

@ -22,8 +22,6 @@ defaults = {
def session_key(session, key):
if key not in session.keys():
session[key] = defaults[key]
if key == 'backend_filepath':
session['backend_filepath_updated'] = True
# TODO: consider serializing user sessions for debugging in the future.
logging.info(
@ -107,7 +105,8 @@ def index(request):
def get_address(request):
if request.method == 'GET':
return HttpResponse(dumps({'listen_address': request.session['listen_address'], 'backend_filepath_update': request.session['backend_filepath_updated']}), content_type="application/json")
session_key(request.session, 'backend_filepath_updated')
return HttpResponse(dumps({'listen_address': request.session['listen_address'], 'backend_filepath_updated': request.session['backend_filepath_updated']}), content_type="application/json")
else:
return render(request, 'tracker/index.html')

View File

@ -23,11 +23,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = 'django-insecure-ae-fwu3z$wexeiac4ggt0l@x1*uq5v9-q&$y#frf85xli)bo8f'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = False
ALLOWED_HOSTS = [
"localhost",
"127.0.0.1"
"127.0.0.1",
"tunic.werefox.cafe"
]