From 60593de7855588ecefb962b7e9e9605107687b6d Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Thu, 11 Jul 2024 22:21:28 +0200 Subject: [PATCH] Nostr library update and subscription improvement --- platformio.ini | 2 +- src/lib/nostr_notify.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/platformio.ini b/platformio.ini index 7392655..f4cb6e5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -41,7 +41,7 @@ lib_deps = https://github.com/dsbaars/universal_pin https://github.com/dsbaars/GxEPD2#universal_pin https://github.com/tzapu/WiFiManager.git#v2.0.17 - rblb/Nostrduino@^1.2.5 + rblb/Nostrduino@^1.2.7 [env:lolin_s3_mini] extends = btclock_base diff --git a/src/lib/nostr_notify.cpp b/src/lib/nostr_notify.cpp index 4f7650f..a2784d6 100644 --- a/src/lib/nostr_notify.cpp +++ b/src/lib/nostr_notify.cpp @@ -7,8 +7,12 @@ TaskHandle_t nostrTaskHandle = NULL; void setupNostrNotify() { nostr::esp32::ESP32Platform::initNostr(false); - - + time_t now; + time(&now); + struct tm* utcTimeInfo; + utcTimeInfo = gmtime(&now); + time_t utcNow = mktime(utcTimeInfo); + time_t timestamp60MinutesAgo = utcNow - 3600; try { @@ -23,6 +27,7 @@ void setupNostrNotify() {{// we set the filters here (see // https://github.com/nostr-protocol/nips/blob/master/01.md#from-client-to-relay-sending-events-and-creating-subscriptions) {"kinds", {"1"}}, + {"since", {String(timestamp60MinutesAgo)}}, {"authors", {pubKey}}}}, [&](const String &subId, nostr::SignedNostrEvent *event) {