diff options
| author | polwex <polwex@sortug.com> | 2025-11-19 05:47:15 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-11-19 05:47:15 +0700 |
| commit | e6e657be3a3b1dae426b46f3bc16f9a5cf4861c2 (patch) | |
| tree | 8c04343c4b13861f2124b34f16652418e671e423 /app/lib/json | |
| parent | 4bad4b5705144b6a537053c68c3c2c3f5984de85 (diff) | |
Improvements to handling nostr post on backend
Diffstat (limited to 'app/lib/json')
| -rw-r--r-- | app/lib/json/nostr.hoon | 2 | ||||
| -rw-r--r-- | app/lib/json/nostrill.hoon | 27 | ||||
| -rw-r--r-- | app/lib/json/trill.hoon | 18 |
3 files changed, 34 insertions, 13 deletions
diff --git a/app/lib/json/nostr.hoon b/app/lib/json/nostr.hoon index 0b1a79a..05713a5 100644 --- a/app/lib/json/nostr.hoon +++ b/app/lib/json/nostr.hoon @@ -42,7 +42,7 @@ |= e=event:sur ^- json =/ pubkey ?. nostr (hex:en:common pubkey.e) - =/ pubkeyt (scow:sr %ux pubkey.e) + =/ pubkeyt (scow:parsing:sr %ux pubkey.e) ?~ pubkeyt !! [%s (crip t.pubkeyt)] %: pairs diff --git a/app/lib/json/nostrill.hoon b/app/lib/json/nostrill.hoon index 01cdb13..e6bfd4c 100644 --- a/app/lib/json/nostrill.hoon +++ b/app/lib/json/nostrill.hoon @@ -82,6 +82,7 @@ ?- -.f %nostr (en-nostr +.f) %post (postfact +.f) + %prof (en-profiles +.f) %enga (enga +.f) %fols (fols +.f) %hark (hark +.f) @@ -228,6 +229,7 @@ %- of :~ add+ui-meta del+ul + fetch+(ar user) == ++ ui-meta %- ot :~ @@ -255,25 +257,25 @@ ++ reply %- ot :~ content+so - host+(se:de:common %p) - id+de-atom-id - thread+de-atom-id + host+user + id+de-post-id + id+de-post-id == ++ quote %- ot :~ content+so - host+(se:de:common %p) - id+de-atom-id + host+user + id+de-post-id == ++ pid %- ot :~ - host+(se:de:common %p) + host+user id+de-atom-id == ++ reaction %- ot :~ - host+(se:de:common %p) - id+de-atom-id + host+user + id+de-post-id reaction+so == ++ rt @@ -287,6 +289,7 @@ add+so del+de-atom-id sync+ul + prof+ul user+hex:de:common thread+hex:de:common send+de-relay-send @@ -296,6 +299,14 @@ id+de-atom-id relays+(ar so) == + +++ de-post-id + |= jon=json ^- (unit @) + ?. ?=([%s @t] jon) ~ + =/ tryatom (rush p.jon dem) + ?^ tryatom tryatom + ^- (unit @) (hex:de:common jon) + ++ de-atom-id |= jon=json ^- (unit @) ?. ?=([%s @t] jon) ~ diff --git a/app/lib/json/trill.hoon b/app/lib/json/trill.hoon index 415d2f4..c3ef3b6 100644 --- a/app/lib/json/trill.hoon +++ b/app/lib/json/trill.hoon @@ -1,4 +1,4 @@ -/- feed=trill-feed, post=trill-post +/- feed=trill-feed, post=trill-post, sur=nostrill /+ common=json-common, sr=sortug |% ++ en @@ -23,16 +23,26 @@ :- (crip (scow:sr %ud `@ud`post-id)) (poast p) + ++ branch-user |= p=@p ^- user:sur + =/ bitsize (met 3 p) + :: TODO surely there's proper verification methods + ?: .=(32 bitsize) [%nostr `@ux`p] [%urbit p] + ++ user |= u=user:sur ^- json + ?- -.u + %urbit (patp:en:common +.u) + %nostr (hex:en:common +.u) + == ++ poast |= p=post:post ^- json %- pairs :~ id+(ud:en:common id.p) - host+(patp:en:common host.p) - author+(patp:en:common author.p) + host+(user (branch-user host.p)) + author+(user (branch-user author.p)) thread+(ud:en:common thread.p) parent+?~(parent.p ~ (ud:en:common u.parent.p)) contents+(content contents.p) - hash+(b64:en:common hash.p) + :: hash+(b64:en:common hash.p) + hash+(hex:en:common `@ux`hash.p) engagement+(engagement engagement.p) children+a+(turn ~(tap in children.p) ud:en:common) time+(time id.p) |
