mirror of
https://github.com/CorentinTh/enclosed.git
synced 2026-01-09 07:44:26 +08:00
fix(cli): corrected view note cli command
This commit is contained in:
parent
c1c69c806b
commit
6ae4d4b468
4
.github/workflows/ci-cli.yaml
vendored
4
.github/workflows/ci-cli.yaml
vendored
@ -30,8 +30,8 @@ jobs:
|
||||
- name: Run linters
|
||||
run: pnpm lint
|
||||
|
||||
# - name: Type check
|
||||
# run: pnpm typecheck
|
||||
- name: Type check
|
||||
run: pnpm typecheck
|
||||
|
||||
# - name: Run unit test
|
||||
# run: pnpm test
|
||||
|
||||
@ -27,20 +27,20 @@ export const viewNoteCommand = defineCommand({
|
||||
const { noteUrl, password } = args;
|
||||
|
||||
try {
|
||||
const { noteId, encryptionKey } = parseNoteUrl({ noteUrl });
|
||||
const { noteId, encryptionKey, isPasswordProtected } = parseNoteUrl({ noteUrl });
|
||||
|
||||
const { content: encryptedContent, isPasswordProtected } = await fetchNote({
|
||||
const { payload } = await fetchNote({
|
||||
noteId,
|
||||
apiBaseUrl: getInstanceUrl(),
|
||||
});
|
||||
|
||||
const { decryptedContent } = await decryptNote({
|
||||
encryptedContent,
|
||||
const { note } = await decryptNote({
|
||||
encryptedPayload: payload,
|
||||
encryptionKey,
|
||||
password: isPasswordProtected ? password ?? await promptForPassword() : undefined,
|
||||
});
|
||||
|
||||
console.log(decryptedContent);
|
||||
console.log(note.content);
|
||||
} catch (error) {
|
||||
if (isApiClientErrorWithStatusCode({ error, statusCode: 404 })) {
|
||||
console.error(picocolors.red('Note not found'));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user