diff --git a/.eslintrc.json b/.eslintrc.json index 79834c5..830efd5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -21,6 +21,7 @@ "BUILD_STRING": "writable" }, "rules": { + "import/no-named-as-default-member": "off", "no-unused-vars": ["off"], "@typescript-eslint/no-unused-vars": [ "error", @@ -48,6 +49,7 @@ "root": true, "parser": "@typescript-eslint/parser", "settings": { + "import/ignore": ["preact"], "import/resolver": { "node": { "extensions": [".js", ".ts", ".tsx"] diff --git a/package.json b/package.json index ff1deda..901fefa 100644 --- a/package.json +++ b/package.json @@ -13,38 +13,38 @@ "@typescript-eslint/eslint-plugin": "^5.9.0", "@typescript-eslint/parser": "^5.9.0", "babel-loader": "^8.2.3", - "clipboard": "^2.0.8", - "codejar": "^3.5.0", - "core-js": "^3.20.2", "css-loader": "^6.5.1", "css-minimizer-webpack-plugin": "^3.3.1", - "date-fns": "^2.28.0", "eslint": "^8.6.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.4", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", - "file-saver": "^2.0.5", "git-revision-webpack-plugin": "^5.0.0", "html-webpack-plugin": "^5.5.0", "i18next": "^21.6.5", "mini-css-extract-plugin": "^2.4.5", "node-sass": "^7.0.1", - "normalize.css": "^8.0.1", - "preact": "^10.6.4", "prettier": "^2.5.1", - "prismjs": "^1.25.0", - "qr-scanner": "^1.3.0", "raw-loader": "^4.0.2", "sass-loader": "^12.4.0", "ts-loader": "^9.2.6", "typescript": "^4.5.4", - "uikit": "^3.9.4", "webpack": "^5.65.0", "webpack-cli": "^4.9.1", "webpack-dev-server": "^4.7.2" }, "dependencies": { - "preact-router": "^4.0.0" + "preact-router": "^4.0.0", + "uikit": "^3.9.4", + "preact": "^10.6.4", + "prismjs": "^1.25.0", + "qr-scanner": "^1.3.0", + "normalize.css": "^8.0.1", + "file-saver": "^2.0.5", + "clipboard": "^2.0.8", + "codejar": "^3.5.0", + "core-js": "^3.20.2", + "date-fns": "^2.28.0" } } diff --git a/runLinter.sh b/runLinter.sh index 6b8db62..8925945 100755 --- a/runLinter.sh +++ b/runLinter.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash npx eslint --cache -c .eslintrc.json "$@" --ext .js,.ts,.tsx \ No newline at end of file diff --git a/src/api/API.ts b/src/api/API.ts index 89a7223..b1e4413 100644 --- a/src/api/API.ts +++ b/src/api/API.ts @@ -1,12 +1,6 @@ -import { Settings } from "../settings/Settings"; -import { DoesNotExistError } from "../types/internalErrors"; -import { removeDoubleSlash } from "../utils"; -import { BaseAPIResponse } from "./types/api"; import { AuthListAPIType, AuthListType } from "./types/auth"; +import { BaseAPIResponse } from "./types/api"; import { CapabilitiesType } from "./types/capabilities"; -import { MountsType, MountType, NewMountParams } from "./types/mount"; -import { SealStatusType } from "./types/seal"; -import { TokenInfo } from "./types/token"; import { DecryptionPayload, DecryptionResult, @@ -16,7 +10,14 @@ import { RewrapResult, TransitKeyType, } from "./types/transit"; +import { DoesNotExistError } from "../types/internalErrors"; +import { MountType, MountsType, NewMountParams } from "./types/mount"; +import { SealStatusType } from "./types/seal"; +import { SecretMetadataType } from "./types/secret"; +import { Settings } from "../settings/Settings"; +import { TokenInfo } from "./types/token"; import { UserType, UserTypeAPIResp } from "./types/user"; +import { removeDoubleSlash } from "../utils"; async function checkResponse(resp: Response): Promise { if (resp.ok) return; @@ -352,7 +353,6 @@ export class API { async deleteSecret(baseMount: string, secretPath: string[], name: string): Promise { let secretURL = ""; - let request; const mountInfo = await this.getMount(baseMount); if (mountInfo.options.version == "2") { @@ -361,7 +361,7 @@ export class API { secretURL = `/v1/${baseMount}/${secretPath.join("/")}/${name}`; } secretURL = removeDoubleSlash(secretURL).replace(/\/$/, ""); - request = new Request(this.appendAPIURL(secretURL), { + const request = new Request(this.appendAPIURL(secretURL), { method: "DELETE", headers: this.getHeaders(), }); diff --git a/src/api/types/secret.ts b/src/api/types/secret.ts index 3e2bec8..f65556c 100644 --- a/src/api/types/secret.ts +++ b/src/api/types/secret.ts @@ -1,3 +1,3 @@ -type SecretMetadataType = { +export type SecretMetadataType = { versions: Record; }; diff --git a/src/main.tsx b/src/main.tsx index 6b87944..875fd18 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -24,14 +24,14 @@ import translations from "./translations/index.mjs"; // Actual Imports import { formatDistance } from "./formatDistance"; //import { pageList } from "./allPages"; -import { render } from "preact"; +import { Main } from "./pages"; import { NavBar } from "./ui/elements/NavBar"; import { api } from "./globalAPI"; -import { settings } from "./globalSettings"; -import { playground } from "./playground"; -import i18next from "i18next"; -import { Main } from "./pages"; import { getCurrentUrl, route } from "preact-router"; +import { playground } from "./playground"; +import { render } from "preact"; +import { settings } from "./globalSettings"; +import i18next from "i18next"; async function onLoad(): Promise { document.documentElement.dir = settings.pageDirection; diff --git a/src/pageUtils.ts b/src/pageUtils.ts index 9147a2f..5b98b5c 100644 --- a/src/pageUtils.ts +++ b/src/pageUtils.ts @@ -1,9 +1,9 @@ +import { API } from "./api/API"; import { Settings } from "./settings/Settings"; import { route } from "preact-router"; import ClipboardJS from "clipboard"; import UIkit from "uikit"; import i18next from "i18next"; -import { API } from "./api/API"; async function prePageChecksReal(api: API, settings: Settings) { if (settings.language.length == 0) { diff --git a/src/pages.tsx b/src/pages.tsx index 4e98445..db0c242 100644 --- a/src/pages.tsx +++ b/src/pages.tsx @@ -1,47 +1,47 @@ -import Router from "preact-router"; -import { settings } from "./globalSettings"; import { api } from "./globalAPI"; +import { settings } from "./globalSettings"; +import Router from "preact-router"; +import { AccessHomePage } from "./ui/pages/Access/AccessHome"; +import { AuthHome } from "./ui/pages/Access/Auth/AuthHome"; +import { AuthViewConfig } from "./ui/pages/Access/Auth/AuthViewConfig"; import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine"; import { Home } from "./ui/pages/Home"; import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete"; -import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView"; import { KeyValueEdit } from "./ui/pages/Secrets/KeyValue/KeyValueEdit"; import { KeyValueList } from "./ui/pages/Secrets/KeyValue/KeyValueList"; +import { KeyValueNew } from "./ui/pages/Secrets/KeyValue/KeyValueNew"; +import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView"; import { Login } from "./ui/pages/Login"; import { Me } from "./ui/pages/Me"; 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 { TransitNew } from "./ui/pages/Secrets/Transit/TransitNew"; import { PasswordGenerator } from "./ui/pages/PwGen"; +import { PoliciesHome } from "./ui/pages/Policies/PoliciesHome"; +import { PolicyDelete } from "./ui/pages/Policies/PolicyDelete"; +import { PolicyEdit } from "./ui/pages/Policies/PolicyEdit"; +import { PolicyNew } from "./ui/pages/Policies/PolicyNew"; +import { PolicyView } from "./ui/pages/Policies/PolicyView"; 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 { TOTPList } from "./ui/pages/Secrets/TOTP/TOTPList"; -import { TransitList } from "./ui/pages/Secrets/Transit/TransitList"; -import { TransitView } from "./ui/pages/Secrets/Transit/TransitView"; -import { Unseal } from "./ui/pages/Unseal"; -import { KeyValueNew } from "./ui/pages/Secrets/KeyValue/KeyValueNew"; +import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew"; import { TransitDecrypt } from "./ui/pages/Secrets/Transit/TransitDecrypt"; import { TransitEncrypt } from "./ui/pages/Secrets/Transit/TransitEncrypt"; +import { TransitList } from "./ui/pages/Secrets/Transit/TransitList"; +import { TransitNew } from "./ui/pages/Secrets/Transit/TransitNew"; import { TransitRewrap } from "./ui/pages/Secrets/Transit/TransitRewrap"; -import { PoliciesHome } from "./ui/pages/Policies/PoliciesHome"; -import { PolicyView } from "./ui/pages/Policies/PolicyView"; -import { PolicyNew } from "./ui/pages/Policies/PolicyNew"; -import { PolicyDelete } from "./ui/pages/Policies/PolicyDelete"; -import { PolicyEdit } from "./ui/pages/Policies/PolicyEdit"; -import { AuthHome } from "./ui/pages/Access/Auth/AuthHome"; -import { AccessHomePage } from "./ui/pages/Access/AccessHome"; -import { AuthViewConfig } from "./ui/pages/Access/Auth/AuthViewConfig"; -import { UserPassUsersList } from "./ui/pages/Access/Auth/userpass/UserPassUsersList"; +import { TransitView } from "./ui/pages/Secrets/Transit/TransitView"; +import { Unseal } from "./ui/pages/Unseal"; import { UserPassUserDelete } from "./ui/pages/Access/Auth/userpass/UserPassUserDelete"; -import { UserPassUserView } from "./ui/pages/Access/Auth/userpass/UserPassUserView"; -import { UserPassUserNew } from "./ui/pages/Access/Auth/userpass/UserPassUserNew"; import { UserPassUserEdit } from "./ui/pages/Access/Auth/userpass/UserPassUserEdit"; +import { UserPassUserNew } from "./ui/pages/Access/Auth/userpass/UserPassUserNew"; +import { UserPassUserView } from "./ui/pages/Access/Auth/userpass/UserPassUserView"; +import { UserPassUsersList } from "./ui/pages/Access/Auth/userpass/UserPassUsersList"; export const Main = () => ( diff --git a/src/ui/elements/CopyableInputBox.tsx b/src/ui/elements/CopyableInputBox.tsx index 70cf353..f906b09 100644 --- a/src/ui/elements/CopyableInputBox.tsx +++ b/src/ui/elements/CopyableInputBox.tsx @@ -10,8 +10,7 @@ export type CopyableInputBoxProps = { }; export class CopyableInputBox extends Component { - copyIconRef = createRef(); - inputBoxRef = createRef(); + copyIconRef = createRef(); componentDidMount(): void { const clipboard = new ClipboardJS(this.copyIconRef.current); @@ -32,13 +31,7 @@ export class CopyableInputBox extends Component aria-label={i18next.t("copy_input_box_copy_icon_text")} /> )} - + ); diff --git a/src/ui/elements/CopyableModal.tsx b/src/ui/elements/CopyableModal.tsx index 7e4dbd9..0a9a90f 100644 --- a/src/ui/elements/CopyableModal.tsx +++ b/src/ui/elements/CopyableModal.tsx @@ -12,7 +12,7 @@ export type CopyableModalProps = { export class CopyableModal extends Component { ref = createRef(); - copyButtonRef = createRef(); + copyButtonRef = createRef(); saveAsFile(): void { const blob = new Blob([this.props.contentString], { diff --git a/src/ui/elements/Form.tsx b/src/ui/elements/Form.tsx index 2248416..3df2693 100644 --- a/src/ui/elements/Form.tsx +++ b/src/ui/elements/Form.tsx @@ -6,7 +6,7 @@ export type FormProps = { }; export class Form extends Component { - ref = createRef(); + ref = createRef(); render(): JSX.Element { return ( diff --git a/src/ui/elements/QRScanner.tsx b/src/ui/elements/QRScanner.tsx index 52c1e5e..2873ae2 100644 --- a/src/ui/elements/QRScanner.tsx +++ b/src/ui/elements/QRScanner.tsx @@ -1,8 +1,10 @@ /* eslint-disable import/no-unresolved */ +/* eslint-disable @typescript-eslint/no-unsafe-argument */ // @ts-ignore import qrScannerWorkerSource from "!!raw-loader!qr-scanner/qr-scanner-worker.min.js"; QrScanner.WORKER_PATH = URL.createObjectURL(new Blob([qrScannerWorkerSource])); // end ignore +/* eslint-enable */ import { Component, JSX, createRef } from "preact"; import { Margin } from "./Margin"; diff --git a/src/ui/pages/Access/AccessHome.tsx b/src/ui/pages/Access/AccessHome.tsx index 1a99891..9772a86 100644 --- a/src/ui/pages/Access/AccessHome.tsx +++ b/src/ui/pages/Access/AccessHome.tsx @@ -1,11 +1,11 @@ +import { Component } from "preact"; +import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { Grid, GridSizes } from "../../elements/Grid"; +import { PageTitle } from "../../elements/PageTitle"; import { Tile } from "../../elements/Tile"; import { notImplemented, prePageChecks } from "../../../pageUtils"; -import { Component } from "preact"; -import i18next from "i18next"; -import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { route } from "preact-router"; -import { PageTitle } from "../../elements/PageTitle"; +import i18next from "i18next"; export class AccessHomePage extends Component { async componentDidMount() { diff --git a/src/ui/pages/Access/Auth/AuthHome.tsx b/src/ui/pages/Access/Auth/AuthHome.tsx index 572d0e8..72913bc 100644 --- a/src/ui/pages/Access/Auth/AuthHome.tsx +++ b/src/ui/pages/Access/Auth/AuthHome.tsx @@ -1,12 +1,12 @@ import { AuthMethod } from "../../../../api/types/auth"; import { Component, JSX } from "preact"; -import { notImplemented } from "../../../../pageUtils"; -import { objectToMap } from "../../../../utils"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { PageTitle } from "../../../elements/PageTitle"; -import { route } from "preact-router"; import { authViewConfigURL, userPassUserListURL } from "../../pageLinks"; +import { notImplemented } from "../../../../pageUtils"; +import { objectToMap } from "../../../../utils"; +import { route } from "preact-router"; +import i18next from "i18next"; export type AuthListElementProps = { path: string; @@ -49,7 +49,7 @@ export function AuthListElement(props: AuthListElementProps): JSX.Element { ); } -export class AuthHome extends Component }> { +export class AuthHome extends Component }> { async componentDidMount() { const authList = objectToMap(await this.props.api.listAuth()) as Map; this.setState({ authList }); diff --git a/src/ui/pages/Access/Auth/AuthViewConfig.tsx b/src/ui/pages/Access/Auth/AuthViewConfig.tsx index d4c5c4d..fb7e975 100644 --- a/src/ui/pages/Access/Auth/AuthViewConfig.tsx +++ b/src/ui/pages/Access/Auth/AuthViewConfig.tsx @@ -1,10 +1,10 @@ import { AuthMethod } from "../../../../api/types/auth"; -import { HeaderAndContent } from "../../../elements/HeaderAndContent"; -import { objectToMap, toStr } from "../../../../utils"; import { Component } from "preact"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; +import { HeaderAndContent } from "../../../elements/HeaderAndContent"; import { PageTitle } from "../../../elements/PageTitle"; +import { objectToMap, toStr } from "../../../../utils"; +import i18next from "i18next"; export class AuthViewConfig extends Component { async componentDidMount() { diff --git a/src/ui/pages/Access/Auth/userpass/UserPassUserDelete.tsx b/src/ui/pages/Access/Auth/userpass/UserPassUserDelete.tsx index 6855a60..0c14055 100644 --- a/src/ui/pages/Access/Auth/userpass/UserPassUserDelete.tsx +++ b/src/ui/pages/Access/Auth/userpass/UserPassUserDelete.tsx @@ -1,9 +1,9 @@ import { Component } from "preact"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; import { PageTitle } from "../../../../elements/PageTitle"; import { route } from "preact-router"; import { userPassUserListURL } from "../../../pageLinks"; +import i18next from "i18next"; export class UserPassUserDelete extends Component { render() { diff --git a/src/ui/pages/Access/Auth/userpass/UserPassUserEdit.tsx b/src/ui/pages/Access/Auth/userpass/UserPassUserEdit.tsx index b591ea2..5eb0bec 100644 --- a/src/ui/pages/Access/Auth/userpass/UserPassUserEdit.tsx +++ b/src/ui/pages/Access/Auth/userpass/UserPassUserEdit.tsx @@ -1,16 +1,16 @@ +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; import { Form } from "../../../../elements/Form"; import { InputWithTitle } from "../../../../elements/InputWithTitle"; import { Margin } from "../../../../elements/Margin"; import { MarginInline } from "../../../../elements/MarginInline"; +import { PageTitle } from "../../../../elements/PageTitle"; import { UserType } from "../../../../../api/types/user"; -import { Component } from "preact"; +import { route } from "preact-router"; import { setErrorText } from "../../../../../pageUtils"; import { toStr } from "../../../../../utils"; -import i18next from "i18next"; -import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; -import { PageTitle } from "../../../../elements/PageTitle"; -import { route } from "preact-router"; import { userPassUserViewURL } from "../../../pageLinks"; +import i18next from "i18next"; const removeEmptyStrings = (arr: string[]) => arr.filter((e) => e.length > 0); diff --git a/src/ui/pages/Access/Auth/userpass/UserPassUserNew.tsx b/src/ui/pages/Access/Auth/userpass/UserPassUserNew.tsx index 37ed98a..bfb0c6f 100644 --- a/src/ui/pages/Access/Auth/userpass/UserPassUserNew.tsx +++ b/src/ui/pages/Access/Auth/userpass/UserPassUserNew.tsx @@ -1,14 +1,14 @@ +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; import { Form } from "../../../../elements/Form"; import { Margin } from "../../../../elements/Margin"; import { MarginInline } from "../../../../elements/MarginInline"; -import { UserType } from "../../../../../api/types/user"; -import { Component } from "preact"; -import { setErrorText } from "../../../../../pageUtils"; -import i18next from "i18next"; -import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; import { PageTitle } from "../../../../elements/PageTitle"; +import { UserType } from "../../../../../api/types/user"; import { route } from "preact-router"; +import { setErrorText } from "../../../../../pageUtils"; import { userPassUserViewURL } from "../../../pageLinks"; +import i18next from "i18next"; export class UserPassUserNew extends Component { render() { diff --git a/src/ui/pages/Access/Auth/userpass/UserPassUserView.tsx b/src/ui/pages/Access/Auth/userpass/UserPassUserView.tsx index 8e62094..2f2811c 100644 --- a/src/ui/pages/Access/Auth/userpass/UserPassUserView.tsx +++ b/src/ui/pages/Access/Auth/userpass/UserPassUserView.tsx @@ -1,13 +1,13 @@ +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; import { HeaderAndContent } from "../../../../elements/HeaderAndContent"; import { Margin } from "../../../../elements/Margin"; -import { Component } from "preact"; -import { toStr } from "../../../../../utils"; -import i18next from "i18next"; -import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; -import { UserType } from "../../../../../api/types/user"; import { PageTitle } from "../../../../elements/PageTitle"; +import { UserType } from "../../../../../api/types/user"; import { route } from "preact-router"; +import { toStr } from "../../../../../utils"; import { userPassUserDeleteURL, userPassUserEditURL } from "../../../pageLinks"; +import i18next from "i18next"; export class UserPassUserView extends Component { async componentDidMount() { diff --git a/src/ui/pages/Access/Auth/userpass/UserPassUsersList.tsx b/src/ui/pages/Access/Auth/userpass/UserPassUsersList.tsx index fd10f10..37fcb6f 100644 --- a/src/ui/pages/Access/Auth/userpass/UserPassUsersList.tsx +++ b/src/ui/pages/Access/Auth/userpass/UserPassUsersList.tsx @@ -1,9 +1,9 @@ import { Component } from "preact"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../../../types/DefaultPageProps"; +import { PageTitle } from "../../../../elements/PageTitle"; import { route } from "preact-router"; import { userPassUserNewURL, userPassUserViewURL } from "../../../pageLinks"; -import { PageTitle } from "../../../../elements/PageTitle"; +import i18next from "i18next"; export class UserPassUsersList extends Component { async componentDidMount() { diff --git a/src/ui/pages/Home.tsx b/src/ui/pages/Home.tsx index b5a107a..0ec4dbe 100644 --- a/src/ui/pages/Home.tsx +++ b/src/ui/pages/Home.tsx @@ -1,4 +1,5 @@ -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; +import { DefaultPageProps } from "../../types/DefaultPageProps"; import { Grid, GridSizes } from "../elements/Grid"; import { Margin } from "../elements/Margin"; import { PageTitle } from "../elements/PageTitle"; @@ -7,7 +8,6 @@ import { TokenInfo } from "../../api/types/token"; import { prePageChecks, setErrorText } from "../../pageUtils"; import { route } from "preact-router"; import i18next from "i18next"; -import { DefaultPageProps } from "../../types/DefaultPageProps"; type HomeState = { selfTokenInfo: TokenInfo; diff --git a/src/ui/pages/Login.tsx b/src/ui/pages/Login.tsx index fb249c1..71fcd9b 100644 --- a/src/ui/pages/Login.tsx +++ b/src/ui/pages/Login.tsx @@ -1,4 +1,4 @@ -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; import { DefaultPageProps } from "../../types/DefaultPageProps"; import { Form } from "../elements/Form"; import { Margin } from "../elements/Margin"; diff --git a/src/ui/pages/Me.tsx b/src/ui/pages/Me.tsx index 42fef50..392ef0c 100644 --- a/src/ui/pages/Me.tsx +++ b/src/ui/pages/Me.tsx @@ -7,7 +7,7 @@ import ClipboardJS from "clipboard"; import i18next from "i18next"; export class CopyLink extends Component<{ text: string; data: string }, unknown> { - linkRef = createRef(); + linkRef = createRef(); componentDidMount(): void { const clipboard = new ClipboardJS(this.linkRef.current); diff --git a/src/ui/pages/Policies/PoliciesHome.tsx b/src/ui/pages/Policies/PoliciesHome.tsx index 4b38c3a..b822fdf 100644 --- a/src/ui/pages/Policies/PoliciesHome.tsx +++ b/src/ui/pages/Policies/PoliciesHome.tsx @@ -1,11 +1,11 @@ -import { Margin } from "../../elements/Margin"; -import { prePageChecks } from "../../../pageUtils"; import { Component } from "preact"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../types/DefaultPageProps"; +import { Margin } from "../../elements/Margin"; import { PageTitle } from "../../elements/PageTitle"; -import { route } from "preact-router"; import { policyNewURL, policyViewURL } from "../pageLinks"; +import { prePageChecks } from "../../../pageUtils"; +import { route } from "preact-router"; +import i18next from "i18next"; export class PoliciesHome extends Component { async componentDidMount() { diff --git a/src/ui/pages/Policies/PolicyDelete.tsx b/src/ui/pages/Policies/PolicyDelete.tsx index aafdd1c..533b3fe 100644 --- a/src/ui/pages/Policies/PolicyDelete.tsx +++ b/src/ui/pages/Policies/PolicyDelete.tsx @@ -1,9 +1,9 @@ import { Component } from "preact"; -import { setErrorText } from "../../../pageUtils"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { PageTitle } from "../../elements/PageTitle"; import { route } from "preact-router"; +import { setErrorText } from "../../../pageUtils"; +import i18next from "i18next"; export class PolicyDelete extends Component { render() { diff --git a/src/ui/pages/Policies/PolicyEdit.tsx b/src/ui/pages/Policies/PolicyEdit.tsx index f844eef..fe713e6 100644 --- a/src/ui/pages/Policies/PolicyEdit.tsx +++ b/src/ui/pages/Policies/PolicyEdit.tsx @@ -1,13 +1,13 @@ import { CodeEditor } from "../../elements/CodeEditor"; -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; +import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { Margin } from "../../elements/Margin"; import { MarginInline } from "../../elements/MarginInline"; +import { PageTitle } from "../../elements/PageTitle"; +import { policyViewURL } from "../pageLinks"; +import { route } from "preact-router"; import { setErrorText } from "../../../pageUtils"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../types/DefaultPageProps"; -import { PageTitle } from "../../elements/PageTitle"; -import { route } from "preact-router"; -import { policyViewURL } from "../pageLinks"; type PolicyEditorProps = DefaultPageProps & { policyName: string; diff --git a/src/ui/pages/Policies/PolicyNew.tsx b/src/ui/pages/Policies/PolicyNew.tsx index 274261d..89cc5c3 100644 --- a/src/ui/pages/Policies/PolicyNew.tsx +++ b/src/ui/pages/Policies/PolicyNew.tsx @@ -1,12 +1,12 @@ +import { Component } from "preact"; +import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { Form } from "../../elements/Form"; import { Margin } from "../../elements/Margin"; -import { Component } from "preact"; +import { PageTitle } from "../../elements/PageTitle"; +import { policyViewURL } from "../pageLinks"; +import { route } from "preact-router"; import { setErrorText } from "../../../pageUtils"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../types/DefaultPageProps"; -import { PageTitle } from "../../elements/PageTitle"; -import { route } from "preact-router"; -import { policyViewURL } from "../pageLinks"; export class PolicyNew extends Component { render() { diff --git a/src/ui/pages/Policies/PolicyView.tsx b/src/ui/pages/Policies/PolicyView.tsx index 3f034f1..0dec434 100644 --- a/src/ui/pages/Policies/PolicyView.tsx +++ b/src/ui/pages/Policies/PolicyView.tsx @@ -1,12 +1,12 @@ import { CodeBlock } from "../../elements/CodeBlock"; -import { Margin } from "../../elements/Margin"; -import { prePageChecks } from "../../../pageUtils"; import { Component } from "preact"; -import i18next from "i18next"; import { DefaultPageProps } from "../../../types/DefaultPageProps"; +import { Margin } from "../../elements/Margin"; import { PageTitle } from "../../elements/PageTitle"; -import { route } from "preact-router"; import { policyDeleteURL, policyEditURL } from "../pageLinks"; +import { prePageChecks } from "../../../pageUtils"; +import { route } from "preact-router"; +import i18next from "i18next"; export class PolicyView extends Component< DefaultPageProps, diff --git a/src/ui/pages/PwGen.tsx b/src/ui/pages/PwGen.tsx index 041719e..eaba998 100644 --- a/src/ui/pages/PwGen.tsx +++ b/src/ui/pages/PwGen.tsx @@ -1,10 +1,10 @@ -import { Component, JSX, createRef, render } from "preact"; +import { Component, JSX, createRef } from "preact"; import { CopyableInputBox } from "../elements/CopyableInputBox"; +import { DefaultPageProps } from "../../types/DefaultPageProps"; import { Form } from "../elements/Form"; import { Margin } from "../elements/Margin"; import { PageTitle } from "../elements/PageTitle"; import i18next from "i18next"; -import { DefaultPageProps } from "../../types/DefaultPageProps"; const passwordLengthMin = 1; const passwordLengthMax = 64; diff --git a/src/ui/pages/Secrets/DeleteSecretsEngine.tsx b/src/ui/pages/Secrets/DeleteSecretsEngine.tsx index 00db74f..1526d28 100644 --- a/src/ui/pages/Secrets/DeleteSecretsEngine.tsx +++ b/src/ui/pages/Secrets/DeleteSecretsEngine.tsx @@ -1,4 +1,4 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { Form } from "../../elements/Form"; import { MarginInline } from "../../elements/MarginInline"; diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx index f97b4f5..699f613 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueDelete.tsx @@ -1,4 +1,4 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { SecretTitleElement } from "../SecretTitleElement"; import i18next from "i18next"; diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx index 037662b..2286cf0 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueEdit.tsx @@ -43,7 +43,7 @@ export class KVEditor extends Component { this.props.baseMount, this.props.secretPath.map((e) => e + "/"), this.props.secretItem, - JSON.parse(editorContent), + JSON.parse(editorContent) as unknown as Record, ); window.history.back(); } diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueList.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueList.tsx index 9c043aa..95817de 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueList.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueList.tsx @@ -1,4 +1,4 @@ -import { Component, JSX, createRef, render } from "preact"; +import { Component, JSX, createRef } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { DoesNotExistError } from "../../../../types/internalErrors"; import { SecretTitleElement } from "../SecretTitleElement"; diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx index 3dfc1ec..23308ae 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueNew.tsx @@ -1,4 +1,4 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; diff --git a/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx b/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx index 1732f52..36c4a4d 100644 --- a/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx +++ b/src/ui/pages/Secrets/KeyValue/KeyValueView.tsx @@ -1,5 +1,5 @@ import { CodeBlock } from "../../../elements/CodeBlock"; -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; import { CopyableInputBox } from "../../../elements/CopyableInputBox"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Grid, GridSizes } from "../../../elements/Grid"; diff --git a/src/ui/pages/Secrets/NewEngines/NewKVEngine.tsx b/src/ui/pages/Secrets/NewEngines/NewKVEngine.tsx index 06527d3..fa6c103 100644 --- a/src/ui/pages/Secrets/NewEngines/NewKVEngine.tsx +++ b/src/ui/pages/Secrets/NewEngines/NewKVEngine.tsx @@ -1,4 +1,5 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; import { MarginInline } from "../../../elements/MarginInline"; @@ -7,7 +8,6 @@ import { kvListURL } from "../../pageLinks"; import { route } from "preact-router"; import { setErrorText } from "../../../../pageUtils"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; export class NewKVEngine extends Component { render() { diff --git a/src/ui/pages/Secrets/NewEngines/NewTOTPEngine.tsx b/src/ui/pages/Secrets/NewEngines/NewTOTPEngine.tsx index a0841fd..4cdd38d 100644 --- a/src/ui/pages/Secrets/NewEngines/NewTOTPEngine.tsx +++ b/src/ui/pages/Secrets/NewEngines/NewTOTPEngine.tsx @@ -1,4 +1,5 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; import { MarginInline } from "../../../elements/MarginInline"; @@ -7,7 +8,6 @@ import { route } from "preact-router"; import { setErrorText } from "../../../../pageUtils"; import { totpListURL } from "../../pageLinks"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; export class NewTOTPEngine extends Component { render() { diff --git a/src/ui/pages/Secrets/NewEngines/NewTransitEngine.tsx b/src/ui/pages/Secrets/NewEngines/NewTransitEngine.tsx index c730972..2b660f7 100644 --- a/src/ui/pages/Secrets/NewEngines/NewTransitEngine.tsx +++ b/src/ui/pages/Secrets/NewEngines/NewTransitEngine.tsx @@ -1,4 +1,5 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; import { MarginInline } from "../../../elements/MarginInline"; @@ -6,7 +7,6 @@ import { PageTitle } from "../../../elements/PageTitle"; import { route } from "preact-router"; import { setErrorText } from "../../../../pageUtils"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; export class NewTransitEngine extends Component { render() { diff --git a/src/ui/pages/Secrets/NewSecretsEngine.tsx b/src/ui/pages/Secrets/NewSecretsEngine.tsx index a69f0e1..8f1bc57 100644 --- a/src/ui/pages/Secrets/NewSecretsEngine.tsx +++ b/src/ui/pages/Secrets/NewSecretsEngine.tsx @@ -1,10 +1,10 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; +import { DefaultPageProps } from "../../../types/DefaultPageProps"; import { Grid, GridSizes } from "../../elements/Grid"; import { PageTitle } from "../../elements/PageTitle"; import { Tile } from "../../elements/Tile"; import { route } from "preact-router"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../types/DefaultPageProps"; export class NewSecretsEngine extends Component { render() { diff --git a/src/ui/pages/Secrets/SecretsHome.tsx b/src/ui/pages/Secrets/SecretsHome.tsx index 73c6a05..cfe56c8 100644 --- a/src/ui/pages/Secrets/SecretsHome.tsx +++ b/src/ui/pages/Secrets/SecretsHome.tsx @@ -1,11 +1,11 @@ -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; import { DefaultPageProps } from "../../../types/DefaultPageProps"; +import { MountType } from "../../../api/types/mount"; import { PageTitle } from "../../elements/PageTitle"; import { prePageChecks } from "../../../pageUtils"; import { route } from "preact-router"; import { sortedObjectMap } from "../../../utils"; import i18next from "i18next"; -import { MountType } from "../../../api/types/mount"; const supportedMountTypes = ["kv", "totp", "transit", "cubbyhole"]; diff --git a/src/ui/pages/Secrets/TOTP/TOTPDelete.tsx b/src/ui/pages/Secrets/TOTP/TOTPDelete.tsx index ae5f37a..4fc551b 100644 --- a/src/ui/pages/Secrets/TOTP/TOTPDelete.tsx +++ b/src/ui/pages/Secrets/TOTP/TOTPDelete.tsx @@ -1,4 +1,4 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { SecretTitleElement } from "../SecretTitleElement"; import { route } from "preact-router"; diff --git a/src/ui/pages/Secrets/TOTP/TOTPList.tsx b/src/ui/pages/Secrets/TOTP/TOTPList.tsx index 247f68f..7091303 100644 --- a/src/ui/pages/Secrets/TOTP/TOTPList.tsx +++ b/src/ui/pages/Secrets/TOTP/TOTPList.tsx @@ -1,3 +1,4 @@ +import { CapabilitiesType } from "../../../../api/types/capabilities"; import { Component, JSX } from "preact"; import { CopyableInputBox } from "../../../elements/CopyableInputBox"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; @@ -10,7 +11,6 @@ import { removeDoubleSlash } from "../../../../utils"; import { route } from "preact-router"; import { setErrorText } from "../../../../pageUtils"; import i18next from "i18next"; -import { CapabilitiesType } from "../../../../api/types/capabilities"; type TOTPGridItemProps = DefaultPageProps & { baseMount: string; diff --git a/src/ui/pages/Secrets/TOTP/TOTPNew.tsx b/src/ui/pages/Secrets/TOTP/TOTPNew.tsx index 0adaa9f..c4532d5 100644 --- a/src/ui/pages/Secrets/TOTP/TOTPNew.tsx +++ b/src/ui/pages/Secrets/TOTP/TOTPNew.tsx @@ -1,4 +1,4 @@ -import { Component, JSX, createRef, render } from "preact"; +import { Component, JSX, createRef } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; diff --git a/src/ui/pages/Secrets/Transit/TransitDecrypt.tsx b/src/ui/pages/Secrets/Transit/TransitDecrypt.tsx index 4113cdb..e4276ab 100644 --- a/src/ui/pages/Secrets/Transit/TransitDecrypt.tsx +++ b/src/ui/pages/Secrets/Transit/TransitDecrypt.tsx @@ -1,15 +1,15 @@ +import { Component, render } from "preact"; import { CopyableModal } from "../../../elements/CopyableModal"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { FileUploadInput } from "../../../elements/FileUploadInput"; import { Form } from "../../../elements/Form"; import { InputWithTitle } from "../../../elements/InputWithTitle"; import { Margin } from "../../../elements/Margin"; import { SecretTitleElement } from "../SecretTitleElement"; import { fileToBase64 } from "../../../../htmlUtils"; -import { Component, render } from "preact"; import { setErrorText } from "../../../../pageUtils"; import UIkit from "uikit"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; export class TransitDecrypt extends Component { render() { diff --git a/src/ui/pages/Secrets/Transit/TransitEncrypt.tsx b/src/ui/pages/Secrets/Transit/TransitEncrypt.tsx index 96ea08a..d36d9f0 100644 --- a/src/ui/pages/Secrets/Transit/TransitEncrypt.tsx +++ b/src/ui/pages/Secrets/Transit/TransitEncrypt.tsx @@ -1,15 +1,15 @@ +import { Component, render } from "preact"; import { CopyableModal } from "../../../elements/CopyableModal"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { FileUploadInput } from "../../../elements/FileUploadInput"; import { Form } from "../../../elements/Form"; import { InputWithTitle } from "../../../elements/InputWithTitle"; import { Margin } from "../../../elements/Margin"; import { SecretTitleElement } from "../SecretTitleElement"; import { fileToBase64 } from "../../../../htmlUtils"; -import { Component, render } from "preact"; import { setErrorText } from "../../../../pageUtils"; import UIkit from "uikit"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; export class TransitEncrypt extends Component { render() { diff --git a/src/ui/pages/Secrets/Transit/TransitList.tsx b/src/ui/pages/Secrets/Transit/TransitList.tsx index 633735a..b6b0f70 100644 --- a/src/ui/pages/Secrets/Transit/TransitList.tsx +++ b/src/ui/pages/Secrets/Transit/TransitList.tsx @@ -1,10 +1,10 @@ +import { CapabilitiesType } from "../../../../api/types/capabilities"; import { Component, JSX } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { SecretTitleElement } from "../SecretTitleElement"; import { delSecretsEngineURL, transitNewSecretURL, transitViewSecretURL } from "../../pageLinks"; import { route } from "preact-router"; import i18next from "i18next"; -import { CapabilitiesType } from "../../../../api/types/capabilities"; type TransitViewListState = { contentLoaded: boolean; diff --git a/src/ui/pages/Secrets/Transit/TransitRewrap.tsx b/src/ui/pages/Secrets/Transit/TransitRewrap.tsx index e82471f..bdb556c 100644 --- a/src/ui/pages/Secrets/Transit/TransitRewrap.tsx +++ b/src/ui/pages/Secrets/Transit/TransitRewrap.tsx @@ -1,14 +1,14 @@ +import { Component, render } from "preact"; import { CopyableModal } from "../../../elements/CopyableModal"; +import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Form } from "../../../elements/Form"; import { Margin } from "../../../elements/Margin"; import { SecretTitleElement } from "../SecretTitleElement"; +import { TransitKeyType } from "../../../../api/types/transit"; import { objectToMap } from "../../../../utils"; -import { Component, render } from "preact"; import { setErrorText } from "../../../../pageUtils"; import UIkit from "uikit"; import i18next from "i18next"; -import { DefaultPageProps } from "../../../../types/DefaultPageProps"; -import { TransitKeyType } from "../../../../api/types/transit"; type versionOption = { version: string; label: string }; diff --git a/src/ui/pages/Secrets/Transit/TransitView.tsx b/src/ui/pages/Secrets/Transit/TransitView.tsx index 94b275b..1bdb8fe 100644 --- a/src/ui/pages/Secrets/Transit/TransitView.tsx +++ b/src/ui/pages/Secrets/Transit/TransitView.tsx @@ -1,16 +1,16 @@ -import { Component, render } from "preact"; +import { Component } from "preact"; import { DefaultPageProps } from "../../../../types/DefaultPageProps"; import { Grid, GridSizes } from "../../../elements/Grid"; import { SecretTitleElement } from "../SecretTitleElement"; import { Tile } from "../../../elements/Tile"; import { TransitKeyType } from "../../../../api/types/transit"; -import i18next from "i18next"; import { route } from "preact-router"; import { transitDecryptSecretURL, transitEncryptSecretURL, transitRewrapSecretURL, } from "../../pageLinks"; +import i18next from "i18next"; export class TransitView extends Component { async componentDidMount() { diff --git a/src/ui/pages/SetLanguage.tsx b/src/ui/pages/SetLanguage.tsx index 84d8d00..7d95e6a 100644 --- a/src/ui/pages/SetLanguage.tsx +++ b/src/ui/pages/SetLanguage.tsx @@ -3,7 +3,7 @@ import translations from "../../translations/index.mjs"; // ts-unignore import { Component } from "preact"; -import { DefaultPageProps } from "../../types/DefaultPageProps.js"; +import { DefaultPageProps } from "../../types/DefaultPageProps"; import { Form } from "../elements/Form"; import { Margin } from "../elements/Margin"; import { MarginInline } from "../elements/MarginInline"; diff --git a/src/ui/pages/Unseal.tsx b/src/ui/pages/Unseal.tsx index dd39c57..5c522a8 100644 --- a/src/ui/pages/Unseal.tsx +++ b/src/ui/pages/Unseal.tsx @@ -1,9 +1,9 @@ -import { Component, JSX, render } from "preact"; +import { Component, JSX } from "preact"; +import { DefaultPageProps } from "../../types/DefaultPageProps"; import { Form } from "../elements/Form"; import { MarginInline } from "../elements/MarginInline"; -import { QRScanner } from "../elements/QRScanner"; -import { DefaultPageProps } from "../../types/DefaultPageProps"; import { PageTitle } from "../elements/PageTitle"; +import { QRScanner } from "../elements/QRScanner"; import { route } from "preact-router"; import { setErrorText } from "../../pageUtils"; import { toStr } from "../../utils"; diff --git a/tsconfig.json b/tsconfig.json index bc53fc8..20c13d6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,4 +12,4 @@ "jsx": "react-jsx", "jsxImportSource": "preact", } -} +} \ No newline at end of file