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): def session_key(session, key):
if key not in session.keys(): if key not in session.keys():
session[key] = defaults[key] session[key] = defaults[key]
if key == 'backend_filepath':
session['backend_filepath_updated'] = True
# TODO: consider serializing user sessions for debugging in the future. # TODO: consider serializing user sessions for debugging in the future.
logging.info( logging.info(
@ -107,7 +105,8 @@ def index(request):
def get_address(request): def get_address(request):
if request.method == 'GET': 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: else:
return render(request, 'tracker/index.html') 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' SECRET_KEY = 'django-insecure-ae-fwu3z$wexeiac4ggt0l@x1*uq5v9-q&$y#frf85xli)bo8f'
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = False
ALLOWED_HOSTS = [ ALLOWED_HOSTS = [
"localhost", "localhost",
"127.0.0.1" "127.0.0.1",
"tunic.werefox.cafe"
] ]