Commit 3b08a33c authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Booth: use URLs relative to the election

We assume the election URL is $PREFIX/elections/$UUID/election.json,
and we use URLs relative to $PREFIX elsewhere. For compatibility with
reverse-proxies.
parent 4901270e
......@@ -83,7 +83,7 @@ window.onbeforeunload = function(evt) {
BOOTH.exit = function() {
if (confirm("Are you sure you want to exit the booth and lose all information about your current ballot?")) {
BOOTH.started_p = false;
window.location = "/election/?uuid=" + BOOTH.election.uuid;
window.location = BOOTH.server_url + "/election/?uuid=" + BOOTH.election.uuid;
}
};
......@@ -165,7 +165,7 @@ BOOTH.setup_election = function(raw_json) {
// the main reason for this is unicode representation: the Python approach
// appears to be safer.
BOOTH.election = HELIOS.Election.fromJSONString(raw_json);
BOOTH.election.cast_url = "/election/cast?uuid=" + BOOTH.election.uuid
BOOTH.election.cast_url = BOOTH.server_url + "/election/cast?uuid=" + BOOTH.election.uuid
// FIXME: we shouldn't need to set both, but right now we are doing so
// because different code uses each one. Bah. Need fixing.
......@@ -326,6 +326,8 @@ BOOTH.show_encryption_message_before = function(func_to_execute) {
};
BOOTH.load_and_setup_election = function(election_url) {
BOOTH.server_url = election_url.split("/").slice(0,-3).join("/");
// the hash will be computed within the setup function call now
$.get(election_url, function(raw_json) {
raw_json = raw_json.trim();
......@@ -337,7 +339,7 @@ BOOTH.load_and_setup_election = function(election_url) {
if (USE_SJCL) {
// get more randomness from server
$.getJSON("/get-randomness", {}, function(result) {
$.getJSON(BOOTH.server_url + "/get-randomness", {}, function(result) {
sjcl.random.addEntropy(result.randomness);
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment