From b0a0ab60d54219696c3a95d52292ed1eae85ba31 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Sat, 5 Jul 2025 08:28:37 +0800 Subject: [PATCH] feat: add postmessage for add note --- script-meta-v2.json | 6 +++--- single-scripts/post-note.ts | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/script-meta-v2.json b/script-meta-v2.json index bd102df..6f47ab9 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -53,12 +53,12 @@ }, "post-note.ts": { "script_name": "post-note.ts", - "script_length": 1925, - "script_sha256": "dfd76c534aae1a31a86af9dd7de85dbf2426bfca45a7967b457ef3d114ede4a2", + "script_length": 2025, + "script_sha256": "ed3d797d90c845b569c3280749cba07695951c555c99e70febd0fcc65de85db9", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/post-note.ts", "single_script_file": true, "publish_time": 1737475603673, - "update_time": 1750472965161 + "update_time": 1751675304726 }, "print-env.ts": { "script_name": "print-env.ts", diff --git a/single-scripts/post-note.ts b/single-scripts/post-note.ts index 82178dc..5fc9762 100755 --- a/single-scripts/post-note.ts +++ b/single-scripts/post-note.ts @@ -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 ] <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=