summaryrefslogtreecommitdiff
path: root/app/lib
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-11-18 09:43:16 +0700
committerpolwex <polwex@sortug.com>2025-11-18 09:43:16 +0700
commita465c73178dc621578d10312f263355f0f2d5309 (patch)
tree08a0b655835d4c08d45e8e3e8f52601f7911044b /app/lib
parent7706acaafa89691dba33c216e6287a8405c4c302 (diff)
fixes to profile handling and rendering
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/json/nostr.hoon5
-rw-r--r--app/lib/nostr/client.hoon12
-rw-r--r--app/lib/websockets.hoon5
3 files changed, 19 insertions, 3 deletions
diff --git a/app/lib/json/nostr.hoon b/app/lib/json/nostr.hoon
index 3c42f0b..ca4ed43 100644
--- a/app/lib/json/nostr.hoon
+++ b/app/lib/json/nostr.hoon
@@ -276,10 +276,13 @@
?~ crd $(fields t.fields) $(fields t.fields, um um(name u.crd))
%'about'
=/ crd (so jn)
- ?~ crd $(fields t.fields) $(fields t.fields, um um(picture u.crd))
+ ?~ crd $(fields t.fields) $(fields t.fields, um um(about u.crd))
%'picture'
=/ crd (so jn)
?~ crd $(fields t.fields) $(fields t.fields, um um(picture u.crd))
+ %'image'
+ =/ crd (so jn)
+ ?~ crd $(fields t.fields) $(fields t.fields, um um(picture u.crd))
==
--
--
diff --git a/app/lib/nostr/client.hoon b/app/lib/nostr/client.hoon
index 741c51e..9c732bb 100644
--- a/app/lib/nostr/client.hoon
+++ b/app/lib/nostr/client.hoon
@@ -69,6 +69,13 @@
=/ =filter:nsur [~ `pubkeys `kinds ~ ~ ~ ~]
(send-req ~[filter] .y ~)
+++ get-profile |= pubkey=@ux
+ =/ kinds (silt ~[0])
+ :: =/ since (to-unix-secs:jikan:sr last-week)
+ =/ pubkeys (silt ~[pubkey])
+ =/ =filter:nsur [~ `pubkeys `kinds ~ ~ ~ ~]
+ (send-req ~[filter] .n ~)
+
++ get-profiles
^- (quip card _state)
=/ npoasts (tap:norm:sur nostr-feed.state)
@@ -80,11 +87,12 @@
=. missing-profs ?: have missing-profs (~(put in missing-profs) pubkey.poast)
$(npoasts t.npoasts)
=/ kinds (silt ~[0])
- ?. (gth ~(wyt in pubkeys) 300)
+ =/ chunk-size 300
+ ?. (gth ~(wyt in pubkeys) chunk-size)
=/ =filter:nsur [~ `pubkeys `kinds ~ ~ ~ ~]
(send-req ~[filter] .n ~)
::
- =/ chunks=(list (list @ux)) (chunk-by-size:seq ~(tap in pubkeys) 300)
+ =/ chunks=(list (list @ux)) (chunk-by-size:seq ~(tap in pubkeys) chunk-size)
?~ chunks ~& >>> "error chunking pubkeys" `state
=/ queue=(list filter:nsur)
%+ turn t.chunks |= l=(list @ux) ^- filter:nsur
diff --git a/app/lib/websockets.hoon b/app/lib/websockets.hoon
index ae48775..a87f2a1 100644
--- a/app/lib/websockets.hoon
+++ b/app/lib/websockets.hoon
@@ -4,6 +4,11 @@
=/ =task:iris [%websocket-connect dap.bowl endpoint]
[%pass /ws-connect %arvo %i task]
+ ++ cancel-connect |= wid=@ud
+ ^- card:agent:gall
+ =/ =task:iris [%cancel-websocket wid]
+ [%pass /ws-connect %arvo %i task]
+
++ disconnect |= wid=@ud
^- card:agent:gall
=/ =path /websocket-client/(scot %ud wid)