Cookie Fix

This commit is contained in:
ebolam
2022-09-08 18:00:57 -04:00
parent c4ec92abdf
commit eb0f59bdfb
2 changed files with 4 additions and 1 deletions

View File

@@ -7694,9 +7694,12 @@ def UI_2_theme_list_refresh(data):
#==================================================================#
@socketio.on('save_cookies')
def UI_2_save_cookies(data):
print("Adding: {}".format(data))
print("to: {}".format(koboldai_vars.cookies))
for key in data:
#Note this won't sync to the client automatically as we're modifying a variable rather than setting it
koboldai_vars.cookies[key] = data[key]
print("Updated: {}".format(koboldai_vars.cookies))
with open("./settings/cookies.settings", "w") as f:
f.write(json.dumps(koboldai_vars.cookies))

View File

@@ -3097,7 +3097,7 @@ function setCookie(cname, cvalue, exdays=60) {
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
let expires = "expires="+d.toUTCString();
if (document.getElementById("on_colab").textContent == "true") {
socket.emit("save_cookies", {cname: cvavlue});
socket.emit("save_cookies", {[cname]: cvalue});
}
document.cookie = cname + "=" + cvalue + ";" + expires + ";";
}