fix(cli): corrected view note cli command

This commit is contained in:
Corentin Thomasset 2024-09-21 23:22:58 +02:00
parent c1c69c806b
commit 6ae4d4b468
No known key found for this signature in database
GPG Key ID: DBD997E935996158
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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'));