mirror of https://github.com/kurisufriend/frontend
parent
d481ac7935
commit
4c9a56f4cc
@ -1,17 +0,0 @@ |
|||||||
function get_instance() { |
|
||||||
var addr = "test.cynic.moe"; |
|
||||||
var cookie = document.cookie; |
|
||||||
if(cookie != "") { |
|
||||||
addr = decodeURIComponent(cookie).split(";")[0].split("=")[1]; |
|
||||||
} |
|
||||||
return addr; |
|
||||||
} |
|
||||||
|
|
||||||
function set_instance(addr) { |
|
||||||
var str = "Instance="+addr+"; SameSite=Lax;"; |
|
||||||
document.cookie = str; |
|
||||||
} |
|
||||||
|
|
||||||
function clear_instance() { |
|
||||||
document.cookie = "Instance=test.cynic.moe; SameSite=Lax;"; |
|
||||||
} |
|
@ -0,0 +1,13 @@ |
|||||||
|
const DEFAULT_INSTANCE = "test.cynic.moe"; |
||||||
|
|
||||||
|
function get_instance() { |
||||||
|
return localStorage.getItem("instance") || DEFAULT_INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
function set_instance(addr) { |
||||||
|
localStorage.setItem("instance", addr); |
||||||
|
} |
||||||
|
|
||||||
|
function clear_instance() { |
||||||
|
localStorage.setItem("instance", DEFAULT_INSTANCE); |
||||||
|
} |
Loading…
Reference in new issue