From 06b64f9a48ffce6e5c471ab3c3d5365420bcf9ad Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 11 Apr 2024 10:05:49 +0200 Subject: [PATCH] add reposts to content discovery, noogle: show likes/disklies --- .../content_discovery_currently_popular.py | 2 +- ...t_discovery_currently_popular_followers.py | 2 +- nostr_dvm/utils/definitions.py | 1 + ui/noogle/src/components/ImageGeneration.vue | 100 ++++++++++++++++-- ui/noogle/src/components/helper/Helper.vue | 13 ++- 5 files changed, 108 insertions(+), 10 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index 6e81f26..e13c884 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -104,7 +104,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface): for event in events: if event.created_at().as_secs() > timestamp_hour_ago: ns.finallist[event.id().to_hex()] = 0 - filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(lasthour) + filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(lasthour) reactions = cli.database().query([filt]) ns.finallist[event.id().to_hex()] = len(reactions) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py index ebc77eb..40c2757 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py @@ -137,7 +137,7 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface): if event.created_at().as_secs() > timestamp_hour_ago: ns.finallist[event.id().to_hex()] = 0 filt = Filter().kinds( - [definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, + [definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(lasthour) reactions = cli.database().query([filt]) ns.finallist[event.id().to_hex()] = len(reactions) diff --git a/nostr_dvm/utils/definitions.py b/nostr_dvm/utils/definitions.py index 737d90e..ee6aa50 100644 --- a/nostr_dvm/utils/definitions.py +++ b/nostr_dvm/utils/definitions.py @@ -7,6 +7,7 @@ from nostr_sdk import Event, Kind class EventDefinitions: KIND_NOTE = Kind(1) KIND_DM = Kind(4) + KIND_REPOST = Kind(6) KIND_REACTION = Kind(7) KIND_ZAP = Kind(9735) KIND_ANNOUNCEMENT = Kind(31990) diff --git a/ui/noogle/src/components/ImageGeneration.vue b/ui/noogle/src/components/ImageGeneration.vue index 1631d73..a1f0282 100644 --- a/ui/noogle/src/components/ImageGeneration.vue +++ b/ui/noogle/src/components/ImageGeneration.vue @@ -466,13 +466,83 @@ const submitHandler = async () => {
{{dvm.reactions.positive.length}} {{dvm.reactions.negative.length}}
+{{dvm.reactions.positive.length}} -