nutstore-webdav-secret-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +265 -0
- package/package.json +54 -0
- package/scripts/build.ts +56 -0
- package/src/App.tsx +57 -0
- package/src/atom/auth.ts +55 -0
- package/src/atom/platform.ts +10 -0
- package/src/atom/secrets.ts +94 -0
- package/src/authMock.ts +11 -0
- package/src/cli.tsx +6 -0
- package/src/components/auth-gate.tsx +205 -0
- package/src/components/footer.tsx +37 -0
- package/src/components/header.tsx +39 -0
- package/src/components/nutstore-logo.tsx +56 -0
- package/src/components/secret-detail.tsx +198 -0
- package/src/components/secret-list.tsx +78 -0
- package/src/components/secrets-page.tsx +252 -0
- package/src/constants.ts +1 -0
- package/src/effect/add-secret.ts +94 -0
- package/src/effect/auth.ts +46 -0
- package/src/effect/delete-secret.ts +62 -0
- package/src/effect/list-secrets.ts +160 -0
- package/src/hooks/useThemeMode.ts +26 -0
- package/src/index.tsx +1 -0
- package/src/mockSecrets.ts +39 -0
- package/src/opentui-jsx.d.ts +94 -0
- package/src/theme.ts +49 -0
- package/src/types.ts +7 -0
- package/src/utils.ts +31 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { BaseRenderable } from "@opentui/core";
|
|
2
|
+
import type {
|
|
3
|
+
AsciiFontProps,
|
|
4
|
+
BoxProps,
|
|
5
|
+
CodeProps,
|
|
6
|
+
ExtendedIntrinsicElements,
|
|
7
|
+
InputProps,
|
|
8
|
+
LinkProps,
|
|
9
|
+
MarkdownProps,
|
|
10
|
+
OpenTUIComponents,
|
|
11
|
+
ScrollBoxProps,
|
|
12
|
+
SelectProps,
|
|
13
|
+
SpanProps,
|
|
14
|
+
TabSelectProps,
|
|
15
|
+
TextareaProps,
|
|
16
|
+
TextProps,
|
|
17
|
+
} from "../node_modules/@opentui/solid/src/types/elements.js";
|
|
18
|
+
|
|
19
|
+
export type OpenTUIElement =
|
|
20
|
+
| BaseRenderable
|
|
21
|
+
| OpenTUIArrayElement
|
|
22
|
+
| string
|
|
23
|
+
| number
|
|
24
|
+
| boolean
|
|
25
|
+
| null
|
|
26
|
+
| undefined;
|
|
27
|
+
|
|
28
|
+
export interface OpenTUIArrayElement extends Array<OpenTUIElement> {}
|
|
29
|
+
|
|
30
|
+
interface OpenTUIIntrinsicElements
|
|
31
|
+
extends ExtendedIntrinsicElements<OpenTUIComponents> {
|
|
32
|
+
box: BoxProps;
|
|
33
|
+
text: TextProps;
|
|
34
|
+
span: SpanProps;
|
|
35
|
+
input: InputProps;
|
|
36
|
+
select: SelectProps;
|
|
37
|
+
ascii_font: AsciiFontProps;
|
|
38
|
+
tab_select: TabSelectProps;
|
|
39
|
+
scrollbox: ScrollBoxProps;
|
|
40
|
+
code: CodeProps;
|
|
41
|
+
textarea: TextareaProps;
|
|
42
|
+
markdown: MarkdownProps;
|
|
43
|
+
|
|
44
|
+
b: SpanProps;
|
|
45
|
+
strong: SpanProps;
|
|
46
|
+
i: SpanProps;
|
|
47
|
+
em: SpanProps;
|
|
48
|
+
u: SpanProps;
|
|
49
|
+
br: Record<string, never>;
|
|
50
|
+
a: LinkProps;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module "@opentui/solid/jsx-runtime" {
|
|
54
|
+
export function jsx(
|
|
55
|
+
type: unknown,
|
|
56
|
+
props: unknown,
|
|
57
|
+
key?: unknown,
|
|
58
|
+
): JSX.Element;
|
|
59
|
+
|
|
60
|
+
export function jsxs(
|
|
61
|
+
type: unknown,
|
|
62
|
+
props: unknown,
|
|
63
|
+
key?: unknown,
|
|
64
|
+
): JSX.Element;
|
|
65
|
+
|
|
66
|
+
export const Fragment: (props: { children?: JSX.Element }) => JSX.Element;
|
|
67
|
+
|
|
68
|
+
export namespace JSX {
|
|
69
|
+
type Element = OpenTUIElement;
|
|
70
|
+
type ArrayElement = OpenTUIArrayElement;
|
|
71
|
+
|
|
72
|
+
interface IntrinsicElements extends OpenTUIIntrinsicElements {}
|
|
73
|
+
|
|
74
|
+
interface ElementChildrenAttribute {
|
|
75
|
+
children: Record<string, never>;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
declare global {
|
|
81
|
+
namespace JSX {
|
|
82
|
+
type Element = OpenTUIElement;
|
|
83
|
+
|
|
84
|
+
type ArrayElement = OpenTUIArrayElement;
|
|
85
|
+
|
|
86
|
+
interface IntrinsicElements extends OpenTUIIntrinsicElements {}
|
|
87
|
+
|
|
88
|
+
interface ElementChildrenAttribute {
|
|
89
|
+
children: Record<string, never>;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export {};
|
package/src/theme.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ThemeMode } from "@opentui/core";
|
|
2
|
+
|
|
3
|
+
const DANGER_FG = "#dc2626";
|
|
4
|
+
const NUTSTORE_LOGO_COLORS = [
|
|
5
|
+
"#D89F44",
|
|
6
|
+
"#C78A3D",
|
|
7
|
+
"#B67535",
|
|
8
|
+
"#9E5726",
|
|
9
|
+
"#965B25",
|
|
10
|
+
"#854A21",
|
|
11
|
+
"#713F1D",
|
|
12
|
+
"#623718",
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export type Palette = {
|
|
16
|
+
fg: string;
|
|
17
|
+
muted: string;
|
|
18
|
+
border: string;
|
|
19
|
+
brandLogo: string[];
|
|
20
|
+
cursor: string;
|
|
21
|
+
selectedFg: string;
|
|
22
|
+
selectedBg: string;
|
|
23
|
+
danger: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const lightPalette: Palette = {
|
|
27
|
+
fg: "#111827",
|
|
28
|
+
muted: "#4b5563",
|
|
29
|
+
border: "#6b7280",
|
|
30
|
+
brandLogo: NUTSTORE_LOGO_COLORS,
|
|
31
|
+
cursor: "#111827",
|
|
32
|
+
selectedFg: "#ffffff",
|
|
33
|
+
selectedBg: "#111827",
|
|
34
|
+
danger: DANGER_FG,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const darkPalette: Palette = {
|
|
38
|
+
fg: "#f9fafb",
|
|
39
|
+
muted: "#9ca3af",
|
|
40
|
+
border: "#9ca3af",
|
|
41
|
+
brandLogo: NUTSTORE_LOGO_COLORS,
|
|
42
|
+
cursor: "#f9fafb",
|
|
43
|
+
selectedFg: "#111827",
|
|
44
|
+
selectedBg: "#f9fafb",
|
|
45
|
+
danger: "#f87171",
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const getPalette = (mode: ThemeMode | null): Palette =>
|
|
49
|
+
mode === "dark" ? darkPalette : lightPalette;
|
package/src/types.ts
ADDED
package/src/utils.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const clamp = (value: number, min: number, max: number) =>
|
|
2
|
+
Math.max(min, Math.min(value, max));
|
|
3
|
+
|
|
4
|
+
export const truncate = (value: string, maxLength: number) => {
|
|
5
|
+
if (value.length <= maxLength) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return `${value.slice(0, Math.max(0, maxLength - 3))}...`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const maskPassword = (password: string) =>
|
|
13
|
+
`********${password.slice(-3)}`;
|
|
14
|
+
|
|
15
|
+
export const copyToClipboard = async (value: string) => {
|
|
16
|
+
if (typeof Bun === "undefined") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const process = Bun.spawn(["pbcopy"], {
|
|
21
|
+
stdin: "pipe",
|
|
22
|
+
stdout: "ignore",
|
|
23
|
+
stderr: "ignore",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
process.stdin.write(value);
|
|
27
|
+
process.stdin.end();
|
|
28
|
+
|
|
29
|
+
const exitCode = await process.exited;
|
|
30
|
+
return exitCode === 0;
|
|
31
|
+
};
|