Sort imports and lint code.
This commit is contained in:
parent
7479fc2ed9
commit
79257dfb13
|
@ -4,6 +4,9 @@ extends:
|
|||
- plugin:import/errors
|
||||
- plugin:import/warnings
|
||||
|
||||
plugins:
|
||||
- sort-imports-es6-autofix
|
||||
|
||||
parserOptions:
|
||||
ecmaVersion: 8
|
||||
sourceType: module
|
||||
|
@ -19,6 +22,8 @@ rules:
|
|||
no-unused-vars:
|
||||
- 2
|
||||
- argsIgnorePattern: ^_
|
||||
sort-imports-es6-autofix/sort-imports-es6:
|
||||
- 2
|
||||
|
||||
env:
|
||||
browser: true
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"date-fns": "^2.21.1",
|
||||
"eslint": "^7.24.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
|
||||
"file-saver": "^2.0.5",
|
||||
"html-webpack-plugin": "^5.3.1",
|
||||
"i18next": "^20.2.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIURL, getToken, removeDoubleSlash } from "./utils.js";
|
||||
import { DoesNotExistError } from "./types/internalErrors.js";
|
||||
import { getAPIURL, getToken, removeDoubleSlash } from "./utils.js";
|
||||
|
||||
export async function lookupSelf() {
|
||||
const request = new Request(getAPIURL() + "/v1/auth/token/lookup-self", {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import ClipboardJS from "clipboard";
|
||||
import { MarginInline } from "./MarginInline.js";
|
||||
import { addClipboardNotifications } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { MarginInline } from "./MarginInline.js";
|
||||
import ClipboardJS from "clipboard";
|
||||
import i18next from "i18next";
|
||||
|
||||
export function CopyableInputBox(text, copyable = true) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { makeElement } from "../htmlUtils.js";
|
||||
import { addClipboardNotifications } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import ClipboardJS from "clipboard";
|
||||
import FileSaver from 'file-saver';
|
||||
import i18next from 'i18next';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { makeElement } from "../htmlUtils.js";
|
||||
import { Margin } from "./Margin.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import QrScanner from 'qr-scanner';
|
||||
|
||||
/* eslint-disable import/no-unresolved */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { de, enGB, fr, nl, ru, it } from 'date-fns/locale'
|
||||
import { de, enGB, fr, it, nl, ru } from 'date-fns/locale'
|
||||
import { formatDistance as formatDistanceReal} from 'date-fns';
|
||||
|
||||
function getLocale() {
|
||||
|
|
48
src/main.js
48
src/main.js
|
@ -3,44 +3,44 @@
|
|||
// JS & CSS
|
||||
|
||||
import "./scss/main.scss";
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import Icons from 'uikit/dist/js/uikit-icons.min.js';
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
UIkit.use(Icons);
|
||||
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/components/prism-json";
|
||||
import Prism from "prismjs";
|
||||
Prism.highlightAll();
|
||||
|
||||
import { PageState } from "./PageState.js";
|
||||
import {
|
||||
changePage,
|
||||
renderPage,
|
||||
} from "./pageUtils.js";
|
||||
import { PageState } from "./PageState.js";
|
||||
import { makeElement } from "./htmlUtils.js";
|
||||
import { getSealStatus } from './api.js';
|
||||
import { makeElement } from "./htmlUtils.js";
|
||||
|
||||
// Pages
|
||||
|
||||
import {
|
||||
HomePage,
|
||||
MePage,
|
||||
TOTPViewPage,
|
||||
NewTOTPPage,
|
||||
LoginPage,
|
||||
SetVaultURLPage,
|
||||
UnsealPage,
|
||||
TransitViewPage,
|
||||
TransitViewSecretPage,
|
||||
TransitEncryptPage,
|
||||
TransitDecryptPage,
|
||||
KeyValueViewPage,
|
||||
KeyValueDeletePage,
|
||||
KeyValueNewPage,
|
||||
KeyValueSecretEditPage,
|
||||
KeyValueSecretPage,
|
||||
KeyValueVersionsPage,
|
||||
KeyValueNewPage,
|
||||
KeyValueDeletePage,
|
||||
KeyValueSecretEditPage,
|
||||
KeyValueViewPage,
|
||||
LoginPage,
|
||||
MePage,
|
||||
NewTOTPPage,
|
||||
PwGenPage,
|
||||
SetLanguagePage,
|
||||
SetVaultURLPage,
|
||||
TOTPViewPage,
|
||||
TransitDecryptPage,
|
||||
TransitEncryptPage,
|
||||
TransitViewPage,
|
||||
TransitViewSecretPage,
|
||||
UnsealPage,
|
||||
} from "./pages";
|
||||
|
||||
const pages = {
|
||||
|
@ -66,13 +66,13 @@ const pages = {
|
|||
};
|
||||
|
||||
// Translations
|
||||
import i18next from 'i18next';
|
||||
import translation_en from './translations/en.js'
|
||||
import translation_de from './translations/de.js'
|
||||
import translation_ru from './translations/ru.js'
|
||||
import translation_nl from './translations/nl.js'
|
||||
import translation_fr from './translations/fr.js'
|
||||
import {formatDistance} from './formatDistance.js';
|
||||
import i18next from 'i18next';
|
||||
import translation_de from './translations/de.js'
|
||||
import translation_en from './translations/en.js'
|
||||
import translation_fr from './translations/fr.js'
|
||||
import translation_nl from './translations/nl.js'
|
||||
import translation_ru from './translations/ru.js'
|
||||
|
||||
|
||||
/*import "en-GB" as date_locale_en from 'date-fns/locale'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { makeElement } from "./htmlUtils.js";
|
||||
import { lookupSelf, getSealStatus } from './api.js';
|
||||
import { getAPIURL } from "./utils.js";
|
||||
import { getSealStatus, lookupSelf } from './api.js';
|
||||
import { makeElement } from "./htmlUtils.js";
|
||||
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import i18next from 'i18next';
|
||||
|
@ -15,15 +15,11 @@ async function prePageChecksReal() {
|
|||
throw new Error("Vault URL Not Set");
|
||||
}
|
||||
|
||||
try {
|
||||
let sealStatus = await getSealStatus();
|
||||
if (sealStatus.sealed) {
|
||||
changePage("UNSEAL");
|
||||
throw new Error("Vault Sealed");
|
||||
}
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
try {
|
||||
await lookupSelf();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { setErrorText, changePage, prePageChecks } from "../pageUtils.js";
|
||||
import { getAPIURL, getToken } from "../utils.js";
|
||||
import { changePage, prePageChecks, setErrorText } from "../pageUtils.js";
|
||||
import { getAPIURL } from "../utils.js";
|
||||
import { getMounts, lookupSelf } from "../api.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { getSealStatus, lookupSelf, getMounts } from "../api.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class HomePage extends Page {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { deleteSecret } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { createOrUpdateSecret } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getSecret, undeleteSecret, getCapabilities } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js";
|
||||
import { CopyableInputBox } from "../../elements/CopyableInputBox.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { getCapabilities, getSecret, undeleteSecret } from "../../api.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import Prism from "prismjs";
|
||||
import i18next from 'i18next';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getSecret, createOrUpdateSecret } from "../../api.js";
|
||||
import { verifyJSONString } from "../../utils.js";
|
||||
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { CodeJar } from "codejar";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { createOrUpdateSecret, getSecret } from "../../api.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { verifyJSONString } from "../../utils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class KeyValueSecretEditPage extends Page {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { getSecretMetadata } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getSecrets } from "../../api.js";
|
||||
import { setErrorText, setTitleElement, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { DoesNotExistError } from "../../types/internalErrors.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setTitleElement } from "../../pageUtils.js";
|
||||
import { getSecrets } from "../../api.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { lookupSelf, usernameLogin } from "../api.js";
|
||||
import { setPageContent, setErrorText, changePage } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { Margin } from "../elements/Margin.js";
|
||||
import { MarginInline } from "../elements/MarginInline.js";
|
||||
import { Page } from "../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent } from "../pageUtils.js";
|
||||
import { lookupSelf, usernameLogin } from "../api.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class LoginPage extends Page {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { addClipboardNotifications, setErrorText, setPageContent, changePage, prePageChecks } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { addClipboardNotifications, changePage, prePageChecks, setErrorText, setPageContent } from "../pageUtils.js";
|
||||
import { getCapabilitiesPath, renewSelf, sealVault } from "../api.js";
|
||||
import { getToken } from "../utils.js";
|
||||
import { renewSelf, getCapabilitiesPath, sealVault } from "../api.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import ClipboardJS from "clipboard";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { setPageContent } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { CopyableInputBox } from "../elements/CopyableInputBox.js";
|
||||
import { Page } from "../types/Page.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { setPageContent } from "../pageUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { setPageContent, changePage } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { Margin } from "../elements/Margin.js";
|
||||
import { Page } from "../types/Page.js";
|
||||
import { changePage, setPageContent } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
let languages = ["en", "de", "nl", "ru", "fr"];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { setPageContent, changePage } from "../pageUtils.js";
|
||||
import { changePage, setPageContent } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
|
||||
export class SetVaultURLPage extends Page {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { addNewTOTP } from "../../api.js";
|
||||
import { setTitleElement, setPageContent, setErrorText, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { Margin } from "../../elements/Margin.js";
|
||||
import { MarginInline } from "../../elements/MarginInline.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { addNewTOTP } from "../../api.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class NewTOTPPage extends Page {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getTOTPKeys, getTOTPCode } from "../../api.js";
|
||||
import { setTitleElement, setPageContent, changePage, setErrorText } from "../../pageUtils.js";
|
||||
import { CopyableInputBox } from "../../elements/CopyableInputBox.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { DoesNotExistError } from "../../types/internalErrors.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { getTOTPCode, getTOTPKeys } from "../../api.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class TOTPViewPage extends Page {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { setPageContent, setTitleElement, changePage } from "../pageUtils.js";
|
||||
import { changePage, setPageContent, setTitleElement } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
|
||||
export class TemplatePage extends Page {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { transitDecrypt } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { Margin } from "../../elements/Margin.js";
|
||||
import { CopyableModal } from "../../elements/CopyableModal.js";
|
||||
import { Margin } from "../../elements/Margin.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { transitDecrypt } from "../../api.js";
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import i18next from "i18next";
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { transitEncrypt } from "../../api.js";
|
||||
import { setPageContent, setTitleElement, setErrorText, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { Margin } from "../../elements/Margin.js";
|
||||
import { CopyableModal } from "../../elements/CopyableModal.js";
|
||||
import { Margin } from "../../elements/Margin.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setPageContent, setTitleElement } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { transitEncrypt } from "../../api.js";
|
||||
import UIkit from 'uikit/dist/js/uikit.min.js';
|
||||
import i18next from "i18next";
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Page } from "../../types/Page.js";
|
||||
import { getTransitKeys } from "../../api.js";
|
||||
import { setErrorText, setTitleElement, changePage } from "../../pageUtils.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import { DoesNotExistError } from "../../types/internalErrors.js";
|
||||
import { Page } from "../../types/Page.js";
|
||||
import { changePage, setErrorText, setTitleElement } from "../../pageUtils.js";
|
||||
import { getTransitKeys } from "../../api.js";
|
||||
import { makeElement } from "../../htmlUtils.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
export class TransitViewPage extends Page {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
import { Page } from "../types/Page.js";
|
||||
import { submitUnsealKey, getSealStatus } from "../api.js";
|
||||
import { setPageContent, setErrorText, changePage } from "../pageUtils.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
import { MarginInline } from "../elements/MarginInline.js";
|
||||
import { QRScanner } from "../elements/QRScanner.js";
|
||||
import i18next from 'i18next';
|
||||
|
||||
import { changePage, setErrorText, setPageContent } from "../pageUtils.js";
|
||||
import { getSealStatus, submitUnsealKey } from "../api.js";
|
||||
|
||||
import { MarginInline } from "../elements/MarginInline.js";
|
||||
import { Page } from "../types/Page.js";
|
||||
import { QRScanner } from "../elements/QRScanner.js";
|
||||
import { makeElement } from "../htmlUtils.js";
|
||||
|
||||
const UnsealInputModes = {
|
||||
FORM_INPUT: "FORM_INPUT",
|
||||
QR_INPUT: "QR_INPUT"
|
||||
|
|
Loading…
Reference in a new issue