feat: add postmessage for add note

This commit is contained in:
2025-07-05 08:28:37 +08:00
parent aefa8d371e
commit b0a0ab60d5
2 changed files with 11 additions and 7 deletions

View File

@@ -20,12 +20,12 @@ if (!endpoint || !publicKeyPointHex) {
}
const flags = parseArgs(Deno.args, {
boolean: ["help"],
boolean: ["help", "post-message"],
string: ["title"],
});
if (flags.help) {
console.log("post-note.ts [--title <title>] <message>");
console.log("post-note.ts [--post-message] [--title <title>] <message>");
Deno.exit(0);
}
@@ -50,11 +50,15 @@ const encryptedMessage = await encryptEcdhP256(
);
args.push(`memo=${encodeURIComponent(encryptedMessage.toString())}`);
if (flags["post-message"]) {
args.push("postMessage=true");
}
const response = await fetchWithTimoutAndAutoProxy(
`${endpoint}?${args.join("&")}`,
);
console.info(response.status, await response.json());
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20250621T102758+08:00.MEYCIQCNUYJ+DlrcTT15QOdQ
// Z+6eFhnaJWSqMZhEBHxq0m3qMQIhAJvwKn5ZzXkDGj+PRcfCIQ0NWTLHTYsjcOOxUkYC/TBv
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20250705T082352+08:00.MEUCIQCXIiNRCQYEV3S5tDmu
// j/1mMjlNjHne9gWjxNJuJuz8pQIgNtTvQ4XwngDgNSAGYCUDCgB7abitnVUsG+NRVwJJurw=