formatting run linter --fix src
This commit is contained in:
parent
ff8a2995cb
commit
6131a13331
|
@ -1,6 +1,6 @@
|
||||||
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
||||||
import { removeDoubleSlash } from "../../utils";
|
|
||||||
import { getMount } from "../sys/getMounts";
|
import { getMount } from "../sys/getMounts";
|
||||||
|
import { removeDoubleSlash } from "../../utils";
|
||||||
|
|
||||||
export async function createOrUpdateSecret(
|
export async function createOrUpdateSecret(
|
||||||
baseMount: string,
|
baseMount: string,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
||||||
import { removeDoubleSlash } from "../../utils";
|
|
||||||
import { getMount } from "../sys/getMounts";
|
import { getMount } from "../sys/getMounts";
|
||||||
|
import { removeDoubleSlash } from "../../utils";
|
||||||
|
|
||||||
export async function deleteSecret(
|
export async function deleteSecret(
|
||||||
baseMount: string,
|
baseMount: string,
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
import { appendAPIURL, checkResponse, getHeaders } from "../apiUtils";
|
||||||
|
|
||||||
export async function getSecrets(
|
export async function getSecrets(baseMount: string, secretPath: string[]): Promise<string[]> {
|
||||||
baseMount: string,
|
|
||||||
secretPath: string[],
|
|
||||||
): Promise<string[]> {
|
|
||||||
let secretURL = "";
|
let secretURL = "";
|
||||||
|
|
||||||
// TODO: FIX THIS
|
// TODO: FIX THIS
|
||||||
let secretMountType = "kv-v2"
|
const secretMountType = "kv-v2";
|
||||||
|
|
||||||
if (secretMountType == "kv-v2") {
|
if (secretMountType == "kv-v2") {
|
||||||
secretURL = `/v1/${baseMount}/metadata/${secretPath.join("/")}?list=true`;
|
secretURL = `/v1/${baseMount}/metadata/${secretPath.join("/")}?list=true`;
|
||||||
|
|
|
@ -29,7 +29,6 @@ export async function getMount(mountName: string): Promise<MountType> {
|
||||||
const resp = await fetch(request);
|
const resp = await fetch(request);
|
||||||
await checkResponse(resp);
|
await checkResponse(resp);
|
||||||
|
|
||||||
const data = (await resp.json()) as { data: MountType };
|
const data = (await resp.json()) as { data: MountType };
|
||||||
return data.data;
|
return data.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
56
src/main.tsx
56
src/main.tsx
|
@ -12,8 +12,8 @@ UIkit.use(Icons);
|
||||||
|
|
||||||
import Prism from "prismjs";
|
import Prism from "prismjs";
|
||||||
// Don't Sort These!
|
// Don't Sort These!
|
||||||
import "prismjs/components/prism-json";
|
|
||||||
import "prismjs/components/prism-hcl";
|
import "prismjs/components/prism-hcl";
|
||||||
|
import "prismjs/components/prism-json";
|
||||||
|
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
@ -26,35 +26,35 @@ import { PageRouter } from "./pagerouter/PageRouter";
|
||||||
import { formatDistance } from "./formatDistance";
|
import { formatDistance } from "./formatDistance";
|
||||||
import { getSealStatus } from "./api/sys/getSealStatus";
|
import { getSealStatus } from "./api/sys/getSealStatus";
|
||||||
//import { pageList } from "./allPages";
|
//import { pageList } from "./allPages";
|
||||||
import { pageState } from "./globalPageState";
|
import { Component, render } from "preact";
|
||||||
import { playground } from "./playground";
|
|
||||||
import { NavBar } from "./ui/elements/NavBar";
|
|
||||||
import { render, Component } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import Router from 'preact-router';
|
|
||||||
import { Home } from "./ui/pages/Home";
|
|
||||||
import { Me } from "./ui/pages/Me";
|
|
||||||
import { Login } from "./ui/pages/Login";
|
|
||||||
import { PasswordGenerator } from "./ui/pages/PwGen";
|
|
||||||
import { SetVaultURL } from "./ui/pages/SetVaultURL";
|
|
||||||
import { Unseal } from "./ui/pages/Unseal";
|
|
||||||
import { SetLanguage } from "./ui/pages/SetLanguage";
|
|
||||||
import { Secrets } from "./ui/pages/Secrets/SecretsHome";
|
|
||||||
import { TOTPView } from "./ui/pages/Secrets/TOTP/TOTPView";
|
|
||||||
import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew";
|
|
||||||
import { TOTPDelete } from "./ui/pages/Secrets/TOTP/TOTPDelete";
|
|
||||||
import { NewSecretsEngine } from "./ui/pages/Secrets/NewSecretsEngine";
|
|
||||||
import { NewKVEngine } from "./ui/pages/Secrets/NewEngines/NewKVEngine";
|
|
||||||
import { NewTOTPEngine } from "./ui/pages/Secrets/NewEngines/NewTOTPEngine";
|
|
||||||
import { NewTransitEngine } from "./ui/pages/Secrets/NewEngines/NewTransitEngine";
|
|
||||||
import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine";
|
import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine";
|
||||||
import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView";
|
import { Home } from "./ui/pages/Home";
|
||||||
|
import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete";
|
||||||
import { KeyValueSecret } from "./ui/pages/Secrets/KeyValue/KeyValueSecret";
|
import { KeyValueSecret } from "./ui/pages/Secrets/KeyValue/KeyValueSecret";
|
||||||
import { KeyValueSecretEdit } from "./ui/pages/Secrets/KeyValue/KeyValueSecretsEdit";
|
import { KeyValueSecretEdit } from "./ui/pages/Secrets/KeyValue/KeyValueSecretsEdit";
|
||||||
import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete";
|
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 { TransitView } from "./ui/pages/Secrets/Transit/TransitView";
|
||||||
import { TransitViewSecret } from "./ui/pages/Secrets/Transit/TransitViewSecret";
|
import { TransitViewSecret } from "./ui/pages/Secrets/Transit/TransitViewSecret";
|
||||||
import { NewTransitKey } from "./ui/pages/Secrets/Transit/NewTransitKey";
|
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<void> {
|
async function onLoad(): Promise<void> {
|
||||||
const Main = () => (
|
const Main = () => (
|
||||||
|
@ -88,9 +88,9 @@ async function onLoad(): Promise<void> {
|
||||||
<TransitViewSecret path="/secrets/transit/view/:baseMount/:secretItem" state={pageState} />
|
<TransitViewSecret path="/secrets/transit/view/:baseMount/:secretItem" state={pageState} />
|
||||||
<NewTransitKey path="/secrets/transit/new/:baseMount" state={pageState} />
|
<NewTransitKey path="/secrets/transit/new/:baseMount" state={pageState} />
|
||||||
|
|
||||||
|
<div default>
|
||||||
<div default><p>PAGE NOT YET IMPLEMENTED</p></div>
|
<p>PAGE NOT YET IMPLEMENTED</p>
|
||||||
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ import { PageRouter } from "./pagerouter/PageRouter";
|
||||||
import { PageState } from "./state/PageState";
|
import { PageState } from "./state/PageState";
|
||||||
import { getSealStatus } from "./api/sys/getSealStatus";
|
import { getSealStatus } from "./api/sys/getSealStatus";
|
||||||
import { lookupSelf } from "./api/sys/lookupSelf";
|
import { lookupSelf } from "./api/sys/lookupSelf";
|
||||||
|
import { route } from "preact-router";
|
||||||
import ClipboardJS from "clipboard";
|
import ClipboardJS from "clipboard";
|
||||||
import UIkit from "uikit";
|
import UIkit from "uikit";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { route } from "preact-router";
|
|
||||||
|
|
||||||
async function prePageChecksReal(state: PageState) {
|
async function prePageChecksReal(state: PageState) {
|
||||||
if (state.language.length == 0) {
|
if (state.language.length == 0) {
|
||||||
|
|
|
@ -3,4 +3,4 @@ import { PageType } from "./PageType";
|
||||||
export type PageListType = {
|
export type PageListType = {
|
||||||
getPageIDs(): Promise<string[]>;
|
getPageIDs(): Promise<string[]>;
|
||||||
getPage(pageID: string): Promise<PageType>;
|
getPage(pageID: string): Promise<PageType>;
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { PageType } from "./PageType";
|
|
||||||
import { PageListType } from "./PageListType";
|
import { PageListType } from "./PageListType";
|
||||||
|
import { PageType } from "./PageType";
|
||||||
|
|
||||||
const PageDoesNotExistError = new Error("Page does not exist.");
|
const PageDoesNotExistError = new Error("Page does not exist.");
|
||||||
const PageHasNotBeenSetError = new Error("Page has not been set.");
|
const PageHasNotBeenSetError = new Error("Page has not been set.");
|
||||||
|
@ -9,20 +9,18 @@ export type Options = {
|
||||||
state: unknown;
|
state: unknown;
|
||||||
pageContentElement: HTMLElement;
|
pageContentElement: HTMLElement;
|
||||||
pageTitleElement: HTMLElement;
|
pageTitleElement: HTMLElement;
|
||||||
resetElementContent?: Boolean;
|
resetElementContent?: boolean;
|
||||||
onPageChange: () => void;
|
onPageChange: () => void;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class PageRouter {
|
export class PageRouter {
|
||||||
constructor(
|
constructor(options: Options) {
|
||||||
options: Options
|
|
||||||
) {
|
|
||||||
this.pageList = options.pageList;
|
this.pageList = options.pageList;
|
||||||
this.state = options.state;
|
this.state = options.state;
|
||||||
this.pageContentElement = options.pageContentElement;
|
this.pageContentElement = options.pageContentElement;
|
||||||
this.pageTitleElement = options.pageTitleElement;
|
this.pageTitleElement = options.pageTitleElement;
|
||||||
this.resetElementContent = (options.resetElementContent || true) == true;
|
this.resetElementContent = (options.resetElementContent || true) == true;
|
||||||
this.onPageChange = (options.onPageChange);
|
this.onPageChange = options.onPageChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public onPageChange: () => void;
|
public onPageChange: () => void;
|
||||||
|
@ -31,7 +29,7 @@ export class PageRouter {
|
||||||
private currentPageID: string;
|
private currentPageID: string;
|
||||||
private currentPage: PageType;
|
private currentPage: PageType;
|
||||||
|
|
||||||
private resetElementContent: Boolean;
|
private resetElementContent: boolean;
|
||||||
|
|
||||||
public state: unknown;
|
public state: unknown;
|
||||||
public pageContentElement: HTMLElement;
|
public pageContentElement: HTMLElement;
|
||||||
|
@ -87,11 +85,7 @@ export class PageRouter {
|
||||||
this.pageContentElement.innerHTML = "";
|
this.pageContentElement.innerHTML = "";
|
||||||
this.pageTitleElement.innerHTML = "";
|
this.pageTitleElement.innerHTML = "";
|
||||||
}
|
}
|
||||||
await Promise.all([
|
await Promise.all([this.currentPage.renderPageTitle(), this.currentPage.render()]);
|
||||||
this.currentPage.renderPageTitle(),
|
|
||||||
this.currentPage.render(),
|
|
||||||
])
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async refresh(): Promise<void> {
|
public async refresh(): Promise<void> {
|
||||||
|
|
|
@ -6,4 +6,4 @@ export type PageType = {
|
||||||
goBack(): Promise<void>;
|
goBack(): Promise<void>;
|
||||||
cleanup(): Promise<void>;
|
cleanup(): Promise<void>;
|
||||||
setRouterAndState(router: PageRouter, state: unknown): Promise<void>;
|
setRouterAndState(router: PageRouter, state: unknown): Promise<void>;
|
||||||
}
|
};
|
||||||
|
|
|
@ -4,8 +4,8 @@ export class PageState {
|
||||||
constructor() {
|
constructor() {
|
||||||
const params = new URLSearchParams(window.location.search);
|
const params = new URLSearchParams(window.location.search);
|
||||||
if (params.has("reset")) this.storage.clear();
|
if (params.has("reset")) this.storage.clear();
|
||||||
if (params.has("state")) {
|
if (params.has("state")) {
|
||||||
console.log("state owo")
|
console.log("state owo");
|
||||||
this.loadState(JSON.parse(params.get("state")));
|
this.loadState(JSON.parse(params.get("state")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,29 +20,28 @@ export class PageState {
|
||||||
|
|
||||||
dumpState(): { [key: string]: unknown } {
|
dumpState(): { [key: string]: unknown } {
|
||||||
return {
|
return {
|
||||||
"baseMount": this.baseMount,
|
baseMount: this.baseMount,
|
||||||
"secretPath": this.secretPath,
|
secretPath: this.secretPath,
|
||||||
"secretVersion": this.secretVersion,
|
secretVersion: this.secretVersion,
|
||||||
"secretItem": this.secretItem,
|
secretItem: this.secretItem,
|
||||||
"secretMountType": this.secretMountType,
|
secretMountType: this.secretMountType,
|
||||||
"policyItem": this.policyItem,
|
policyItem: this.policyItem,
|
||||||
"authPath": this.authPath,
|
authPath: this.authPath,
|
||||||
"userPassUser": this.userPassUser,
|
userPassUser: this.userPassUser,
|
||||||
"currentPage": this.currentPage,
|
currentPage: this.currentPage,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
loadState(newState: { [key: string]: unknown }) {
|
loadState(newState: { [key: string]: unknown }) {
|
||||||
console.log(newState)
|
console.log(newState);
|
||||||
for (let prop in newState) {
|
for (const prop in newState) {
|
||||||
console.log("WANTS", prop)
|
console.log("WANTS", prop);
|
||||||
if (prop in this) {
|
if (prop in this) {
|
||||||
console.log("HAS", prop.toString());
|
console.log("HAS", prop.toString());
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this[prop] = newState[prop];
|
this[prop] = newState[prop];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: When a item in the page state isn't a string (e.g it is a array or object),
|
// NOTE: When a item in the page state isn't a string (e.g it is a array or object),
|
||||||
|
|
5
src/translations/de.js
vendored
5
src/translations/de.js
vendored
|
@ -147,7 +147,8 @@ module.exports = {
|
||||||
"Bei cubbyhole, können secrets gespeichert werden, solange dein Token gültig ist. Sobald der Token nicht mehr gültig ist, werden die Secrets gelöscht und können daher auch nur mit dem jetzigen Token gültig ist.",
|
"Bei cubbyhole, können secrets gespeichert werden, solange dein Token gültig ist. Sobald der Token nicht mehr gültig ist, werden die Secrets gelöscht und können daher auch nur mit dem jetzigen Token gültig ist.",
|
||||||
kv_view_new_btn: "Neu",
|
kv_view_new_btn: "Neu",
|
||||||
kv_view_delete_btn: "Löschen",
|
kv_view_delete_btn: "Löschen",
|
||||||
kv_view_none_here_text: "Es scheint so als hättest du noch keine Secrets hier. Möchtest du eins erstellen?",
|
kv_view_none_here_text:
|
||||||
|
"Es scheint so als hättest du noch keine Secrets hier. Möchtest du eins erstellen?",
|
||||||
|
|
||||||
// TOTP View Page
|
// TOTP View Page
|
||||||
totp_view_title: "TOTP",
|
totp_view_title: "TOTP",
|
||||||
|
@ -320,4 +321,4 @@ module.exports = {
|
||||||
policy_delete_text:
|
policy_delete_text:
|
||||||
"Sicher das diese Richtlinie gelöscht werden soll? Diese Aktion kann nicht rückgängig gemacht werden und könnte die Berechtigungen der Benutzer stören.",
|
"Sicher das diese Richtlinie gelöscht werden soll? Diese Aktion kann nicht rückgängig gemacht werden und könnte die Berechtigungen der Benutzer stören.",
|
||||||
policy_delete_btn: "Richtlinie Löschen",
|
policy_delete_btn: "Richtlinie Löschen",
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { PageState } from "../state/PageState";
|
import { PageState } from "../state/PageState";
|
||||||
|
|
||||||
export type DefaultPageProps = {
|
export type DefaultPageProps = {
|
||||||
state: PageState;
|
state: PageState;
|
||||||
matches?: {[key: string]: string}
|
matches?: { [key: string]: string };
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { render } from "preact";
|
import { CopyStateLinkButton } from "../ui/elements/CopyStateLinkButton";
|
||||||
import { PageRouter } from "../pagerouter/PageRouter";
|
import { PageRouter } from "../pagerouter/PageRouter";
|
||||||
import { PageState } from "../state/PageState";
|
import { PageState } from "../state/PageState";
|
||||||
import { CopyStateLinkButton } from "../ui/elements/CopyStateLinkButton";
|
import { render } from "preact";
|
||||||
|
|
||||||
export class Page {
|
export class Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -18,8 +18,8 @@ export class Page {
|
||||||
async renderPageTitle(): Promise<void> {
|
async renderPageTitle(): Promise<void> {
|
||||||
render(
|
render(
|
||||||
<>
|
<>
|
||||||
<span>{this.name}</span>
|
<span>{this.name}</span>
|
||||||
<CopyStateLinkButton state={this.state} />
|
<CopyStateLinkButton state={this.state} />
|
||||||
</>,
|
</>,
|
||||||
this.router.pageTitleElement,
|
this.router.pageTitleElement,
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
import { Component, JSX, createRef } from "preact";
|
import { Component, JSX, createRef } from "preact";
|
||||||
|
import { PageState } from "../../state/PageState";
|
||||||
import { addClipboardNotifications } from "../../pageUtils";
|
import { addClipboardNotifications } from "../../pageUtils";
|
||||||
import ClipboardJS from "clipboard";
|
import ClipboardJS from "clipboard";
|
||||||
import { PageState } from "../../state/PageState";
|
|
||||||
|
|
||||||
export type CopyStateLinkButtonProps = {
|
export type CopyStateLinkButtonProps = {
|
||||||
state: PageState;
|
state: PageState;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class CopyStateLinkButton extends Component<CopyStateLinkButtonProps, unknown> {
|
export class CopyStateLinkButton extends Component<CopyStateLinkButtonProps, unknown> {
|
||||||
buttonRef = createRef();
|
buttonRef = createRef();
|
||||||
|
|
||||||
componentDidMount(): void {
|
componentDidMount(): void {
|
||||||
const clipboard = new ClipboardJS(this.buttonRef.current);
|
const clipboard = new ClipboardJS(this.buttonRef.current);
|
||||||
addClipboardNotifications(clipboard, 600);
|
addClipboardNotifications(clipboard, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
const newURL = new URL(window.location.toString());
|
const newURL = new URL(window.location.toString());
|
||||||
newURL.searchParams.set("state", JSON.stringify(this.props.state.dumpState()));
|
newURL.searchParams.set("state", JSON.stringify(this.props.state.dumpState()));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
ref={this.buttonRef}
|
ref={this.buttonRef}
|
||||||
class="uk-icon uk-margin-small-left"
|
class="uk-icon uk-margin-small-left"
|
||||||
uk-icon={"icon: copy"}
|
uk-icon={"icon: copy"}
|
||||||
role="img"
|
role="img"
|
||||||
aria-label="Copy Link"
|
aria-label="Copy Link"
|
||||||
data-clipboard-text={newURL.toString()}
|
data-clipboard-text={newURL.toString()}
|
||||||
></a>
|
></a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { JSX, render } from "preact";
|
import { JSX, render } from "preact";
|
||||||
import { PageRouter } from "../../pagerouter/PageRouter";
|
import { PageRouter } from "../../pagerouter/PageRouter";
|
||||||
import i18next from "i18next";
|
|
||||||
import { getCurrentUrl, route } from "preact-router";
|
import { getCurrentUrl, route } from "preact-router";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export function NavBar(): JSX.Element {
|
export function NavBar(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
|
@ -10,14 +9,12 @@ export function NavBar(): JSX.Element {
|
||||||
<div class="uk-navbar-left">
|
<div class="uk-navbar-left">
|
||||||
<ul class="uk-navbar-nav">
|
<ul class="uk-navbar-nav">
|
||||||
<li>
|
<li>
|
||||||
<a href="/">
|
<a href="/">{i18next.t("home_btn")}</a>
|
||||||
{i18next.t("home_btn")}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
window.history.back()
|
window.history.back();
|
||||||
// maybe???
|
// maybe???
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -50,4 +47,4 @@ export function NavBar(): JSX.Element {
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
import { JSX } from "preact";
|
import { JSX } from "preact";
|
||||||
|
|
||||||
export type PageTitleProps = {
|
export type PageTitleProps = {
|
||||||
title: string;
|
title: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PageTitle(props: PageTitleProps): JSX.Element {
|
export function PageTitle(props: PageTitleProps): JSX.Element {
|
||||||
return <h3 class="uk-card-title" id="pageTitle">{props.title}</h3>;
|
return (
|
||||||
|
<h3 class="uk-card-title" id="pageTitle">
|
||||||
|
{props.title}
|
||||||
|
</h3>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Grid, GridSizes } from "../../elements/Grid";
|
import { Grid, GridSizes } from "../../elements/Grid";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
|
import { PageState } from "../../../state/PageState";
|
||||||
import { Tile } from "../../elements/Tile";
|
import { Tile } from "../../elements/Tile";
|
||||||
import { notImplemented, prePageChecks } from "../../../pageUtils";
|
import { notImplemented, prePageChecks } from "../../../pageUtils";
|
||||||
import { render } from "preact";
|
import { render } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
|
|
||||||
export class AccessHomePage extends Page {
|
export class AccessHomePage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
|
import { Component, JSX, render } from "preact";
|
||||||
import { Grid, GridSizes } from "../elements/Grid";
|
import { Grid, GridSizes } from "../elements/Grid";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
|
import { PageState } from "../../state/PageState";
|
||||||
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { Tile } from "../elements/Tile";
|
import { Tile } from "../elements/Tile";
|
||||||
import { TokenInfo } from "../../api/types/token";
|
import { TokenInfo } from "../../api/types/token";
|
||||||
import { getCapabilitiesPath } from "../../api/sys/getCapabilities";
|
import { getCapabilitiesPath } from "../../api/sys/getCapabilities";
|
||||||
import { lookupSelf } from "../../api/sys/lookupSelf";
|
import { lookupSelf } from "../../api/sys/lookupSelf";
|
||||||
import { prePageChecks, setErrorText } from "../../pageUtils";
|
import { prePageChecks, setErrorText } from "../../pageUtils";
|
||||||
import { Component, JSX, render } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { PageState } from "../../state/PageState";
|
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import i18next from "i18next";
|
||||||
|
|
||||||
type HomeProps = {
|
type HomeProps = {
|
||||||
state: PageState;
|
state: PageState;
|
||||||
}
|
};
|
||||||
|
|
||||||
type HomeState = {
|
type HomeState = {
|
||||||
selfTokenInfo: TokenInfo;
|
selfTokenInfo: TokenInfo;
|
||||||
authCaps: string[];
|
authCaps: string[];
|
||||||
policiesCaps: string[];
|
policiesCaps: string[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Home extends Component<HomeProps, HomeState> {
|
export class Home extends Component<HomeProps, HomeState> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
if (!(await prePageChecks(this.props.state))) return;
|
if (!(await prePageChecks(this.props.state))) return;
|
||||||
|
|
||||||
let selfTokenInfo: TokenInfo;
|
let selfTokenInfo: TokenInfo;
|
||||||
try {
|
try {
|
||||||
selfTokenInfo = await lookupSelf();
|
selfTokenInfo = await lookupSelf();
|
||||||
|
@ -34,7 +34,7 @@ export class Home extends Component<HomeProps, HomeState> {
|
||||||
setErrorText(error.message);
|
setErrorText(error.message);
|
||||||
if (error.message == "permission denied") {
|
if (error.message == "permission denied") {
|
||||||
this.props.state.token = "";
|
this.props.state.token = "";
|
||||||
route('/login', true);
|
route("/login", true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,63 +47,63 @@ export class Home extends Component<HomeProps, HomeState> {
|
||||||
selfTokenInfo: selfTokenInfo,
|
selfTokenInfo: selfTokenInfo,
|
||||||
authCaps: authCaps,
|
authCaps: authCaps,
|
||||||
policiesCaps: policiesCaps,
|
policiesCaps: policiesCaps,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
return this.state.selfTokenInfo && (
|
return (
|
||||||
<>
|
this.state.selfTokenInfo && (
|
||||||
<PageTitle title={this.name} />
|
<>
|
||||||
<div>
|
<PageTitle title={this.name} />
|
||||||
<ul id="textList" class="uk-nav">
|
<div>
|
||||||
<li>
|
<ul id="textList" class="uk-nav">
|
||||||
<span>{i18next.t("home_vaulturl_text", { text: this.props.state.apiURL })}</span>
|
<li>
|
||||||
</li>
|
<span>{i18next.t("home_vaulturl_text", { text: this.props.state.apiURL })}</span>
|
||||||
<li>
|
</li>
|
||||||
<a href="/pw_gen">
|
<li>
|
||||||
{i18next.t("home_password_generator_btn")}
|
<a href="/pw_gen">{i18next.t("home_password_generator_btn")}</a>
|
||||||
</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
<span>
|
||||||
<span>
|
{i18next.t("home_your_token_expires_in", {
|
||||||
{i18next.t("home_your_token_expires_in", {
|
date: new Date(this.state.selfTokenInfo.expire_time),
|
||||||
date: new Date(this.state.selfTokenInfo.expire_time),
|
})}
|
||||||
})}
|
</span>
|
||||||
</span>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
</ul>
|
<Margin>
|
||||||
<Margin>
|
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
||||||
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
<Tile
|
||||||
<Tile
|
title={i18next.t("home_secrets_title")}
|
||||||
title={i18next.t("home_secrets_title")}
|
description={i18next.t("home_secrets_description")}
|
||||||
description={i18next.t("home_secrets_description")}
|
icon="file-edit"
|
||||||
icon="file-edit"
|
onclick={async () => {
|
||||||
onclick={async () => {
|
route("/secrets");
|
||||||
route("/secrets");
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
<Tile
|
||||||
<Tile
|
title={i18next.t("home_access_title")}
|
||||||
title={i18next.t("home_access_title")}
|
description={i18next.t("home_access_description")}
|
||||||
description={i18next.t("home_access_description")}
|
icon="users"
|
||||||
icon="users"
|
disabled={!this.state.authCaps.includes("read")}
|
||||||
disabled={!this.state.authCaps.includes("read")}
|
onclick={async () => {
|
||||||
onclick={async () => {
|
route("/access");
|
||||||
route("/access");
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
<Tile
|
||||||
<Tile
|
title={i18next.t("home_policies_title")}
|
||||||
title={i18next.t("home_policies_title")}
|
description={i18next.t("home_policies_description")}
|
||||||
description={i18next.t("home_policies_description")}
|
icon="pencil"
|
||||||
icon="pencil"
|
disabled={!this.state.policiesCaps.includes("read")}
|
||||||
disabled={!this.state.policiesCaps.includes("read")}
|
onclick={async () => {
|
||||||
onclick={async () => {
|
route("/policies");
|
||||||
route("/policies");
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</Grid>
|
||||||
</Grid>
|
</Margin>
|
||||||
</Margin>
|
</div>
|
||||||
</div>
|
</>
|
||||||
</>
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
import { Form } from "../elements/Form";
|
import { Form } from "../elements/Form";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { MarginInline } from "../elements/MarginInline";
|
import { MarginInline } from "../elements/MarginInline";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
|
import { PageState } from "../../state/PageState";
|
||||||
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { lookupSelf } from "../../api/sys/lookupSelf";
|
import { lookupSelf } from "../../api/sys/lookupSelf";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../pageUtils";
|
import { setErrorText } from "../../pageUtils";
|
||||||
import { usernameLogin } from "../../api/auth/usernameLogin";
|
import { usernameLogin } from "../../api/auth/usernameLogin";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
|
||||||
import { PageState } from "../../state/PageState";
|
|
||||||
|
|
||||||
export class TokenLoginForm extends Component<{state: PageState}, unknown> {
|
export class TokenLoginForm extends Component<{ state: PageState }, unknown> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ export class TokenLoginForm extends Component<{state: PageState}, unknown> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UsernameLoginForm extends Component<{state: PageState}, unknown> {
|
export class UsernameLoginForm extends Component<{ state: PageState }, unknown> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import { Component, JSX, createRef } from "preact";
|
import { Component, JSX, createRef } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { addClipboardNotifications, prePageChecks, setErrorText } from "../../pageUtils";
|
import { addClipboardNotifications, prePageChecks, setErrorText } from "../../pageUtils";
|
||||||
import { getCapsPath } from "../../api/sys/getCapabilities";
|
import { getCapsPath } from "../../api/sys/getCapabilities";
|
||||||
import { renewSelf } from "../../api/sys/renewSelf";
|
import { renewSelf } from "../../api/sys/renewSelf";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { sealVault } from "../../api/sys/sealVault";
|
import { sealVault } from "../../api/sys/sealVault";
|
||||||
import ClipboardJS from "clipboard";
|
import ClipboardJS from "clipboard";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
|
||||||
|
|
||||||
export class CopyLink extends Component<{ text: string; data: string }, unknown> {
|
export class CopyLink extends Component<{ text: string; data: string }, unknown> {
|
||||||
linkRef = createRef();
|
linkRef = createRef();
|
||||||
|
@ -29,10 +29,10 @@ export class CopyLink extends Component<{ text: string; data: string }, unknown>
|
||||||
type MeState = {
|
type MeState = {
|
||||||
loaded: boolean;
|
loaded: boolean;
|
||||||
canSealVault: boolean;
|
canSealVault: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Me extends Component<DefaultPageProps, MeState> {
|
export class Me extends Component<DefaultPageProps, MeState> {
|
||||||
defaultState = { loaded: false, canSealVault: false }
|
defaultState = { loaded: false, canSealVault: false };
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = this.defaultState;
|
this.state = this.defaultState;
|
||||||
|
@ -58,62 +58,60 @@ export class Me extends Component<DefaultPageProps, MeState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): JSX.Element {
|
render(): JSX.Element {
|
||||||
return this.state.loaded && (
|
return (
|
||||||
<>
|
this.state.loaded && (
|
||||||
<PageTitle title={this.name} />
|
<>
|
||||||
<ul class="uk-nav">
|
<PageTitle title={this.name} />
|
||||||
<li>
|
<ul class="uk-nav">
|
||||||
<a
|
|
||||||
onClick={async () => {
|
|
||||||
this.props.state.token = "";
|
|
||||||
route("/");
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{i18next.t("me_log_out_btn")}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<CopyLink text={i18next.t("me_copy_token_btn")} data={this.props.state.token} />
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
onClick={async () => {
|
|
||||||
try {
|
|
||||||
await renewSelf();
|
|
||||||
route("/");
|
|
||||||
} catch (e: unknown) {
|
|
||||||
const error = e as Error;
|
|
||||||
setErrorText(error.message);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{i18next.t("me_renew_lease_btn")}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{this.state.canSealVault && (
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await sealVault();
|
this.props.state.token = "";
|
||||||
route("/unseal", true);
|
route("/");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("me_seal_vault_btn")}
|
{i18next.t("me_log_out_btn")}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
)}
|
<li>
|
||||||
<li>
|
<CopyLink text={i18next.t("me_copy_token_btn")} data={this.props.state.token} />
|
||||||
<a href="/set_language">
|
</li>
|
||||||
{i18next.t("me_change_language_btn")}
|
<li>
|
||||||
</a>
|
<a
|
||||||
</li>
|
onClick={async () => {
|
||||||
<li>
|
try {
|
||||||
<a href="/set_vault_url">
|
await renewSelf();
|
||||||
{i18next.t("me_set_vault_url_btn")}
|
route("/");
|
||||||
</a>
|
} catch (e: unknown) {
|
||||||
</li>
|
const error = e as Error;
|
||||||
</ul>
|
setErrorText(error.message);
|
||||||
</>
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{i18next.t("me_renew_lease_btn")}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{this.state.canSealVault && (
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
onClick={async () => {
|
||||||
|
await sealVault();
|
||||||
|
route("/unseal", true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{i18next.t("me_seal_vault_btn")}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
)}
|
||||||
|
<li>
|
||||||
|
<a href="/set_language">{i18next.t("me_change_language_btn")}</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/set_vault_url">{i18next.t("me_set_vault_url_btn")}</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</>
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import { Margin } from "../../elements/Margin";
|
import { Margin } from "../../elements/Margin";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
|
import { PageState } from "../../../state/PageState";
|
||||||
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
import { getPolicies } from "../../../api/sys/policies/getPolicies";
|
||||||
import { prePageChecks } from "../../../pageUtils";
|
import { prePageChecks } from "../../../pageUtils";
|
||||||
import { render } from "preact";
|
import { render } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
|
|
||||||
export class PoliciesHomePage extends Page {
|
export class PoliciesHomePage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { CodeBlock } from "../../elements/CodeBlock";
|
import { CodeBlock } from "../../elements/CodeBlock";
|
||||||
import { Margin } from "../../elements/Margin";
|
import { Margin } from "../../elements/Margin";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
|
import { PageState } from "../../../state/PageState";
|
||||||
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
import { getPolicy } from "../../../api/sys/policies/getPolicy";
|
||||||
import { prePageChecks } from "../../../pageUtils";
|
import { prePageChecks } from "../../../pageUtils";
|
||||||
import { render } from "preact";
|
import { render } from "preact";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
|
|
||||||
export class PolicyViewPage extends Page {
|
export class PolicyViewPage extends Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Component, JSX, createRef, render } from "preact";
|
import { Component, JSX, createRef, render } from "preact";
|
||||||
import { CopyableInputBox } from "../elements/CopyableInputBox";
|
import { CopyableInputBox } from "../elements/CopyableInputBox";
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
|
||||||
import { Form } from "../elements/Form";
|
import { Form } from "../elements/Form";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
|
||||||
const passwordLengthMin = 1;
|
const passwordLengthMin = 1;
|
||||||
|
@ -140,4 +140,4 @@ export class PasswordGenerator extends Component<{}, PasswordGeneratorState> {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../elements/Form";
|
import { Form } from "../../elements/Form";
|
||||||
import { MarginInline } from "../../elements/MarginInline";
|
import { MarginInline } from "../../elements/MarginInline";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { deleteMount } from "../../../api/sys/deleteMount";
|
import { deleteMount } from "../../../api/sys/deleteMount";
|
||||||
import { Component, render } from "preact";
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../pageUtils";
|
import { setErrorText } from "../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
|
|
||||||
export class DeleteSecretsEngine extends Component<DefaultPageProps> {
|
export class DeleteSecretsEngine extends Component<DefaultPageProps> {
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageTitle title={i18next.t("delete_secrets_engine_title", { mount: this.props.matches["mount"] })}/>
|
<PageTitle
|
||||||
|
title={i18next.t("delete_secrets_engine_title", { mount: this.props.matches["mount"] })}
|
||||||
|
/>
|
||||||
<Form
|
<Form
|
||||||
onSubmit={async () => {
|
onSubmit={async () => {
|
||||||
await this.onSubmit();
|
await this.onSubmit();
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { deleteSecret } from "../../../../api/kv/deleteSecret";
|
import { deleteSecret } from "../../../../api/kv/deleteSecret";
|
||||||
import { Component, render } from "preact";
|
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
|
|
||||||
export class KeyValueDelete extends Component<DefaultPageProps> {
|
export class KeyValueDelete extends Component<DefaultPageProps> {
|
||||||
render() {
|
render() {
|
||||||
|
@ -25,11 +25,7 @@ export class KeyValueDelete extends Component<DefaultPageProps> {
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await deleteSecret(
|
await deleteSecret(baseMount, secretPath, item);
|
||||||
baseMount,
|
|
||||||
secretPath,
|
|
||||||
item,
|
|
||||||
);
|
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -37,7 +33,6 @@ export class KeyValueDelete extends Component<DefaultPageProps> {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
||||||
import { Component, render } from "preact";
|
import { kvViewURL } from "../../pageLinks";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { kvViewURL } from "../../pageLinks";
|
|
||||||
|
|
||||||
export class KeyValueNewPage extends Component<DefaultPageProps> {
|
export class KeyValueNewPage extends Component<DefaultPageProps> {
|
||||||
render(){
|
render() {
|
||||||
const baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
const secretPath = (this.props.matches["secretPath"] || "").split("/");
|
const secretPath = (this.props.matches["secretPath"] || "").split("/");
|
||||||
|
|
||||||
return(
|
return (
|
||||||
<>
|
<>
|
||||||
<SecretTitleElement
|
<SecretTitleElement
|
||||||
type="kv"
|
type="kv"
|
||||||
|
@ -22,40 +22,43 @@ export class KeyValueNewPage extends Component<DefaultPageProps> {
|
||||||
secretPath={secretPath}
|
secretPath={secretPath}
|
||||||
suffix={i18next.t("kv_sec_edit_suffix")}
|
suffix={i18next.t("kv_sec_edit_suffix")}
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<Form onSubmit={async (formData) => await this.newKVSecretHandleForm(formData, baseMount, secretPath)}>
|
<Form
|
||||||
<Margin>
|
onSubmit={async (formData) =>
|
||||||
<input
|
await this.newKVSecretHandleForm(formData, baseMount, secretPath)
|
||||||
class="uk-input uk-form-width-medium"
|
}
|
||||||
name="path"
|
>
|
||||||
placeholder={i18next.t("kv_new_path")}
|
<Margin>
|
||||||
required
|
<input
|
||||||
/>
|
class="uk-input uk-form-width-medium"
|
||||||
</Margin>
|
name="path"
|
||||||
<p class="uk-text-danger" id="errorText" />
|
placeholder={i18next.t("kv_new_path")}
|
||||||
<button class="uk-button uk-button-primary" type="submit">
|
required
|
||||||
{i18next.t("kv_new_create_btn")}
|
/>
|
||||||
</button>
|
</Margin>
|
||||||
</Form>
|
<p class="uk-text-danger" id="errorText" />
|
||||||
</div>
|
<button class="uk-button uk-button-primary" type="submit">
|
||||||
|
{i18next.t("kv_new_create_btn")}
|
||||||
|
</button>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async newKVSecretHandleForm(formData: FormData, baseMount: string, secretPath: string[]): Promise<void> {
|
async newKVSecretHandleForm(
|
||||||
|
formData: FormData,
|
||||||
|
baseMount: string,
|
||||||
|
secretPath: string[],
|
||||||
|
): Promise<void> {
|
||||||
const path = formData.get("path") as string;
|
const path = formData.get("path") as string;
|
||||||
|
|
||||||
// TODO: check only do this on kv v1
|
// TODO: check only do this on kv v1
|
||||||
let keyData = { "key": "value" };
|
const keyData = { key: "value" };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createOrUpdateSecret(
|
await createOrUpdateSecret(baseMount, secretPath, path, keyData);
|
||||||
baseMount,
|
route(kvViewURL(baseMount, secretPath, path));
|
||||||
secretPath,
|
|
||||||
path,
|
|
||||||
keyData,
|
|
||||||
);
|
|
||||||
route(kvViewURL(baseMount, secretPath, path))
|
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
setErrorText(error.message);
|
setErrorText(error.message);
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import { CodeBlock } from "../../../elements/CodeBlock";
|
import { CodeBlock } from "../../../elements/CodeBlock";
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Grid, GridSizes } from "../../../elements/Grid";
|
import { Grid, GridSizes } from "../../../elements/Grid";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { getCapabilities } from "../../../../api/sys/getCapabilities";
|
import { getCapabilities } from "../../../../api/sys/getCapabilities";
|
||||||
import { getSecret } from "../../../../api/kv/getSecret";
|
import { getSecret } from "../../../../api/kv/getSecret";
|
||||||
|
import { kvDeleteURL, kvEditURL } from "../../pageLinks";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { sortedObjectMap } from "../../../../utils";
|
import { sortedObjectMap } from "../../../../utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { kvDeleteURL, kvEditURL } from "../../pageLinks";
|
|
||||||
|
|
||||||
export type KVSecretViewProps = {
|
export type KVSecretViewProps = {
|
||||||
kvData: Record<string, unknown>;
|
kvData: Record<string, unknown>;
|
||||||
|
@ -48,7 +48,7 @@ type KeyValueSecretState = {
|
||||||
secretItem: string;
|
secretItem: string;
|
||||||
caps: string[];
|
caps: string[];
|
||||||
secretInfo: Record<string, unknown>;
|
secretInfo: Record<string, unknown>;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class KeyValueSecret extends Component<DefaultPageProps, KeyValueSecretState> {
|
export class KeyValueSecret extends Component<DefaultPageProps, KeyValueSecretState> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -56,30 +56,25 @@ export class KeyValueSecret extends Component<DefaultPageProps, KeyValueSecretSt
|
||||||
const secretPath = this.props.matches["secretPath"].split("/");
|
const secretPath = this.props.matches["secretPath"].split("/");
|
||||||
const secretItem = this.props.matches["item"];
|
const secretItem = this.props.matches["item"];
|
||||||
|
|
||||||
const caps = (
|
const caps = (await getCapabilities(baseMount, secretPath, secretItem)).capabilities;
|
||||||
await getCapabilities(baseMount, secretPath, secretItem)
|
|
||||||
).capabilities;
|
|
||||||
|
|
||||||
let secretPathAPI = secretPath.map((e) => e + "/");
|
const secretPathAPI = secretPath.map((e) => e + "/");
|
||||||
// TODO: this is a big hacky, fix when redo how api arguments work
|
// TODO: this is a big hacky, fix when redo how api arguments work
|
||||||
secretPathAPI[secretPathAPI.length - 1] = String(secretPathAPI[secretPathAPI.length - 1]).replace("/", "").toString();
|
secretPathAPI[secretPathAPI.length - 1] = String(secretPathAPI[secretPathAPI.length - 1])
|
||||||
|
.replace("/", "")
|
||||||
|
.toString();
|
||||||
|
|
||||||
const secretInfo = await getSecret(
|
const secretInfo = await getSecret(baseMount, secretPathAPI, secretItem);
|
||||||
baseMount,
|
|
||||||
secretPathAPI,
|
|
||||||
secretItem,
|
|
||||||
);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
baseMount,
|
baseMount,
|
||||||
secretPath,
|
secretPath,
|
||||||
secretItem,
|
secretItem,
|
||||||
caps,
|
caps,
|
||||||
secretInfo
|
secretInfo,
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
if (!this.state.baseMount) return;
|
if (!this.state.baseMount) return;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -92,23 +87,25 @@ export class KeyValueSecret extends Component<DefaultPageProps, KeyValueSecretSt
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<p id="buttonsBlock">
|
<p id="buttonsBlock">
|
||||||
{
|
{this.state.caps.includes("delete") && (
|
||||||
this.state.caps.includes("delete") && (
|
<button
|
||||||
<button
|
class="uk-button uk-button-danger"
|
||||||
class="uk-button uk-button-danger"
|
onClick={async () => {
|
||||||
onClick={async () => {
|
route(
|
||||||
route(kvDeleteURL(this.state.baseMount, this.state.secretPath, this.state.secretItem))
|
kvDeleteURL(this.state.baseMount, this.state.secretPath, this.state.secretItem),
|
||||||
}}
|
);
|
||||||
>
|
}}
|
||||||
{i18next.t("kv_secret_delete_btn")}
|
>
|
||||||
</button>
|
{i18next.t("kv_secret_delete_btn")}
|
||||||
)
|
</button>
|
||||||
}
|
)}
|
||||||
{this.state.caps.includes("update") && (
|
{this.state.caps.includes("update") && (
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-primary"
|
class="uk-button uk-button-primary"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(kvEditURL(this.state.baseMount, this.state.secretPath, this.state.secretItem))
|
route(
|
||||||
|
kvEditURL(this.state.baseMount, this.state.secretPath, this.state.secretItem),
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("kv_secret_edit_btn")}
|
{i18next.t("kv_secret_edit_btn")}
|
||||||
|
@ -119,7 +116,6 @@ export class KeyValueSecret extends Component<DefaultPageProps, KeyValueSecretSt
|
||||||
{<KVSecretVew kvData={this.state.secretInfo} />}
|
{<KVSecretVew kvData={this.state.secretInfo} />}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { CodeEditor } from "../../../elements/CodeEditor";
|
import { CodeEditor } from "../../../elements/CodeEditor";
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
import { createOrUpdateSecret } from "../../../../api/kv/createOrUpdateSecret";
|
||||||
|
@ -7,7 +8,6 @@ import { getSecret } from "../../../../api/kv/getSecret";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import { sortedObjectMap, verifyJSONString } from "../../../../utils";
|
import { sortedObjectMap, verifyJSONString } from "../../../../utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
|
|
||||||
export type KVEditProps = {
|
export type KVEditProps = {
|
||||||
baseMount: string;
|
baseMount: string;
|
||||||
|
@ -17,13 +17,13 @@ export type KVEditProps = {
|
||||||
|
|
||||||
type KVEditState =
|
type KVEditState =
|
||||||
| {
|
| {
|
||||||
dataLoaded: false;
|
dataLoaded: false;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
dataLoaded: true;
|
dataLoaded: true;
|
||||||
kvData: Record<string, unknown>;
|
kvData: Record<string, unknown>;
|
||||||
code: string;
|
code: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export class KVEditor extends Component<KVEditProps, KVEditState> {
|
export class KVEditor extends Component<KVEditProps, KVEditState> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
import { Component, createRef, JSX, render } from "preact";
|
import { CapabilitiesType, getCapabilitiesPath } from "../../../../api/sys/getCapabilities";
|
||||||
|
import { Component, JSX, createRef, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { DoesNotExistError } from "../../../../types/internalErrors";
|
import { DoesNotExistError } from "../../../../types/internalErrors";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { CapabilitiesType, getCapabilitiesPath } from "../../../../api/sys/getCapabilities";
|
|
||||||
import { getSecrets } from "../../../../api/kv/getSecrets";
|
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageLinks";
|
import { delSecretsEngineURL, kvListURL, kvNewURL, kvViewURL } from "../../pageLinks";
|
||||||
import { getMount } from "../../../../api/sys/getMounts";
|
import { getMount } from "../../../../api/sys/getMounts";
|
||||||
|
import { getSecrets } from "../../../../api/kv/getSecrets";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export type KVKeysListProps = DefaultPageProps & {
|
export type KVKeysListProps = DefaultPageProps & {
|
||||||
baseMount: string;
|
baseMount: string;
|
||||||
|
@ -28,11 +27,16 @@ function SecretsList(baseMount: string, secretPath: string[], secrets: string[])
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
console.log(baseMount, secretPath, secret)
|
console.log(baseMount, secretPath, secret);
|
||||||
if (secret.endsWith("/")) {
|
if (secret.endsWith("/")) {
|
||||||
route(kvListURL(baseMount, [...secretPath, secret.replace("/", "")].filter((e)=>e.length > 0)))
|
route(
|
||||||
|
kvListURL(
|
||||||
|
baseMount,
|
||||||
|
[...secretPath, secret.replace("/", "")].filter((e) => e.length > 0),
|
||||||
|
),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
route(kvViewURL(baseMount, secretPath, secret))
|
route(kvViewURL(baseMount, secretPath, secret));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -54,10 +58,7 @@ export class KVKeysList extends Component<KVKeysListProps, KVKeysListState> {
|
||||||
|
|
||||||
async loadData(): Promise<void> {
|
async loadData(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const keys = await getSecrets(
|
const keys = await getSecrets(this.props.baseMount, this.props.secretPath);
|
||||||
this.props.baseMount,
|
|
||||||
this.props.secretPath,
|
|
||||||
);
|
|
||||||
this.setState({
|
this.setState({
|
||||||
dataLoaded: true,
|
dataLoaded: true,
|
||||||
keys: keys,
|
keys: keys,
|
||||||
|
@ -142,7 +143,7 @@ type KeyValueViewState = {
|
||||||
pathCaps: string[];
|
pathCaps: string[];
|
||||||
mountCaps: string[];
|
mountCaps: string[];
|
||||||
mountType: string;
|
mountType: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class KeyValueView extends Component<DefaultPageProps, KeyValueViewState> {
|
export class KeyValueView extends Component<DefaultPageProps, KeyValueViewState> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -181,7 +182,7 @@ export class KeyValueView extends Component<DefaultPageProps, KeyValueViewState>
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-primary"
|
class="uk-button uk-button-primary"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(kvNewURL(baseMount, secretPath.length > 0 ? secretPath : null))
|
route(kvNewURL(baseMount, secretPath.length > 0 ? secretPath : null));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("kv_view_new_btn")}
|
{i18next.t("kv_view_new_btn")}
|
||||||
|
@ -191,7 +192,7 @@ export class KeyValueView extends Component<DefaultPageProps, KeyValueViewState>
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(delSecretsEngineURL(baseMount))
|
route(delSecretsEngineURL(baseMount));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("kv_view_delete_btn")}
|
{i18next.t("kv_view_delete_btn")}
|
||||||
|
@ -206,4 +207,4 @@ export class KeyValueView extends Component<DefaultPageProps, KeyValueViewState>
|
||||||
get name(): string {
|
get name(): string {
|
||||||
return i18next.t("kv_view_title");
|
return i18next.t("kv_view_title");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
|
import { kvListURL } from "../../pageLinks";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
import { Component, render } from "preact";
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { kvListURL } from "../../pageLinks";
|
|
||||||
|
|
||||||
export class NewKVEngine extends Component {
|
export class NewKVEngine extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
|
||||||
import { Component, render } from "preact";
|
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import { totpListURL } from "../../pageLinks";
|
import { totpListURL } from "../../pageLinks";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class NewTOTPEngine extends Component {
|
export class NewTOTPEngine extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
@ -31,7 +31,8 @@ export class NewTOTPEngine extends Component {
|
||||||
{i18next.t("new_totp_engine_create_btn")}
|
{i18next.t("new_totp_engine_create_btn")}
|
||||||
</button>
|
</button>
|
||||||
</MarginInline>
|
</MarginInline>
|
||||||
</Form>,
|
</Form>
|
||||||
|
,
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
|
import { PageTitle } from "../../../elements/PageTitle";
|
||||||
import { newMount } from "../../../../api/sys/newMount";
|
import { newMount } from "../../../../api/sys/newMount";
|
||||||
import { Component, render } from "preact";
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageTitle } from "../../../elements/PageTitle";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
|
|
||||||
export class NewTransitEngine extends Component {
|
export class NewTransitEngine extends Component {
|
||||||
render() {
|
render() {
|
||||||
|
@ -30,7 +30,8 @@ export class NewTransitEngine extends Component {
|
||||||
{i18next.t("new_transit_engine_create_btn")}
|
{i18next.t("new_transit_engine_create_btn")}
|
||||||
</button>
|
</button>
|
||||||
</MarginInline>
|
</MarginInline>
|
||||||
</Form>,
|
</Form>
|
||||||
|
,
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +44,7 @@ export class NewTransitEngine extends Component {
|
||||||
name: name,
|
name: name,
|
||||||
type: "transit",
|
type: "transit",
|
||||||
});
|
});
|
||||||
route("/secrets/transit/list/" + name + "/")
|
route("/secrets/transit/list/" + name + "/");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
setErrorText(error.message);
|
setErrorText(error.message);
|
||||||
|
|
|
@ -1,39 +1,39 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
import { Grid, GridSizes } from "../../elements/Grid";
|
import { Grid, GridSizes } from "../../elements/Grid";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
import { Tile } from "../../elements/Tile";
|
|
||||||
import { Component, render } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
|
import { Tile } from "../../elements/Tile";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class NewSecretsEngine extends Component {
|
export class NewSecretsEngine extends Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageTitle title={i18next.t("new_secrets_engine_title")} />
|
<PageTitle title={i18next.t("new_secrets_engine_title")} />
|
||||||
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
||||||
<Tile
|
<Tile
|
||||||
title={i18next.t("new_secrets_engine_kv_title")}
|
title={i18next.t("new_secrets_engine_kv_title")}
|
||||||
description={i18next.t("new_secrets_engine_kv_description")}
|
description={i18next.t("new_secrets_engine_kv_description")}
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
route("/secrets/new_secrets_engine/kv")
|
route("/secrets/new_secrets_engine/kv");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Tile
|
<Tile
|
||||||
title={i18next.t("new_secrets_engine_totp_title")}
|
title={i18next.t("new_secrets_engine_totp_title")}
|
||||||
description={i18next.t("new_secrets_engine_totp_description")}
|
description={i18next.t("new_secrets_engine_totp_description")}
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
route("/secrets/new_secrets_engine/totp")
|
route("/secrets/new_secrets_engine/totp");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Tile
|
<Tile
|
||||||
title={i18next.t("new_secrets_engine_transit_title")}
|
title={i18next.t("new_secrets_engine_transit_title")}
|
||||||
description={i18next.t("new_secrets_engine_transit_description")}
|
description={i18next.t("new_secrets_engine_transit_description")}
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
route("/secrets/new_secrets_engine/transit")
|
route("/secrets/new_secrets_engine/transit");
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { route } from "preact-router";
|
|
||||||
import { JSX } from "preact/jsx-runtime";
|
import { JSX } from "preact/jsx-runtime";
|
||||||
import { kvListURL } from "../pageLinks";
|
import { kvListURL } from "../pageLinks";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
|
||||||
type SecretTitleElementProps = {
|
type SecretTitleElementProps = {
|
||||||
type: string;
|
type: string;
|
||||||
|
@ -17,7 +17,6 @@ export function SecretTitleElement(props: SecretTitleElementProps): JSX.Element
|
||||||
const baseMount = props.baseMount;
|
const baseMount = props.baseMount;
|
||||||
const secretPath = props.secretPath || [];
|
const secretPath = props.secretPath || [];
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<h3 class="uk-card-title" id="pageTitle">
|
<h3 class="uk-card-title" id="pageTitle">
|
||||||
<div>
|
<div>
|
||||||
|
@ -30,24 +29,29 @@ export function SecretTitleElement(props: SecretTitleElementProps): JSX.Element
|
||||||
{"/ "}
|
{"/ "}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href={"/secrets/" + type + "/list/" + baseMount + "/"} test-data="secrets-title-baseMount">
|
<a
|
||||||
|
href={"/secrets/" + type + "/list/" + baseMount + "/"}
|
||||||
|
test-data="secrets-title-baseMount"
|
||||||
|
>
|
||||||
{baseMount + "/ "}
|
{baseMount + "/ "}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{...secretPath.map((secretPath, index, secretPaths) => {
|
{...secretPath.map((secretPath, index, secretPaths) => {
|
||||||
// TODO: find where a '' is returned so dont need this
|
// TODO: find where a '' is returned so dont need this
|
||||||
if (secretPath.length < 1) return;
|
if (secretPath.length < 1) return;
|
||||||
return <a test-data="secrets-title-secretPath"
|
return (
|
||||||
onClick={async () => {
|
<a
|
||||||
|
test-data="secrets-title-secretPath"
|
||||||
if (type == "kv") {
|
onClick={async () => {
|
||||||
let secretPath = secretPaths.slice(0, index + 1);
|
if (type == "kv") {
|
||||||
route(kvListURL(baseMount, secretPath))
|
const secretPath = secretPaths.slice(0, index + 1);
|
||||||
}
|
route(kvListURL(baseMount, secretPath));
|
||||||
}}
|
}
|
||||||
>
|
}}
|
||||||
{secretPath + "/" + " "}
|
>
|
||||||
</a>
|
{secretPath + "/" + " "}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
{item.length != 0 && <span>{item}</span>}
|
{item.length != 0 && <span>{item}</span>}
|
||||||
{suffix.length != 0 && <span>{suffix}</span>}
|
{suffix.length != 0 && <span>{suffix}</span>}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
||||||
import { MountType, getMounts } from "../../../api/sys/getMounts";
|
import { MountType, getMounts } from "../../../api/sys/getMounts";
|
||||||
import { Page } from "../../../types/Page";
|
import { Page } from "../../../types/Page";
|
||||||
|
import { PageState } from "../../../state/PageState";
|
||||||
|
import { PageTitle } from "../../elements/PageTitle";
|
||||||
import { getCapsPath } from "../../../api/sys/getCapabilities";
|
import { getCapsPath } from "../../../api/sys/getCapabilities";
|
||||||
import { prePageChecks } from "../../../pageUtils";
|
import { prePageChecks } from "../../../pageUtils";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { sortedObjectMap } from "../../../utils";
|
import { sortedObjectMap } from "../../../utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { PageState } from "../../../state/PageState";
|
|
||||||
import { DefaultPageProps } from "../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../../elements/PageTitle";
|
|
||||||
|
|
||||||
const supportedMountTypes = ["kv", "totp", "transit", "cubbyhole"];
|
const supportedMountTypes = ["kv", "totp", "transit", "cubbyhole"];
|
||||||
|
|
||||||
|
@ -46,21 +46,19 @@ function MountLink(props: MountLinkProps): JSX.Element {
|
||||||
mountPathType = "kv";
|
mountPathType = "kv";
|
||||||
}
|
}
|
||||||
|
|
||||||
let link = "/secrets/" + mountPathType + "/list/" + baseMount;
|
const link = "/secrets/" + mountPathType + "/list/" + baseMount;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<a href={link}>
|
<a href={link}>{linkText}</a>
|
||||||
{linkText}
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
type SecretsState = {
|
type SecretsState = {
|
||||||
mountsMap: Map<String, MountType>;
|
mountsMap: Map<string, MountType>;
|
||||||
capabilities: string[];
|
capabilities: string[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Secrets extends Component<DefaultPageProps, SecretsState> {
|
export class Secrets extends Component<DefaultPageProps, SecretsState> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
|
@ -72,44 +70,48 @@ export class Secrets extends Component<DefaultPageProps, SecretsState> {
|
||||||
const mountsMap = sortedObjectMap(mounts);
|
const mountsMap = sortedObjectMap(mounts);
|
||||||
this.setState({
|
this.setState({
|
||||||
capabilities: mountsCapabilities,
|
capabilities: mountsCapabilities,
|
||||||
mountsMap: mountsMap as Map<String, MountType>
|
mountsMap: mountsMap as Map<string, MountType>,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return this.state.mountsMap && (
|
return (
|
||||||
<>
|
this.state.mountsMap && (
|
||||||
<PageTitle title={i18next.t("secrets_home_page_title")} />
|
<>
|
||||||
<div>
|
<PageTitle title={i18next.t("secrets_home_page_title")} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<div>
|
||||||
{this.state.capabilities.includes("sudo") && this.state.capabilities.includes("create") && (
|
<p>
|
||||||
<button
|
{this.state.capabilities.includes("sudo") &&
|
||||||
class="uk-button uk-button-primary"
|
this.state.capabilities.includes("create") && (
|
||||||
onClick={() => {
|
<button
|
||||||
route("/secrets/new_secrets_engine")
|
class="uk-button uk-button-primary"
|
||||||
}}
|
onClick={() => {
|
||||||
>
|
route("/secrets/new_secrets_engine");
|
||||||
{i18next.t("secrets_home_new_secrets_engine_button")}
|
}}
|
||||||
</button>
|
>
|
||||||
)}
|
{i18next.t("secrets_home_new_secrets_engine_button")}
|
||||||
</p>
|
</button>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="uk-margin-top">
|
||||||
|
<ul class="uk-nav uk-nav-default">
|
||||||
|
{Array.from(this.state.mountsMap).map((args: [string, MountType]) => {
|
||||||
|
const baseMount = args[0];
|
||||||
|
const mount = args[1];
|
||||||
|
console.log(baseMount, mount);
|
||||||
|
if (isSupportedMount(mount)) {
|
||||||
|
return (
|
||||||
|
<MountLink state={this.props.state} mount={mount} baseMount={baseMount} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uk-margin-top">
|
</>
|
||||||
<ul class="uk-nav uk-nav-default">
|
)
|
||||||
{Array.from(this.state.mountsMap).map((args: [string, MountType]) => {
|
|
||||||
const baseMount = args[0];
|
|
||||||
const mount = args[1];
|
|
||||||
console.log(baseMount, mount)
|
|
||||||
if (isSupportedMount(mount)) {
|
|
||||||
return <MountLink state={this.props.state} mount={mount} baseMount={baseMount} />;
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { deleteTOTP } from "../../../../api/totp/deleteTOTP";
|
import { deleteTOTP } from "../../../../api/totp/deleteTOTP";
|
||||||
import { Component, render } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
import { totpListURL } from "../../pageLinks";
|
import { totpListURL } from "../../pageLinks";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class TOTPDelete extends Component<DefaultPageProps> {
|
export class TOTPDelete extends Component<DefaultPageProps> {
|
||||||
render() {
|
render() {
|
||||||
|
@ -22,8 +22,8 @@ export class TOTPDelete extends Component<DefaultPageProps> {
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
let baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
let item = this.props.matches["item"];
|
const item = this.props.matches["item"];
|
||||||
await deleteTOTP(baseMount, item);
|
await deleteTOTP(baseMount, item);
|
||||||
route(totpListURL(baseMount));
|
route(totpListURL(baseMount));
|
||||||
}}
|
}}
|
||||||
|
@ -32,7 +32,6 @@ export class TOTPDelete extends Component<DefaultPageProps> {
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, JSX, createRef, render } from "preact";
|
import { Component, JSX, createRef, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
|
@ -6,10 +7,9 @@ import { Page } from "../../../../types/Page";
|
||||||
import { QRScanner } from "../../../elements/QRScanner";
|
import { QRScanner } from "../../../elements/QRScanner";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { addNewTOTP } from "../../../../api/totp/addNewTOTP";
|
import { addNewTOTP } from "../../../../api/totp/addNewTOTP";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { route } from "preact-router";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
|
|
||||||
function replaceAll(str: string, replace: string, replaceWith: string): string {
|
function replaceAll(str: string, replace: string, replaceWith: string): string {
|
||||||
return str.replace(new RegExp(replace, "g"), replaceWith);
|
return str.replace(new RegExp(replace, "g"), replaceWith);
|
||||||
|
@ -41,7 +41,7 @@ export class TOTPNewForm extends Component<{ baseMount: string }, { qrMode: bool
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await addNewTOTP(this.props.baseMount, parms);
|
await addNewTOTP(this.props.baseMount, parms);
|
||||||
route("/secrets/totp/list/" + this.props.baseMount)
|
route("/secrets/totp/list/" + this.props.baseMount);
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
setErrorText(`API Error: ${error.message}`);
|
setErrorText(`API Error: ${error.message}`);
|
||||||
|
@ -124,7 +124,11 @@ export class TOTPNew extends Component<DefaultPageProps> {
|
||||||
const baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SecretTitleElement type="totp" baseMount={baseMount} suffix={i18next.t("totp_new_suffix")} />
|
<SecretTitleElement
|
||||||
|
type="totp"
|
||||||
|
baseMount={baseMount}
|
||||||
|
suffix={i18next.t("totp_new_suffix")}
|
||||||
|
/>
|
||||||
<TOTPNewForm baseMount={baseMount} />
|
<TOTPNewForm baseMount={baseMount} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,28 +1,31 @@
|
||||||
|
import {
|
||||||
|
CapabilitiesType,
|
||||||
|
getCapabilitiesPath,
|
||||||
|
getCapsPath,
|
||||||
|
} from "../../../../api/sys/getCapabilities";
|
||||||
import { Component, JSX, render } from "preact";
|
import { Component, JSX, render } from "preact";
|
||||||
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
import { CopyableInputBox } from "../../../elements/CopyableInputBox";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { DoesNotExistError } from "../../../../types/internalErrors";
|
import { DoesNotExistError } from "../../../../types/internalErrors";
|
||||||
import { Grid, GridSizes } from "../../../elements/Grid";
|
import { Grid, GridSizes } from "../../../elements/Grid";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { CapabilitiesType, getCapabilitiesPath, getCapsPath } from "../../../../api/sys/getCapabilities";
|
import { delSecretsEngineURL, totpNewURL } from "../../pageLinks";
|
||||||
import { getTOTPCode } from "../../../../api/totp/getTOTPCode";
|
import { getTOTPCode } from "../../../../api/totp/getTOTPCode";
|
||||||
import { getTOTPKeys } from "../../../../api/totp/getTOTPKeys";
|
import { getTOTPKeys } from "../../../../api/totp/getTOTPKeys";
|
||||||
import { removeDoubleSlash } from "../../../../utils";
|
import { removeDoubleSlash } from "../../../../utils";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { delSecretsEngineURL, totpNewURL } from "../../pageLinks";
|
|
||||||
|
|
||||||
type TOTPGridItemProps = {
|
type TOTPGridItemProps = {
|
||||||
baseMount: string; totpKey: string; canDelete: boolean;
|
baseMount: string;
|
||||||
}
|
totpKey: string;
|
||||||
|
canDelete: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export class RefreshingTOTPGridItem extends Component<
|
export class RefreshingTOTPGridItem extends Component<TOTPGridItemProps, { totpValue: string }> {
|
||||||
TOTPGridItemProps,
|
|
||||||
{ totpValue: string }
|
|
||||||
> {
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = { totpValue: "" };
|
this.state = { totpValue: "" };
|
||||||
|
@ -73,7 +76,7 @@ export class RefreshingTOTPGridItem extends Component<
|
||||||
type TOTPViewState = {
|
type TOTPViewState = {
|
||||||
capabilities?: CapabilitiesType;
|
capabilities?: CapabilitiesType;
|
||||||
totpItems: TOTPGridItemProps[];
|
totpItems: TOTPGridItemProps[];
|
||||||
}
|
};
|
||||||
|
|
||||||
export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -85,7 +88,7 @@ export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
||||||
refresher: number;
|
refresher: number;
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
var baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
const mountsPath = "/sys/mounts/" + baseMount;
|
const mountsPath = "/sys/mounts/" + baseMount;
|
||||||
const caps = await getCapabilitiesPath([mountsPath, baseMount]);
|
const caps = await getCapabilitiesPath([mountsPath, baseMount]);
|
||||||
|
|
||||||
|
@ -95,9 +98,7 @@ export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
||||||
try {
|
try {
|
||||||
totpItems = await Promise.all(
|
totpItems = await Promise.all(
|
||||||
Array.from(await getTOTPKeys(baseMount)).map(async (key) => {
|
Array.from(await getTOTPKeys(baseMount)).map(async (key) => {
|
||||||
const totpCaps = await getCapsPath(
|
const totpCaps = await getCapsPath(removeDoubleSlash(baseMount + "/code/" + key));
|
||||||
removeDoubleSlash(baseMount + "/code/" + key),
|
|
||||||
);
|
|
||||||
if (totpCaps.includes("read")) {
|
if (totpCaps.includes("read")) {
|
||||||
return {
|
return {
|
||||||
baseMount: baseMount,
|
baseMount: baseMount,
|
||||||
|
@ -116,13 +117,13 @@ export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
capabilities: caps,
|
capabilities: caps,
|
||||||
totpItems: totpItems
|
totpItems: totpItems,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!this.state.capabilities) return;
|
if (!this.state.capabilities) return;
|
||||||
var baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
|
|
||||||
const mountsPath = "/sys/mounts/" + baseMount;
|
const mountsPath = "/sys/mounts/" + baseMount;
|
||||||
const mountCaps = this.state.capabilities[mountsPath];
|
const mountCaps = this.state.capabilities[mountsPath];
|
||||||
|
@ -130,50 +131,49 @@ export class TOTPView extends Component<DefaultPageProps, TOTPViewState> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SecretTitleElement type="totp" baseMount={baseMount} />
|
<SecretTitleElement type="totp" baseMount={baseMount} />
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
{totpCaps.includes("create") && (
|
{totpCaps.includes("create") && (
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-primary"
|
class="uk-button uk-button-primary"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(totpNewURL(baseMount))
|
route(totpNewURL(baseMount));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("totp_view_new_btn")}
|
{i18next.t("totp_view_new_btn")}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{mountCaps.includes("delete") && (
|
{mountCaps.includes("delete") && (
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(delSecretsEngineURL(baseMount))
|
route(delSecretsEngineURL(baseMount));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("totp_view_delete_btn")}
|
{i18next.t("totp_view_delete_btn")}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
<div id="totpList">
|
<div id="totpList">
|
||||||
{
|
{(() => {
|
||||||
(() => {
|
|
||||||
if (this.state.totpItems.length == 0) {
|
if (this.state.totpItems.length == 0) {
|
||||||
return <p>{i18next.t("totp_view_empty")}</p>;
|
return <p>{i18next.t("totp_view_empty")}</p>;
|
||||||
} else {
|
} else {
|
||||||
return this.state.totpItems.map((totpItem) => {
|
return this.state.totpItems.map((totpItem) => {
|
||||||
return <RefreshingTOTPGridItem
|
return (
|
||||||
baseMount={totpItem.baseMount}
|
<RefreshingTOTPGridItem
|
||||||
totpKey={totpItem.totpKey}
|
baseMount={totpItem.baseMount}
|
||||||
canDelete={totpItem.canDelete}
|
totpKey={totpItem.totpKey}
|
||||||
/>
|
canDelete={totpItem.canDelete}
|
||||||
})
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})()
|
})()}
|
||||||
}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
|
import { Component } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Form } from "../../../elements/Form";
|
import { Form } from "../../../elements/Form";
|
||||||
import { Margin } from "../../../elements/Margin";
|
import { Margin } from "../../../elements/Margin";
|
||||||
import { MarginInline } from "../../../elements/MarginInline";
|
import { MarginInline } from "../../../elements/MarginInline";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { newTransitKey } from "../../../../api/transit/newTransitKey";
|
import { newTransitKey } from "../../../../api/transit/newTransitKey";
|
||||||
import { Component } from "preact";
|
|
||||||
import { setErrorText } from "../../../../pageUtils";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
import { route } from "preact-router";
|
||||||
|
import { setErrorText } from "../../../../pageUtils";
|
||||||
import { transitViewSecretURL } from "../../pageLinks";
|
import { transitViewSecretURL } from "../../pageLinks";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class NewTransitKey extends Component<DefaultPageProps> {
|
export class NewTransitKey extends Component<DefaultPageProps> {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -65,7 +65,6 @@ export class NewTransitKey extends Component<DefaultPageProps> {
|
||||||
</MarginInline>
|
</MarginInline>
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ export class NewTransitKey extends Component<DefaultPageProps> {
|
||||||
name: name,
|
name: name,
|
||||||
type: type,
|
type: type,
|
||||||
});
|
});
|
||||||
route(transitViewSecretURL(baseMount, name))
|
route(transitViewSecretURL(baseMount, name));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const error = e as Error;
|
const error = e as Error;
|
||||||
setErrorText(error.message);
|
setErrorText(error.message);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Component, JSX, render } from "preact";
|
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
|
||||||
import { CapabilitiesType, getCapabilitiesPath } from "../../../../api/sys/getCapabilities";
|
import { CapabilitiesType, getCapabilitiesPath } from "../../../../api/sys/getCapabilities";
|
||||||
import { getTransitKeys } from "../../../../api/transit/getTransitKeys";
|
import { Component, JSX, render } from "preact";
|
||||||
import i18next from "i18next";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { delSecretsEngineURL, transitNewSecretURL, transitViewSecretURL } from "../../pageLinks";
|
import { delSecretsEngineURL, transitNewSecretURL, transitViewSecretURL } from "../../pageLinks";
|
||||||
|
import { getTransitKeys } from "../../../../api/transit/getTransitKeys";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
type TransitViewListState = {
|
type TransitViewListState = {
|
||||||
contentLoaded: boolean;
|
contentLoaded: boolean;
|
||||||
|
@ -58,7 +58,7 @@ export class TransitViewListItem extends Component<{ baseMount: string }, Transi
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(transitViewSecretURL(this.props.baseMount, key))
|
route(transitViewSecretURL(this.props.baseMount, key));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{key}
|
{key}
|
||||||
|
@ -70,13 +70,13 @@ export class TransitViewListItem extends Component<{ baseMount: string }, Transi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TransitView extends Component<DefaultPageProps, {caps: CapabilitiesType}> {
|
export class TransitView extends Component<DefaultPageProps, { caps: CapabilitiesType }> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
const mountsPath = "/sys/mounts/" + baseMount;
|
const mountsPath = "/sys/mounts/" + baseMount;
|
||||||
|
|
||||||
const caps = await getCapabilitiesPath([mountsPath, baseMount]);
|
const caps = await getCapabilitiesPath([mountsPath, baseMount]);
|
||||||
this.setState({caps})
|
this.setState({ caps });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -105,7 +105,7 @@ export class TransitView extends Component<DefaultPageProps, {caps: Capabilities
|
||||||
<button
|
<button
|
||||||
class="uk-button uk-button-danger"
|
class="uk-button uk-button-danger"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
route(delSecretsEngineURL(baseMount))
|
route(delSecretsEngineURL(baseMount));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{i18next.t("transit_view_delete_btn")}
|
{i18next.t("transit_view_delete_btn")}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
||||||
import { Grid, GridSizes } from "../../../elements/Grid";
|
import { Grid, GridSizes } from "../../../elements/Grid";
|
||||||
import { Page } from "../../../../types/Page";
|
import { Page } from "../../../../types/Page";
|
||||||
import { SecretTitleElement } from "../SecretTitleElement";
|
import { SecretTitleElement } from "../SecretTitleElement";
|
||||||
import { Tile } from "../../../elements/Tile";
|
import { Tile } from "../../../elements/Tile";
|
||||||
import { getTransitKey } from "../../../../api/transit/getTransitKey";
|
|
||||||
import { Component, render } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { DefaultPageProps } from "../../../../types/DefaultPageProps";
|
|
||||||
import { TransitKeyType } from "../../../../api/types/transit";
|
import { TransitKeyType } from "../../../../api/types/transit";
|
||||||
|
import { getTransitKey } from "../../../../api/transit/getTransitKey";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
export class TransitViewSecret extends Component<DefaultPageProps, {transitKey: TransitKeyType}> {
|
export class TransitViewSecret extends Component<DefaultPageProps, { transitKey: TransitKeyType }> {
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
const secretItem = this.props.matches["secretItem"];
|
const secretItem = this.props.matches["secretItem"];
|
||||||
const transitKey = await getTransitKey(baseMount, secretItem);
|
const transitKey = await getTransitKey(baseMount, secretItem);
|
||||||
this.setState({transitKey});
|
this.setState({ transitKey });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -21,7 +21,6 @@ export class TransitViewSecret extends Component<DefaultPageProps, {transitKey:
|
||||||
const baseMount = this.props.matches["baseMount"];
|
const baseMount = this.props.matches["baseMount"];
|
||||||
const secretItem = this.props.matches["secretItem"];
|
const secretItem = this.props.matches["secretItem"];
|
||||||
const transitKey = this.state.transitKey;
|
const transitKey = this.state.transitKey;
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
<Grid size={GridSizes.MATCHING_TWO_ROWS}>
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
import translations from "../../translations/index.mjs";
|
import translations from "../../translations/index.mjs";
|
||||||
// ts-unignore
|
// ts-unignore
|
||||||
|
|
||||||
|
import { Component } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../types/DefaultPageProps.js";
|
||||||
import { Form } from "../elements/Form";
|
import { Form } from "../elements/Form";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { MarginInline } from "../elements/MarginInline";
|
import { MarginInline } from "../elements/MarginInline";
|
||||||
import { Component } from "preact";
|
|
||||||
import i18next from "i18next";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps.js";
|
import { route } from "preact-router";
|
||||||
|
import i18next from "i18next";
|
||||||
|
|
||||||
const languageIDs = Object.getOwnPropertyNames(translations);
|
const languageIDs = Object.getOwnPropertyNames(translations);
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ export class SetLanguage extends Component<DefaultPageProps> {
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async onSubmit(data: FormData): Promise<void> {
|
async onSubmit(data: FormData): Promise<void> {
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
|
import { Component, render } from "preact";
|
||||||
|
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
import { Form } from "../elements/Form";
|
import { Form } from "../elements/Form";
|
||||||
import { Margin } from "../elements/Margin";
|
import { Margin } from "../elements/Margin";
|
||||||
import { Page } from "../../types/Page";
|
import { Page } from "../../types/Page";
|
||||||
import { Component, render } from "preact";
|
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
|
|
||||||
export class SetVaultURL extends Component<DefaultPageProps> {
|
export class SetVaultURL extends Component<DefaultPageProps> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageTitle title={this.name} />
|
<PageTitle title={this.name} />
|
||||||
<Form onSubmit={(data) => this.onSubmit(data)}>
|
<Form onSubmit={(data) => this.onSubmit(data)}>
|
||||||
<Margin>
|
<Margin>
|
||||||
<input
|
<input
|
||||||
class="uk-input uk-form-width-medium"
|
class="uk-input uk-form-width-medium"
|
||||||
name="vaultURL"
|
name="vaultURL"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Vault URL"
|
placeholder="Vault URL"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</Margin>
|
</Margin>
|
||||||
<p id="errorText" class="uk-text-danger" />
|
<p id="errorText" class="uk-text-danger" />
|
||||||
<Margin>
|
<Margin>
|
||||||
<button class="uk-button uk-button-primary" type="submit">
|
<button class="uk-button uk-button-primary" type="submit">
|
||||||
Set
|
Set
|
||||||
</button>
|
</button>
|
||||||
</Margin>
|
</Margin>
|
||||||
</Form>
|
</Form>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,11 @@ export class SetVaultURL extends Component<DefaultPageProps> {
|
||||||
async onSubmit(data: FormData): Promise<void> {
|
async onSubmit(data: FormData): Promise<void> {
|
||||||
// TODO: check if vault is actually working here.
|
// TODO: check if vault is actually working here.
|
||||||
this.props.state.apiURL = data.get("vaultURL") as string;
|
this.props.state.apiURL = data.get("vaultURL") as string;
|
||||||
route("/")
|
route("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
get name(): string {
|
get name(): string {
|
||||||
// TODO:
|
// TODO:
|
||||||
return "Set Vault URL";
|
return "Set Vault URL";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@ import { Page } from "../../types/Page";
|
||||||
import { QRScanner } from "../elements/QRScanner";
|
import { QRScanner } from "../elements/QRScanner";
|
||||||
import { getSealStatus } from "../../api/sys/getSealStatus";
|
import { getSealStatus } from "../../api/sys/getSealStatus";
|
||||||
|
|
||||||
|
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
||||||
|
import { PageTitle } from "../elements/PageTitle";
|
||||||
|
import { route } from "preact-router";
|
||||||
import { setErrorText } from "../../pageUtils";
|
import { setErrorText } from "../../pageUtils";
|
||||||
import { submitUnsealKey } from "../../api/sys/submitUnsealKey";
|
import { submitUnsealKey } from "../../api/sys/submitUnsealKey";
|
||||||
import { toStr } from "../../utils";
|
import { toStr } from "../../utils";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { DefaultPageProps } from "../../types/DefaultPageProps";
|
|
||||||
import { PageTitle } from "../elements/PageTitle";
|
|
||||||
import { route } from "preact-router";
|
|
||||||
|
|
||||||
const UnsealInputModes = {
|
const UnsealInputModes = {
|
||||||
FORM_INPUT: "FORM_INPUT",
|
FORM_INPUT: "FORM_INPUT",
|
||||||
|
@ -146,4 +146,4 @@ export class Unseal extends Component<DefaultPageProps, UnsealPageState> {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,55 +1,54 @@
|
||||||
// Delete Secret Engine
|
// Delete Secret Engine
|
||||||
|
|
||||||
export function delSecretsEngineURL(baseMount: string): string {
|
export function delSecretsEngineURL(baseMount: string): string {
|
||||||
return `/secrets/delete_engine/${baseMount}`;
|
return `/secrets/delete_engine/${baseMount}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secrets / Key Value
|
// Secrets / Key Value
|
||||||
|
|
||||||
export function kvNewURL(baseMount: string, secretPath?: string[]): string {
|
export function kvNewURL(baseMount: string, secretPath?: string[]): string {
|
||||||
return `/secrets/kv/new/${baseMount}` + secretPath ? `/${secretPath.join("/")}` : "";
|
return `/secrets/kv/new/${baseMount}` + secretPath ? `/${secretPath.join("/")}` : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kvDeleteURL(baseMount: string, secretPath: string[], secret: string): string {
|
export function kvDeleteURL(baseMount: string, secretPath: string[], secret: string): string {
|
||||||
return `/secrets/kv/delete/${secret}/${baseMount}/${secretPath.join("/")}`;
|
return `/secrets/kv/delete/${secret}/${baseMount}/${secretPath.join("/")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kvEditURL(baseMount: string, secretPath: string[], secret: string): string {
|
export function kvEditURL(baseMount: string, secretPath: string[], secret: string): string {
|
||||||
return `/secrets/kv/edit/${secret}/${baseMount}/${secretPath.join("/")}`;
|
return `/secrets/kv/edit/${secret}/${baseMount}/${secretPath.join("/")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kvViewURL(baseMount: string, secretPath: string[], secret: string): string {
|
export function kvViewURL(baseMount: string, secretPath: string[], secret: string): string {
|
||||||
return `/secrets/kv/view/${secret}/${baseMount}/${secretPath.join("/")}`;
|
return `/secrets/kv/view/${secret}/${baseMount}/${secretPath.join("/")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function kvListURL(baseMount: string, secretPath: string[]): string {
|
export function kvListURL(baseMount: string, secretPath: string[]): string {
|
||||||
console.log(baseMount, secretPath);
|
console.log(baseMount, secretPath);
|
||||||
return `/secrets/kv/list/${baseMount}/${secretPath.join("/")}`;
|
return `/secrets/kv/list/${baseMount}/${secretPath.join("/")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secrets / TOTP
|
// Secrets / TOTP
|
||||||
|
|
||||||
export function totpNewURL(baseMount: string): string {
|
export function totpNewURL(baseMount: string): string {
|
||||||
return `/secrets/totp/new/${baseMount}`;
|
return `/secrets/totp/new/${baseMount}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function totpListURL(baseMount: string): string {
|
export function totpListURL(baseMount: string): string {
|
||||||
return `/secrets/totp/list/${baseMount}`;
|
return `/secrets/totp/list/${baseMount}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function totpDeleteURL(baseMount: string, secret: string): string {
|
export function totpDeleteURL(baseMount: string, secret: string): string {
|
||||||
return `/secrets/totp/delete/${baseMount}/${secret}`;
|
return `/secrets/totp/delete/${baseMount}/${secret}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secrets / Transit
|
// Secrets / Transit
|
||||||
|
|
||||||
export function transitNewSecretURL(baseMount: string): string {
|
export function transitNewSecretURL(baseMount: string): string {
|
||||||
return `/secrets/transit/new/${baseMount}`;
|
return `/secrets/transit/new/${baseMount}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function transitViewSecretURL(baseMount: string, secret: string): string {
|
export function transitViewSecretURL(baseMount: string, secret: string): string {
|
||||||
return `/secrets/transit/view/${baseMount}/${secret}`;
|
return `/secrets/transit/view/${baseMount}/${secret}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue