Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion client/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
registerServiceWorker,
setupServiceWorkerUpdates,
} from "./impl/load-service-worker";
import atob from "atob";

require("../assetify/client")();

Expand Down Expand Up @@ -245,7 +246,18 @@ export function renderBreakingNews(container, store, view, props) {

function getJsonContent(id) {
const element = global.document.getElementById(id);
if (element) return JSON.parse(element.textContent);
if (element) {
const content = element.textContent;
try {
if (atob(content)) {
return JSON.parse(atob(content));
}
} catch {
console.log('Looks like the content is not encrypted. Parsing regular content.');
}

return JSON.parse(content);
}
}

const performance = window.performance || { mark: () => {}, measure: () => {} };
Expand Down