Backend appdata path won't update when any form is submitted, just when form to update settings is submitted.
This commit is contained in:
parent
d022243e5a
commit
5a1a5ac326
@ -61,8 +61,11 @@ async function get_updated_server_address() {
|
||||
)
|
||||
.then(
|
||||
(data) => {
|
||||
server_address = JSON.parse(JSON.stringify(data));
|
||||
get_updated_filepath();
|
||||
parsed_data = JSON.parse(JSON.stringify(data));
|
||||
server_address = parsed_data["listen_address"];
|
||||
if (parsed_data["backend_filepath_updated"]) {
|
||||
get_updated_filepath();
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
|
@ -21,6 +21,8 @@ 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(
|
||||
@ -59,7 +61,8 @@ def index(request):
|
||||
with open('tracker/static/tracker/data/holy_cross_codes.json', 'r') as t:
|
||||
try:
|
||||
temp_codes = loads(t.read())
|
||||
cross_codes = { x: { k: l.replace('U', '⬆️').replace('D', '⬇️').replace('L', '⬅️').replace('R', '➡️').strip() for k,l in temp_codes[x].items() } for x in temp_codes.keys() }
|
||||
cross_codes = {x: {k: l.replace('U', '⬆️').replace('D', '⬇️').replace('L', '⬅️').replace(
|
||||
'R', '➡️').strip() for k, l in temp_codes[x].items()} for x in temp_codes.keys()}
|
||||
except:
|
||||
return
|
||||
tracker_debug = tracker_output['Debug']
|
||||
@ -103,7 +106,7 @@ def index(request):
|
||||
|
||||
def get_address(request):
|
||||
if request.method == 'GET':
|
||||
return HttpResponse(dumps(request.session['listen_address']), content_type="application/json")
|
||||
return HttpResponse(dumps({'listen_address': request.session['listen_address'], 'backend_filepath_update': request.session['backend_filepath_updated']}), content_type="application/json")
|
||||
else:
|
||||
return render(request, 'tracker/index.html')
|
||||
|
||||
@ -124,6 +127,7 @@ def set_settings(request):
|
||||
form = BackendFilepathForm(request.POST)
|
||||
if form.is_valid():
|
||||
request.session['backend_filepath'] = form.cleaned_data['backend_filepath_form']
|
||||
request.session['backend_filepath_updated'] = True
|
||||
return HttpResponseRedirect('/')
|
||||
else:
|
||||
form = BackendFilepathForm()
|
||||
@ -132,6 +136,7 @@ def set_settings(request):
|
||||
|
||||
def get_settings(request):
|
||||
if request.method == 'GET':
|
||||
request.session['backend_filepath_updated'] = False
|
||||
return HttpResponse(dumps(request.session['backend_filepath']), content_type="application/json")
|
||||
else:
|
||||
return render(request, 'tracker/index.html')
|
||||
|
Loading…
Reference in New Issue
Block a user