import "./App.css"; import { Routes, Route } from "react-router-dom"; import Menu from "./components/menu"; import CreateNote from "./pages/create"; import Save from "./pages/save-local"; import Publish from "./pages/publish"; import NotePage from "./pages/note"; import Notes from "./pages/notes"; import PubNote from "./pages/pubNote"; import PubError from "./pages/pubError"; import PubNoteSafe from "./pages/pubNoteSafe"; import RenderMarkdown from "./components/markdown"; import socket from "./components/socket"; import Settings from "./pages/settings"; import Chat from "./pages/chat"; import Locales from "./localisation/main"; import { useState } from "react"; function App() { Storage.prototype.setObj = function (key, obj) { return this.setItem(key, JSON.stringify(obj)); }; Storage.prototype.getObj = function (key) { return JSON.parse(this.getItem(key)) || {}; }; const [key, setKey] = useState(Math.random()); window.settings = localStorage.getObj("settings") || {}; window.locals = Locales[window.settings.language] || Locales[navigator.language] || Locales[navigator.userLanguage] || Locales.en; window.addEventListener("reRenderPage", () => { setKey(Math.random()); }); return (