From 7887fa360bb3480609689eb1b58d85aa8a2e9469 Mon Sep 17 00:00:00 2001 From: Wolvan Date: Sat, 8 Jan 2022 16:12:51 +0100 Subject: [PATCH] Fix votes from breaking server side rendering --- frontend/static/js/result.js | 2 +- src/frontend.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/static/js/result.js b/frontend/static/js/result.js index a3ce44d..62a480a 100644 --- a/frontend/static/js/result.js +++ b/frontend/static/js/result.js @@ -35,7 +35,7 @@ function domLoaded() { }; try { - drawChart(JSON.parse(POLL_VOTE_DATA_STRING)); + drawChart(JSON.parse(window.atob(POLL_VOTE_DATA_STRING))); } catch (error) { // eh } diff --git a/src/frontend.ts b/src/frontend.ts index a08e6be..9a2ea3f 100644 --- a/src/frontend.ts +++ b/src/frontend.ts @@ -123,7 +123,7 @@ export default function init(router: Router): void { "POLL_OPTION_DIVS": pollOptionsDivs, "POLL_VOTES_TOTAL": totalVotes, "BACKEND_BASE_PATH": (program.opts().backendBaseUrl || ""), - "POLL_OPTION_VOTES": JSON.stringify(Object.entries(poll.votes)) + "POLL_OPTION_VOTES": Buffer.from(JSON.stringify(Object.entries(poll.votes))).toString("base64") }); } catch (error) { console.log(error);