"use strict"; // JS & CSS /* eslint-disable */ import "./scss/main.scss"; import UIkit from 'uikit'; // Don't Sort These! import Icons from 'uikit/dist/js/uikit-icons'; // @ts-ignore UIkit.use(Icons); import Prism from "prismjs"; // Don't Sort These! import "prismjs/components/prism-hcl"; import "prismjs/components/prism-json"; Prism.highlightAll(); /* eslint-enable */ // @ts-ignore import translations from "./translations/index.mjs"; // Actual Imports import { PageRouter } from "./pagerouter/PageRouter"; import { formatDistance } from "./formatDistance"; import { getSealStatus } from "./api/sys/getSealStatus"; //import { pageList } from "./allPages"; import { Component, render } from "preact"; import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine"; import { Home } from "./ui/pages/Home"; import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete"; import { KeyValueSecret } from "./ui/pages/Secrets/KeyValue/KeyValueSecret"; import { KeyValueSecretEdit } from "./ui/pages/Secrets/KeyValue/KeyValueSecretsEdit"; import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView"; import { Login } from "./ui/pages/Login"; import { Me } from "./ui/pages/Me"; import { NavBar } from "./ui/elements/NavBar"; import { NewKVEngine } from "./ui/pages/Secrets/NewEngines/NewKVEngine"; import { NewSecretsEngine } from "./ui/pages/Secrets/NewSecretsEngine"; import { NewTOTPEngine } from "./ui/pages/Secrets/NewEngines/NewTOTPEngine"; import { NewTransitEngine } from "./ui/pages/Secrets/NewEngines/NewTransitEngine"; import { NewTransitKey } from "./ui/pages/Secrets/Transit/NewTransitKey"; import { PasswordGenerator } from "./ui/pages/PwGen"; import { Secrets } from "./ui/pages/Secrets/SecretsHome"; import { SetLanguage } from "./ui/pages/SetLanguage"; import { SetVaultURL } from "./ui/pages/SetVaultURL"; import { TOTPDelete } from "./ui/pages/Secrets/TOTP/TOTPDelete"; import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew"; import { TOTPView } from "./ui/pages/Secrets/TOTP/TOTPView"; import { TransitView } from "./ui/pages/Secrets/Transit/TransitView"; import { TransitViewSecret } from "./ui/pages/Secrets/Transit/TransitViewSecret"; import { Unseal } from "./ui/pages/Unseal"; import { pageState } from "./globalPageState"; import { playground } from "./playground"; import Router from "preact-router"; import i18next from "i18next"; async function onLoad(): Promise { const Main = () => (

PAGE NOT YET IMPLEMENTED

); render( <>
, document.body, ); //const pageRouter = new PageRouter({ // pageList: pageList, // state: pageState, // pageTitleElement: document.querySelector("#pageTitle"), // pageContentElement: document.querySelector("#pageContent"), // resetElementContent: !true, // onPageChange: async function () { // pageState.currentPage = await pageRouter.getCurrentPageID(); // document.documentElement.dir = pageState.pageDirection; // }, //}); // //reloadNavBar(pageRouter); if (process.env.NODE_ENV == "development") { // await playground(pageRouter); } //await pageRouter.changePage(pageState.currentPage); //setInterval(async () => { // if ((await pageRouter.getCurrentPageID()) != "UNSEAL") { // if (pageState.apiURL.length != 0) { // return; // } // const sealStatus = await getSealStatus(); // if (sealStatus.sealed) { // await pageRouter.changePage("UNSEAL"); // return; // } // } //}, 5000); } document.addEventListener( "DOMContentLoaded", async () => { console.log("Loading..."); // @ts-expect-error console.log("Build Data:", BUILD_STRING); await i18next.init({ lng: pageState.language, fallbackLng: "en", debug: true, // @ts-ignore resources: Object.fromEntries( Object.entries(translations).map(([k, v]) => [k, { translation: v }]), ), interpolation: { escape: (str) => { return str; }, format: function (value: unknown, format, _): string { if (format === "until_date" && value instanceof Date) return formatDistance(new Date(), new Date(value), pageState.language); return value as string; }, }, }); await onLoad(); }, false, );