From 3cc7fd11a81ea285998cd9418982187d15cead59 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Sat, 16 Nov 2024 11:57:45 +0100 Subject: [PATCH 01/26] update to sdk 036.1 / 0.37? --- nostr_dvm/bot.py | 68 +++++++++++-------- nostr_dvm/dvm.py | 9 +-- nostr_dvm/subscription.py | 14 ++-- ...ent_discovery_currently_latest_longform.py | 4 +- ...content_discovery_currently_latest_wiki.py | 4 +- .../content_discovery_currently_popular.py | 8 +-- ...discovery_currently_popular_by_top_zaps.py | 8 +-- ...t_discovery_currently_popular_followers.py | 8 +-- ...ent_discovery_currently_popular_gallery.py | 14 ++-- ...ntent_discovery_currently_popular_mostr.py | 8 +-- ...iscovery_currently_popular_nonfollowers.py | 8 +-- ...ntent_discovery_currently_popular_topic.py | 8 +-- ...ntent_discovery_latest_one_per_follower.py | 4 +- nostr_dvm/tasks/discovery_bot_farms.py | 6 +- nostr_dvm/tasks/discovery_censor_wot.py | 4 +- nostr_dvm/tasks/discovery_inactive_follows.py | 4 +- nostr_dvm/tasks/discovery_nonfollowers.py | 5 +- nostr_dvm/tasks/people_discovery_mywot.py | 4 +- nostr_dvm/tasks/people_discovery_wot.py | 4 +- nostr_dvm/tasks/search_users.py | 6 +- nostr_dvm/utils/database_utils.py | 6 +- nostr_dvm/utils/gallery_utils.py | 2 +- nostr_dvm/utils/nip65_utils.py | 8 +-- nostr_dvm/utils/nip88_utils.py | 4 +- nostr_dvm/utils/nip89_utils.py | 6 +- nostr_dvm/utils/nip98_utils.py | 2 +- nostr_dvm/utils/nostr_utils.py | 35 ++++------ nostr_dvm/utils/nut_wallet_utils.py | 12 ++-- nostr_dvm/utils/outbox_utils.py | 18 ++--- nostr_dvm/utils/output_utils.py | 2 +- nostr_dvm/utils/reaction_utils.py | 4 +- nostr_dvm/utils/zap_utils.py | 6 +- tests/db.py | 2 +- tests/generic_dvm_autotopic_feed.py | 8 +-- tests/wot.py | 4 +- 35 files changed, 165 insertions(+), 152 deletions(-) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 0c79be8..4c87397 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -2,11 +2,11 @@ import json import os import signal -from datetime import timedelta +from multiprocessing.connection import Connection -from nostr_sdk import (Keys, Client, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, - Options, Tag, Event, nip04_encrypt, NostrSigner, EventId, Nip19Event, Kind, KindEnum, - UnsignedEvent, UnwrappedGift, uniffi_set_event_loop) +from nostr_sdk import (Keys, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, + Options, Tag, Event, nip04_encrypt, EventId, Nip19Event, Kind, KindEnum, + UnsignedEvent, UnwrappedGift, uniffi_set_event_loop, ClientBuilder, make_private_msg) from nostr_dvm.utils.admin_utils import admin_make_database_updates from nostr_dvm.utils.cashu_utils import redeem_cashu @@ -44,8 +44,8 @@ async def run_bot(self, dvm_config, admin_config): self.keys = Keys.parse(dvm_config.PRIVATE_KEY) self.CHATBOT = False - opts = (Options().gossip(True)) - self.client = Client.with_opts(self.keys, opts) + opts = Options().gossip(True) + self.client = ClientBuilder().signer(self.keys).opts(opts).build() self.invoice_list = [] pk = self.keys.public_key() @@ -63,9 +63,6 @@ async def run_bot(self, dvm_config, admin_config): for relay in self.dvm_config.RELAY_LIST: await self.client.add_relay(relay) - await self.client.add_read_relay("wss://relay.nostr.band") - await self.client.add_read_relay("wss://relay.damus.io") - await self.client.connect() zap_filter = Filter().pubkey(pk).kinds([EventDefinitions.KIND_ZAP]).since(Timestamp.now()) @@ -124,7 +121,6 @@ async def handle_dm(nostr_event, giftwrap): if giftwrap: try: # Extract rumor - unwrapped_gift = await UnwrappedGift.from_gift_wrap(self.keys, nostr_event) sender = unwrapped_gift.sender().to_hex() rumor: UnsignedEvent = unwrapped_gift.rumor() @@ -194,13 +190,13 @@ async def handle_dm(nostr_event, giftwrap): encrypted_tag = Tag.parse(['encrypted']) # add the encrypted params to the content nip90request = (EventBuilder(self.dvm_config.SUPPORTED_DVMS[index].KIND, - encrypted_params, [p_tag, encrypted_tag]). + encrypted_params).tags([p_tag, encrypted_tag]). sign_with_keys(self.keys)) else: tags.append(p_tag) nip90request = (EventBuilder(self.dvm_config.SUPPORTED_DVMS[index].KIND, - "", tags). + "").tags(tags). sign_with_keys(self.keys)) # remember in the job_list that we have made an event, if anybody asks for payment, @@ -240,7 +236,10 @@ async def handle_dm(nostr_event, giftwrap): else: message = invoice if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), message, + None) + await self.client.send_event(event) + else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -259,11 +258,11 @@ async def handle_dm(nostr_event, giftwrap): "100 sats (or any other amount) " "to top up your balance") if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), message, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) - # await self.client.send_direct_msg(PublicKey.parse(sender), message, None) - # await self.client.send_private_msg(PublicKey.parse(sender), message, None) elif decrypted_text.startswith("cashuA"): print("Received Cashu token:" + decrypted_text) cashu_redeemed, cashu_message, total_amount, fees = await redeem_cashu(decrypted_text, @@ -278,14 +277,18 @@ async def handle_dm(nostr_event, giftwrap): message = "Error: " + cashu_message + ". Token has not been redeemed." if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), message, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) elif decrypted_text.lower().startswith("what's the second best"): await asyncio.sleep(2.0) message = "No, there is no second best.\n\nhttps://cdn.nostr.build/p/mYLv.mp4" if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), message, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) else: @@ -313,7 +316,7 @@ async def handle_dm(nostr_event, giftwrap): tags.append(p_tag) nip90request = (EventBuilder(Kind(kind), - "", tags). + "").tags(tags). sign_with_keys(self.keys)) entry = {"npub": user.npub, "event_id": nip90request.id().to_hex(), @@ -379,7 +382,9 @@ async def handle_nip90_feedback(nostr_event): client=self.client, config=self.dvm_config) await asyncio.sleep(2.0) if entry["giftwrap"]: - await self.client.send_private_msg(PublicKey.parse(entry["npub"]), content, None) + event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse(entry["npub"])), content, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(entry['npub']), self.dvm_config) print(status + ": " + content) @@ -408,8 +413,9 @@ async def handle_nip90_feedback(nostr_event): amount) + " Sats from balance to DVM. New balance is " + str( balance) + " Sats.\n" if entry["giftwrap"]: - await self.client.send_private_msg(PublicKey.parse(entry["npub"]), message, - None) + event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse(entry["npub"])), message, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(entry['npub']), self.dvm_config) @@ -424,8 +430,9 @@ async def handle_nip90_feedback(nostr_event): int(amount - user.balance)) + " Sats, then try again." if entry["giftwrap"]: - await self.client.send_private_msg(PublicKey.parse(entry["npub"]), message, - None) + event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse((entry["npub"]))), message, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(entry['npub']), self.dvm_config) @@ -502,7 +509,9 @@ async def handle_nip90_response_event(nostr_event: Event): print("[" + self.NAME + "] Received results, message to orignal sender " + user.name) await asyncio.sleep(2.0) if entry["giftwrap"]: - await self.client.send_private_msg(PublicKey.parse(user.npub), content, None) + event = await make_private_msg(self.keys, PublicKey.parse(user.npub), content, + None) + await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(user.npub), self.dvm_config) @@ -568,14 +577,16 @@ async def answer_overview(nostr_event, giftwrap, sender): text = message + "\nSelect an Index and provide an input (e.g. \"2 A purple ostrich\")\nType \"index info\" to learn more about each DVM. (e.g. \"2 info\")\n\n Type \"balance\" to see your current balance" if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), text, nostr_event.id()) + event = await make_private_msg(self.keys, PublicKey.parse(sender), text) + await self.client.send_event(event) else: await send_nip04_dm(self.client, text, PublicKey.parse(sender), self.dvm_config) async def answer_blacklisted(nostr_event, giftwrap, sender): message = "Your are currently blocked from this service." if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), message) + await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -586,7 +597,8 @@ async def answer_nip89(nostr_event, index, giftwrap, sender): await asyncio.sleep(2.0) if giftwrap: - await self.client.send_private_msg(PublicKey.parse(sender), info, None) + event = await make_private_msg(self.keys, PublicKey.parse(sender), info) + await self.client.send_event(event) else: await send_nip04_dm(self.client, info, PublicKey.parse(sender), self.dvm_config) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 27b3bfb..9a5c620 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -4,7 +4,7 @@ from sys import platform from nostr_sdk import PublicKey, Keys, Client, Tag, Event, EventBuilder, Filter, HandleNotification, Timestamp, \ - LogLevel, Options, nip04_encrypt, Kind, RelayLimits, uniffi_set_event_loop + LogLevel, Options, nip04_encrypt, Kind, RelayLimits, uniffi_set_event_loop, ClientBuilder from nostr_dvm.utils.admin_utils import admin_make_database_updates, AdminConfig from nostr_dvm.utils.backend_utils import get_amount_per_task, check_task_is_supported, get_task @@ -47,7 +47,8 @@ async def run_dvm(self, dvm_config, admin_config): opts = ( Options().relay_limits(relaylimits)) #.difficulty(28) - self.client = Client.with_opts(self.keys, opts) + #self.client = Client(self.keys) + self.client = ClientBuilder().signer(self.keys).opts(opts).build() self.job_list = [] self.jobs_on_hold_list = [] pk = self.keys.public_key() @@ -611,7 +612,7 @@ async def send_nostr_reply_event(content, original_event_as_str): content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), content) - reply_event = EventBuilder(Kind(original_event.kind().as_u16() + 1000), str(content), reply_tags).sign_with_keys( + reply_event = EventBuilder(Kind(original_event.kind().as_u16() + 1000), str(content)).tags(reply_tags).sign_with_keys( self.keys) # send_event(reply_event, client=self.client, dvm_config=self.dvm_config) @@ -727,7 +728,7 @@ async def send_job_status_reaction(original_event, status, is_paid=True, amount= content = reaction keys = Keys.parse(dvm_config.PRIVATE_KEY) - reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content), reply_tags).sign_with_keys(keys) + reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content)).tags(reply_tags).sign_with_keys(keys) # send_event(reaction_event, client=self.client, dvm_config=self.dvm_config) await send_event_outbox(reaction_event, client=self.client, dvm_config=self.dvm_config) diff --git a/nostr_dvm/subscription.py b/nostr_dvm/subscription.py index 7dd7e15..a64ec5d 100644 --- a/nostr_dvm/subscription.py +++ b/nostr_dvm/subscription.py @@ -6,7 +6,7 @@ from datetime import timedelta from nostr_sdk import (Keys, Client, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, - Options, Tag, Event, nip04_encrypt, NostrSigner, EventId, uniffi_set_event_loop) + Options, Tag, Event, nip04_encrypt, NostrSigner, EventId, uniffi_set_event_loop, make_private_msg) from nostr_dvm.utils.database_utils import fetch_user_metadata from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout @@ -151,7 +151,7 @@ async def send_status_success(original_event, domain): reply_tags = encryption_tags keys = Keys.parse(dvm_config.PRIVATE_KEY) - reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content), reply_tags).sign_with_keys(keys) + reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content)).tags(reply_tags).sign_with_keys(keys) await send_event(reaction_event, client=self.client, dvm_config=self.dvm_config) print("[" + self.dvm_config.NIP89.NAME + "]" + ": Sent Kind " + str( EventDefinitions.KIND_FEEDBACK.as_u16()) + " Reaction: " + "success" + " " + reaction_event.as_json()) @@ -209,7 +209,7 @@ async def make_subscription_zap_recipe(event7001, recipient, subscriber, start, tags = [pTag, PTag, eTag, validTag, tierTag, alttag] event = EventBuilder(EventDefinitions.KIND_NIP88_PAYMENT_RECIPE, - message, tags).sign_with_keys(self.keys) + message).tags(tags).sign_with_keys(self.keys) dvmconfig = DVMConfig() client = Client(self.keys) @@ -348,7 +348,9 @@ async def handle_nwc_request(nostr_event): Timestamp.from_secs(end).to_human_datetime().replace("Z", " ").replace("T", " ") + " GMT")) - self.client.send_private_msg(PublicKey.parse(subscriber), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(subscriber), message, + None) + await self.client.send_event(event) @@ -407,7 +409,9 @@ async def handle_subscription_renewal(subscription): Timestamp.from_secs(end).to_human_datetime().replace("Z", " ").replace("T", " "))) # await self.client.send_direct_msg(PublicKey.parse(subscription.subscriber), message, None) - await self.client.send_private_msg(PublicKey.parse(subscription.subscriber), message, None) + event = await make_private_msg(self.keys, PublicKey.parse(subscription.subscriber), message, + None) + await self.client.send_event(event) async def check_subscriptions(): try: diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py index a1207a1..6d28e16 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py @@ -123,10 +123,10 @@ async def calculate_result(self, request_form): filter1 = Filter().kind(definitions.EventDefinitions.KIND_LONGFORM).since(since) events = await cli.database().query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} index = options["max_results"] - for event in events: + for event in events.to_vec(): if event.created_at().as_secs() > timestamp_hour_ago: ns.finallist[event.id().to_hex()] = index index = index - 1 diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py index 68ed059..e8c9e32 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py @@ -123,10 +123,10 @@ async def calculate_result(self, request_form): filter1 = Filter().kind(definitions.EventDefinitions.KIND_WIKI).since(since) events = await cli.database().query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} index = options["max_results"] - for event in events: + for event in events.to_vec(): if event.created_at().as_secs() > timestamp_hour_ago: ns.finallist[event.id().to_hex()] = index index = index - 1 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index ac09e91..22c76b6 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -117,17 +117,17 @@ async def calculate_result(self, request_form): events = await database.query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): if event.created_at().as_secs() > timestamp_since: filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await database.query([filt]) - if len(reactions) >= self.min_reactions: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) if len(ns.finallist) == 0: return self.result diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py index 1b0a56c..e7c9f30 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py @@ -115,20 +115,20 @@ async def calculate_result(self, request_form): filter1 = Filter().kind(definitions.EventDefinitions.KIND_NOTE).since(since) events = await database.query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): if event.created_at().as_secs() > timestamp_hour_ago: filt = Filter().kinds([definitions.EventDefinitions.KIND_ZAP]).event(event.id()).since(since) zaps = await database.query([filt]) invoice_amount = 0 event_author = event.author().to_hex() - if len(zaps) >= self.min_reactions: + if len(zaps.to_vec()) >= self.min_reactions: has_preimage = False has_amount = False overall_amount = 0 - for zap in zaps: + for zap in zaps.to_vec(): if event_author == zap.author().to_hex(): continue # Skip self zaps.. invoice_amount = 0 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py index afa7f8b..6f3bcf6 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py @@ -137,18 +137,18 @@ async def process(self, request_form): filter1 = Filter().kind(definitions.EventDefinitions.KIND_NOTE).authors(followings).since(since) events = await cli.database().query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): # if event.created_at().as_secs() > timestamp_since: filt = Filter().kinds( [definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await cli.database().query([filt]) - if len(reactions) >= self.min_reactions: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[ :int(options["max_results"])] diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py index 3bc1857..9a717f8 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py @@ -121,16 +121,16 @@ async def calculate_result(self, request_form): ge_events = await databasegallery.query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(ge_events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(ge_events.to_vec())) + " Events") ns.finallist = {} ids = [] relays = [] - if len(ge_events) == 0: + if len(ge_events.to_vec()) == 0: return [] - for ge_event in ge_events: + for ge_event in ge_events.to_vec(): id = None for tag in ge_event.tags().to_vec(): @@ -176,7 +176,7 @@ async def calculate_result(self, request_form): if event.created_at().as_secs() > timestamp_since: filt1 = Filter().kinds([definitions.EventDefinitions.KIND_DELETION]).event(event.id()).limit(1) deletions = await databasegallery.query([filt1]) - if len(deletions) > 0: + if len(deletions.to_vec()) > 0: print("Deleted event, skipping") continue @@ -185,13 +185,13 @@ async def calculate_result(self, request_form): definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await databasegallery.query([filt]) - if len(reactions) >= self.min_reactions: + if len(reactions.to_vec()) >= self.min_reactions: found = False - for ge_event in ge_events: + for ge_event in ge_events.to_vec(): for tag in ge_event.tags().to_vec(): if tag.as_vec()[0] == "e": if event.id().to_hex() == tag.as_vec()[1]: - ns.finallist[ge_event.id().to_hex()] = len(reactions) + ns.finallist[ge_event.id().to_hex()] = len(reactions.to_vec()) found = True break if found: diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py index 5de007e..1e46d56 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -121,10 +121,10 @@ async def calculate_result(self, request_form): events = await database.query([filter1]) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): if event.created_at().as_secs() > timestamp_since: filt = Filter().kinds( @@ -133,8 +133,8 @@ async def calculate_result(self, request_form): EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await database.query([filt]) - if len(reactions) >= self.min_reactions: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) if len(ns.finallist) == 0: return self.result diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py index 829c77e..4a44715 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py @@ -185,10 +185,10 @@ async def calculate_result(self, request_form): events = await self.database.query([filter1]) - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): if event.author().to_hex() in followings: continue @@ -197,8 +197,8 @@ async def calculate_result(self, request_form): definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await self.database.query([filt]) - if len(reactions) >= self.min_reactions: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) print(len(ns.finallist)) result_list = [] diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py index 91c1d73..5a7758d 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py @@ -161,10 +161,10 @@ async def calculate_result(self, request_form): events = await self.database.query(filters) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} - for event in events: + for event in events.to_vec(): if all(ele in event.content().lower() for ele in self.must_list): # if any(ele in event.content().lower() for ele in self.search_list): if not any(ele in event.content().lower() for ele in self.avoid_list): @@ -173,8 +173,8 @@ async def calculate_result(self, request_form): definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await self.database.query([filt]) - if len(reactions) >= self.min_reactions: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= self.min_reactions: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) result_list = [] finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(options["max_results"])] diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index a43400f..11ef815 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -4,7 +4,7 @@ from datetime import timedelta from threading import Thread -from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayLimits +from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayLimits, ClientBuilder from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils.admin_utils import AdminConfig @@ -76,7 +76,7 @@ async def process(self, request_form): opts = (Options().relay_limits(relaylimits)) - cli = Client.with_opts(keys, opts) + cli = ClientBuilder().signer(keys).opts(opts).build() for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) # ropts = RelayOptions().ping(False) diff --git a/nostr_dvm/tasks/discovery_bot_farms.py b/nostr_dvm/tasks/discovery_bot_farms.py index 60a199b..2ee8f8e 100644 --- a/nostr_dvm/tasks/discovery_bot_farms.py +++ b/nostr_dvm/tasks/discovery_bot_farms.py @@ -91,13 +91,13 @@ async def process(self, request_form): filter1 = Filter().kind(Kind(0)) events = await cli.database().query([filter1]) result_list = [] - print("Events: " + str(len(events))) + print("Events: " + str(len(events.to_vec()))) searchterms = str(options["search"]).split(";") index = 0 - if len(events) > 0: + if len(events.to_vec()) > 0: - for event in events: + for event in events.to_vec(): if index < options["max_results"]: try: if any(ext in event.content().lower() for ext in searchterms): diff --git a/nostr_dvm/tasks/discovery_censor_wot.py b/nostr_dvm/tasks/discovery_censor_wot.py index 2bd81c8..9dcbe12 100644 --- a/nostr_dvm/tasks/discovery_censor_wot.py +++ b/nostr_dvm/tasks/discovery_censor_wot.py @@ -2,7 +2,7 @@ import os from datetime import timedelta -from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayLimits +from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayLimits, ClientBuilder from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils.admin_utils import AdminConfig @@ -73,7 +73,7 @@ async def process(self, request_form): Options().relay_limits(relaylimits)) sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = Client.with_opts(keys, opts) + cli = ClientBuilder().signer(keys).opts(opts).build() # cli.add_relay("wss://relay.nostr.band") for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/discovery_inactive_follows.py b/nostr_dvm/tasks/discovery_inactive_follows.py index 35e0fc1..02f4527 100644 --- a/nostr_dvm/tasks/discovery_inactive_follows.py +++ b/nostr_dvm/tasks/discovery_inactive_follows.py @@ -5,7 +5,7 @@ from threading import Thread from nostr_sdk import Client, Timestamp, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayOptions, \ - RelayLimits + RelayLimits, ClientBuilder from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils.admin_utils import AdminConfig @@ -76,7 +76,7 @@ async def process(self, request_form): opts = (Options().relay_limits(relaylimits)) - cli = Client.with_opts(keys, opts) + cli = ClientBuilder().signer(keys).opts(opts).build() for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) await cli.add_relay("wss://nostr.band") diff --git a/nostr_dvm/tasks/discovery_nonfollowers.py b/nostr_dvm/tasks/discovery_nonfollowers.py index 34e42b3..a9bff5e 100644 --- a/nostr_dvm/tasks/discovery_nonfollowers.py +++ b/nostr_dvm/tasks/discovery_nonfollowers.py @@ -5,7 +5,7 @@ from threading import Thread from nostr_sdk import Client, PublicKey, Tag, Keys, Options, SecretKey, NostrSigner, Kind, RelayOptions, \ - RelayLimits + RelayLimits, ClientBuilder from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils.admin_utils import AdminConfig @@ -68,7 +68,8 @@ async def process(self, request_form): relaylimits)) sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = Client.with_opts(keys, opts) + cli= ClientBuilder().signer(keys).opts(opts).build() + # cli.add_relay("wss://relay.nostr.band") for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/people_discovery_mywot.py b/nostr_dvm/tasks/people_discovery_mywot.py index 0c1d9f5..1cc353e 100644 --- a/nostr_dvm/tasks/people_discovery_mywot.py +++ b/nostr_dvm/tasks/people_discovery_mywot.py @@ -248,8 +248,8 @@ async def analyse_users(user_ids=None, dunbar=100000000): followers_filter = Filter().authors(user_keys).kind(Kind(3)) followers = await database.query([followers_filter]) allfriends = [] - if len(followers) > 0: - for follower in followers: + if len(followers.to_vec()) > 0: + for follower in followers.to_vec(): frens = [] if len(follower.tags().to_vec()) < dunbar: for tag in follower.tags().to_vec(): diff --git a/nostr_dvm/tasks/people_discovery_wot.py b/nostr_dvm/tasks/people_discovery_wot.py index 591afdc..61af031 100644 --- a/nostr_dvm/tasks/people_discovery_wot.py +++ b/nostr_dvm/tasks/people_discovery_wot.py @@ -253,8 +253,8 @@ async def analyse_users(user_ids=None, dunbar=100000000): followers_filter = Filter().authors(user_keys).kind(Kind(3)) followers = await database.query([followers_filter]) allfriends = [] - if len(followers) > 0: - for follower in followers: + if len(followers.to_vec()) > 0: + for follower in followers.to_vec(): frens = [] if len(follower.tags().to_vec()) < dunbar: for tag in follower.tags().to_vec(): diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 05cac30..932ca69 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -95,11 +95,11 @@ async def process(self, request_form): events = await cli.database().query([filter1]) result_list = [] - print("Events: " + str(len(events))) + print("Events: " + str(len(events.to_vec()))) index = 0 - if len(events) > 0: + if len(events.to_vec()) > 0: - for event in events: + for event in events.to_vec(): if index < options["max_results"]: try: if options["search"].lower() in event.content().lower(): diff --git a/nostr_dvm/utils/database_utils.py b/nostr_dvm/utils/database_utils.py index a9abad0..ae96b79 100644 --- a/nostr_dvm/utils/database_utils.py +++ b/nostr_dvm/utils/database_utils.py @@ -5,7 +5,7 @@ from logging import Filter from sqlite3 import Error -from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind +from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind, make_private_msg from nostr_dvm.utils.definitions import relay_timeout from nostr_dvm.utils.nostr_utils import send_nip04_dm @@ -192,7 +192,9 @@ async def update_user_balance(db, npub, additional_sats, client, config, giftwra # always send giftwrapped. sorry not sorry. #if giftwrap: - await client.send_private_msg(PublicKey.parse(npub), message, None) + event = await make_private_msg(keys, PublicKey.parse(npub), message, + None) + await client.send_event(event) #else: # await send_nip04_dm(client, message, PublicKey.parse(npub), config) diff --git a/nostr_dvm/utils/gallery_utils.py b/nostr_dvm/utils/gallery_utils.py index 8147431..6bb25eb 100644 --- a/nostr_dvm/utils/gallery_utils.py +++ b/nostr_dvm/utils/gallery_utils.py @@ -7,7 +7,7 @@ async def gallery_announce_list(tags, dvm_config, client): keys = Keys.parse(dvm_config.NIP89.PK) content = "" - event = EventBuilder(Kind(10011), content, tags).sign_with_keys(keys) + event = EventBuilder(Kind(10011), content).tags(tags).sign_with_keys(keys) eventid = await send_event(event, client=client, dvm_config=dvm_config) print( diff --git a/nostr_dvm/utils/nip65_utils.py b/nostr_dvm/utils/nip65_utils.py index 8797651..55c4791 100644 --- a/nostr_dvm/utils/nip65_utils.py +++ b/nostr_dvm/utils/nip65_utils.py @@ -15,9 +15,9 @@ async def announce_dm_relays(dvm_config, client): keys = Keys.parse(dvm_config.NIP89.PK) content = "" - event = EventBuilder(Kind(10050), content, tags).sign_with_keys(keys) + event = EventBuilder(Kind(10050), content).tags(tags).sign_with_keys(keys) eventid = await send_event(event, client=client, dvm_config=dvm_config) - if (eventid is not None): + if eventid is not None: print( bcolors.BLUE + "[" + dvm_config.NIP89.NAME + "] Announced DM relays for " + dvm_config.NIP89.NAME + " (EventID: " + str( eventid.id.to_hex()) + ")" + bcolors.ENDC) @@ -39,9 +39,9 @@ async def nip65_announce_relays(dvm_config, client): keys = Keys.parse(dvm_config.NIP89.PK) content = "" - event = EventBuilder(EventDefinitions.KIND_RELAY_ANNOUNCEMENT, content, tags).sign_with_keys(keys) + event = EventBuilder(EventDefinitions.KIND_RELAY_ANNOUNCEMENT, content).tags(tags).sign_with_keys(keys) eventid = await send_event(event, client=client, dvm_config=dvm_config) - if (eventid is not None): + if eventid is not None: print( bcolors.BLUE + "[" + dvm_config.NIP89.NAME + "] Announced NIP 65 for " + dvm_config.NIP89.NAME + " (EventID: " + str( eventid.id.to_hex()) + ")" + bcolors.ENDC) diff --git a/nostr_dvm/utils/nip88_utils.py b/nostr_dvm/utils/nip88_utils.py index 199dda2..1b8c63c 100644 --- a/nostr_dvm/utils/nip88_utils.py +++ b/nostr_dvm/utils/nip88_utils.py @@ -83,7 +83,7 @@ async def nip88_delete_announcement(eid: str, keys: Keys, dtag: str, client: Cli e_tag = Tag.parse(["e", eid]) a_tag = Tag.parse( ["a", str(EventDefinitions.KIND_NIP88_TIER_EVENT) + ":" + keys.public_key().to_hex() + ":" + dtag]) - event = EventBuilder(Kind(5), "", [e_tag, a_tag]).sign_with_keys(keys) + event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys) await send_event(event, client, config) @@ -176,7 +176,7 @@ async def nip88_announce_tier(dvm_config, client): keys = Keys.parse(dvm_config.NIP89.PK) content = dvm_config.NIP88.CONTENT - event = EventBuilder(EventDefinitions.KIND_NIP88_TIER_EVENT, content, tags).sign_with_keys(keys) + event = EventBuilder(EventDefinitions.KIND_NIP88_TIER_EVENT, content).tags(tags).sign_with_keys(keys) annotier_id = await send_event(event, client=client, dvm_config=dvm_config) if dvm_config.NIP89 is not None: diff --git a/nostr_dvm/utils/nip89_utils.py b/nostr_dvm/utils/nip89_utils.py index 3234c47..9dd92da 100644 --- a/nostr_dvm/utils/nip89_utils.py +++ b/nostr_dvm/utils/nip89_utils.py @@ -29,7 +29,7 @@ async def nip89_announce_tasks(dvm_config, client): d_tag = Tag.parse(["d", dvm_config.NIP89.DTAG]) keys = Keys.parse(dvm_config.NIP89.PK) content = dvm_config.NIP89.CONTENT - event = EventBuilder(EventDefinitions.KIND_ANNOUNCEMENT, content, [k_tag, d_tag]).sign_with_keys(keys) + event = EventBuilder(EventDefinitions.KIND_ANNOUNCEMENT, content).tags([k_tag, d_tag]).sign_with_keys(keys) eventid = await send_event(event, client=client, dvm_config=dvm_config) print( @@ -65,7 +65,7 @@ async def nip89_delete_announcement(eid: str, keys: Keys, dtag: str, client: Cli e_tag = Tag.parse(["e", eid]) a_tag = Tag.parse( ["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag]) - event = EventBuilder(Kind(5), "", [e_tag, a_tag]).sign_with_keys(keys) + event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys) print(f"POW event: {event.as_json()}") await send_event(event, client, config) @@ -74,7 +74,7 @@ async def nip89_delete_announcement_pow(eid: str, keys: Keys, dtag: str, client: e_tag = Tag.parse(["e", eid]) a_tag = Tag.parse( ["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag]) - event = EventBuilder(Kind(5), "", [e_tag, a_tag]).pow(28).sign_with_keys(keys) + event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).pow(28).sign_with_keys(keys) print(f"POW event: {event.as_json()}") await send_event(event, client, config) diff --git a/nostr_dvm/utils/nip98_utils.py b/nostr_dvm/utils/nip98_utils.py index d1f3cf3..ed0c7eb 100644 --- a/nostr_dvm/utils/nip98_utils.py +++ b/nostr_dvm/utils/nip98_utils.py @@ -17,7 +17,7 @@ async def generate_nip98_header(pkeys_hex, url="", kind="POST", filepath=""): if kind == "POST": payloadtag = Tag.parse(["payload", sha256sum(filepath)]) tags.append(payloadtag) - eb = EventBuilder(Kind(27235), "", tags) + eb = EventBuilder(Kind(27235), "").tags(tags) event = eb.sign_with_keys(keys) encoded_nip98_event = base64.b64encode(event.as_json().encode('utf-8')).decode('utf-8') diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 9b432de..dc4c40c 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -6,8 +6,8 @@ import dotenv from nostr_sdk import Filter, Client, Alphabet, EventId, Event, PublicKey, Tag, Keys, nip04_decrypt, Metadata, Options, \ - Nip19Event, SingleLetterTag, RelayLimits, SecretKey, NostrSigner, Connection, ConnectionTarget, \ - EventSource, EventBuilder, Kind + Nip19Event, SingleLetterTag, RelayLimits, SecretKey, Connection, ConnectionTarget, \ + EventBuilder, Kind, ClientBuilder, SendEventOutput from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout @@ -33,8 +33,7 @@ async def get_event_by_id(event_id_str: str, client: Client, config=None) -> Eve async def get_events_async(client, filter, timeout): - source_l = EventSource.relays(timedelta(seconds=timeout)) - events = await client.fetch_events([filter], source_l) + events = await client.fetch_events([filter], timedelta(seconds=timeout)) return events.to_vec() @@ -183,7 +182,7 @@ async def get_main_relays(event_to_send: Event, client: Client, dvm_config): return [] -async def send_event_outbox(event: Event, client, dvm_config) -> EventId: +async def send_event_outbox(event: Event, client, dvm_config) -> SendEventOutput | None: # 1. OK, Let's overcomplicate things. # 2. If our event has a relays tag, we just send the event to these relay in the classical way. relays = [] @@ -208,6 +207,9 @@ async def send_event_outbox(event: Event, client, dvm_config) -> EventId: print("[" + dvm_config.NIP89.NAME + "] No Inbox found, replying to generic relays") relays = await get_main_relays(event, client, dvm_config) + + if len(relays) == 0: + return # eventid = await send_event(event, client, dvm_config) # return eventid @@ -215,10 +217,10 @@ async def send_event_outbox(event: Event, client, dvm_config) -> EventId: relaylimits = RelayLimits.disable() connection = Connection().embedded_tor().target(ConnectionTarget.ONION) # connection = Connection().addr("127.0.0.1:9050").target(ConnectionTarget.ONION) - opts = Options().relay_limits(relaylimits).connection(connection).connection_timeout(timedelta(seconds=30)) + opts = Options().relay_limits(relaylimits).connection(connection).timeout(timedelta(seconds=5)) sk = SecretKey.from_hex(dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - outboxclient = Client.with_opts(keys, opts) + outboxclient = ClientBuilder().signer(keys).opts(opts).build() print("[" + dvm_config.NIP89.NAME + "] Receiver Inbox relays: " + str(relays)) for relay in relays[:5]: @@ -236,32 +238,23 @@ async def send_event_outbox(event: Event, client, dvm_config) -> EventId: event_id = None print(e) - for relay in relays[:5]: - try: - await outboxclient.force_remove_relay(relay) - except: - print("Error removing relay: " + relay) - # 5. Fallback, if we couldn't send the event to any relay, we try to send to generic relays instead. if event_id is None: relays = await get_main_relays(event, client, dvm_config) + if len(relays) == 0: + return None for relay in relays: await outboxclient.add_relay(relay) try: await outboxclient.connect() event_id = await outboxclient.send_event(event) - for relay in relays: - try: - await outboxclient.force_remove_relay(relay) - except: - print("Error removing relay: " + relay) except Exception as e: # Love yourself then. event_id = None print(e) - await outboxclient.remove_all_relays() - await outboxclient.disconnect() + await outboxclient.shutdown() + return event_id @@ -413,7 +406,7 @@ async def send_nip04_dm(client: Client, msg, receiver: PublicKey, dvm_config): keys = Keys.parse(dvm_config.PRIVATE_KEY) content = await keys.nip04_encrypt(receiver, msg) ptag = Tag.parse(["p", receiver.to_hex()]) - event = EventBuilder(Kind(4), content, [ptag]).sign_with_keys(Keys.parse(dvm_config.PRIVATE_KEY)) + event = EventBuilder(Kind(4), content).tags([ptag]).sign_with_keys(Keys.parse(dvm_config.PRIVATE_KEY)) await client.send_event(event) # relays = await get_dm_relays(event, client, dvm_config) diff --git a/nostr_dvm/utils/nut_wallet_utils.py b/nostr_dvm/utils/nut_wallet_utils.py index 240a47f..3c2fe76 100644 --- a/nostr_dvm/utils/nut_wallet_utils.py +++ b/nostr_dvm/utils/nut_wallet_utils.py @@ -9,7 +9,7 @@ EventId, nip04_decrypt, nip04_encrypt, PublicKey, Metadata from nostr_dvm.utils.database_utils import fetch_user_metadata -from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout, relay_timeout_long +from nostr_dvm.utils.definitions import EventDefinitions from nostr_dvm.utils.dvmconfig import DVMConfig from nostr_dvm.utils.nostr_utils import check_and_set_private_key from nostr_dvm.utils.print_utils import bcolors @@ -103,7 +103,7 @@ async def create_or_update_nut_wallet_event(self, nut_wallet: NutWallet, client, relay_tag = Tag.parse(["relay", relay]) tags.append(relay_tag) - event = EventBuilder(EventDefinitions.KIND_NUT_WALLET, content, tags).sign_with_keys(keys) + event = EventBuilder(EventDefinitions.KIND_NUT_WALLET, content).tags(tags).sign_with_keys(keys) send_response = await client.send_event(event) print( @@ -327,7 +327,7 @@ async def create_transaction_history_event(self, nut_wallet: NutWallet, amount: p_tag = Tag.parse(["p", sender_hex]) tags.append(p_tag) - event = EventBuilder(Kind(7376), content, tags).sign_with_keys(keys) + event = EventBuilder(Kind(7376), content).tags(tags).sign_with_keys(keys) eventid = await client.send_event(event) async def create_unspent_proof_event(self, nut_wallet: NutWallet, mint_proofs, mint_url, amount, direction, marker, @@ -373,7 +373,7 @@ async def create_unspent_proof_event(self, nut_wallet: NutWallet, mint_proofs, m else: content = nip44_encrypt(keys.secret_key(), keys.public_key(), message, Nip44Version.V2) - event = EventBuilder(Kind(7375), content, tags).sign_with_keys(keys) + event = EventBuilder(Kind(7375), content).tags(tags).sign_with_keys(keys) eventid = await client.send_event(event) await self.create_transaction_history_event(nut_wallet, amount, nut_wallet.unit, old_event_id, eventid.id, direction, marker, sender_hex, event_hex, client, keys) @@ -436,7 +436,7 @@ async def announce_nutzap_info_event(self, nut_wallet, client, keys): pubkey = Keys.parse(nut_wallet.privkey).public_key().to_hex() tags.append(Tag.parse(["pubkey", pubkey])) - event = EventBuilder(Kind(10019), "", tags).sign_with_keys(keys) + event = EventBuilder(Kind(10019), "").tags(tags).sign_with_keys(keys) eventid = await client.send_event(event) print( bcolors.CYAN + "[" + nut_wallet.name + "] Announced mint preferences info event (" + eventid.id.to_hex() + ")" + bcolors.ENDC) @@ -624,7 +624,7 @@ async def send_nut_zap(self, amount, comment, nut_wallet: NutWallet, zapped_even } tags.append(Tag.parse(["proof", json.dumps(nut_proof)])) - event = EventBuilder(Kind(9321), comment, tags).sign_with_keys(keys) + event = EventBuilder(Kind(9321), comment).tags(tags).sign_with_keys(keys) response = await client.send_event(event) await self.update_spend_mint_proof_event(nut_wallet, proofs, mint_url, "zapped", keys.public_key().to_hex(), diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 4627d91..373bda1 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -2,14 +2,17 @@ # even trying to send to them, avoiding potential errors or delays on the way. -AVOID_OUTBOX_RELAY_LIST = ["wss://nos.lol", "wss://relay.primal.net", - "wss://nostrelay.yeghro.site", "wss://nostr.wine", "wss://filter.nostr.wine", +AVOID_OUTBOX_RELAY_LIST = ["wss://nos.lol", "wss://nostrelay.yeghro.site", "wss://nostr.wine", + "wss://filter.nostr.wine", "wss://relay.lightwork.space", "wss://onchain.pub", "wss://nostr21.com", "wss://nostr.bitcoiner.social", "wss://nostr.orangepill.dev", - "wss://brb.io", + "wss://brb.io", "wss://relay.nostr.ch", "wss://nostr.rock", "wss://nostr.sandwich.farm", + "wss://nostr.onsats.org", "wss://nostr-pub.semisol.dev", "wss://no.str.cr", + "wss://nostr.zebedee.cloud", + "wss://nostr.600.wtf", "wss://relay.lnpay.me", "wss://relay.snort.social", "wss://relay.minds.com/nostr/v1/ws", "ws://elitedesk:4848", "wss://nostr-pub.semisol.dev", "wss://mostr.mostr.pub", "wss://relay.mostr.pub", - "wss://minds.com", + "wss://minds.com", "wss://nostr.leximaster.com", "wss://yabu.me", "wss://relay.yozora.world", "wss://filter.nostr.wine/?global=all", "wss://eden.nostr.land", "wss://relay.orangepill.ovh", "wss://nostr.jcloud.es", "wss://af.purplerelay.com", @@ -48,14 +51,14 @@ "wss://relay.nostreggs.io", "wss://relay.blackbyte.nl", "ws://localhost:8080", "wss://127.0.0.1:4869", "wss://sendit.nosflare.io", "wss://astral.ninja", "wss://nostr.libertasprimordium.com", "wss://relay.shitforce.one", - "wss://nostr.cro.social", + "wss://nostr.cro.social", "wss://datagrave.wild-vibes.ts.net/nostr", "wss://nostr01.sharkshake.net", "wss://relay.nostreggs.io", "wss://nostr.rocks", "wss://groups.0xchat.com", "wss://bostr.lecturify.net", "wss://dave.st.germa.in/nostr", "wss://dvms.f7z.io", "wss://nostr.social", "wss://i.nostr.build", - "wss://teemie1-relay.duckdns.org", + "wss://teemie1-relay.duckdns.org", "wss://newperspectives.duckdns.org", "wss://nostrs.build", "wss://relay.hllo.live", "wss://relay-pub.deschooling.us", "wss://nostr.sandwich.farm", "wss://nostr.lol", "wss://nostr.developer.li", - "wss://paid.spore.ws", + "wss://paid.spore.ws", "ws://relay.damus.io", "ws://ofotwjuiv7t6q4azt2fjx3qo7esglmxdeqmh2qvdsdnxw5eqgza24iyd.onion", "wss://r.kojira.io", "wss://nostr-relay.h3z.jp", "wss://relay.yozora.world", "wss://nostr.0xtr.dev", "wss://purplepeg.es", "wss://nostr.mutinywallet.com", @@ -73,5 +76,4 @@ "wss://pablof7z.nostr1.com", "wss://nostr.beckmeyer.us", "wss://pow.hzrd149.com", "wss://relay.nostrss.re", "wss://relay.nostr.bg", "ws://bugman.mguy.net:4848" - ] diff --git a/nostr_dvm/utils/output_utils.py b/nostr_dvm/utils/output_utils.py index 6a2f9dc..c91b0cb 100644 --- a/nostr_dvm/utils/output_utils.py +++ b/nostr_dvm/utils/output_utils.py @@ -318,7 +318,7 @@ async def send_job_status_reaction(original_event_id_hex, original_event_author_ content = reaction keys = Keys.parse(dvm_config.PRIVATE_KEY) - reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content), reply_tags).sign_with_keys(keys) + reaction_event = EventBuilder(EventDefinitions.KIND_FEEDBACK, str(content)).tags(reply_tags).sign_with_keys(keys) await send_event_outbox(reaction_event, client=client, dvm_config=dvm_config) if dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: diff --git a/nostr_dvm/utils/reaction_utils.py b/nostr_dvm/utils/reaction_utils.py index 94cd038..52af6fb 100644 --- a/nostr_dvm/utils/reaction_utils.py +++ b/nostr_dvm/utils/reaction_utils.py @@ -21,7 +21,7 @@ async def create_reaction(keys, title, dtag): keys = Keys.parse(keys) content = "" - event = EventBuilder(Kind(30030), content, [d_tag, title_tag] + emoji_tags).sign_with_keys(keys) + event = EventBuilder(Kind(30030), content).tags([d_tag, title_tag] + emoji_tags).sign_with_keys(keys) client = Client(keys) # We add the relays we defined above and told our DVM we would want to receive events to. @@ -42,7 +42,7 @@ async def delete_reaction(keys, eid: str, dtag: str): e_tag = Tag.parse(["e", eid]) a_tag = Tag.parse( ["a", "30030:" + keys.public_key().to_hex() + ":" + dtag]) - event = EventBuilder(Kind(5), "", [e_tag, a_tag]).sign_with_keys(keys) + event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys) client = Client(keys) # We add the relays we defined above and told our DVM we would want to receive events to. diff --git a/nostr_dvm/utils/zap_utils.py b/nostr_dvm/utils/zap_utils.py index 50dcf94..06b6cd5 100644 --- a/nostr_dvm/utils/zap_utils.py +++ b/nostr_dvm/utils/zap_utils.py @@ -304,8 +304,7 @@ def zaprequest(lud16: str, amount: int, content, zapped_event, zapped_user, keys tags = [p_tag] if zapped_event is not None: tags.append(e_tag) - zap_request = EventBuilder(Kind(9733), content, - tags).sign_with_keys(keys).as_json() + zap_request = EventBuilder(Kind(9733), content).tags(tags).sign_with_keys(keys).as_json() keys = Keys.parse(encryption_key) if zapped_event is not None: encrypted_content = enrypt_private_zap_message(zap_request, keys.secret_key(), zapped_event.author()) @@ -316,8 +315,7 @@ def zaprequest(lud16: str, amount: int, content, zapped_event, zapped_user, keys tags.append(anon_tag) content = "" - zap_request = EventBuilder(Kind(9734), content, - tags).sign_with_keys(keys).as_json() + zap_request = EventBuilder(Kind(9734), content).tags(tags).sign_with_keys(keys).as_json() response = requests.get(callback + "?amount=" + str(int(amount) * 1000) + "&nostr=" + urllib.parse.quote_plus( zap_request) + "&lnurl=" + encoded_lnurl) diff --git a/tests/db.py b/tests/db.py index 1fea844..93a663e 100644 --- a/tests/db.py +++ b/tests/db.py @@ -32,7 +32,7 @@ async def do_some_work(): f = Filter().author(keys.public_key()).limit(10) events = await database.query([f]) - for event in events: + for event in events.to_vec(): print(event.as_json()) nostr_dvm_thread = Thread(target=reconcile_db) diff --git a/tests/generic_dvm_autotopic_feed.py b/tests/generic_dvm_autotopic_feed.py index 656f2c6..5e6585a 100644 --- a/tests/generic_dvm_autotopic_feed.py +++ b/tests/generic_dvm_autotopic_feed.py @@ -183,11 +183,11 @@ async def process(request_form): events = await database.query(filters) if dvm.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + dvm.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + print("[" + dvm.dvm_config.NIP89.NAME + "] Considering " + str(len(events.to_vec())) + " Events") ns.finallist = {} #search_list = result.split(',') - for event in events: + for event in events.to_vec(): #if all(ele in event.content().lower() for ele in []): #if not any(ele in event.content().lower() for ele in []): filt = Filter().kinds( @@ -195,8 +195,8 @@ async def process(request_form): definitions.EventDefinitions.KIND_REPOST, definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) reactions = await database.query([filt]) - if len(reactions) >= 1: - ns.finallist[event.id().to_hex()] = len(reactions) + if len(reactions.to_vec()) >= 1: + ns.finallist[event.id().to_hex()] = len(reactions.to_vec()) result_list = [] finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(200)] diff --git a/tests/wot.py b/tests/wot.py index 4eba286..6d29219 100644 --- a/tests/wot.py +++ b/tests/wot.py @@ -86,8 +86,8 @@ async def analyse_users(user_ids=None): followers_filter = Filter().authors(user_keys).kind(Kind(3)) followers = await database.query([followers_filter]) allfriends = [] - if len(followers) > 0: - for follower in followers: + if len(followers.to_vec()) > 0: + for follower in followers.to_vec(): frens = [] for tag in follower.tags().to_vec(): if tag.as_vec()[0] == "p": From b6b7ab877a0598269d5cf4f0ecb345bbf706801a Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Sun, 17 Nov 2024 12:52:56 +0100 Subject: [PATCH 02/26] Update outbox_utils.py --- nostr_dvm/utils/outbox_utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 373bda1..d4a0260 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -7,10 +7,12 @@ "wss://nostr21.com", "wss://nostr.bitcoiner.social", "wss://nostr.orangepill.dev", "wss://brb.io", "wss://relay.nostr.ch", "wss://nostr.rock", "wss://nostr.sandwich.farm", "wss://nostr.onsats.org", "wss://nostr-pub.semisol.dev", "wss://no.str.cr", - "wss://nostr.zebedee.cloud", - "wss://nostr.600.wtf", + "wss://nostr.zebedee.cloud", "wss://blg.nostr.sx", "wss://relay.nostr.ai", + "wss://nostr.600.wtf", "ws://umbrel.local:4848", "wss://192.168.1.52:5051", + "wss://nostrvista.aaroniumii.com", "wss://https//nostr.einundzwanzig.space", + "wss://nostr.localhost.re", "wss://shopstr.store", "wss://th1.nostr.earnkrub.xyz", "wss://relay.lnpay.me", "wss://relay.snort.social", "wss://relay.minds.com/nostr/v1/ws", - "ws://elitedesk:4848", + "ws://elitedesk:4848", "wss://wot.nostr.net", "wss://blg.nostr.sx", "wss://nostr-pub.semisol.dev", "wss://mostr.mostr.pub", "wss://relay.mostr.pub", "wss://minds.com", "wss://nostr.leximaster.com", "wss://yabu.me", "wss://relay.yozora.world", "wss://filter.nostr.wine/?global=all", From ceac02c8092ad480d73a76cbe107f48924d61ddc Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Sun, 17 Nov 2024 13:10:15 +0100 Subject: [PATCH 03/26] Update outbox_utils.py --- nostr_dvm/utils/outbox_utils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index d4a0260..f83f958 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -14,13 +14,14 @@ "wss://relay.lnpay.me", "wss://relay.snort.social", "wss://relay.minds.com/nostr/v1/ws", "ws://elitedesk:4848", "wss://wot.nostr.net", "wss://blg.nostr.sx", "wss://nostr-pub.semisol.dev", "wss://mostr.mostr.pub", "wss://relay.mostr.pub", - "wss://minds.com", "wss://nostr.leximaster.com", + "wss://minds.com", "wss://nostr.leximaster.com", "wss://th2.nostr.earnkrub.xyz", + "wss://relay.zerosatoshi.xyz", "wss://bouncer.minibolt.info", "wss://yabu.me", "wss://relay.yozora.world", "wss://filter.nostr.wine/?global=all", - "wss://eden.nostr.land", + "wss://eden.nostr.land", "wss://relay.otherstuff.fyi", "wss://relay.orangepill.ovh", "wss://nostr.jcloud.es", "wss://af.purplerelay.com", - "wss://za.purplerelay.com", "ws://192.168.18.7:7777", + "wss://za.purplerelay.com", "ws://192.168.18.7:7777", "wss://nostr.fediverse.jp", "wss://relay.nostrich.land", "wss://relay.nostrplebs.com", "wss://relay.nostrich.land", - "ws://elitedesk.local:4848", + "ws://elitedesk.local:4848", "wss://nrelay-jp.c-stellar.net", "wss://rss.nos.social", "wss://atlas.nostr.land", "wss://puravida.nostr.land", "wss://nostr.inosta.cc", "wss://relay.orangepill.dev", "wss://no.str.cr", "wss://nostr.milou.lol", From 39ded300fa1db02b4b77e20885c47382f648da82 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:53:28 +0100 Subject: [PATCH 04/26] Update outbox_utils.py --- nostr_dvm/utils/outbox_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index f83f958..0d4334f 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -21,15 +21,15 @@ "wss://relay.orangepill.ovh", "wss://nostr.jcloud.es", "wss://af.purplerelay.com", "wss://za.purplerelay.com", "ws://192.168.18.7:7777", "wss://nostr.fediverse.jp", "wss://relay.nostrich.land", "wss://relay.nostrplebs.com", "wss://relay.nostrich.land", - "ws://elitedesk.local:4848", "wss://nrelay-jp.c-stellar.net", + "ws://elitedesk.local:4848", "wss://nrelay-jp.c-stellar.net", "wss://blastr.f7z.xyz", "wss://rss.nos.social", "wss://atlas.nostr.land", "wss://puravida.nostr.land", - "wss://nostr.inosta.cc", + "wss://nostr.inosta.cc", "wss://relay-jp.nostr.wirednet.jp", "wss://relay.orangepill.dev", "wss://no.str.cr", "wss://nostr.milou.lol", - "wss://relay.nostr.com.au", + "wss://relay.nostr.com.au", "wss://nostrelites.com", "wss://sfr0.nostr1.com", "wss://puravida.nostr.land", "wss://atlas.nostr.land", "wss://nostr-pub.wellorder.net", - "wss://relay.current.fyi", + "wss://relay.current.fyi", "wss://nfrelay.app", "wss://nostr.thesamecat.io", "wss://nostr.plebchain.org", "wss://relay.noswhere.com", - "wss://nostr.uselessshit.co", + "wss://nostr.uselessshit.co", "wss://tictac.nostr1.com", "wss://abcdefg20240104205400.xyz/v1", "wss://bitcoiner.social", "wss://relay.stoner.com", "wss://nostr.l00p.org", "wss://relay.nostr.ro", "wss://nostr.kollider.xyz", "wss://relay.valera.co", "wss://relay.austrich.net", "wss://relay.nostrich.de", From fb31d39d23aa6ff02c9e893a6d1822ca4570beb9 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:47:25 +0100 Subject: [PATCH 05/26] Update discovery.py --- tests/discovery.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/discovery.py b/tests/discovery.py index 16a5f06..5cc7270 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -887,10 +887,10 @@ def playground(): options_animal = { "search_list": ["catstr", "pawstr", "dogstr", "pugstr", " cat ", " cats ", "doggo", " deer ", " dog ", " dogs ", " fluffy ", - "animal", + " animal", " duck", " lion ", " lions ", " fox ", " foxes ", " koala ", " koalas ", "capybara", "squirrel", - " monkey", "panda", "alpaca", " otter"], - "avoid_list": ["porn", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo", + " monkey", " panda", "alpaca", " otter"], + "avoid_list": ["porn", "broth", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo", "encryption", "government", "airpod", "ipad", "iphone", "android", "warren", "moderna", "pfizer", " meat ", "pc mouse", "shotgun", "vagina", "rune", "testicle", "victim", "sexualize", "murder", "tax", "engagement", "hodlers", "hodl", "gdp", "global markets", "crypto", @@ -909,7 +909,7 @@ def playground(): "must_list": ["http"], "db_name": "db/nostr_recent_notes.db", - "db_since": 12 * 60 * 60, # 48h since gmt, + "db_since": 24 * 60 * 60, # 48h since gmt, "personalized": False, "logger": False} From 96a5d9714089d3c6d9a930cfbd8f2e81d35debec Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:00:00 +0100 Subject: [PATCH 06/26] Update nostr_utils.py --- nostr_dvm/utils/nostr_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index dc4c40c..6edddbc 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -175,7 +175,7 @@ async def get_main_relays(event_to_send: Event, client: Client, dvm_config): content = json.loads(followlist.content()) relays = [] for relay in content: - if relay not in dvm_config.AVOID_OUTBOX_RELAY_LIST: + if relay.rstrip("/") not in dvm_config.AVOID_OUTBOX_RELAY_LIST: relays.append(relay) return relays except: From 246f12869f3d4307fbaeca421778d1816540a2b8 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 18 Nov 2024 16:11:40 +0100 Subject: [PATCH 07/26] Update bot.py --- nostr_dvm/bot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 4c87397..59d0406 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -28,6 +28,10 @@ class Bot: # This is a simple list just to keep track which events we created and manage, so we don't pay for other requests def __init__(self, dvm_config, admin_config=None): + self.dvm_config = None + self.keys = None + self.admin_config = None + self.client = None asyncio.run(self.run_bot(dvm_config, admin_config)) uniffi_set_event_loop(asyncio.get_running_loop()) From 464a091750fdd1b93810644351bfcf65f35e507b Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:14:07 +0100 Subject: [PATCH 08/26] ... --- nostr_dvm/utils/outbox_utils.py | 2 +- tests/search.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 0d4334f..3327186 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -2,7 +2,7 @@ # even trying to send to them, avoiding potential errors or delays on the way. -AVOID_OUTBOX_RELAY_LIST = ["wss://nos.lol", "wss://nostrelay.yeghro.site", "wss://nostr.wine", +AVOID_OUTBOX_RELAY_LIST = ["wss://nos.lol", "wss://nostr.fmt.wiz.biz", "wss://nostrelay.yeghro.site", "wss://nostr.wine", "wss://filter.nostr.wine", "wss://relay.lightwork.space", "wss://onchain.pub", "wss://nostr21.com", "wss://nostr.bitcoiner.social", "wss://nostr.orangepill.dev", "wss://brb.io", "wss://relay.nostr.ch", "wss://nostr.rock", "wss://nostr.sandwich.farm", diff --git a/tests/search.py b/tests/search.py index a3bef47..87a819c 100644 --- a/tests/search.py +++ b/tests/search.py @@ -101,7 +101,7 @@ def build_advanced_search_wine(name, identifier): dvm_config.PRIVATE_KEY = check_and_set_private_key(identifier) npub = Keys.parse(dvm_config.PRIVATE_KEY).public_key().to_bech32() dvm_config.RELAY_LIST = RELAY_LIST - invoice_key, admin_key, wallet_id, user_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) + invoice_key, admin_key, wallet_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) dvm_config.LNBITS_INVOICE_KEY = invoice_key dvm_config.LNBITS_ADMIN_KEY = admin_key # The dvm might pay failed jobs back dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") From 83b75a5b9bd212a1775580e0e065e4d7703c10b1 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:56:15 +0100 Subject: [PATCH 09/26] Update content_discovery_update_db_only.py --- nostr_dvm/tasks/content_discovery_update_db_only.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index 7487ace..149d734 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -177,7 +177,6 @@ async def sync_db(self): [definitions.EventDefinitions.KIND_NOTE, definitions.EventDefinitions.KIND_REACTION, definitions.EventDefinitions.KIND_ZAP]).since(since) # Notes, reactions, zaps - # filter = Filter().author(keys.public_key()) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: print("[" + self.dvm_config.IDENTIFIER + "] Syncing notes of the last " + str( self.db_since) + " seconds.. this might take a while..") From 40175719555771fc32ccfcb51cbe90d30761d341 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:08:00 +0100 Subject: [PATCH 10/26] adapt NostrSigner to new sdk --- nostr_dvm/bot.py | 4 ++-- nostr_dvm/dvm.py | 4 ++-- .../tasks/content_discovery_currently_latest_longform.py | 4 ++-- nostr_dvm/tasks/content_discovery_currently_latest_wiki.py | 4 ++-- nostr_dvm/tasks/content_discovery_currently_popular.py | 2 +- .../tasks/content_discovery_currently_popular_by_top_zaps.py | 2 +- .../tasks/content_discovery_currently_popular_followers.py | 4 ++-- .../tasks/content_discovery_currently_popular_gallery.py | 4 ++-- nostr_dvm/tasks/content_discovery_currently_popular_mostr.py | 2 +- .../tasks/content_discovery_currently_popular_nonfollowers.py | 4 ++-- nostr_dvm/tasks/content_discovery_currently_popular_topic.py | 2 +- nostr_dvm/tasks/content_discovery_latest_one_per_follower.py | 2 +- nostr_dvm/tasks/content_discovery_update_db_only.py | 2 +- nostr_dvm/tasks/discovery_bot_farms.py | 4 ++-- nostr_dvm/tasks/discovery_censor_wot.py | 2 +- nostr_dvm/tasks/discovery_inactive_follows.py | 2 +- nostr_dvm/tasks/discovery_nonfollowers.py | 2 +- nostr_dvm/tasks/people_discovery_mywot.py | 2 +- nostr_dvm/tasks/people_discovery_wot.py | 2 +- nostr_dvm/tasks/search_users.py | 4 ++-- nostr_dvm/utils/nostr_utils.py | 4 ++-- nostr_dvm/utils/wot_utils.py | 4 ++-- tests/wot.py | 4 ++-- 23 files changed, 35 insertions(+), 35 deletions(-) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 59d0406..443b09f 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -5,7 +5,7 @@ from multiprocessing.connection import Connection from nostr_sdk import (Keys, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, - Options, Tag, Event, nip04_encrypt, EventId, Nip19Event, Kind, KindEnum, + Options, Tag, Event, nip04_encrypt, EventId, Nip19Event, Kind, KindEnum, NostrSigner, UnsignedEvent, UnwrappedGift, uniffi_set_event_loop, ClientBuilder, make_private_msg) from nostr_dvm.utils.admin_utils import admin_make_database_updates @@ -49,7 +49,7 @@ async def run_bot(self, dvm_config, admin_config): self.CHATBOT = False opts = Options().gossip(True) - self.client = ClientBuilder().signer(self.keys).opts(opts).build() + self.client = ClientBuilder().signer(NostrSigner.keys(self.keys)).opts(opts).build() self.invoice_list = [] pk = self.keys.public_key() diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 9a5c620..a61144c 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -4,7 +4,7 @@ from sys import platform from nostr_sdk import PublicKey, Keys, Client, Tag, Event, EventBuilder, Filter, HandleNotification, Timestamp, \ - LogLevel, Options, nip04_encrypt, Kind, RelayLimits, uniffi_set_event_loop, ClientBuilder + LogLevel, Options, nip04_encrypt, Kind, RelayLimits, uniffi_set_event_loop, ClientBuilder, NostrSigner from nostr_dvm.utils.admin_utils import admin_make_database_updates, AdminConfig from nostr_dvm.utils.backend_utils import get_amount_per_task, check_task_is_supported, get_task @@ -48,7 +48,7 @@ async def run_dvm(self, dvm_config, admin_config): Options().relay_limits(relaylimits)) #.difficulty(28) #self.client = Client(self.keys) - self.client = ClientBuilder().signer(self.keys).opts(opts).build() + self.client = ClientBuilder().signer(NostrSigner.keys(self.keys)).opts(opts).build() self.job_list = [] self.jobs_on_hold_list = [] pk = self.keys.public_key() diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py index 6d28e16..df85bc4 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py @@ -112,7 +112,7 @@ async def calculate_result(self, request_form): database = NostrDatabase.lmdb(self.db_name) # print(self.db_name) - cli = ClientBuilder().database(database).signer(keys).build() + cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).build() await cli.connect() # Negentropy reconciliation @@ -175,7 +175,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).opts(opts).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py index e8c9e32..5bbba0c 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py @@ -112,7 +112,7 @@ async def calculate_result(self, request_form): database = NostrDatabase.lmdb(self.db_name) # print(self.db_name) - cli = ClientBuilder().database(database).signer(keys).build() + cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).build() await cli.connect() # Negentropy reconciliation @@ -175,7 +175,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).opts(opts).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index 22c76b6..6417c2b 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -172,7 +172,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py index e7c9f30..718fad8 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py @@ -216,7 +216,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py index 6f3bcf6..5ab4e9d 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py @@ -98,7 +98,7 @@ async def process(self, request_form): keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().database(database).signer(keys).opts(opts).build() + cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).opts(opts).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) @@ -192,7 +192,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py index 9a717f8..80faca5 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py @@ -150,7 +150,7 @@ async def calculate_result(self, request_form): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = ClientBuilder().database(databasegallery).signer(keys).opts(opts).build() + cli = ClientBuilder().database(databasegallery).signer(NostrSigner.keys(keys)).opts(opts).build() for relay in relays: await cli.add_relay(relay) @@ -241,7 +241,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py index 1e46d56..6c5b725 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -179,7 +179,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py index 4a44715..13e3e92 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py @@ -147,7 +147,7 @@ async def calculate_result(self, request_form): if self.database is None: self.database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().database(self.database).signer(keys).opts(opts).build() + cli = ClientBuilder().database(self.database).signer(NostrSigner.keys(keys)).opts(opts).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) @@ -228,7 +228,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py index 5a7758d..6b45459 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py @@ -205,7 +205,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index 11ef815..5f9fcb6 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -76,7 +76,7 @@ async def process(self, request_form): opts = (Options().relay_limits(relaylimits)) - cli = ClientBuilder().signer(keys).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner(NostrSigner.keys(keys))).opts(opts).build() for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) # ropts = RelayOptions().ping(False) diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index 149d734..7c14ea9 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -137,7 +137,7 @@ async def sync_db(self): if self.database is None: self.database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(self.database).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(self.database).opts(opts).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/discovery_bot_farms.py b/nostr_dvm/tasks/discovery_bot_farms.py index 2ee8f8e..b6e89a1 100644 --- a/nostr_dvm/tasks/discovery_bot_farms.py +++ b/nostr_dvm/tasks/discovery_bot_farms.py @@ -78,7 +78,7 @@ async def process(self, request_form): keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb("db/nostr_profiles.db") - cli = ClientBuilder().database(database).signer(keys).build() + cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).build() await cli.add_relay("wss://relay.damus.io") # cli.add_relay("wss://atl.purplerelay.com") @@ -137,7 +137,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb("db/nostr_profiles.db") - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() await cli.add_relay("wss://relay.damus.io") await cli.add_relay("wss://nostr21.com") diff --git a/nostr_dvm/tasks/discovery_censor_wot.py b/nostr_dvm/tasks/discovery_censor_wot.py index 9dcbe12..596f375 100644 --- a/nostr_dvm/tasks/discovery_censor_wot.py +++ b/nostr_dvm/tasks/discovery_censor_wot.py @@ -73,7 +73,7 @@ async def process(self, request_form): Options().relay_limits(relaylimits)) sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = ClientBuilder().signer(keys).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() # cli.add_relay("wss://relay.nostr.band") for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/discovery_inactive_follows.py b/nostr_dvm/tasks/discovery_inactive_follows.py index 02f4527..6044144 100644 --- a/nostr_dvm/tasks/discovery_inactive_follows.py +++ b/nostr_dvm/tasks/discovery_inactive_follows.py @@ -76,7 +76,7 @@ async def process(self, request_form): opts = (Options().relay_limits(relaylimits)) - cli = ClientBuilder().signer(keys).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) await cli.add_relay("wss://nostr.band") diff --git a/nostr_dvm/tasks/discovery_nonfollowers.py b/nostr_dvm/tasks/discovery_nonfollowers.py index a9bff5e..b2db15d 100644 --- a/nostr_dvm/tasks/discovery_nonfollowers.py +++ b/nostr_dvm/tasks/discovery_nonfollowers.py @@ -68,7 +68,7 @@ async def process(self, request_form): relaylimits)) sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli= ClientBuilder().signer(keys).opts(opts).build() + cli= ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() # cli.add_relay("wss://relay.nostr.band") for relay in self.dvm_config.RELAY_LIST: diff --git a/nostr_dvm/tasks/people_discovery_mywot.py b/nostr_dvm/tasks/people_discovery_mywot.py index 1cc353e..79ff77e 100644 --- a/nostr_dvm/tasks/people_discovery_mywot.py +++ b/nostr_dvm/tasks/people_discovery_mywot.py @@ -205,7 +205,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/people_discovery_wot.py b/nostr_dvm/tasks/people_discovery_wot.py index 61af031..6c79456 100644 --- a/nostr_dvm/tasks/people_discovery_wot.py +++ b/nostr_dvm/tasks/people_discovery_wot.py @@ -210,7 +210,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() for relay in self.dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 932ca69..3429bdb 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -81,7 +81,7 @@ async def process(self, request_form): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().database(database).signer(keys).build() + cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).build() await cli.add_relay(self.relay) # cli.add_relay("wss://atl.purplerelay.com") @@ -140,7 +140,7 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() await cli.add_relay(self.relay) await cli.connect() diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 6edddbc..3a744bf 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -7,7 +7,7 @@ import dotenv from nostr_sdk import Filter, Client, Alphabet, EventId, Event, PublicKey, Tag, Keys, nip04_decrypt, Metadata, Options, \ Nip19Event, SingleLetterTag, RelayLimits, SecretKey, Connection, ConnectionTarget, \ - EventBuilder, Kind, ClientBuilder, SendEventOutput + EventBuilder, Kind, ClientBuilder, SendEventOutput, NostrSigner from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout @@ -220,7 +220,7 @@ async def send_event_outbox(event: Event, client, dvm_config) -> SendEventOutput opts = Options().relay_limits(relaylimits).connection(connection).timeout(timedelta(seconds=5)) sk = SecretKey.from_hex(dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - outboxclient = ClientBuilder().signer(keys).opts(opts).build() + outboxclient = ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() print("[" + dvm_config.NIP89.NAME + "] Receiver Inbox relays: " + str(relays)) for relay in relays[:5]: diff --git a/nostr_dvm/utils/wot_utils.py b/nostr_dvm/utils/wot_utils.py index 25a395d..8e100c2 100644 --- a/nostr_dvm/utils/wot_utils.py +++ b/nostr_dvm/utils/wot_utils.py @@ -46,7 +46,7 @@ async def get_following(pks, max_time_request=10, newer_than_time=None, dvm_conf # fetching events keys = Keys.parse(check_and_set_private_key("test_client")) - cli = ClientBuilder().signer(keys).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).build() for relay in dvm_config.SYNC_DB_RELAY_LIST: await cli.add_relay(relay) @@ -586,7 +586,7 @@ async def get_metadata(npub): except: return "", "", "" keys = Keys.parse(check_and_set_private_key("test_client")) - client = ClientBuilder().signer(keys).build() + client = ClientBuilder().signer(NostrSigner.keys(keys)).build() await client.add_relay("wss://relay.damus.io") await client.add_relay("wss://purplepag.es") await client.connect() diff --git a/tests/wot.py b/tests/wot.py index 6d29219..d4204ef 100644 --- a/tests/wot.py +++ b/tests/wot.py @@ -27,7 +27,7 @@ async def getmetadata(npub): except: return "", "", "" keys = Keys.parse("nsec1zmzllu40a7mr7ztl78uwfwslnp0pn0pww868adl05x52d4la237s6m8qfj") - client = ClientBuilder().signer(keys).build() + client = ClientBuilder().signer(NostrSigner.keys(keys)).build() await client.add_relay("wss://relay.damus.io") #await client.add_relay("wss://relay.primal.net") await client.add_relay("wss://purplepag.es") @@ -54,7 +54,7 @@ async def getmetadata(npub): async def sync_db(): keys = Keys.parse("nsec1zmzllu40a7mr7ztl78uwfwslnp0pn0pww868adl05x52d4la237s6m8qfj") database = NostrDatabase.lmdb("db/nostr_followlists.db") - cli = ClientBuilder().signer(keys).database(database).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() await cli.add_relay("wss://relay.damus.io") # TODO ADD MORE # await cli.add_relay("wss://relay.primal.net") # TODO ADD MORE From b0994998ba94b9c9d701fc5c79f249b130c5d371 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:19:06 +0100 Subject: [PATCH 11/26] adapt to sdk --- examples/ollama_dvm/test_client.py | 6 +- examples/tts_dvm/test_client.py | 6 +- examples/unleashed_dvm/test_client.py | 6 +- nostr_dvm/subscription.py | 2 +- nostr_dvm/tasks/advanced_search.py | 2 +- ...ntent_discovery_latest_one_per_follower.py | 2 +- nostr_dvm/tasks/discovery_inactive_follows.py | 2 +- nostr_dvm/tasks/discovery_nonfollowers.py | 2 +- .../discovery_trending_notes_gleasonator.py | 2 +- nostr_dvm/utils/external_dvm_utils.py | 2 +- nostr_dvm/utils/nostr_utils.py | 2 +- nostr_dvm/utils/nut_wallet_utils.py | 4 +- nostr_dvm/utils/reaction_utils.py | 4 +- tests/ditto.py | 2 +- tests/simplebot.py | 2 +- tests/test_dvm_client.py | 58 +++++++++---------- tests/test_events.py | 4 +- tutorials/03_client.py | 6 +- tutorials/09_nutzap_client.py | 6 +- 19 files changed, 60 insertions(+), 60 deletions(-) diff --git a/examples/ollama_dvm/test_client.py b/examples/ollama_dvm/test_client.py index d591103..b4f3470 100644 --- a/examples/ollama_dvm/test_client.py +++ b/examples/ollama_dvm/test_client.py @@ -20,13 +20,13 @@ async def nostr_client_test_llm(prompt): relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTSt"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Generate an Audio File."), + event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Generate an Audio File.")).tags( [iTag, relaysTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -40,7 +40,7 @@ async def nostr_client(): sk = keys.secret_key() pk = keys.public_key() print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: await client.add_relay(relay) diff --git a/examples/tts_dvm/test_client.py b/examples/tts_dvm/test_client.py index c62e001..e504dd9 100644 --- a/examples/tts_dvm/test_client.py +++ b/examples/tts_dvm/test_client.py @@ -24,14 +24,14 @@ async def nostr_client_test_tts(prompt): relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTS"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File."), + event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File.")).tags( [iTag, paramTag1, bidTag, relaysTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -44,7 +44,7 @@ async def nostr_client(): sk = keys.secret_key() pk = keys.public_key() print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: diff --git a/examples/unleashed_dvm/test_client.py b/examples/unleashed_dvm/test_client.py index 3202d9c..736950b 100644 --- a/examples/unleashed_dvm/test_client.py +++ b/examples/unleashed_dvm/test_client.py @@ -23,13 +23,13 @@ async def nostr_client_test(prompt): relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTS"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Answer to prompt"), + event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_TEXT, str("Answer to prompt")).tags( [iTag, relaysTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -42,7 +42,7 @@ async def nostr_client(): sk = keys.secret_key() pk = keys.public_key() print(f"Nostr Test Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: diff --git a/nostr_dvm/subscription.py b/nostr_dvm/subscription.py index a64ec5d..8b45af8 100644 --- a/nostr_dvm/subscription.py +++ b/nostr_dvm/subscription.py @@ -39,7 +39,7 @@ async def run_subscription(self, dvm_config, admin_config): self.dvm_config.NIP89 = nip89config self.admin_config = admin_config self.keys = Keys.parse(dvm_config.PRIVATE_KEY) - self.client = Client(self.keys) + self.client = Client(NostrSigner.keys(self.keys)) pk = self.keys.public_key() diff --git a/nostr_dvm/tasks/advanced_search.py b/nostr_dvm/tasks/advanced_search.py index 8545265..4bfe692 100644 --- a/nostr_dvm/tasks/advanced_search.py +++ b/nostr_dvm/tasks/advanced_search.py @@ -89,7 +89,7 @@ async def process(self, request_form): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) await cli.add_relay(options["relay"]) diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index 5f9fcb6..16a1fdd 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -123,7 +123,7 @@ async def scanList(users, instance, i, st, notactivesince): from nostr_sdk import Filter keys = Keys.parse(self.dvm_config.PRIVATE_KEY) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) await cli.connect() diff --git a/nostr_dvm/tasks/discovery_inactive_follows.py b/nostr_dvm/tasks/discovery_inactive_follows.py index 6044144..ef48c01 100644 --- a/nostr_dvm/tasks/discovery_inactive_follows.py +++ b/nostr_dvm/tasks/discovery_inactive_follows.py @@ -123,7 +123,7 @@ async def scanList(users, instance, i, st, notactivesince): from nostr_sdk import Filter keys = Keys.parse(self.dvm_config.PRIVATE_KEY) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) await cli.connect() diff --git a/nostr_dvm/tasks/discovery_nonfollowers.py b/nostr_dvm/tasks/discovery_nonfollowers.py index b2db15d..b1e6d07 100644 --- a/nostr_dvm/tasks/discovery_nonfollowers.py +++ b/nostr_dvm/tasks/discovery_nonfollowers.py @@ -106,7 +106,7 @@ async def process(self, request_form): async def scanList(users, instance, i, st): from nostr_sdk import Filter keys = Keys.parse(self.dvm_config.PRIVATE_KEY) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) await cli.connect() diff --git a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py index 75cf909..ad60f5f 100644 --- a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py +++ b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py @@ -72,7 +72,7 @@ async def process(self, request_form): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) await cli.add_relay(options["relay"]) await cli.connect() diff --git a/nostr_dvm/utils/external_dvm_utils.py b/nostr_dvm/utils/external_dvm_utils.py index 6cdc961..04456f1 100644 --- a/nostr_dvm/utils/external_dvm_utils.py +++ b/nostr_dvm/utils/external_dvm_utils.py @@ -12,7 +12,7 @@ async def build_client(config): keys = Keys.parse(config.PRIVATE_KEY) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in config.RELAY_LIST: await client.add_relay(relay) diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 3a744bf..33d24b9 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -361,7 +361,7 @@ def check_and_decrypt_own_tags(event, dvm_config): async def update_profile_lnaddress(private_key, dvm_config, lud16="", ): keys = Keys.parse(private_key) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in dvm_config.RELAY_LIST: await client.add_relay(relay) await client.connect() diff --git a/nostr_dvm/utils/nut_wallet_utils.py b/nostr_dvm/utils/nut_wallet_utils.py index 3c2fe76..450c42b 100644 --- a/nostr_dvm/utils/nut_wallet_utils.py +++ b/nostr_dvm/utils/nut_wallet_utils.py @@ -6,7 +6,7 @@ import requests from nostr_sdk import Tag, Keys, nip44_encrypt, nip44_decrypt, Nip44Version, EventBuilder, Client, Filter, Kind, \ - EventId, nip04_decrypt, nip04_encrypt, PublicKey, Metadata + EventId, nip04_decrypt, nip04_encrypt, PublicKey, Metadata, NostrSigner from nostr_dvm.utils.database_utils import fetch_user_metadata from nostr_dvm.utils.definitions import EventDefinitions @@ -52,7 +52,7 @@ class NutZapWallet: async def client_connect(self, relay_list, keys): - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() diff --git a/nostr_dvm/utils/reaction_utils.py b/nostr_dvm/utils/reaction_utils.py index 52af6fb..5d5798f 100644 --- a/nostr_dvm/utils/reaction_utils.py +++ b/nostr_dvm/utils/reaction_utils.py @@ -23,7 +23,7 @@ async def create_reaction(keys, title, dtag): content = "" event = EventBuilder(Kind(30030), content).tags([d_tag, title_tag] + emoji_tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) # We add the relays we defined above and told our DVM we would want to receive events to. for relay in DVMConfig().RELAY_LIST: await client.add_relay(relay) @@ -44,7 +44,7 @@ async def delete_reaction(keys, eid: str, dtag: str): ["a", "30030:" + keys.public_key().to_hex() + ":" + dtag]) event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) # We add the relays we defined above and told our DVM we would want to receive events to. for relay in DVMConfig().RELAY_LIST: await client.add_relay(relay) diff --git a/tests/ditto.py b/tests/ditto.py index dd80ba2..f9dbc31 100644 --- a/tests/ditto.py +++ b/tests/ditto.py @@ -17,7 +17,7 @@ async def main(): } keys = Keys.parse(check_and_set_private_key("test_client")) - cli = Client(keys) + cli = Client(NostrSigner.keys(keys)) await cli.add_relay(options["relay"]) await cli.connect() diff --git a/tests/simplebot.py b/tests/simplebot.py index 59ffe8d..edcd7ab 100644 --- a/tests/simplebot.py +++ b/tests/simplebot.py @@ -20,7 +20,7 @@ async def test(): pk = keys.public_key() print(f"Bot public key: {pk.to_bech32()}") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) await client.add_relay("wss://relay.damus.io") await client.add_relay("wss://nostr.mom") diff --git a/tests/test_dvm_client.py b/tests/test_dvm_client.py index 92acf9e..3b707ee 100644 --- a/tests/test_dvm_client.py +++ b/tests/test_dvm_client.py @@ -27,13 +27,13 @@ async def nostr_client_test_translation(input, kind, lang, sats, satsmax): relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to translate a given Input"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_TRANSLATE_TEXT, str("Translate the given input."), + event = EventBuilder(EventDefinitions.KIND_NIP90_TRANSLATE_TEXT, str("Translate the given input.")).tags( [iTag, paramTag1, bidTag, relaysTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -48,13 +48,13 @@ async def nostr_client_test_search_profile(input): iTag = Tag.parse(["i", input, "text"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to translate a given Input"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_USER_SEARCH, str("Search for user"), + event = EventBuilder(EventDefinitions.KIND_NIP90_USER_SEARCH, str("Search for user")).tags( [iTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -74,10 +74,10 @@ async def nostr_client_test_image(prompt): bidTag = Tag.parse(['bid', str(1000 * 1000), str(1000 * 1000)]) relaysTag = Tag.parse(['relays', "wss://relay.primal.net", "wss://nostr.oxtr.dev"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate an Image from a given Input"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_IMAGE, str("Generate an Image."), + event = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_IMAGE, str("Generate an Image.")).tags( [iTag, outTag, paramTag1, bidTag, relaysTag, alttag]).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in DVMConfig().RELAY_LIST: await client.add_relay(relay) await client.connect() @@ -102,10 +102,10 @@ async def nostr_client_test_censor_filter(users): iTag = Tag.parse(["i", user, "text"]) tags.append(iTag) - event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me bad actors"), + event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me bad actors")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -127,10 +127,10 @@ async def nostr_client_test_inactive_filter(user): tags = [relaysTag, alttag, paramTag, paramTag2] - event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me inactive users"), + event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me inactive users")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.add_relay("wss://nostr.band") @@ -150,13 +150,13 @@ async def nostr_client_test_tts(prompt): relaysTag = Tag.parse(['relays', "wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org", "wss://nostr-pub.wellorder.net"]) alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to generate TTSt"]) - event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File."), + event = EventBuilder(EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH, str("Generate an Audio File.")).tags( [iTag, paramTag1, bidTag, relaysTag, alttag]).sign_with_keys(keys) relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz", "wss://relayable.org" "wss://dvms.f7z.io", ] - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -178,10 +178,10 @@ async def nostr_client_test_discovery(user, ptag): tags = [relaysTag, alttag, paramTag, pTag] - event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content"), + event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -215,10 +215,10 @@ async def nostr_client_custom_discovery(user, ptag): tags = [relaysTag, alttag, paramTag, pTag]# paramTagSearch, paramTagMust, paramTagAvoid] - event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content"), + event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -241,10 +241,10 @@ async def nostr_client_generic_test(ptag): tags = [relaysTag, alttag, pTag] - event = EventBuilder(Kind(5050), str("Give me content"), + event = EventBuilder(Kind(5050), str("Give me content")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -267,10 +267,10 @@ async def nostr_client_duckduck_test(ptag, query): tags = [relaysTag, alttag, pTag, iTag] - event = EventBuilder(Kind(5050), str("Give me content"), + event = EventBuilder(Kind(5050), str("Give me content")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -291,10 +291,10 @@ async def nostr_client_flux_schnell(ptag, query): tags = [relaysTag, alttag, pTag, iTag] - event = EventBuilder(Kind(5100), str("Give me image"), + event = EventBuilder(Kind(5100), str("Give me image")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) ropts = RelayOptions().ping(False) @@ -319,10 +319,10 @@ async def nostr_client_test_discovery_user(user, ptag): tags = [relaysTag, alttag, paramTag, pTag] - event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me people"), + event = EventBuilder(EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY, str("Give me people")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -344,10 +344,10 @@ async def nostr_client_test_discovery_gallery(user, ptag): tags = [relaysTag, alttag, paramTag, pTag] - event = EventBuilder(EventDefinitions.KIND_NIP90_VISUAL_DISCOVERY, str("Give me visuals"), + event = EventBuilder(EventDefinitions.KIND_NIP90_VISUAL_DISCOVERY, str("Give me visuals")).tags( tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -381,10 +381,10 @@ async def nostr_client_test_image_private(prompt, cashutoken): encrypted_params_string) encrypted_tag = Tag.parse(['encrypted']) - nip90request = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_IMAGE, encrypted_params, + nip90request = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_IMAGE, encrypted_params).tags( [pTag, encrypted_tag]).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -398,7 +398,7 @@ async def nostr_client(): sk = keys.secret_key() pk = keys.public_key() print(f"Nostr Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: diff --git a/tests/test_events.py b/tests/test_events.py index 77fd4a4..260780e 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -17,7 +17,7 @@ async def test(): relay_list = dvmconfig.DVMConfig.RELAY_LIST keys = Keys.parse(check_and_set_private_key("test_client")) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) @@ -71,7 +71,7 @@ async def test_gallery(): relay_list = dvmconfig.DVMConfig.RELAY_LIST keys = Keys.parse(check_and_set_private_key("test_client")) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) diff --git a/tutorials/03_client.py b/tutorials/03_client.py index d8951a5..671da81 100644 --- a/tutorials/03_client.py +++ b/tutorials/03_client.py @@ -36,10 +36,10 @@ async def nostr_client_generic_test(ptag): # We now send a 5050 Request (for Text Generation) with our tags. The content is optional. event = EventBuilder(Kind(5050), "This is a test", - tags).sign_with_keys(keys) + ).tags(tags).sign_with_keys(keys) # We create a signer with some random keys - client = Client(keys) + client = Client(NostrSigner.keys(keys)) # We add the relays we defined above and told our DVM we would want to receive events to. for relay in relay_list: await client.add_relay(relay) @@ -57,7 +57,7 @@ async def nostr_client(target_dvm_npub): sk = keys.secret_key() pk = keys.public_key() print(f"Nostr Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: diff --git a/tutorials/09_nutzap_client.py b/tutorials/09_nutzap_client.py index 69ec6f8..0bbbd38 100644 --- a/tutorials/09_nutzap_client.py +++ b/tutorials/09_nutzap_client.py @@ -31,9 +31,9 @@ async def nostr_client_generic_test(ptag): pTag = Tag.parse(["p", PublicKey.parse(ptag).to_hex()]) tags = [relaysTag, alttag, pTag, paramTag] event = EventBuilder(Kind(5050), "This is a test", - tags).sign_with_keys(keys) + ).tags(tags).sign_with_keys(keys) - client = Client(keys) + client = Client(NostrSigner.keys(keys)) for relay in relay_list: await client.add_relay(relay) await client.connect() @@ -46,7 +46,7 @@ async def nostr_client(target_dvm_npub): keys = Keys.parse(check_and_set_private_key("test_client")) pk = keys.public_key() print(f"Nostr Client public key: {pk.to_bech32()}, Hex: {pk.to_hex()} ") - client = Client(keys) + client = Client(NostrSigner.keys(keys)) dvmconfig = DVMConfig() for relay in dvmconfig.RELAY_LIST: From c5a3bb30db39803eab48eae1d9dd38f0dbb7f219 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:46:17 +0100 Subject: [PATCH 12/26] Update content_discovery_latest_one_per_follower.py --- nostr_dvm/tasks/content_discovery_latest_one_per_follower.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index 16a1fdd..d182f20 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -74,9 +74,9 @@ async def process(self, request_form): relaylimits = RelayLimits.disable() - opts = (Options().relay_limits(relaylimits)) + opts = Options().relay_limits(relaylimits) - cli = ClientBuilder().signer(NostrSigner(NostrSigner.keys(keys))).opts(opts).build() + cli = ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() for relay in self.dvm_config.RELAY_LIST: await cli.add_relay(relay) # ropts = RelayOptions().ping(False) From 9d802fcdd9f2cfe2b8fadaac09f9773597723ba0 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:39:35 +0100 Subject: [PATCH 13/26] calculate wot less frenquently --- nostr_dvm/tasks/content_discovery_update_db_only.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index 7c14ea9..75a1e30 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -42,6 +42,7 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface): personalized = False result = "" database = None + wot_counter = 0 async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, admin_config: AdminConfig = None, options=None): @@ -144,7 +145,7 @@ async def sync_db(self): await cli.connect() - if self.dvm_config.WOT_FILTERING: + if self.dvm_config.WOT_FILTERING and self.wot_counter == 0: print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS)) filtering = cli.filtering() index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS, @@ -166,7 +167,11 @@ async def sync_db(self): # toc = time.time() # print(f'finished in {toc - tic} seconds') await filtering.add_public_keys(wot_keys) - + self.wot_calculated = True + self.wot_counter += 1 + # only calculate wot every 10th call + if self.wot_counter >= 10: + self.wot_counter = 0 # Mute public key # await cli. (self.dvm_config.MUTE) From 4d4b870ae6e9e5c4deb2469c3ae6ce67673954a8 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:57:22 +0100 Subject: [PATCH 14/26] Update discovery.py --- tests/discovery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/discovery.py b/tests/discovery.py index 5cc7270..33d09b0 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -36,7 +36,7 @@ global_update_rate = 180 # set this high on first sync so db can fully sync before another process trys to. use_logger = True log_level = LogLevel.ERROR -max_sync_duration_in_h = 48 +max_sync_duration_in_h = 24 SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", #"wss://relay.primal.net", From 4fdeb456683a193d3512e0820494dba33f2e7578 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Wed, 20 Nov 2024 08:38:45 +0100 Subject: [PATCH 15/26] Update outbox_utils.py --- nostr_dvm/utils/outbox_utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 3327186..2335ed8 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -77,6 +77,12 @@ "wss://nostream-production-5895.up.railway.app", "ws://127.0.0.1:4869", "wss://sign.siamstr.com", "wss://relay.hash.stream", "wss://pablof7z.nostr1.com", "wss://nostr.beckmeyer.us", "wss://pow.hzrd149.com", - "wss://relay.nostrss.re", "wss://relay.nostr.bg", "ws://bugman.mguy.net:4848" + "wss://relay.nostrss.re", "wss://relay.nostr.bg", "ws://bugman.mguy.net:4848", + "wss://nostr-2.zebedee.cloud", "wss://nostr.lorentz.is", "wss://zap.nostr1.com", + "wss://onchain.pub", "wss://relay.nostr.info", "wss://relay.chicagoplebs.com", + "wss://relay.current.fyi", "wss://relay.stemstr.app", "wss://nostr.zenon.info", + "ws://localhost:7777" + + ] From 32ff092bf1643dac93bde5d75927906bafc5ac8e Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:05:25 +0100 Subject: [PATCH 16/26] Update search_users.py --- nostr_dvm/tasks/search_users.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 3429bdb..6d4de20 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -28,13 +28,11 @@ class SearchUser(DVMTaskInterface): dvm_config: DVMConfig last_schedule: int = 0 db_name = "db/nostr_profiles.db" - relay = "wss://profiles.nostr1.com" async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, admin_config: AdminConfig = None, options=None): dvm_config.SCRIPT = os.path.abspath(__file__) - if self.options.get("relay"): - self.relay = self.options['relay'] + if self.dvm_config.UPDATE_DATABASE: await self.sync_db() @@ -83,7 +81,8 @@ async def process(self, request_form): database = NostrDatabase.lmdb(self.db_name) cli = ClientBuilder().database(database).signer(NostrSigner.keys(keys)).build() - await cli.add_relay(self.relay) + for relay in self.dvm_config.SYNC_DB_RELAY_LIST: + await cli.add_relay(relay) # cli.add_relay("wss://atl.purplerelay.com") await cli.connect() From 31e388831a662272e14cdceff9d12143c9d5f7e8 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:40:55 +0100 Subject: [PATCH 17/26] add wot filter to profile database --- .../tasks/content_discovery_update_db_only.py | 1 - nostr_dvm/tasks/search_users.py | 41 +++++++++++++++++-- tests/search.py | 12 +++--- 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index 75a1e30..6ff5c0e 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -167,7 +167,6 @@ async def sync_db(self): # toc = time.time() # print(f'finished in {toc - tic} seconds') await filtering.add_public_keys(wot_keys) - self.wot_calculated = True self.wot_counter += 1 # only calculate wot every 10th call if self.wot_counter >= 10: diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 6d4de20..1c090ed 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -1,9 +1,10 @@ import json import os from datetime import timedelta +from itertools import islice from nostr_sdk import Timestamp, Tag, Keys, Options, SecretKey, NostrSigner, NostrDatabase, \ - ClientBuilder, Filter, SyncOptions, SyncDirection, Kind + ClientBuilder, Filter, SyncOptions, SyncDirection, Kind, PublicKey, RelayFilteringMode, RelayLimits from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils.admin_utils import AdminConfig @@ -12,6 +13,7 @@ from nostr_dvm.utils.nip88_utils import NIP88Config from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag from nostr_dvm.utils.output_utils import post_process_list_to_users +from nostr_dvm.utils.wot_utils import build_wot_network """ This File contains a Module to search for notes @@ -28,6 +30,7 @@ class SearchUser(DVMTaskInterface): dvm_config: DVMConfig last_schedule: int = 0 db_name = "db/nostr_profiles.db" + wot_counter = 0 async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, admin_config: AdminConfig = None, options=None): @@ -139,10 +142,42 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) database = NostrDatabase.lmdb(self.db_name) - cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() + relaylimits = RelayLimits.disable() + opts = (Options().relay_limits(relaylimits)) + if self.dvm_config.WOT_FILTERING: + opts = opts.filtering_mode(RelayFilteringMode.WHITELIST) + cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).opts(opts).build() - await cli.add_relay(self.relay) + for relay in self.dvm_config.SYNC_DB_RELAY_LIST: + await cli.add_relay(relay) await cli.connect() + if self.dvm_config.WOT_FILTERING and self.wot_counter == 0: + print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS)) + filtering = cli.filtering() + index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS, + depth=self.dvm_config.WOT_DEPTH, max_batch=500, + max_time_request=10, dvm_config=self.dvm_config) + + # Do we actually need pagerank here? + # print('computing global pagerank...') + # tic = time.time() + # p_G = nx.pagerank(G, tol=1e-12) + # print("network after pagerank: " + str(len(p_G))) + + wot_keys = [] + for item in islice(G, len(G)): + key = next((PublicKey.parse(pubkey) for pubkey, id in index_map.items() if id == item), + None) + wot_keys.append(key) + + # toc = time.time() + # print(f'finished in {toc - tic} seconds') + await filtering.add_public_keys(wot_keys) + + self.wot_counter += 1 + # only calculate wot every 10th call + if self.wot_counter >= 10: + self.wot_counter = 0 filter1 = Filter().kind(Kind(0)) diff --git a/tests/search.py b/tests/search.py index 87a819c..178eb5b 100644 --- a/tests/search.py +++ b/tests/search.py @@ -158,11 +158,11 @@ def build_advanced_search_wine(name, identifier): def build_user_search(name, identifier): dvm_config = build_default_config(identifier) - dvm_config.SYNC_DB_RELAY_LIST = ["wss://relay.damus.io"] + dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST dvm_config.RELAY_LIST = RELAY_LIST + dvm_config.WOT_FILTERING = True npub = Keys.parse(dvm_config.PRIVATE_KEY).public_key().to_bech32() - dvm_config.RELAY_LIST = RELAY_LIST invoice_key, admin_key, wallet_id, lnaddress = check_and_set_ln_bits_keys(identifier, npub) admin_config = AdminConfig() admin_config.REBROADCAST_NIP89 = rebroadcast_NIP89 @@ -189,11 +189,9 @@ def build_user_search(name, identifier): nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) nip89config.CONTENT = json.dumps(nip89info) - options = {"relay": "wss://profiles.nostr1.com"} - return SearchUser(name=name, dvm_config=dvm_config, nip89config=nip89config, - admin_config=admin_config, options=options) + admin_config=admin_config) @@ -208,8 +206,8 @@ def playground(): advanced_search_wine = build_advanced_search_wine("Nostr.wine Search", "discovery_content_searchwine") advanced_search_wine.run() - #profile_search = build_user_search("Profile Searcher", "profile_search") - #profile_search.run() + profile_search = build_user_search("Profile Searcher", "profile_search") + profile_search.run() From 6d4858bbef3de695235af837659aa0df72f1908a Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:44:38 +0100 Subject: [PATCH 18/26] Update search_users.py --- nostr_dvm/tasks/search_users.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 1c090ed..49ea8c2 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -104,6 +104,7 @@ async def process(self, request_form): for event in events.to_vec(): if index < options["max_results"]: try: + searchterm = " " + options["search"].lower() + " " if options["search"].lower() in event.content().lower(): p_tag = Tag.parse(["p", event.author().to_hex()]) #print(event.as_json()) @@ -235,10 +236,8 @@ def build_example(name, identifier, admin_config): nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) nip89config.CONTENT = json.dumps(nip89info) - options = {"relay": "wss://profiles.nostr1.com"} - return SearchUser(name=name, dvm_config=dvm_config, nip89config=nip89config, - admin_config=admin_config, options=options) + admin_config=admin_config) if __name__ == '__main__': From a4d003c832bb8d0dbb82b9e2b69ad141b89e9a82 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:44:40 +0100 Subject: [PATCH 19/26] Update discovery.py --- tests/discovery.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/discovery.py b/tests/discovery.py index 33d09b0..0d57830 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -421,7 +421,7 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, dvm_config.UPDATE_DATABASE = update_db dvm_config.DATABASE = database # Activate these to use a subscription based model instead - dvm_config.FIX_COST = 10 + dvm_config.FIX_COST = cost dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST @@ -443,6 +443,7 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, "cashuAccepted": True, "subscription": False, "personalized": True, + "amount": create_amount_tag(cost), "nip90Params": { "max_results": { "required": False, @@ -1031,7 +1032,7 @@ def playground(): "db_name": "db/nostr_recent_notes.db", "db_since": 2 * 60 * 60, # 2h since gmt, } - cost = 0 + cost = 10 image = "https://i.nostr.build/l11EczDmpZBaxlRm.jpg" discovery_non_followers = build_example_popular_non_followers( From 22d07982a39e9bd09730c420dc37bd2e2beb8fff Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:33:14 +0100 Subject: [PATCH 20/26] Update outbox_utils.py --- nostr_dvm/utils/outbox_utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 2335ed8..44e15d0 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -81,7 +81,9 @@ "wss://nostr-2.zebedee.cloud", "wss://nostr.lorentz.is", "wss://zap.nostr1.com", "wss://onchain.pub", "wss://relay.nostr.info", "wss://relay.chicagoplebs.com", "wss://relay.current.fyi", "wss://relay.stemstr.app", "wss://nostr.zenon.info", - "ws://localhost:7777" + "ws://localhost:7777", "wss://nostr.fmt.wiz.biz", "wss://nostrich.friendship.tw", + "wss://public.relaying.io", "wss://relay.me3d.app", + From b88f4a54ca8c186559316c940c16f9b77a6bb7f9 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Fri, 22 Nov 2024 11:14:39 +0100 Subject: [PATCH 21/26] deprecate "image" in nip89, use picture instead --- examples/ollama_dvm/main.py | 4 +- examples/tts_dvm/main.py | 4 +- examples/unleashed_dvm/main.py | 4 +- main.py | 4 +- nostr_dvm/bot.py | 4 +- nostr_dvm/tasks/advanced_search.py | 4 +- nostr_dvm/tasks/advanced_search_wine.py | 4 +- nostr_dvm/tasks/audiogeneration_suno_ai.py | 4 +- ...ent_discovery_currently_latest_longform.py | 10 ++--- ...content_discovery_currently_latest_wiki.py | 10 ++--- .../content_discovery_currently_popular.py | 10 ++--- ...discovery_currently_popular_by_top_zaps.py | 10 ++--- ...t_discovery_currently_popular_followers.py | 10 ++--- ...ent_discovery_currently_popular_gallery.py | 10 ++--- ...ntent_discovery_currently_popular_mostr.py | 10 ++--- ...iscovery_currently_popular_nonfollowers.py | 10 ++--- ...ntent_discovery_currently_popular_topic.py | 10 ++--- ...ntent_discovery_latest_one_per_follower.py | 4 +- .../tasks/content_discovery_update_db_only.py | 10 ++--- nostr_dvm/tasks/convert_media.py | 2 +- nostr_dvm/tasks/discovery_bot_farms.py | 4 +- nostr_dvm/tasks/discovery_censor_wot.py | 4 +- nostr_dvm/tasks/discovery_inactive_follows.py | 4 +- nostr_dvm/tasks/discovery_nonfollowers.py | 4 +- .../discovery_trending_notes_gleasonator.py | 5 +-- .../discovery_trending_notes_nostrband.py | 3 +- nostr_dvm/tasks/generic_dvm.py | 4 +- .../tasks/imagegeneration_openai_dalle.py | 4 +- nostr_dvm/tasks/imagegeneration_replicate.py | 4 +- .../imagegeneration_replicate_fluxpro.py | 4 +- .../imagegeneration_replicate_recraft.py | 4 +- .../tasks/imagegeneration_replicate_sdxl.py | 4 +- nostr_dvm/tasks/imagegeneration_sd21_mlx.py | 4 +- nostr_dvm/tasks/imagegeneration_sd35_api.py | 4 +- nostr_dvm/tasks/imagegeneration_sdxl.py | 4 +- .../tasks/imagegeneration_sdxlimg2img.py | 4 +- nostr_dvm/tasks/imageinterrogator.py | 4 +- nostr_dvm/tasks/imageupscale.py | 4 +- nostr_dvm/tasks/people_discovery_mywot.py | 11 +++-- nostr_dvm/tasks/people_discovery_wot.py | 10 ++--- nostr_dvm/tasks/search_users.py | 4 +- nostr_dvm/tasks/summarization_duckduck_ai.py | 4 +- nostr_dvm/tasks/summarization_huggingchat.py | 4 +- .../tasks/summarization_unleashed_chat.py | 4 +- nostr_dvm/tasks/textextraction_google.py | 4 +- nostr_dvm/tasks/textextraction_pdf.py | 4 +- nostr_dvm/tasks/textextraction_whisperx.py | 4 +- nostr_dvm/tasks/textgeneration_huggingchat.py | 4 +- nostr_dvm/tasks/textgeneration_llmlite.py | 4 +- .../tasks/textgeneration_unleashed_chat.py | 4 +- nostr_dvm/tasks/texttospeech.py | 4 +- nostr_dvm/tasks/translation_google.py | 4 +- nostr_dvm/tasks/translation_libretranslate.py | 4 +- .../tasks/videogeneration_replicate_svd.py | 4 +- nostr_dvm/tasks/videogeneration_svd.py | 4 +- nostr_dvm/utils/external_dvm_utils.py | 6 ++- nostr_dvm/utils/nip88_utils.py | 2 +- nostr_dvm/utils/nostr_utils.py | 2 +- tests/chat_bot.py | 4 +- tests/dalle.py | 4 +- tests/discovery.py | 40 +++++++------------ tests/discovery_custom_feed.py | 3 +- tests/discovery_gallery.py | 3 +- tests/discovery_mostr.py | 3 +- tests/discovery_one_per_follow.py | 3 +- tests/discovery_people.py | 3 +- tests/discovery_test.py | 40 +++++++------------ tests/generic_dvm.py | 4 +- tests/generic_dvm_autotopic_feed.py | 4 +- tests/generic_dvm_duck_chat.py | 4 +- tests/generic_dvm_flux_hf.py | 4 +- tests/otherstuff.py | 40 +++++++++---------- tests/sd35_api.py | 4 +- tests/search.py | 12 +++--- tests/summarization_duck.py | 4 +- tests/tts.py | 4 +- tutorials/05_announce_dvm.py | 2 +- tutorials/06_dvm_config.py | 2 +- tutorials/07_admin_config.py | 2 +- 79 files changed, 220 insertions(+), 270 deletions(-) diff --git a/examples/ollama_dvm/main.py b/examples/ollama_dvm/main.py index 6e0fb91..0695eb3 100644 --- a/examples/ollama_dvm/main.py +++ b/examples/ollama_dvm/main.py @@ -22,7 +22,7 @@ def main(): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use a LLM connected via OLLAMA", "encryptionSupported": True, "cashuAccepted": True, @@ -32,7 +32,7 @@ def main(): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) ollama = TextGenerationLLMLite(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, diff --git a/examples/tts_dvm/main.py b/examples/tts_dvm/main.py index 2ce8d46..7154cab 100644 --- a/examples/tts_dvm/main.py +++ b/examples/tts_dvm/main.py @@ -22,7 +22,7 @@ def main(): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", "encryptionSupported": True, "cashuAccepted": True, @@ -35,7 +35,7 @@ def main(): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) tts = TextToSpeech(name=name, diff --git a/examples/unleashed_dvm/main.py b/examples/unleashed_dvm/main.py index d32c250..babf537 100644 --- a/examples/unleashed_dvm/main.py +++ b/examples/unleashed_dvm/main.py @@ -22,7 +22,7 @@ def main(): nip89info = { "name": name, - "image": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", + "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I generate Text with Unleashed.chat", "encryptionSupported": True, "cashuAccepted": True, @@ -30,7 +30,7 @@ def main(): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) diff --git a/main.py b/main.py index e5cd934..f7d5b77 100644 --- a/main.py +++ b/main.py @@ -24,7 +24,7 @@ def playground(announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm just a demo DVM, not doing much.'", "encryptionSupported": True, "cashuAccepted": True, @@ -33,7 +33,7 @@ def playground(announce=False): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 443b09f..2179f06 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -741,7 +741,9 @@ async def print_dvm_info(client, index): if nip89content.get("name"): info += "Name: " + nip89content.get("name") + "\n" - if nip89content.get("image"): + if nip89content.get("picture"): + info += nip89content.get("picture") + "\n" + elif nip89content.get("image"): info += nip89content.get("image") + "\n" if nip89content.get("about"): info += "About:\n" + nip89content.get("about") + "\n\n" diff --git a/nostr_dvm/tasks/advanced_search.py b/nostr_dvm/tasks/advanced_search.py index 4bfe692..542148b 100644 --- a/nostr_dvm/tasks/advanced_search.py +++ b/nostr_dvm/tasks/advanced_search.py @@ -162,7 +162,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://nostr.band/android-chrome-192x192.png", + "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I search notes on Nostr.band.", "encryptionSupported": True, "cashuAccepted": True, @@ -191,7 +191,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = {"relay": "wss://relay.nostr.band"} diff --git a/nostr_dvm/tasks/advanced_search_wine.py b/nostr_dvm/tasks/advanced_search_wine.py index 68a5715..8f6f559 100644 --- a/nostr_dvm/tasks/advanced_search_wine.py +++ b/nostr_dvm/tasks/advanced_search_wine.py @@ -147,7 +147,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", + "picture": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", "about": "I search notes on nostr.wine using the nostr-wine API", "encryptionSupported": True, "cashuAccepted": True, @@ -176,7 +176,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return AdvancedSearchWine(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/audiogeneration_suno_ai.py b/nostr_dvm/tasks/audiogeneration_suno_ai.py index a0af881..de2c585 100644 --- a/nostr_dvm/tasks/audiogeneration_suno_ai.py +++ b/nostr_dvm/tasks/audiogeneration_suno_ai.py @@ -156,7 +156,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I create songs based on prompts with suno.ai", "encryptionSupported": True, "cashuAccepted": True, @@ -164,7 +164,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return AudioGenerationSonoAI(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py index df85bc4..e1a3f6e 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py @@ -227,7 +227,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, @@ -245,7 +244,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -273,7 +272,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes", "lud16": dvm_config.LN_ADDRESS, @@ -291,14 +289,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py index 5bbba0c..dc0c78e 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py @@ -226,7 +226,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, @@ -244,7 +243,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -272,7 +271,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes", "lud16": dvm_config.LN_ADDRESS, @@ -290,14 +288,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index 6417c2b..ce0799f 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -225,7 +225,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -243,7 +242,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -270,7 +269,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -288,14 +286,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py index 718fad8..1398258 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py @@ -269,7 +269,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, @@ -287,7 +286,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -314,7 +313,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -332,14 +330,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py index 5ab4e9d..657d0d4 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py @@ -243,7 +243,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=3 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -261,7 +260,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=3 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -287,7 +286,6 @@ def build_example_subscription(name, identifier, admin_config, options, processi image = "https://image.nostr.build/d92652a6a07677e051d647dcf9f0f59e265299b3335a939d008183a911513f4a.jpg" nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular, just like the free DVM, I'm also used for testing subscriptions. (beta)", "lud16": dvm_config.LN_ADDRESS, @@ -305,14 +303,14 @@ def build_example_subscription(name, identifier, admin_config, options, processi } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py index 80faca5..431b451 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py @@ -293,7 +293,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -311,7 +310,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -338,7 +337,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -356,14 +354,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py index 6c5b725..6e55033 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -247,7 +247,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -265,7 +264,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -293,7 +292,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -311,14 +309,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py index 13e3e92..99b3860 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py @@ -279,7 +279,6 @@ def build_example(name, identifier, admin_config, options, image, description, u # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -297,7 +296,7 @@ def build_example(name, identifier, admin_config, options, image, description, u } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularNonFollowers(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -319,7 +318,6 @@ def build_example_subscription(name, identifier, admin_config, options, image, d # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -337,14 +335,14 @@ def build_example_subscription(name, identifier, admin_config, options, image, d } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py index 6b45459..83e806c 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py @@ -256,7 +256,6 @@ def build_example(name, identifier, admin_config, options, image, description, u # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -274,7 +273,7 @@ def build_example(name, identifier, admin_config, options, image, description, u } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularbyTopic(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -296,7 +295,6 @@ def build_example_subscription(name, identifier, admin_config, options, image, d # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -314,14 +312,14 @@ def build_example_subscription(name, identifier, admin_config, options, image, d } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index d182f20..101d407 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -205,7 +205,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg", + "picture": "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg", "about": "I discover users you follow, but that have been inactive on Nostr", "action": "unfollow", # follow, mute, unmute "encryptionSupported": True, @@ -224,7 +224,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return Discoverlatestperfollower(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index 6ff5c0e..e26ee48 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -217,7 +217,6 @@ def build_example(name, identifier, admin_config, options, image, description, u # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -235,7 +234,7 @@ def build_example(name, identifier, admin_config, options, image, description, u } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentDBUpdateScheduler(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -257,7 +256,6 @@ def build_example_subscription(name, identifier, admin_config, options, image, d # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -275,14 +273,14 @@ def build_example_subscription(name, identifier, admin_config, options, image, d } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/convert_media.py b/nostr_dvm/tasks/convert_media.py index d69c15a..b1f9a72 100644 --- a/nostr_dvm/tasks/convert_media.py +++ b/nostr_dvm/tasks/convert_media.py @@ -87,7 +87,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I convert videos from urls to given output format.", "encryptionSupported": True, "cashuAccepted": True, diff --git a/nostr_dvm/tasks/discovery_bot_farms.py b/nostr_dvm/tasks/discovery_bot_farms.py index b6e89a1..8e1a18a 100644 --- a/nostr_dvm/tasks/discovery_bot_farms.py +++ b/nostr_dvm/tasks/discovery_bot_farms.py @@ -163,7 +163,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", + "picture": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", "about": "I hunt down bot farms.", "encryptionSupported": True, "cashuAccepted": True, @@ -178,7 +178,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = {"relay": "wss://relay.damus.io"} diff --git a/nostr_dvm/tasks/discovery_censor_wot.py b/nostr_dvm/tasks/discovery_censor_wot.py index 596f375..6c8b69d 100644 --- a/nostr_dvm/tasks/discovery_censor_wot.py +++ b/nostr_dvm/tasks/discovery_censor_wot.py @@ -171,7 +171,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", + "picture": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", "about": "I show users that have been reported by either your followers or your Web of Trust. Note: Anyone can report, so you might double check and decide for yourself who to mute. Considers spam, illegal and impersonation reports. Notice: This works with NIP51 mute lists. Not all clients support the new mute list format.", "encryptionSupported": True, "cashuAccepted": True, @@ -185,7 +185,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverReports(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/discovery_inactive_follows.py b/nostr_dvm/tasks/discovery_inactive_follows.py index ef48c01..d39aaa4 100644 --- a/nostr_dvm/tasks/discovery_inactive_follows.py +++ b/nostr_dvm/tasks/discovery_inactive_follows.py @@ -191,7 +191,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I discover users you follow, but that have been inactive on Nostr", "action": "unfollow", # follow, mute, unmute "encryptionSupported": True, @@ -210,7 +210,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverInactiveFollows(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/discovery_nonfollowers.py b/nostr_dvm/tasks/discovery_nonfollowers.py index b1e6d07..5b4a80e 100644 --- a/nostr_dvm/tasks/discovery_nonfollowers.py +++ b/nostr_dvm/tasks/discovery_nonfollowers.py @@ -195,7 +195,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I discover users you follow, but that don't follow you back.", "encryptionSupported": True, "cashuAccepted": True, @@ -213,7 +213,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverNonFollowers(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py index ad60f5f..1127a60 100644 --- a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py +++ b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py @@ -125,8 +125,7 @@ def build_example(name, identifier, admin_config, custom_processing_msg): nip89info = { "name": name, - "picture": "0c760b3ecdbc993ba47b785d0adecf00c760b3ecdbc993ba47b785d0adecf0ec71fd9c59808e27d0665b9f77a32d8de.png", - "image": "0c760b3ecdbc993ba47b785d0adecf00c760b3ecdbc993ba47b785d0adecf0ec71fd9c59808e27d0665b9f77a32d8de.png", + "picture": "https://image.nostr.build/0c760b3ecdbc993ba47b785d0adecf00c760b3ecdbc993ba47b785d0adecf0ec71fd9c59808e27d0665b9f77a32d8de.png", "about": "I show trending notes from Soapbox Ditto", "amount": "Free", "encryptionSupported": True, @@ -134,7 +133,7 @@ def build_example(name, identifier, admin_config, custom_processing_msg): "nip90Params": {} } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TrendingNotesGleasonator(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/discovery_trending_notes_nostrband.py b/nostr_dvm/tasks/discovery_trending_notes_nostrband.py index edc91fc..a767d0f 100644 --- a/nostr_dvm/tasks/discovery_trending_notes_nostrband.py +++ b/nostr_dvm/tasks/discovery_trending_notes_nostrband.py @@ -117,7 +117,6 @@ def build_example(name, identifier, admin_config, custom_processing_msg): nip89info = { "name": name, - "image": "https://nostr.band/android-chrome-192x192.png", "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I show trending notes from nostr.band", "amount": "Free", @@ -126,7 +125,7 @@ def build_example(name, identifier, admin_config, custom_processing_msg): "nip90Params": {} } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/generic_dvm.py b/nostr_dvm/tasks/generic_dvm.py index f26e989..3e272de 100644 --- a/nostr_dvm/tasks/generic_dvm.py +++ b/nostr_dvm/tasks/generic_dvm.py @@ -83,7 +83,7 @@ def build_example(name, identifier, admin_config, announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm an all purpose DVM'", "encryptionSupported": True, "cashuAccepted": True, @@ -92,7 +92,7 @@ def build_example(name, identifier, admin_config, announce=False): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/nostr_dvm/tasks/imagegeneration_openai_dalle.py b/nostr_dvm/tasks/imagegeneration_openai_dalle.py index bfc6773..6c2cef0 100644 --- a/nostr_dvm/tasks/imagegeneration_openai_dalle.py +++ b/nostr_dvm/tasks/imagegeneration_openai_dalle.py @@ -133,7 +133,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use OpenAI's DALL·E 3", "encryptionSupported": True, "cashuAccepted": True, @@ -146,7 +146,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationDALLE(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config) diff --git a/nostr_dvm/tasks/imagegeneration_replicate.py b/nostr_dvm/tasks/imagegeneration_replicate.py index 6f6e902..b94bf52 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate.py +++ b/nostr_dvm/tasks/imagegeneration_replicate.py @@ -148,7 +148,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion 3", "encryptionSupported": True, "cashuAccepted": True, @@ -161,7 +161,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationReplicate(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py b/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py index f5a8702..4159a0f 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py @@ -143,7 +143,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run FluxPro", "encryptionSupported": True, "cashuAccepted": True, @@ -156,7 +156,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationReplicateFluxPro(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_recraft.py b/nostr_dvm/tasks/imagegeneration_replicate_recraft.py index dbb285c..dfd46db 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_recraft.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_recraft.py @@ -141,7 +141,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run Recraft", "encryptionSupported": True, "cashuAccepted": True, @@ -154,7 +154,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationReplicateRecraft(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py b/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py index 749f463..7e8848e 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py @@ -127,7 +127,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", "encryptionSupported": True, "cashuAccepted": True, @@ -140,7 +140,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationReplicateSDXL(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_sd21_mlx.py b/nostr_dvm/tasks/imagegeneration_sd21_mlx.py index 3c66dbf..449813e 100644 --- a/nostr_dvm/tasks/imagegeneration_sd21_mlx.py +++ b/nostr_dvm/tasks/imagegeneration_sd21_mlx.py @@ -156,7 +156,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", "encryptionSupported": True, "cashuAccepted": True, @@ -169,7 +169,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationMLX(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_sd35_api.py b/nostr_dvm/tasks/imagegeneration_sd35_api.py index 981e116..0352bb7 100644 --- a/nostr_dvm/tasks/imagegeneration_sd35_api.py +++ b/nostr_dvm/tasks/imagegeneration_sd35_api.py @@ -264,7 +264,7 @@ def build_example(name, identifier, admin_config, server_address, default_model= nip89info = { "name": name, - "image": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", + "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", "encryptionSupported": True, "cashuAccepted": True, @@ -284,7 +284,7 @@ def build_example(name, identifier, admin_config, server_address, default_model= } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationSD35(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_sdxl.py b/nostr_dvm/tasks/imagegeneration_sdxl.py index 7c7e743..c51da2e 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_sdxl.py @@ -175,7 +175,7 @@ def build_example(name, identifier, admin_config, server_address, default_model= nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I draw images based on a prompt with a Model called unstable diffusion", "encryptionSupported": True, "cashuAccepted": True, @@ -191,7 +191,7 @@ def build_example(name, identifier, admin_config, server_address, default_model= } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationSDXL(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py index 9fa5fea..30d3aef 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py +++ b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py @@ -197,7 +197,7 @@ def build_example(name, identifier, admin_config, server_address, default_lora=" nip89info = { "name": name, - "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", + "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I convert an image to another image, kinda random for now. ", "encryptionSupported": True, "cashuAccepted": True, @@ -221,7 +221,7 @@ def build_example(name, identifier, admin_config, server_address, default_lora=" options = {'default_lora': default_lora, 'strength': strength, 'server': server_address} nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageGenerationSDXLIMG2IMG(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imageinterrogator.py b/nostr_dvm/tasks/imageinterrogator.py index 3dfcf57..314595e 100644 --- a/nostr_dvm/tasks/imageinterrogator.py +++ b/nostr_dvm/tasks/imageinterrogator.py @@ -114,7 +114,7 @@ def build_example(name, identifier, admin_config, server_address): nip89info = { "name": name, - "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", + "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I analyse Images an return a prompt or a prompt analysis", "encryptionSupported": True, "cashuAccepted": True, @@ -134,7 +134,7 @@ def build_example(name, identifier, admin_config, server_address): options = {'server': server_address} nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageInterrogator(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/imageupscale.py b/nostr_dvm/tasks/imageupscale.py index afdccad..2676ec2 100644 --- a/nostr_dvm/tasks/imageupscale.py +++ b/nostr_dvm/tasks/imageupscale.py @@ -119,7 +119,7 @@ def build_example(name, identifier, admin_config, server_address): nip89info = { "name": name, - "image": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", + "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I upscale an image using realESRGan up to factor 4 (default is factor 4)", "encryptionSupported": True, "cashuAccepted": True, @@ -131,7 +131,7 @@ def build_example(name, identifier, admin_config, server_address): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return ImageUpscale(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/people_discovery_mywot.py b/nostr_dvm/tasks/people_discovery_mywot.py index 79ff77e..c411881 100644 --- a/nostr_dvm/tasks/people_discovery_mywot.py +++ b/nostr_dvm/tasks/people_discovery_mywot.py @@ -8,6 +8,7 @@ ClientBuilder, Filter, SyncOptions, SyncDirection, init_logger, LogLevel, Kind from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv +from nostr_dvm.tasks.people_discovery_wot import DiscoverPeopleWOT from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.definitions import EventDefinitions from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config @@ -306,7 +307,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -324,7 +324,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -351,7 +351,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -369,14 +368,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/people_discovery_wot.py b/nostr_dvm/tasks/people_discovery_wot.py index 6c79456..64654f1 100644 --- a/nostr_dvm/tasks/people_discovery_wot.py +++ b/nostr_dvm/tasks/people_discovery_wot.py @@ -311,7 +311,6 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -329,7 +328,7 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -356,7 +355,6 @@ def build_example_subscription(name, identifier, admin_config, options, update_r # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, @@ -374,14 +372,14 @@ def build_example_subscription(name, identifier, admin_config, options, update_r } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 49ea8c2..11ddd1a 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -204,7 +204,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/a99ab925084029d9468fef8330ff3d9be2cf67da473b024f2a6d48b5cd77197f.jpg", + "picture": "https://image.nostr.build/a99ab925084029d9468fef8330ff3d9be2cf67da473b024f2a6d48b5cd77197f.jpg", "about": "I search users.", "encryptionSupported": True, "cashuAccepted": True, @@ -233,7 +233,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return SearchUser(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/summarization_duckduck_ai.py b/nostr_dvm/tasks/summarization_duckduck_ai.py index 74b6b1b..b252b04 100644 --- a/nostr_dvm/tasks/summarization_duckduck_ai.py +++ b/nostr_dvm/tasks/summarization_duckduck_ai.py @@ -120,7 +120,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I summarize Text", "encryptionSupported": True, "cashuAccepted": True, @@ -128,7 +128,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) admin_config2 = AdminConfig() admin_config2.REBROADCAST_NIP89 = False diff --git a/nostr_dvm/tasks/summarization_huggingchat.py b/nostr_dvm/tasks/summarization_huggingchat.py index 8aea328..bd975ce 100644 --- a/nostr_dvm/tasks/summarization_huggingchat.py +++ b/nostr_dvm/tasks/summarization_huggingchat.py @@ -125,7 +125,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", + "picture": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", "about": "I use a LLM connected via Huggingchat to summarize Inputs", "encryptionSupported": True, "cashuAccepted": True, @@ -133,7 +133,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextSummarizationHuggingChat(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/summarization_unleashed_chat.py b/nostr_dvm/tasks/summarization_unleashed_chat.py index fffb175..2d683b5 100644 --- a/nostr_dvm/tasks/summarization_unleashed_chat.py +++ b/nostr_dvm/tasks/summarization_unleashed_chat.py @@ -149,7 +149,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", + "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I summarize Text with https://unleashed.chat", "encryptionSupported": True, "cashuAccepted": True, @@ -157,7 +157,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) admin_config2 = AdminConfig() admin_config2.REBROADCAST_NIP89 = False diff --git a/nostr_dvm/tasks/textextraction_google.py b/nostr_dvm/tasks/textextraction_google.py index 04be3cb..9e42a07 100644 --- a/nostr_dvm/tasks/textextraction_google.py +++ b/nostr_dvm/tasks/textextraction_google.py @@ -137,7 +137,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from media files with the Google API. I understand English by default", "encryptionSupported": True, "cashuAccepted": True, @@ -149,7 +149,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return SpeechToTextGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/textextraction_pdf.py b/nostr_dvm/tasks/textextraction_pdf.py index 2f15b54..94bb0db 100644 --- a/nostr_dvm/tasks/textextraction_pdf.py +++ b/nostr_dvm/tasks/textextraction_pdf.py @@ -100,7 +100,7 @@ def build_example(name, identifier, admin_config): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from pdf documents. I only support Latin letters", "encryptionSupported": True, "cashuAccepted": True, @@ -108,7 +108,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextExtractionPDF(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config) diff --git a/nostr_dvm/tasks/textextraction_whisperx.py b/nostr_dvm/tasks/textextraction_whisperx.py index 910bd37..570edac 100644 --- a/nostr_dvm/tasks/textextraction_whisperx.py +++ b/nostr_dvm/tasks/textextraction_whisperx.py @@ -161,7 +161,7 @@ def build_example(name, identifier, admin_config, server_address): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from media files with WhisperX", "encryptionSupported": True, "cashuAccepted": True, @@ -178,7 +178,7 @@ def build_example(name, identifier, admin_config, server_address): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return SpeechToTextWhisperX(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/textgeneration_huggingchat.py b/nostr_dvm/tasks/textgeneration_huggingchat.py index 163a944..01ae75c 100644 --- a/nostr_dvm/tasks/textgeneration_huggingchat.py +++ b/nostr_dvm/tasks/textgeneration_huggingchat.py @@ -90,7 +90,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", + "picture": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", "about": "I use a LLM connected via Huggingchat", "encryptionSupported": True, "cashuAccepted": True, @@ -98,7 +98,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextGenerationHuggingChat(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/textgeneration_llmlite.py b/nostr_dvm/tasks/textgeneration_llmlite.py index ce33766..decf908 100644 --- a/nostr_dvm/tasks/textgeneration_llmlite.py +++ b/nostr_dvm/tasks/textgeneration_llmlite.py @@ -105,7 +105,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use a LLM connected via OLLAMA", "encryptionSupported": True, "cashuAccepted": True, @@ -113,7 +113,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextGenerationLLMLite(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, diff --git a/nostr_dvm/tasks/textgeneration_unleashed_chat.py b/nostr_dvm/tasks/textgeneration_unleashed_chat.py index bb27229..14ece25 100644 --- a/nostr_dvm/tasks/textgeneration_unleashed_chat.py +++ b/nostr_dvm/tasks/textgeneration_unleashed_chat.py @@ -113,7 +113,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", + "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I generate Text with Unleashed.chat", "encryptionSupported": True, "cashuAccepted": True, @@ -121,7 +121,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextGenerationUnleashedChat(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/texttospeech.py b/nostr_dvm/tasks/texttospeech.py index b90393a..0d9c6e5 100644 --- a/nostr_dvm/tasks/texttospeech.py +++ b/nostr_dvm/tasks/texttospeech.py @@ -175,7 +175,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", "encryptionSupported": True, "cashuAccepted": True, @@ -188,7 +188,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TextToSpeech(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, diff --git a/nostr_dvm/tasks/translation_google.py b/nostr_dvm/tasks/translation_google.py index da112f0..91398bc 100644 --- a/nostr_dvm/tasks/translation_google.py +++ b/nostr_dvm/tasks/translation_google.py @@ -118,7 +118,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I translate text from given text/event/job. Currently using Google TranslationGoogle Services to translate " "input into the language defined in params.", "encryptionSupported": True, @@ -143,7 +143,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TranslationGoogle(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config) diff --git a/nostr_dvm/tasks/translation_libretranslate.py b/nostr_dvm/tasks/translation_libretranslate.py index e2fc33a..fad1a98 100644 --- a/nostr_dvm/tasks/translation_libretranslate.py +++ b/nostr_dvm/tasks/translation_libretranslate.py @@ -116,7 +116,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I translate text from given text/event/job using LibreTranslate Services to translate " "input into the language defined in params.", "encryptionSupported": True, @@ -141,7 +141,7 @@ def build_example(name, identifier, admin_config): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TranslationLibre(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/videogeneration_replicate_svd.py b/nostr_dvm/tasks/videogeneration_replicate_svd.py index 92cb235..2a4162f 100644 --- a/nostr_dvm/tasks/videogeneration_replicate_svd.py +++ b/nostr_dvm/tasks/videogeneration_replicate_svd.py @@ -120,7 +120,7 @@ def build_example(name, identifier, admin_config): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", "encryptionSupported": True, "cashuAccepted": True, @@ -128,7 +128,7 @@ def build_example(name, identifier, admin_config): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return VideoGenerationReplicateSVD(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/tasks/videogeneration_svd.py b/nostr_dvm/tasks/videogeneration_svd.py index ce60455..c8d68af 100644 --- a/nostr_dvm/tasks/videogeneration_svd.py +++ b/nostr_dvm/tasks/videogeneration_svd.py @@ -108,14 +108,14 @@ def build_example(name, identifier, admin_config, server_address): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I create a short video based on an image", "encryptionSupported": True, "cashuAccepted": True, "nip90Params": {} } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return VideoGenerationSVD(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/nostr_dvm/utils/external_dvm_utils.py b/nostr_dvm/utils/external_dvm_utils.py index 04456f1..60e6a73 100644 --- a/nostr_dvm/utils/external_dvm_utils.py +++ b/nostr_dvm/utils/external_dvm_utils.py @@ -44,7 +44,9 @@ def build_external_dvm(pubkey, task, kind, fix_cost, per_unit_cost, config, nip89content = json.loads(nip89content_str) if nip89content.get("name"): name = nip89content.get("name") - if nip89content.get("image"): + if nip89content.get("picture"): + image = nip89content.get("picture") + elif nip89content.get("image"): image = nip89content.get("image") if nip89content.get("about"): about = nip89content.get("about") @@ -58,7 +60,7 @@ def build_external_dvm(pubkey, task, kind, fix_cost, per_unit_cost, config, print("No NIP89 set for " + name) nip89info = { "name": name, - "image": image, + "picture": image, "about": about, "encryptionSupported": encryption_supported, "cashuAccepted": cashu_accepted, diff --git a/nostr_dvm/utils/nip88_utils.py b/nostr_dvm/utils/nip88_utils.py index 1b8c63c..6760dbd 100644 --- a/nostr_dvm/utils/nip88_utils.py +++ b/nostr_dvm/utils/nip88_utils.py @@ -130,7 +130,7 @@ async def nip88_has_active_subscription(user: PublicKey, tiereventdtag, client: async def nip88_announce_tier(dvm_config, client): title_tag = Tag.parse(["title", str(dvm_config.NIP88.TITLE)]) - image_tag = Tag.parse(["image", str(dvm_config.NIP88.IMAGE)]) + image_tag = Tag.parse(["picture", str(dvm_config.NIP88.IMAGE)]) d_tag = Tag.parse(["d", dvm_config.NIP88.DTAG]) # zap splits. Feel free to change this for your DVM diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 33d24b9..9010d75 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -379,7 +379,7 @@ async def update_profile(dvm_config, client, lud16=""): nip89content = json.loads(dvm_config.NIP89.CONTENT) name = nip89content.get("name") about = nip89content.get("about") - image = nip89content.get("image") + image = nip89content.get("picture") # Set metadata metadata = Metadata() \ diff --git a/tests/chat_bot.py b/tests/chat_bot.py index d89194f..f7c2b22 100644 --- a/tests/chat_bot.py +++ b/tests/chat_bot.py @@ -47,7 +47,7 @@ def playground(announce = False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm briding DuckDuckAI'", "encryptionSupported": True, "cashuAccepted": True, @@ -57,7 +57,7 @@ def playground(announce = False): nip89config = NIP89Config() nip89config.KIND = kind - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/tests/dalle.py b/tests/dalle.py index 9f4c9db..a29869c 100644 --- a/tests/dalle.py +++ b/tests/dalle.py @@ -35,7 +35,7 @@ def build_dalle(name, identifier): dvm_config.FIX_COST = int(((4.0 / (get_price_per_sat("USD") * 100)) + profit_in_sats)) nip89info = { "name": name, - "image": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", + "picture": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", "about": "I create Images bridging OpenAI's DALL·E 3", "encryptionSupported": True, "cashuAccepted": True, @@ -48,7 +48,7 @@ def build_dalle(name, identifier): } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) aconfig = AdminConfig() aconfig.REBROADCAST_NIP89 = False # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89 diff --git a/tests/discovery.py b/tests/discovery.py index 0d57830..6bb3c80 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -75,7 +75,6 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -93,7 +92,7 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentDBUpdateScheduler(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -118,7 +117,6 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, @@ -136,7 +134,7 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularGallery(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -156,7 +154,6 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom nip89info = { "name": name, - "image": image, "picture": image, "about": about, "amount": "Free", @@ -165,7 +162,7 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom "nip90Params": {} } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -196,7 +193,6 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, @@ -214,7 +210,7 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -249,7 +245,6 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest wikifreedia entries.", "lud16": dvm_config.LN_ADDRESS, @@ -267,7 +262,7 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -298,7 +293,6 @@ def build_example_topic(name, identifier, admin_config, options, image, descript # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -316,7 +310,7 @@ def build_example_topic(name, identifier, admin_config, options, image, descript } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularbyTopic(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -341,7 +335,6 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -359,7 +352,7 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopular(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -385,7 +378,6 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -403,7 +395,7 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularFollowers(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -435,7 +427,6 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular from people you do not follow", "lud16": dvm_config.LN_ADDRESS, @@ -454,14 +445,14 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 @@ -502,7 +493,6 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, @@ -520,7 +510,7 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -551,7 +541,6 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr", "lud16": dvm_config.LN_ADDRESS, @@ -569,7 +558,7 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -594,7 +583,6 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -612,7 +600,7 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return Discoverlatestperfollower(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/discovery_custom_feed.py b/tests/discovery_custom_feed.py index 679aaac..ec1864d 100644 --- a/tests/discovery_custom_feed.py +++ b/tests/discovery_custom_feed.py @@ -46,7 +46,6 @@ def build_example_topic(name, identifier, admin_config, options, image, descript # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -79,7 +78,7 @@ def build_example_topic(name, identifier, admin_config, options, image, descript } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularbyTopic(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/tests/discovery_gallery.py b/tests/discovery_gallery.py index 618ca4b..49119c5 100644 --- a/tests/discovery_gallery.py +++ b/tests/discovery_gallery.py @@ -37,7 +37,6 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, @@ -55,7 +54,7 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularGallery(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/discovery_mostr.py b/tests/discovery_mostr.py index 29e6153..af93f9c 100644 --- a/tests/discovery_mostr.py +++ b/tests/discovery_mostr.py @@ -51,7 +51,6 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show popular notes from Mostr.pub and Momostr.pink", "lud16": dvm_config.LN_ADDRESS, @@ -69,7 +68,7 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/discovery_one_per_follow.py b/tests/discovery_one_per_follow.py index b230ffd..5b2dece 100644 --- a/tests/discovery_one_per_follow.py +++ b/tests/discovery_one_per_follow.py @@ -40,7 +40,6 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -58,7 +57,7 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return Discoverlatestperfollower(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/discovery_people.py b/tests/discovery_people.py index 4d91656..f94db9f 100644 --- a/tests/discovery_people.py +++ b/tests/discovery_people.py @@ -45,7 +45,6 @@ def build_example_wot(name, identifier, admin_config, options, image, cost=0, up # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show people to follow from your WOT", "lud16": dvm_config.LN_ADDRESS, @@ -63,7 +62,7 @@ def build_example_wot(name, identifier, admin_config, options, image, cost=0, up } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverPeopleMyWOT(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/discovery_test.py b/tests/discovery_test.py index aee8b64..cadd7f5 100644 --- a/tests/discovery_test.py +++ b/tests/discovery_test.py @@ -72,7 +72,6 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -90,7 +89,7 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentDBUpdateScheduler(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -115,7 +114,6 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, @@ -133,7 +131,7 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularGallery(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -152,7 +150,6 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom nip89info = { "name": name, - "image": image, "picture": image, "about": about, "amount": "Free", @@ -161,7 +158,7 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom "nip90Params": {} } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return TrendingNotesNostrBand(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -191,7 +188,6 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, @@ -209,7 +205,7 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -243,7 +239,6 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the latest wikifreedia entries.", "lud16": dvm_config.LN_ADDRESS, @@ -261,7 +256,7 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -289,7 +284,6 @@ def build_example_topic(name, identifier, admin_config, options, image, descript # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, @@ -307,7 +301,7 @@ def build_example_topic(name, identifier, admin_config, options, image, descript } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularbyTopic(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -331,7 +325,6 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, @@ -349,7 +342,7 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopular(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -372,7 +365,6 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -390,7 +382,7 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularFollowers(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -421,7 +413,6 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently popular from people you do not follow", "lud16": dvm_config.LN_ADDRESS, @@ -439,14 +430,14 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) nip88config = NIP88Config() - nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip88config.DTAG = check_and_set_d_tag_nip88(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip88config.TIER_EVENT = check_and_set_tiereventid_nip88(identifier, "1") nip89config.NAME = name - nip88config.IMAGE = nip89info["image"] + nip88config.IMAGE = nip89info["picture"] nip88config.TITLE = name nip88config.AMOUNT_DAILY = 100 nip88config.AMOUNT_MONTHLY = 2000 @@ -484,7 +475,6 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, @@ -502,7 +492,7 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # admin_config.UPDATE_PROFILE = False @@ -532,7 +522,6 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr", "lud16": dvm_config.LN_ADDRESS, @@ -550,7 +539,7 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DicoverContentCurrentlyPopularMostr(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) @@ -573,7 +562,6 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c # Add NIP89 nip89info = { "name": name, - "image": image, "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, @@ -591,7 +579,7 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return Discoverlatestperfollower(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config, options=options) diff --git a/tests/generic_dvm.py b/tests/generic_dvm.py index 915f470..5ef2d93 100644 --- a/tests/generic_dvm.py +++ b/tests/generic_dvm.py @@ -24,7 +24,7 @@ def playground(announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm an all purpose DVM'", "encryptionSupported": True, "cashuAccepted": True, @@ -33,7 +33,7 @@ def playground(announce=False): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/tests/generic_dvm_autotopic_feed.py b/tests/generic_dvm_autotopic_feed.py index 5e6585a..ed00723 100644 --- a/tests/generic_dvm_autotopic_feed.py +++ b/tests/generic_dvm_autotopic_feed.py @@ -79,7 +79,7 @@ def playground(announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://i.nostr.build/I8fJo0n355cbNEbS.png", # "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://i.nostr.build/I8fJo0n355cbNEbS.png", # "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I create a personalized feed based on topics you were writing about recently", "encryptionSupported": True, "cashuAccepted": True, @@ -89,7 +89,7 @@ def playground(announce=False): nip89config = NIP89Config() nip89config.KIND = Kind(kind) - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/tests/generic_dvm_duck_chat.py b/tests/generic_dvm_duck_chat.py index 5cbc172..491c92e 100644 --- a/tests/generic_dvm_duck_chat.py +++ b/tests/generic_dvm_duck_chat.py @@ -44,7 +44,7 @@ def playground(announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm briding DuckDuckAI'", "encryptionSupported": True, "cashuAccepted": True, @@ -54,7 +54,7 @@ def playground(announce=False): nip89config = NIP89Config() nip89config.KIND = kind - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/tests/generic_dvm_flux_hf.py b/tests/generic_dvm_flux_hf.py index e61c5bc..9b71e4f 100644 --- a/tests/generic_dvm_flux_hf.py +++ b/tests/generic_dvm_flux_hf.py @@ -49,7 +49,7 @@ def playground(announce=False): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I produce images with Flux-Schnell'", "encryptionSupported": True, "cashuAccepted": True, @@ -59,7 +59,7 @@ def playground(announce=False): nip89config = NIP89Config() nip89config.KIND = kind - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = { diff --git a/tests/otherstuff.py b/tests/otherstuff.py index 1c7780b..3cb9bfb 100644 --- a/tests/otherstuff.py +++ b/tests/otherstuff.py @@ -58,7 +58,7 @@ def build_sd35(name, identifier, announce): dvm_config.FIX_COST = int(((4.0 / (get_price_per_sat("USD") * 100)) + profit_in_sats)) nip89info = { "name": name, - "image": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", + "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", "encryptionSupported": True, "cashuAccepted": True, @@ -75,7 +75,7 @@ def build_sd35(name, identifier, announce): } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) aconfig = AdminConfig() aconfig.REBROADCAST_NIP89 = announce # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89 @@ -107,7 +107,7 @@ def build_dalle(name, identifier, announce): nip89info = { "name": name, - "image": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", + "picture": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", "about": "I create Images bridging OpenAI's DALL·E 3", "encryptionSupported": True, "cashuAccepted": True, @@ -121,7 +121,7 @@ def build_dalle(name, identifier, announce): nip89config = NIP89Config() nip89config.DTAG = nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89 @@ -143,7 +143,7 @@ def build_svd(name, identifier, announce): nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Stable Video Diffusion to create short videos", "encryptionSupported": True, "cashuAccepted": True, @@ -152,7 +152,7 @@ def build_svd(name, identifier, announce): nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89 return VideoGenerationReplicateSVD(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -170,7 +170,7 @@ def build_media_converter(name, identifier, announce): admin_config.REBROADCAST_NIP65_RELAY_LIST = announce nip89info = { "name": name, - "image": "https://cdn.nostr.build/i/a177be1159da5aad8396a1188f686728d55647d3a7371549584daf2b5e50eec9.jpg", + "picture": "https://cdn.nostr.build/i/a177be1159da5aad8396a1188f686728d55647d3a7371549584daf2b5e50eec9.jpg", "about": "I convert videos from urls to given output format.", "encryptionSupported": True, "cashuAccepted": True, @@ -183,7 +183,7 @@ def build_media_converter(name, identifier, announce): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return MediaConverter(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config) @@ -204,7 +204,7 @@ def build_inactive_follows_finder(name, identifier, announce): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/50621bbf8082c478bc06a06684e1c443b5d37f1362ad56d679cab7328e0481db.jpg", + "picture": "https://image.nostr.build/50621bbf8082c478bc06a06684e1c443b5d37f1362ad56d679cab7328e0481db.jpg", "about": "I discover npubs you follow, but that have been inactive on Nostr for the last 90 days", "action": "unfollow", "cashuAccepted": True, @@ -225,7 +225,7 @@ def build_inactive_follows_finder(name, identifier, announce): nip89config = NIP89Config() nip89config.DTAG = nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverInactiveFollows(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -244,7 +244,7 @@ def build_1984(name, identifier, announce): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", + "picture": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", "about": "I show users that have been reported by either your followers or your Web of Trust. Note: Anyone can report, so you might double check and decide for yourself who to mute. Considers spam, illegal and impersonation reports. Notice: This works with NIP51 mute lists. Not all clients support the new mute list format.", "encryptionSupported": True, "cashuAccepted": True, @@ -258,7 +258,7 @@ def build_1984(name, identifier, announce): } } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return DiscoverReports(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -279,7 +279,7 @@ def build_botfarms(name, identifier, announce): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", + "picture": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", "about": "I hunt down bot farms.", "encryptionSupported": True, "cashuAccepted": True, @@ -294,7 +294,7 @@ def build_botfarms(name, identifier, announce): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) options = {"relay": "wss://relay.damus.io"} @@ -317,7 +317,7 @@ def build_replicate(name, identifier, model, announce): nip89info = { "name": name, - "image": "https://i.nostr.build/qnoBIN4jSkfF8IHk.png", + "picture": "https://i.nostr.build/qnoBIN4jSkfF8IHk.png", "about": "I use Replicate to run StableDiffusion XL", "encryptionSupported": True, "cashuAccepted": True, @@ -330,7 +330,7 @@ def build_replicate(name, identifier, model, announce): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) opts = {"model": model} @@ -354,7 +354,7 @@ def build_replicate_recraft(name, identifier, announce): nip89info = { "name": name, - "image": "https://i.nostr.build/jSbrXvYglXCzSeAc.jpg", + "picture": "https://i.nostr.build/jSbrXvYglXCzSeAc.jpg", "about": "I use Replicate to run Recraft v3", "encryptionSupported": True, "cashuAccepted": True, @@ -367,7 +367,7 @@ def build_replicate_recraft(name, identifier, announce): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) @@ -389,7 +389,7 @@ def build_replicate_fluxpro(name, identifier, announce): nip89info = { "name": name, - "image": "https://i.nostr.build/AQTujqzVmLxLmG16.jpg", + "picture": "https://i.nostr.build/AQTujqzVmLxLmG16.jpg", "about": "I use Replicate to FluxPro 1.1.", "encryptionSupported": True, "cashuAccepted": True, @@ -402,7 +402,7 @@ def build_replicate_fluxpro(name, identifier, announce): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) diff --git a/tests/sd35_api.py b/tests/sd35_api.py index cef26e9..5d69151 100644 --- a/tests/sd35_api.py +++ b/tests/sd35_api.py @@ -33,7 +33,7 @@ def build_sd35(name, identifier): dvm_config.FIX_COST = int(((4.0 / (get_price_per_sat("USD") * 100)) + profit_in_sats)) nip89info = { "name": name, - "image": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", + "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", "encryptionSupported": True, "cashuAccepted": True, @@ -50,7 +50,7 @@ def build_sd35(name, identifier): } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) aconfig = AdminConfig() aconfig.REBROADCAST_NIP89 = False # We add an optional AdminConfig for this one, and tell the dvm to rebroadcast its NIP89 diff --git a/tests/search.py b/tests/search.py index 178eb5b..4868967 100644 --- a/tests/search.py +++ b/tests/search.py @@ -61,7 +61,7 @@ def build_advanced_search(name, identifier): nip89info = { "name": name, - "image": "https://nostr.band/android-chrome-192x192.png", + "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I search notes on nostr.band", "encryptionSupported": True, "cashuAccepted": True, @@ -90,7 +90,7 @@ def build_advanced_search(name, identifier): } nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return AdvancedSearch(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -117,7 +117,7 @@ def build_advanced_search_wine(name, identifier): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", + "picture": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", "about": "I search notes on nostr.wine using the nostr-wine API", "encryptionSupported": True, "cashuAccepted": True, @@ -147,7 +147,7 @@ def build_advanced_search_wine(name, identifier): nip89config = NIP89Config() nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, - nip89info["image"]) + nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) @@ -173,7 +173,7 @@ def build_user_search(name, identifier): # Add NIP89 nip89info = { "name": name, - "image": "https://image.nostr.build/bd0181a3089181f1d92a5da1ef85cffbe37ba80fbcc695b9d85648dc2fa92583.jpg", + "picture": "https://image.nostr.build/bd0181a3089181f1d92a5da1ef85cffbe37ba80fbcc695b9d85648dc2fa92583.jpg", "about": "I search users based on their profile info.", "encryptionSupported": True, "cashuAccepted": True, @@ -187,7 +187,7 @@ def build_user_search(name, identifier): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) return SearchUser(name=name, dvm_config=dvm_config, nip89config=nip89config, diff --git a/tests/summarization_duck.py b/tests/summarization_duck.py index f8a58f9..674ce79 100644 --- a/tests/summarization_duck.py +++ b/tests/summarization_duck.py @@ -22,7 +22,7 @@ def playground(announce=False): nip89info = { "name": name, - "image": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", + "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I summarize Text", "encryptionSupported": True, "cashuAccepted": True, @@ -30,7 +30,7 @@ def playground(announce=False): } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) diff --git a/tests/tts.py b/tests/tts.py index 4c6f7c4..59c5259 100644 --- a/tests/tts.py +++ b/tests/tts.py @@ -32,7 +32,7 @@ options = {'input_file': ""} nip89info = { "name": name, - "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", + "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", "encryptionSupported": True, "cashuAccepted": True, @@ -45,7 +45,7 @@ } nip89config = NIP89Config() - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) tts = TextToSpeech(name=name, dvm_config=dvm_config, nip89config=nip89config, admin_config=admin_config_tts, options=options) diff --git a/tutorials/05_announce_dvm.py b/tutorials/05_announce_dvm.py index 1bbc3ba..18eebf0 100644 --- a/tutorials/05_announce_dvm.py +++ b/tutorials/05_announce_dvm.py @@ -72,7 +72,7 @@ def run_dvm(identifier, announce): # We set a d tag. We need the dtag so if we want to update or delete the announcement, relays know which event is meant # You can choose a dtag you like. Here we build a hash from identiier, name, key and image and store it in the .env file. # So even if you change the name or image, it will now use the dtag from the env file until you delete it. - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) # We dump the nip89info struct from above to the content nip89config.CONTENT = json.dumps(nip89info) diff --git a/tutorials/06_dvm_config.py b/tutorials/06_dvm_config.py index 44229f4..cf61845 100644 --- a/tutorials/06_dvm_config.py +++ b/tutorials/06_dvm_config.py @@ -131,7 +131,7 @@ def run_dvm(identifier, announce): # We now create or Nip89Config object nip89config = NIP89Config() nip89config.KIND = kind - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) diff --git a/tutorials/07_admin_config.py b/tutorials/07_admin_config.py index 9eee2bd..eff01ba 100644 --- a/tutorials/07_admin_config.py +++ b/tutorials/07_admin_config.py @@ -106,7 +106,7 @@ def run_dvm(identifier, announce): # We now create or Nip89Config object nip89config = NIP89Config() nip89config.KIND = kind - nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["image"]) + nip89config.DTAG = check_and_set_d_tag(identifier, name, dvm_config.PRIVATE_KEY, nip89info["picture"]) nip89config.CONTENT = json.dumps(nip89info) From e2f720becce3ace0d55bde869cbbd218ed29659e Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Fri, 22 Nov 2024 19:18:44 +0100 Subject: [PATCH 22/26] clean up nip89 with suggested params in the nip, replace nip04 with nip44 for encryption --- examples/ollama_dvm/main.py | 4 +- examples/tts_dvm/main.py | 4 +- examples/unleashed_dvm/main.py | 4 +- main.py | 4 +- nostr_dvm/bot.py | 63 ++++++++++--------- nostr_dvm/dvm.py | 58 ++++++++++++----- nostr_dvm/subscription.py | 13 ++-- nostr_dvm/tasks/advanced_search.py | 4 +- nostr_dvm/tasks/advanced_search_wine.py | 4 +- nostr_dvm/tasks/audiogeneration_suno_ai.py | 4 +- ...ent_discovery_currently_latest_longform.py | 8 +-- ...content_discovery_currently_latest_wiki.py | 8 +-- .../content_discovery_currently_popular.py | 8 +-- ...discovery_currently_popular_by_top_zaps.py | 8 +-- ...t_discovery_currently_popular_followers.py | 8 +-- ...ent_discovery_currently_popular_gallery.py | 8 +-- ...ntent_discovery_currently_popular_mostr.py | 8 +-- ...iscovery_currently_popular_nonfollowers.py | 8 +-- ...ntent_discovery_currently_popular_topic.py | 8 +-- ...ntent_discovery_latest_one_per_follower.py | 4 +- .../tasks/content_discovery_update_db_only.py | 8 +-- nostr_dvm/tasks/convert_media.py | 4 +- nostr_dvm/tasks/discovery_bot_farms.py | 4 +- nostr_dvm/tasks/discovery_censor_wot.py | 4 +- nostr_dvm/tasks/discovery_inactive_follows.py | 4 +- nostr_dvm/tasks/discovery_nonfollowers.py | 4 +- .../discovery_trending_notes_gleasonator.py | 4 +- .../discovery_trending_notes_nostrband.py | 4 +- nostr_dvm/tasks/generic_dvm.py | 4 +- .../tasks/imagegeneration_openai_dalle.py | 4 +- nostr_dvm/tasks/imagegeneration_replicate.py | 4 +- .../imagegeneration_replicate_fluxpro.py | 4 +- .../imagegeneration_replicate_recraft.py | 4 +- .../tasks/imagegeneration_replicate_sdxl.py | 4 +- nostr_dvm/tasks/imagegeneration_sd21_mlx.py | 4 +- nostr_dvm/tasks/imagegeneration_sd35_api.py | 6 +- nostr_dvm/tasks/imagegeneration_sdxl.py | 4 +- .../tasks/imagegeneration_sdxlimg2img.py | 4 +- nostr_dvm/tasks/imageinterrogator.py | 4 +- nostr_dvm/tasks/imageupscale.py | 4 +- nostr_dvm/tasks/people_discovery_mywot.py | 8 +-- nostr_dvm/tasks/people_discovery_wot.py | 8 +-- nostr_dvm/tasks/search_users.py | 4 +- nostr_dvm/tasks/summarization_duckduck_ai.py | 4 +- nostr_dvm/tasks/summarization_huggingchat.py | 4 +- .../tasks/summarization_unleashed_chat.py | 4 +- nostr_dvm/tasks/textextraction_google.py | 4 +- nostr_dvm/tasks/textextraction_pdf.py | 4 +- nostr_dvm/tasks/textextraction_whisperx.py | 4 +- nostr_dvm/tasks/textgeneration_huggingchat.py | 4 +- nostr_dvm/tasks/textgeneration_llmlite.py | 4 +- .../tasks/textgeneration_unleashed_chat.py | 4 +- nostr_dvm/tasks/texttospeech.py | 4 +- nostr_dvm/tasks/translation_google.py | 4 +- nostr_dvm/tasks/translation_libretranslate.py | 4 +- .../tasks/videogeneration_replicate_svd.py | 4 +- nostr_dvm/tasks/videogeneration_svd.py | 4 +- nostr_dvm/utils/database_utils.py | 5 +- nostr_dvm/utils/external_dvm_utils.py | 12 ++-- nostr_dvm/utils/nostr_utils.py | 33 +++++++--- nostr_dvm/utils/outbox_utils.py | 5 +- tests/chat_bot.py | 4 +- tests/dalle.py | 4 +- tests/discovery.py | 48 +++++++------- tests/discovery_custom_feed.py | 4 +- tests/discovery_gallery.py | 4 +- tests/discovery_mostr.py | 4 +- tests/discovery_one_per_follow.py | 4 +- tests/discovery_people.py | 4 +- tests/discovery_test.py | 48 +++++++------- tests/generic_dvm.py | 4 +- tests/generic_dvm_autotopic_feed.py | 4 +- tests/generic_dvm_duck_chat.py | 4 +- tests/generic_dvm_flux_hf.py | 4 +- tests/otherstuff.py | 38 +++++------ tests/sd35_api.py | 4 +- tests/search.py | 17 ++--- tests/simplebot.py | 2 +- tests/summarization_duck.py | 4 +- tests/test_dvm_client.py | 6 +- tests/tts.py | 4 +- tutorials/05_announce_dvm.py | 2 +- tutorials/06_dvm_config.py | 2 +- tutorials/07_admin_config.py | 2 +- ui/noogle/src/components/ChatGeneration.vue | 2 +- ui/noogle/src/components/FilterGeneration.vue | 41 ++++++------ ui/noogle/src/components/ImageGeneration.vue | 2 +- ui/noogle/src/components/Login.vue | 4 +- ui/noogle/src/components/Search.vue | 31 ++++++--- .../components/SummarizationGeneration.vue | 2 +- 90 files changed, 412 insertions(+), 346 deletions(-) diff --git a/examples/ollama_dvm/main.py b/examples/ollama_dvm/main.py index 0695eb3..a2da1d9 100644 --- a/examples/ollama_dvm/main.py +++ b/examples/ollama_dvm/main.py @@ -24,8 +24,8 @@ def main(): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use a LLM connected via OLLAMA", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } diff --git a/examples/tts_dvm/main.py b/examples/tts_dvm/main.py index 7154cab..75c639f 100644 --- a/examples/tts_dvm/main.py +++ b/examples/tts_dvm/main.py @@ -24,8 +24,8 @@ def main(): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "language": { "required": False, diff --git a/examples/unleashed_dvm/main.py b/examples/unleashed_dvm/main.py index babf537..5cb4a1a 100644 --- a/examples/unleashed_dvm/main.py +++ b/examples/unleashed_dvm/main.py @@ -24,8 +24,8 @@ def main(): "name": name, "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I generate Text with Unleashed.chat", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/main.py b/main.py index f7d5b77..4294046 100644 --- a/main.py +++ b/main.py @@ -26,8 +26,8 @@ def playground(announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm just a demo DVM, not doing much.'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index 2179f06..c1a4917 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -4,8 +4,8 @@ import signal from multiprocessing.connection import Connection -from nostr_sdk import (Keys, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, - Options, Tag, Event, nip04_encrypt, EventId, Nip19Event, Kind, KindEnum, NostrSigner, +from nostr_sdk import (Keys, Timestamp, Filter, nip04_decrypt, nip44_decrypt, HandleNotification, EventBuilder, PublicKey, + Options, Tag, Event, EventId, Nip19Event, Kind, KindEnum, NostrSigner, nip44_encrypt, UnsignedEvent, UnwrappedGift, uniffi_set_event_loop, ClientBuilder, make_private_msg) from nostr_dvm.utils.admin_utils import admin_make_database_updates @@ -28,9 +28,11 @@ class Bot: # This is a simple list just to keep track which events we created and manage, so we don't pay for other requests def __init__(self, dvm_config, admin_config=None): + self.signer = None self.dvm_config = None self.keys = None self.admin_config = None + self.client = None asyncio.run(self.run_bot(dvm_config, admin_config)) uniffi_set_event_loop(asyncio.get_running_loop()) @@ -46,6 +48,7 @@ async def run_bot(self, dvm_config, admin_config): self.dvm_config.NIP89 = nip89config self.admin_config = admin_config self.keys = Keys.parse(dvm_config.PRIVATE_KEY) + self.signer = NostrSigner.keys(self.keys) self.CHATBOT = False opts = Options().gossip(True) @@ -125,7 +128,7 @@ async def handle_dm(nostr_event, giftwrap): if giftwrap: try: # Extract rumor - unwrapped_gift = await UnwrappedGift.from_gift_wrap(self.keys, nostr_event) + unwrapped_gift = await UnwrappedGift.from_gift_wrap(NostrSigner.keys(self.keys), nostr_event) sender = unwrapped_gift.sender().to_hex() rumor: UnsignedEvent = unwrapped_gift.rumor() @@ -185,7 +188,7 @@ async def handle_dm(nostr_event, giftwrap): params_as_str = json.dumps(tags_str) print(params_as_str) # and encrypt them - encrypted_params = nip04_encrypt(self.keys.secret_key(), + encrypted_params = nip44_encrypt(self.keys.secret_key(), PublicKey.from_hex( self.dvm_config.SUPPORTED_DVMS[ index].PUBLIC_KEY), @@ -240,7 +243,7 @@ async def handle_dm(nostr_event, giftwrap): else: message = invoice if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), message, + event = await make_private_msg(self.signer, PublicKey.parse(sender), message, None) await self.client.send_event(event) @@ -262,8 +265,7 @@ async def handle_dm(nostr_event, giftwrap): "100 sats (or any other amount) " "to top up your balance") if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), message, - None) + event = await make_private_msg(NostrSigner.keys(self.keys), PublicKey.parse(sender), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -281,8 +283,7 @@ async def handle_dm(nostr_event, giftwrap): message = "Error: " + cashu_message + ". Token has not been redeemed." if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), message, - None) + event = await make_private_msg(self.signer, PublicKey.parse(sender), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -290,8 +291,7 @@ async def handle_dm(nostr_event, giftwrap): await asyncio.sleep(2.0) message = "No, there is no second best.\n\nhttps://cdn.nostr.build/p/mYLv.mp4" if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), message, - None) + event = await make_private_msg(self.signer, PublicKey.parse(sender), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -356,8 +356,13 @@ async def handle_nip90_feedback(nostr_event): if is_encrypted: if ptag == self.keys.public_key().to_hex(): - tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), - nostr_event.author(), nostr_event.content()) + try: + tags_str = nip44_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + nostr_event.author(), nostr_event.content()) + except: + tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + nostr_event.author(), nostr_event.content()) + params = json.loads(tags_str) params.append(Tag.parse(["p", ptag]).as_vec()) params.append(Tag.parse(["encrypted"]).as_vec()) @@ -386,8 +391,7 @@ async def handle_nip90_feedback(nostr_event): client=self.client, config=self.dvm_config) await asyncio.sleep(2.0) if entry["giftwrap"]: - event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse(entry["npub"])), content, - None) + event = await make_private_msg(self.signer, PublicKey.parse(PublicKey.parse(entry["npub"])), content) await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(entry['npub']), self.dvm_config) @@ -417,8 +421,7 @@ async def handle_nip90_feedback(nostr_event): amount) + " Sats from balance to DVM. New balance is " + str( balance) + " Sats.\n" if entry["giftwrap"]: - event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse(entry["npub"])), message, - None) + event = await make_private_msg(self.signer, PublicKey.parse(PublicKey.parse(entry["npub"])), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(entry['npub']), @@ -434,8 +437,7 @@ async def handle_nip90_feedback(nostr_event): int(amount - user.balance)) + " Sats, then try again." if entry["giftwrap"]: - event = await make_private_msg(self.keys, PublicKey.parse(PublicKey.parse((entry["npub"]))), message, - None) + event = await make_private_msg(self.signer, PublicKey.parse(PublicKey.parse((entry["npub"]))), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(entry['npub']), @@ -496,7 +498,10 @@ async def handle_nip90_response_event(nostr_event: Event): content = nostr_event.content() if is_encrypted: if ptag == self.keys.public_key().to_hex(): - content = nip04_decrypt(self.keys.secret_key(), nostr_event.author(), content) + try: + content = nip44_decrypt(self.keys.secret_key(), nostr_event.author(), content) + except: + content = nip04_decrypt(self.keys.secret_key(), nostr_event.author(), content) else: return @@ -513,8 +518,8 @@ async def handle_nip90_response_event(nostr_event: Event): print("[" + self.NAME + "] Received results, message to orignal sender " + user.name) await asyncio.sleep(2.0) if entry["giftwrap"]: - event = await make_private_msg(self.keys, PublicKey.parse(user.npub), content, - None) + event = await make_private_msg(self.signer, PublicKey.parse(user.npub), content) + await self.client.send_event(event) else: await send_nip04_dm(self.client, content, PublicKey.parse(user.npub), self.dvm_config) @@ -581,7 +586,7 @@ async def answer_overview(nostr_event, giftwrap, sender): text = message + "\nSelect an Index and provide an input (e.g. \"2 A purple ostrich\")\nType \"index info\" to learn more about each DVM. (e.g. \"2 info\")\n\n Type \"balance\" to see your current balance" if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), text) + event = await make_private_msg(self.signer, PublicKey.parse(sender), text) await self.client.send_event(event) else: await send_nip04_dm(self.client, text, PublicKey.parse(sender), self.dvm_config) @@ -589,7 +594,7 @@ async def answer_overview(nostr_event, giftwrap, sender): async def answer_blacklisted(nostr_event, giftwrap, sender): message = "Your are currently blocked from this service." if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), message) + event = await make_private_msg(self.signer, PublicKey.parse(sender), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) @@ -601,7 +606,7 @@ async def answer_nip89(nostr_event, index, giftwrap, sender): await asyncio.sleep(2.0) if giftwrap: - event = await make_private_msg(self.keys, PublicKey.parse(sender), info) + event = await make_private_msg(self.signer, PublicKey.parse(sender), info) await self.client.send_event(event) else: await send_nip04_dm(self.client, info, PublicKey.parse(sender), self.dvm_config) @@ -747,10 +752,10 @@ async def print_dvm_info(client, index): info += nip89content.get("image") + "\n" if nip89content.get("about"): info += "About:\n" + nip89content.get("about") + "\n\n" - if nip89content.get("cashuAccepted"): - cashu_accepted = str(nip89content.get("cashuAccepted")) - if nip89content.get("encryptionSupported"): - encryption_supported = str(nip89content.get("encryptionSupported")) + if nip89content.get("acceptsNutZaps"): + cashu_accepted = str(nip89content.get("acceptsNutZaps")) + if nip89content.get("supportsEncryption"): + encryption_supported = str(nip89content.get("supportsEncryption")) info += "Encryption supported: " + str(encryption_supported) + "\n" info += "Cashu accepted: " + str(cashu_accepted) + "\n\n" diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index a61144c..1ec639b 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -4,7 +4,8 @@ from sys import platform from nostr_sdk import PublicKey, Keys, Client, Tag, Event, EventBuilder, Filter, HandleNotification, Timestamp, \ - LogLevel, Options, nip04_encrypt, Kind, RelayLimits, uniffi_set_event_loop, ClientBuilder, NostrSigner + LogLevel, Options, nip04_encrypt, nip44_encrypt, Nip44Version, Kind, RelayLimits, uniffi_set_event_loop, ClientBuilder, NostrSigner + from nostr_dvm.utils.admin_utils import admin_make_database_updates, AdminConfig from nostr_dvm.utils.backend_utils import get_amount_per_task, check_task_is_supported, get_task @@ -107,7 +108,7 @@ async def handle_msg(self, relay_url, msg): async def handle_nip90_job_event(nip90_event): # decrypted encrypted events - nip90_event = check_and_decrypt_tags(nip90_event, self.dvm_config) + nip90_event, use_legacy_encryption = check_and_decrypt_tags(nip90_event, self.dvm_config) # if event is encrypted, but we can't decrypt it (e.g. because its directed to someone else), return if nip90_event is None: return @@ -235,7 +236,7 @@ async def handle_nip90_job_event(nip90_event): if dvm_config.SEND_FEEDBACK_EVENTS: await send_job_status_reaction(nip90_event, "processing", True, 0, content=self.dvm_config.CUSTOM_PROCESSING_MESSAGE, - client=self.client, dvm_config=self.dvm_config, user=user) + client=self.client, dvm_config=self.dvm_config) # when we reimburse users on error make sure to not send anything if it was free if user.iswhitelisted or task_is_free: @@ -337,7 +338,7 @@ async def handle_nutzap(nut_zap_event): job_event = await get_event_by_id(tag.as_vec()[1], client=self.client, config=self.dvm_config) if job_event is not None: - job_event = check_and_decrypt_tags(job_event, self.dvm_config) + job_event, use_legacy_encryption = check_and_decrypt_tags(job_event, self.dvm_config) if job_event is None: return else: @@ -357,7 +358,7 @@ async def handle_nutzap(nut_zap_event): print("[" + self.dvm_config.NIP89.NAME + "] Payment-request fulfilled...") await send_job_status_reaction(job_event, "processing", client=self.client, content=self.dvm_config.CUSTOM_PROCESSING_MESSAGE, - dvm_config=self.dvm_config, user=user) + dvm_config=self.dvm_config) indices = [i for i, x in enumerate(self.job_list) if x.event == job_event] index = -1 @@ -419,7 +420,7 @@ async def handle_zap(zap_event): job_event = await get_event_by_id(tag.as_vec()[1], client=self.client, config=self.dvm_config) if job_event is not None: - job_event = check_and_decrypt_tags(job_event, self.dvm_config) + job_event, use_legacy_encryption = check_and_decrypt_tags(job_event, self.dvm_config) if job_event is None: return else: @@ -531,11 +532,11 @@ async def check_and_return_event(data, original_event: Event): if self.dvm_config.SHOW_RESULT_BEFORE_PAYMENT and not is_paid: await send_nostr_reply_event(data, original_event.as_json()) await send_job_status_reaction(original_event, "success", amount, - dvm_config=self.dvm_config, + dvm_config=self.dvm_config ) # or payment-required, or both? elif not self.dvm_config.SHOW_RESULT_BEFORE_PAYMENT and not is_paid: await send_job_status_reaction(original_event, "success", amount, - dvm_config=self.dvm_config, + dvm_config=self.dvm_config ) # or payment-required, or both? if self.dvm_config.SHOW_RESULT_BEFORE_PAYMENT and is_paid: @@ -595,11 +596,15 @@ async def send_nostr_reply_event(content, original_event_as_str): reply_tags.append(relay_tag) encrypted = False + is_legacy_encryption = False + encryption_tags = [] for tag in original_event.tags().to_vec(): if tag.as_vec()[0] == "encrypted": encrypted = True encrypted_tag = Tag.parse(["encrypted"]) - reply_tags.append(encrypted_tag) + encryption_tags.append(encrypted_tag) + #_, is_legacy_encryption = check_and_decrypt_tags(original_event, dvm_config) + for tag in original_event.tags().to_vec(): if tag.as_vec()[0] == "i": @@ -607,14 +612,30 @@ async def send_nostr_reply_event(content, original_event_as_str): if not encrypted: reply_tags.append(i_tag) + if encrypted: + encryption_tags.append(p_tag) + encryption_tags.append(e_tag) + + else: + reply_tags.append(p_tag) + if encrypted: print(content) - content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), - content) + if is_legacy_encryption: + content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), + content) + else: + + content = nip44_encrypt(self.keys.secret_key(), + PublicKey.from_hex(original_event.author().to_hex()), + content, Nip44Version.V2) + + reply_tags = encryption_tags + reply_event = EventBuilder(Kind(original_event.kind().as_u16() + 1000), str(content)).tags(reply_tags).sign_with_keys( self.keys) - + print(reply_event) # send_event(reply_event, client=self.client, dvm_config=self.dvm_config) await send_event_outbox(reply_event, client=self.client, dvm_config=self.dvm_config) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: @@ -626,7 +647,7 @@ async def send_nostr_reply_event(content, original_event_as_str): async def send_job_status_reaction(original_event, status, is_paid=True, amount=0, client=None, content=None, - dvm_config=None, user=None): + dvm_config=None): task = await get_task(original_event, client=client, dvm_config=dvm_config) alt_description, reaction = build_status_reaction(status, task, amount, content, dvm_config) @@ -649,11 +670,13 @@ async def send_job_status_reaction(original_event, status, is_paid=True, amount= encryption_tags = [] encrypted = False + is_legacy_encryption = False for tag in original_event.tags().to_vec(): if tag.as_vec()[0] == "encrypted": encrypted = True encrypted_tag = Tag.parse(["encrypted"]) encryption_tags.append(encrypted_tag) + #_, is_legacy_encryption = check_and_decrypt_tags(original_event, dvm_config) if encrypted: encryption_tags.append(p_tag) @@ -720,8 +743,13 @@ async def send_job_status_reaction(original_event, status, is_paid=True, amount= str_tags.append(element.as_vec()) content = json.dumps(str_tags) - content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), - content) + if is_legacy_encryption: + content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), + content) + else: + content = nip44_encrypt(self.keys.secret_key(), + PublicKey.from_hex(original_event.author().to_hex()), + content, version=Nip44Version.V2) reply_tags = encryption_tags else: diff --git a/nostr_dvm/subscription.py b/nostr_dvm/subscription.py index 8b45af8..3cc8ed8 100644 --- a/nostr_dvm/subscription.py +++ b/nostr_dvm/subscription.py @@ -5,8 +5,8 @@ import signal from datetime import timedelta -from nostr_sdk import (Keys, Client, Timestamp, Filter, nip04_decrypt, HandleNotification, EventBuilder, PublicKey, - Options, Tag, Event, nip04_encrypt, NostrSigner, EventId, uniffi_set_event_loop, make_private_msg) +from nostr_sdk import (Keys, Client, Timestamp, Filter, nip04_decrypt, nip44_decrypt, HandleNotification, EventBuilder, PublicKey, + Options, Tag, Event, nip44_encrypt, NostrSigner, EventId, uniffi_set_event_loop, make_private_msg) from nostr_dvm.utils.database_utils import fetch_user_metadata from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout @@ -146,7 +146,7 @@ async def send_status_success(original_event, domain): str_tags.append(element.as_vec()) content = json.dumps(str_tags) - content = nip04_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), + content = nip44_encrypt(self.keys.secret_key(), PublicKey.from_hex(original_event.author().to_hex()), content) reply_tags = encryption_tags @@ -229,7 +229,12 @@ async def handle_nwc_request(nostr_event): return try: - decrypted_text = nip04_decrypt(self.keys.secret_key(), nostr_event.author(), nostr_event.content()) + + try: + decrypted_text = nip44_decrypt(self.keys.secret_key(), nostr_event.author(), nostr_event.content()) + except: + decrypted_text = nip04_decrypt(self.keys.secret_key(), nostr_event.author(), nostr_event.content()) + subscriber = "" nwc = "" try: diff --git a/nostr_dvm/tasks/advanced_search.py b/nostr_dvm/tasks/advanced_search.py index 542148b..257418a 100644 --- a/nostr_dvm/tasks/advanced_search.py +++ b/nostr_dvm/tasks/advanced_search.py @@ -164,8 +164,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I search notes on Nostr.band.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "users": { "required": False, diff --git a/nostr_dvm/tasks/advanced_search_wine.py b/nostr_dvm/tasks/advanced_search_wine.py index 8f6f559..57e8fec 100644 --- a/nostr_dvm/tasks/advanced_search_wine.py +++ b/nostr_dvm/tasks/advanced_search_wine.py @@ -149,8 +149,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", "about": "I search notes on nostr.wine using the nostr-wine API", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "users": { "required": False, diff --git a/nostr_dvm/tasks/audiogeneration_suno_ai.py b/nostr_dvm/tasks/audiogeneration_suno_ai.py index de2c585..1ebc7a4 100644 --- a/nostr_dvm/tasks/audiogeneration_suno_ai.py +++ b/nostr_dvm/tasks/audiogeneration_suno_ai.py @@ -158,8 +158,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I create songs based on prompts with suno.ai", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py index e1a3f6e..79e5bff 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_longform.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_longform.py @@ -230,8 +230,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -275,8 +275,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show the latest longform notes", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py index dc0c78e..e972574 100644 --- a/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py +++ b/nostr_dvm/tasks/content_discovery_currently_latest_wiki.py @@ -229,8 +229,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -274,8 +274,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show the latest longform notes", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index ce0799f..d939c90 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -228,8 +228,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -272,8 +272,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py index 1398258..e0f8c7f 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_by_top_zaps.py @@ -272,8 +272,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -316,8 +316,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py index 657d0d4..507a904 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_followers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_followers.py @@ -246,8 +246,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=3 "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { @@ -289,8 +289,8 @@ def build_example_subscription(name, identifier, admin_config, options, processi "picture": image, "about": "I show notes that are currently popular, just like the free DVM, I'm also used for testing subscriptions. (beta)", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "subscription": True, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py index 431b451..4cdf990 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_gallery.py @@ -296,8 +296,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -340,8 +340,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py index 6e55033..eea4646 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_mostr.py @@ -250,8 +250,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -295,8 +295,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py index 99b3860..765fa04 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py @@ -282,8 +282,8 @@ def build_example(name, identifier, admin_config, options, image, description, u "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -321,8 +321,8 @@ def build_example_subscription(name, identifier, admin_config, options, image, d "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py index 83e806c..d002d10 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_topic.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_topic.py @@ -259,8 +259,8 @@ def build_example(name, identifier, admin_config, options, image, description, u "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -298,8 +298,8 @@ def build_example_subscription(name, identifier, admin_config, options, image, d "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py index 101d407..ca02e43 100644 --- a/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py +++ b/nostr_dvm/tasks/content_discovery_latest_one_per_follower.py @@ -208,8 +208,8 @@ def build_example(name, identifier, admin_config): "picture": "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg", "about": "I discover users you follow, but that have been inactive on Nostr", "action": "unfollow", # follow, mute, unmute - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "user": { "required": False, diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index e26ee48..f2f8f86 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -220,8 +220,8 @@ def build_example(name, identifier, admin_config, options, image, description, u "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -259,8 +259,8 @@ def build_example_subscription(name, identifier, admin_config, options, image, d "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/convert_media.py b/nostr_dvm/tasks/convert_media.py index b1f9a72..4de4ced 100644 --- a/nostr_dvm/tasks/convert_media.py +++ b/nostr_dvm/tasks/convert_media.py @@ -89,8 +89,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I convert videos from urls to given output format.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "format": { "required": False, diff --git a/nostr_dvm/tasks/discovery_bot_farms.py b/nostr_dvm/tasks/discovery_bot_farms.py index 8e1a18a..dee05d6 100644 --- a/nostr_dvm/tasks/discovery_bot_farms.py +++ b/nostr_dvm/tasks/discovery_bot_farms.py @@ -165,8 +165,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", "about": "I hunt down bot farms.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "action": "mute", # follow, unfollow, mute, unmute "nip90Params": { "max_results": { diff --git a/nostr_dvm/tasks/discovery_censor_wot.py b/nostr_dvm/tasks/discovery_censor_wot.py index 6c8b69d..9a72fee 100644 --- a/nostr_dvm/tasks/discovery_censor_wot.py +++ b/nostr_dvm/tasks/discovery_censor_wot.py @@ -173,8 +173,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", "about": "I show users that have been reported by either your followers or your Web of Trust. Note: Anyone can report, so you might double check and decide for yourself who to mute. Considers spam, illegal and impersonation reports. Notice: This works with NIP51 mute lists. Not all clients support the new mute list format.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "action": "mute", # follow, unfollow, mute, unmute "nip90Params": { "since_days": { diff --git a/nostr_dvm/tasks/discovery_inactive_follows.py b/nostr_dvm/tasks/discovery_inactive_follows.py index d39aaa4..5a34fb5 100644 --- a/nostr_dvm/tasks/discovery_inactive_follows.py +++ b/nostr_dvm/tasks/discovery_inactive_follows.py @@ -194,8 +194,8 @@ def build_example(name, identifier, admin_config): "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I discover users you follow, but that have been inactive on Nostr", "action": "unfollow", # follow, mute, unmute - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "user": { "required": False, diff --git a/nostr_dvm/tasks/discovery_nonfollowers.py b/nostr_dvm/tasks/discovery_nonfollowers.py index 5b4a80e..c18673c 100644 --- a/nostr_dvm/tasks/discovery_nonfollowers.py +++ b/nostr_dvm/tasks/discovery_nonfollowers.py @@ -197,8 +197,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I discover users you follow, but that don't follow you back.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "user": { "required": False, diff --git a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py index 1127a60..ada5bfc 100644 --- a/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py +++ b/nostr_dvm/tasks/discovery_trending_notes_gleasonator.py @@ -128,8 +128,8 @@ def build_example(name, identifier, admin_config, custom_processing_msg): "picture": "https://image.nostr.build/0c760b3ecdbc993ba47b785d0adecf00c760b3ecdbc993ba47b785d0adecf0ec71fd9c59808e27d0665b9f77a32d8de.png", "about": "I show trending notes from Soapbox Ditto", "amount": "Free", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } nip89config = NIP89Config() diff --git a/nostr_dvm/tasks/discovery_trending_notes_nostrband.py b/nostr_dvm/tasks/discovery_trending_notes_nostrband.py index a767d0f..b0d33dd 100644 --- a/nostr_dvm/tasks/discovery_trending_notes_nostrband.py +++ b/nostr_dvm/tasks/discovery_trending_notes_nostrband.py @@ -120,8 +120,8 @@ def build_example(name, identifier, admin_config, custom_processing_msg): "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I show trending notes from nostr.band", "amount": "Free", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } nip89config = NIP89Config() diff --git a/nostr_dvm/tasks/generic_dvm.py b/nostr_dvm/tasks/generic_dvm.py index 3e272de..be668e4 100644 --- a/nostr_dvm/tasks/generic_dvm.py +++ b/nostr_dvm/tasks/generic_dvm.py @@ -85,8 +85,8 @@ def build_example(name, identifier, admin_config, announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm an all purpose DVM'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/nostr_dvm/tasks/imagegeneration_openai_dalle.py b/nostr_dvm/tasks/imagegeneration_openai_dalle.py index 6c2cef0..ae1c8f1 100644 --- a/nostr_dvm/tasks/imagegeneration_openai_dalle.py +++ b/nostr_dvm/tasks/imagegeneration_openai_dalle.py @@ -135,8 +135,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use OpenAI's DALL·E 3", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "size": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_replicate.py b/nostr_dvm/tasks/imagegeneration_replicate.py index b94bf52..032e27d 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate.py +++ b/nostr_dvm/tasks/imagegeneration_replicate.py @@ -150,8 +150,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion 3", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "ratio": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py b/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py index 4159a0f..6813b58 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_fluxpro.py @@ -145,8 +145,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run FluxPro", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "ratio": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_recraft.py b/nostr_dvm/tasks/imagegeneration_replicate_recraft.py index dfd46db..8ae8b6d 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_recraft.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_recraft.py @@ -143,8 +143,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run Recraft", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "ratio": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py b/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py index 7e8848e..e5936c7 100644 --- a/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_replicate_sdxl.py @@ -129,8 +129,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "size": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_sd21_mlx.py b/nostr_dvm/tasks/imagegeneration_sd21_mlx.py index 449813e..6a2b03a 100644 --- a/nostr_dvm/tasks/imagegeneration_sd21_mlx.py +++ b/nostr_dvm/tasks/imagegeneration_sd21_mlx.py @@ -158,8 +158,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "size": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_sd35_api.py b/nostr_dvm/tasks/imagegeneration_sd35_api.py index 0352bb7..80d87bd 100644 --- a/nostr_dvm/tasks/imagegeneration_sd35_api.py +++ b/nostr_dvm/tasks/imagegeneration_sd35_api.py @@ -266,9 +266,9 @@ def build_example(name, identifier, admin_config, server_address, default_model= "name": name, "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", - "encryptionSupported": True, - "cashuAccepted": True, - "nip90Params": { + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, + "nip90Params":{ "negative_prompt": { "required": False, "values": [] diff --git a/nostr_dvm/tasks/imagegeneration_sdxl.py b/nostr_dvm/tasks/imagegeneration_sdxl.py index c51da2e..0cdfc31 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxl.py +++ b/nostr_dvm/tasks/imagegeneration_sdxl.py @@ -177,8 +177,8 @@ def build_example(name, identifier, admin_config, server_address, default_model= "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I draw images based on a prompt with a Model called unstable diffusion", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "negative_prompt": { "required": False, diff --git a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py index 30d3aef..976b022 100644 --- a/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py +++ b/nostr_dvm/tasks/imagegeneration_sdxlimg2img.py @@ -199,8 +199,8 @@ def build_example(name, identifier, admin_config, server_address, default_lora=" "name": name, "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I convert an image to another image, kinda random for now. ", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "negative_prompt": { "required": False, diff --git a/nostr_dvm/tasks/imageinterrogator.py b/nostr_dvm/tasks/imageinterrogator.py index 314595e..8809de3 100644 --- a/nostr_dvm/tasks/imageinterrogator.py +++ b/nostr_dvm/tasks/imageinterrogator.py @@ -116,8 +116,8 @@ def build_example(name, identifier, admin_config, server_address): "name": name, "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I analyse Images an return a prompt or a prompt analysis", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "method": { "required": False, diff --git a/nostr_dvm/tasks/imageupscale.py b/nostr_dvm/tasks/imageupscale.py index 2676ec2..928c74a 100644 --- a/nostr_dvm/tasks/imageupscale.py +++ b/nostr_dvm/tasks/imageupscale.py @@ -121,8 +121,8 @@ def build_example(name, identifier, admin_config, server_address): "name": name, "picture": "https://image.nostr.build/229c14e440895da30de77b3ca145d66d4b04efb4027ba3c44ca147eecde891f1.jpg", "about": "I upscale an image using realESRGan up to factor 4 (default is factor 4)", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "upscale": { "required": False, diff --git a/nostr_dvm/tasks/people_discovery_mywot.py b/nostr_dvm/tasks/people_discovery_mywot.py index c411881..3f759c4 100644 --- a/nostr_dvm/tasks/people_discovery_mywot.py +++ b/nostr_dvm/tasks/people_discovery_mywot.py @@ -310,8 +310,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -354,8 +354,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/people_discovery_wot.py b/nostr_dvm/tasks/people_discovery_wot.py index 64654f1..6db6baf 100644 --- a/nostr_dvm/tasks/people_discovery_wot.py +++ b/nostr_dvm/tasks/people_discovery_wot.py @@ -314,8 +314,8 @@ def build_example(name, identifier, admin_config, options, cost=0, update_rate=1 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -358,8 +358,8 @@ def build_example_subscription(name, identifier, admin_config, options, update_r "picture": image, "about": "I show notes that are currently popular all over Nostr. I'm also used for testing subscriptions.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "subscription": True, "personalized": False, "nip90Params": { diff --git a/nostr_dvm/tasks/search_users.py b/nostr_dvm/tasks/search_users.py index 11ddd1a..254113c 100644 --- a/nostr_dvm/tasks/search_users.py +++ b/nostr_dvm/tasks/search_users.py @@ -206,8 +206,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/a99ab925084029d9468fef8330ff3d9be2cf67da473b024f2a6d48b5cd77197f.jpg", "about": "I search users.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "users": { "required": False, diff --git a/nostr_dvm/tasks/summarization_duckduck_ai.py b/nostr_dvm/tasks/summarization_duckduck_ai.py index b252b04..71b4524 100644 --- a/nostr_dvm/tasks/summarization_duckduck_ai.py +++ b/nostr_dvm/tasks/summarization_duckduck_ai.py @@ -122,8 +122,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I summarize Text", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/nostr_dvm/tasks/summarization_huggingchat.py b/nostr_dvm/tasks/summarization_huggingchat.py index bd975ce..0230b20 100644 --- a/nostr_dvm/tasks/summarization_huggingchat.py +++ b/nostr_dvm/tasks/summarization_huggingchat.py @@ -127,8 +127,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", "about": "I use a LLM connected via Huggingchat to summarize Inputs", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/nostr_dvm/tasks/summarization_unleashed_chat.py b/nostr_dvm/tasks/summarization_unleashed_chat.py index 2d683b5..8f91518 100644 --- a/nostr_dvm/tasks/summarization_unleashed_chat.py +++ b/nostr_dvm/tasks/summarization_unleashed_chat.py @@ -151,8 +151,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I summarize Text with https://unleashed.chat", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } diff --git a/nostr_dvm/tasks/textextraction_google.py b/nostr_dvm/tasks/textextraction_google.py index 9e42a07..88fe666 100644 --- a/nostr_dvm/tasks/textextraction_google.py +++ b/nostr_dvm/tasks/textextraction_google.py @@ -139,8 +139,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from media files with the Google API. I understand English by default", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "language": { "required": False, diff --git a/nostr_dvm/tasks/textextraction_pdf.py b/nostr_dvm/tasks/textextraction_pdf.py index 94bb0db..24ed3b6 100644 --- a/nostr_dvm/tasks/textextraction_pdf.py +++ b/nostr_dvm/tasks/textextraction_pdf.py @@ -102,8 +102,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from pdf documents. I only support Latin letters", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } diff --git a/nostr_dvm/tasks/textextraction_whisperx.py b/nostr_dvm/tasks/textextraction_whisperx.py index 570edac..6c58abb 100644 --- a/nostr_dvm/tasks/textextraction_whisperx.py +++ b/nostr_dvm/tasks/textextraction_whisperx.py @@ -163,8 +163,8 @@ def build_example(name, identifier, admin_config, server_address): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I extract text from media files with WhisperX", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "model": { "required": False, diff --git a/nostr_dvm/tasks/textgeneration_huggingchat.py b/nostr_dvm/tasks/textgeneration_huggingchat.py index 01ae75c..bdf2239 100644 --- a/nostr_dvm/tasks/textgeneration_huggingchat.py +++ b/nostr_dvm/tasks/textgeneration_huggingchat.py @@ -92,8 +92,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/720eadc9af89084bb09de659af43ad17fec1f4b0887084e83ac0ae708dfa83a6.png", "about": "I use a LLM connected via Huggingchat", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/nostr_dvm/tasks/textgeneration_llmlite.py b/nostr_dvm/tasks/textgeneration_llmlite.py index decf908..0cb3bb0 100644 --- a/nostr_dvm/tasks/textgeneration_llmlite.py +++ b/nostr_dvm/tasks/textgeneration_llmlite.py @@ -107,8 +107,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use a LLM connected via OLLAMA", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/nostr_dvm/tasks/textgeneration_unleashed_chat.py b/nostr_dvm/tasks/textgeneration_unleashed_chat.py index 14ece25..b139d8f 100644 --- a/nostr_dvm/tasks/textgeneration_unleashed_chat.py +++ b/nostr_dvm/tasks/textgeneration_unleashed_chat.py @@ -115,8 +115,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://unleashed.chat/_app/immutable/assets/hero.pehsu4x_.jpeg", "about": "I generate Text with Unleashed.chat", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } diff --git a/nostr_dvm/tasks/texttospeech.py b/nostr_dvm/tasks/texttospeech.py index 0d9c6e5..29c838f 100644 --- a/nostr_dvm/tasks/texttospeech.py +++ b/nostr_dvm/tasks/texttospeech.py @@ -177,8 +177,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "language": { "required": False, diff --git a/nostr_dvm/tasks/translation_google.py b/nostr_dvm/tasks/translation_google.py index 91398bc..63c016b 100644 --- a/nostr_dvm/tasks/translation_google.py +++ b/nostr_dvm/tasks/translation_google.py @@ -121,8 +121,8 @@ def build_example(name, identifier, admin_config): "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I translate text from given text/event/job. Currently using Google TranslationGoogle Services to translate " "input into the language defined in params.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "language": { "required": False, diff --git a/nostr_dvm/tasks/translation_libretranslate.py b/nostr_dvm/tasks/translation_libretranslate.py index fad1a98..ace5b74 100644 --- a/nostr_dvm/tasks/translation_libretranslate.py +++ b/nostr_dvm/tasks/translation_libretranslate.py @@ -119,8 +119,8 @@ def build_example(name, identifier, admin_config): "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I translate text from given text/event/job using LibreTranslate Services to translate " "input into the language defined in params.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "language": { "required": False, diff --git a/nostr_dvm/tasks/videogeneration_replicate_svd.py b/nostr_dvm/tasks/videogeneration_replicate_svd.py index 2a4162f..f4a7ef2 100644 --- a/nostr_dvm/tasks/videogeneration_replicate_svd.py +++ b/nostr_dvm/tasks/videogeneration_replicate_svd.py @@ -122,8 +122,8 @@ def build_example(name, identifier, admin_config): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Replicate to run StableDiffusion XL", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } diff --git a/nostr_dvm/tasks/videogeneration_svd.py b/nostr_dvm/tasks/videogeneration_svd.py index c8d68af..ba40f9d 100644 --- a/nostr_dvm/tasks/videogeneration_svd.py +++ b/nostr_dvm/tasks/videogeneration_svd.py @@ -110,8 +110,8 @@ def build_example(name, identifier, admin_config, server_address): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I create a short video based on an image", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } nip89config = NIP89Config() diff --git a/nostr_dvm/utils/database_utils.py b/nostr_dvm/utils/database_utils.py index ae96b79..9ef2c6b 100644 --- a/nostr_dvm/utils/database_utils.py +++ b/nostr_dvm/utils/database_utils.py @@ -5,7 +5,7 @@ from logging import Filter from sqlite3 import Error -from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind, make_private_msg +from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind, make_private_msg, NostrSigner from nostr_dvm.utils.definitions import relay_timeout from nostr_dvm.utils.nostr_utils import send_nip04_dm @@ -192,8 +192,7 @@ async def update_user_balance(db, npub, additional_sats, client, config, giftwra # always send giftwrapped. sorry not sorry. #if giftwrap: - event = await make_private_msg(keys, PublicKey.parse(npub), message, - None) + event = await make_private_msg(NostrSigner.keys(keys), PublicKey.parse(npub), message) await client.send_event(event) #else: # await send_nip04_dm(client, message, PublicKey.parse(npub), config) diff --git a/nostr_dvm/utils/external_dvm_utils.py b/nostr_dvm/utils/external_dvm_utils.py index 60e6a73..0f8c106 100644 --- a/nostr_dvm/utils/external_dvm_utils.py +++ b/nostr_dvm/utils/external_dvm_utils.py @@ -52,18 +52,18 @@ def build_external_dvm(pubkey, task, kind, fix_cost, per_unit_cost, config, about = nip89content.get("about") if nip89content.get("nip90Params"): nip90params = nip89content["nip90Params"] - if nip89content.get("encryptionSupported"): - encryption_supported = nip89content["encryptionSupported"] - if nip89content.get("cashuAccepted"): - cashu_accepted = nip89content["cashuAccepted"] + if nip89content.get("supportsEncryption"): + encryption_supported = nip89content["supportsEncryption"] + if nip89content.get("acceptsNutZaps"): + cashu_accepted = nip89content["acceptsNutZaps"] else: print("No NIP89 set for " + name) nip89info = { "name": name, "picture": image, "about": about, - "encryptionSupported": encryption_supported, - "cashuAccepted": cashu_accepted, + "supportsEncryption": encryption_supported, + "acceptsNutZaps": cashu_accepted, "nip90Params": nip90params } nip89config = NIP89Config() diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 9010d75..72f52d8 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -5,7 +5,7 @@ from typing import List import dotenv -from nostr_sdk import Filter, Client, Alphabet, EventId, Event, PublicKey, Tag, Keys, nip04_decrypt, Metadata, Options, \ +from nostr_sdk import Filter, Client, Alphabet, EventId, Event, PublicKey, Tag, Keys, nip04_decrypt, nip44_decrypt, Metadata, Options, \ Nip19Event, SingleLetterTag, RelayLimits, SecretKey, Connection, ConnectionTarget, \ EventBuilder, Kind, ClientBuilder, SendEventOutput, NostrSigner @@ -295,9 +295,10 @@ async def send_event(event: Event, client: Client, dvm_config): def check_and_decrypt_tags(event, dvm_config): - try: + is_encrypted = False + use_legacy_encryption = False - is_encrypted = False + try: p = "" for tag in event.tags().to_vec(): if tag.as_vec()[0] == 'encrypted': @@ -309,11 +310,21 @@ def check_and_decrypt_tags(event, dvm_config): if p != dvm_config.PUBLIC_KEY: print("[" + dvm_config.NIP89.NAME + "] Task encrypted and not addressed to this DVM, " "skipping..") - return None + return None, False elif p == dvm_config.PUBLIC_KEY: - tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), - event.author(), event.content()) + try: + tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + event.author(), event.content()) + except: + try: + tags_str = nip44_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + event.author(), event.content()) + except: + print("Wrong Nip44 Format") + return None, False + use_legacy_encryption = True + params = json.loads(tags_str) params.append(Tag.parse(["p", p]).as_vec()) params.append(Tag.parse(["encrypted"]).as_vec()) @@ -324,7 +335,7 @@ def check_and_decrypt_tags(event, dvm_config): except Exception as e: print(e) - return event + return event, use_legacy_encryption def check_and_decrypt_own_tags(event, dvm_config): @@ -344,8 +355,12 @@ def check_and_decrypt_own_tags(event, dvm_config): return None elif event.author().to_hex() == dvm_config.PUBLIC_KEY: - tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), - PublicKey.from_hex(p), event.content()) + try: + tags_str = nip44_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + PublicKey.from_hex(p), event.content()) + except: + tags_str = nip04_decrypt(Keys.parse(dvm_config.PRIVATE_KEY).secret_key(), + PublicKey.from_hex(p), event.content()) params = json.loads(tags_str) params.append(Tag.parse(["p", p]).as_vec()) params.append(Tag.parse(["encrypted"]).as_vec()) diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index 44e15d0..7ba0497 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -82,7 +82,10 @@ "wss://onchain.pub", "wss://relay.nostr.info", "wss://relay.chicagoplebs.com", "wss://relay.current.fyi", "wss://relay.stemstr.app", "wss://nostr.zenon.info", "ws://localhost:7777", "wss://nostr.fmt.wiz.biz", "wss://nostrich.friendship.tw", - "wss://public.relaying.io", "wss://relay.me3d.app", + "wss://public.relaying.io", "wss://relay.me3d.app", "wss://dreamofthe90s.nostr1.com", + "wss://lnbits.eldamar.icu/nostrrelay/relay", "wss://nostr.olwe.link", + "wss://nostr.cheeserobot.org", + diff --git a/tests/chat_bot.py b/tests/chat_bot.py index f7c2b22..2f2d812 100644 --- a/tests/chat_bot.py +++ b/tests/chat_bot.py @@ -49,8 +49,8 @@ def playground(announce = False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm briding DuckDuckAI'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/tests/dalle.py b/tests/dalle.py index a29869c..6ff8901 100644 --- a/tests/dalle.py +++ b/tests/dalle.py @@ -37,8 +37,8 @@ def build_dalle(name, identifier): "name": name, "picture": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", "about": "I create Images bridging OpenAI's DALL·E 3", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "size": { "required": False, diff --git a/tests/discovery.py b/tests/discovery.py index 6bb3c80..f9670e4 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -78,8 +78,8 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -120,8 +120,8 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { @@ -157,8 +157,8 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom "picture": image, "about": about, "amount": "Free", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } nip89config = NIP89Config() @@ -196,8 +196,8 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -248,8 +248,8 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, "picture": image, "about": "I show the latest wikifreedia entries.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -296,8 +296,8 @@ def build_example_topic(name, identifier, admin_config, options, image, descript "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -338,8 +338,8 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -381,8 +381,8 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { @@ -430,8 +430,8 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, "picture": image, "about": "I show notes that are currently popular from people you do not follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": False, "personalized": True, "amount": create_amount_tag(cost), @@ -496,8 +496,8 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -544,8 +544,8 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, "picture": image, "about": "I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -586,8 +586,8 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_custom_feed.py b/tests/discovery_custom_feed.py index ec1864d..bb3dda6 100644 --- a/tests/discovery_custom_feed.py +++ b/tests/discovery_custom_feed.py @@ -49,8 +49,8 @@ def build_example_topic(name, identifier, admin_config, options, image, descript "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_gallery.py b/tests/discovery_gallery.py index 49119c5..9396909 100644 --- a/tests/discovery_gallery.py +++ b/tests/discovery_gallery.py @@ -40,8 +40,8 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_mostr.py b/tests/discovery_mostr.py index af93f9c..3057395 100644 --- a/tests/discovery_mostr.py +++ b/tests/discovery_mostr.py @@ -54,8 +54,8 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, "picture": image, "about": "I show popular notes from Mostr.pub and Momostr.pink", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_one_per_follow.py b/tests/discovery_one_per_follow.py index 5b2dece..6b0c312 100644 --- a/tests/discovery_one_per_follow.py +++ b/tests/discovery_one_per_follow.py @@ -43,8 +43,8 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_people.py b/tests/discovery_people.py index f94db9f..e3adf27 100644 --- a/tests/discovery_people.py +++ b/tests/discovery_people.py @@ -48,8 +48,8 @@ def build_example_wot(name, identifier, admin_config, options, image, cost=0, up "picture": image, "about": "I show people to follow from your WOT", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/discovery_test.py b/tests/discovery_test.py index cadd7f5..7aea172 100644 --- a/tests/discovery_test.py +++ b/tests/discovery_test.py @@ -75,8 +75,8 @@ def build_db_scheduler(name, identifier, admin_config, options, image, descripti "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -117,8 +117,8 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0 "picture": image, "about": "I show popular gallery entries", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { @@ -153,8 +153,8 @@ def build_example_nostrband(name, identifier, admin_config, image, about, custom "picture": image, "about": about, "amount": "Free", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } nip89config = NIP89Config() @@ -191,8 +191,8 @@ def build_longform(name, identifier, admin_config, options, cost=0, update_rate= "picture": image, "about": "I show the latest longform notes.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -242,8 +242,8 @@ def build_wiki(name, identifier, admin_config, options, cost=0, update_rate=180, "picture": image, "about": "I show the latest wikifreedia entries.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -287,8 +287,8 @@ def build_example_topic(name, identifier, admin_config, options, image, descript "picture": image, "about": description, "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -328,8 +328,8 @@ def build_example_popular(name, identifier, admin_config, options, image, cost=0 "picture": image, "about": "I show notes that are currently popular", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -368,8 +368,8 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima "picture": image, "about": "I show notes that are currently popular from people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": True, "amount": create_amount_tag(cost), "nip90Params": { @@ -416,8 +416,8 @@ def build_example_popular_non_followers(name, identifier, admin_config, options, "picture": image, "about": "I show notes that are currently popular from people you do not follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "subscription": True, "personalized": False, "nip90Params": { @@ -478,8 +478,8 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos "picture": image, "about": "I show notes that are currently zapped the most.", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -525,8 +525,8 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, "picture": image, "about": "I show notes from Mostr.pub and Momostr.pink that are currently popular on Nostr", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { @@ -565,8 +565,8 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c "picture": image, "about": "I show the single latest note of people you follow", "lud16": dvm_config.LN_ADDRESS, - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "personalized": False, "amount": create_amount_tag(cost), "nip90Params": { diff --git a/tests/generic_dvm.py b/tests/generic_dvm.py index 5ef2d93..1b8d481 100644 --- a/tests/generic_dvm.py +++ b/tests/generic_dvm.py @@ -26,8 +26,8 @@ def playground(announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm an all purpose DVM'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/tests/generic_dvm_autotopic_feed.py b/tests/generic_dvm_autotopic_feed.py index ed00723..ee8d6fd 100644 --- a/tests/generic_dvm_autotopic_feed.py +++ b/tests/generic_dvm_autotopic_feed.py @@ -81,8 +81,8 @@ def playground(announce=False): "name": name, "picture": "https://i.nostr.build/I8fJo0n355cbNEbS.png", # "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I create a personalized feed based on topics you were writing about recently", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/tests/generic_dvm_duck_chat.py b/tests/generic_dvm_duck_chat.py index 491c92e..dbb4c13 100644 --- a/tests/generic_dvm_duck_chat.py +++ b/tests/generic_dvm_duck_chat.py @@ -46,8 +46,8 @@ def playground(announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm briding DuckDuckAI'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/tests/generic_dvm_flux_hf.py b/tests/generic_dvm_flux_hf.py index 9b71e4f..8fed4d9 100644 --- a/tests/generic_dvm_flux_hf.py +++ b/tests/generic_dvm_flux_hf.py @@ -51,8 +51,8 @@ def playground(announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I produce images with Flux-Schnell'", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { } } diff --git a/tests/otherstuff.py b/tests/otherstuff.py index 3cb9bfb..ae140b2 100644 --- a/tests/otherstuff.py +++ b/tests/otherstuff.py @@ -60,8 +60,8 @@ def build_sd35(name, identifier, announce): "name": name, "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "negative_prompt": { "required": False, @@ -109,8 +109,8 @@ def build_dalle(name, identifier, announce): "name": name, "picture": "https://image.nostr.build/22f2267ca9d4ee9d5e8a0c7818a9fa325bbbcdac5573a60a2d163e699bb69923.jpg", "about": "I create Images bridging OpenAI's DALL·E 3", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "size": { "required": False, @@ -145,8 +145,8 @@ def build_svd(name, identifier, announce): "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I use Stable Video Diffusion to create short videos", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": {} } @@ -172,8 +172,8 @@ def build_media_converter(name, identifier, announce): "name": name, "picture": "https://cdn.nostr.build/i/a177be1159da5aad8396a1188f686728d55647d3a7371549584daf2b5e50eec9.jpg", "about": "I convert videos from urls to given output format.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "media_format": { "required": False, @@ -207,7 +207,7 @@ def build_inactive_follows_finder(name, identifier, announce): "picture": "https://image.nostr.build/50621bbf8082c478bc06a06684e1c443b5d37f1362ad56d679cab7328e0481db.jpg", "about": "I discover npubs you follow, but that have been inactive on Nostr for the last 90 days", "action": "unfollow", - "cashuAccepted": True, + "acceptsNutZaps": False, "nip90Params": { "user": { "required": False, @@ -246,8 +246,8 @@ def build_1984(name, identifier, announce): "name": name, "picture": "https://image.nostr.build/19872a2edd866258fa9eab137631efda89310d52b2c6ea8f99ef057325aa1c7b.jpg", "about": "I show users that have been reported by either your followers or your Web of Trust. Note: Anyone can report, so you might double check and decide for yourself who to mute. Considers spam, illegal and impersonation reports. Notice: This works with NIP51 mute lists. Not all clients support the new mute list format.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "action": "mute", # follow, unfollow, mute, unmute "nip90Params": { "since_days": { @@ -281,8 +281,8 @@ def build_botfarms(name, identifier, announce): "name": name, "picture": "https://image.nostr.build/981b560820bc283c58de7989b7abc6664996b487a531d852e4ef7322586a2122.jpg", "about": "I hunt down bot farms.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "action": "mute", # follow, unfollow, mute, unmute "nip90Params": { "max_results": { @@ -319,8 +319,8 @@ def build_replicate(name, identifier, model, announce): "name": name, "picture": "https://i.nostr.build/qnoBIN4jSkfF8IHk.png", "about": "I use Replicate to run StableDiffusion XL", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "size": { "required": False, @@ -356,8 +356,8 @@ def build_replicate_recraft(name, identifier, announce): "name": name, "picture": "https://i.nostr.build/jSbrXvYglXCzSeAc.jpg", "about": "I use Replicate to run Recraft v3", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "size": { "required": False, @@ -391,8 +391,8 @@ def build_replicate_fluxpro(name, identifier, announce): "name": name, "picture": "https://i.nostr.build/AQTujqzVmLxLmG16.jpg", "about": "I use Replicate to FluxPro 1.1.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": False, "nip90Params": { "size": { "required": False, diff --git a/tests/sd35_api.py b/tests/sd35_api.py index 5d69151..257afb1 100644 --- a/tests/sd35_api.py +++ b/tests/sd35_api.py @@ -35,8 +35,8 @@ def build_sd35(name, identifier): "name": name, "picture": "https://i.nostr.build/NOXcCIPmOZrDTK35.jpg", "about": "I draw images using Stable diffusion ultra", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "negative_prompt": { "required": False, diff --git a/tests/search.py b/tests/search.py index 4868967..2cb264f 100644 --- a/tests/search.py +++ b/tests/search.py @@ -52,6 +52,7 @@ def build_advanced_search(name, identifier): dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST + admin_config = AdminConfig() admin_config.REBROADCAST_NIP89 = rebroadcast_NIP89 admin_config.REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List @@ -63,8 +64,8 @@ def build_advanced_search(name, identifier): "name": name, "picture": "https://nostr.band/android-chrome-192x192.png", "about": "I search notes on nostr.band", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "users": { "required": False, @@ -119,8 +120,8 @@ def build_advanced_search_wine(name, identifier): "name": name, "picture": "https://image.nostr.build/d844d6a963724b9f9deb6b3326984fd95352343336718812424d5e99d93a6f2d.jpg", "about": "I search notes on nostr.wine using the nostr-wine API", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "users": { "required": False, @@ -175,8 +176,8 @@ def build_user_search(name, identifier): "name": name, "picture": "https://image.nostr.build/bd0181a3089181f1d92a5da1ef85cffbe37ba80fbcc695b9d85648dc2fa92583.jpg", "about": "I search users based on their profile info.", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "max_results": { "required": False, @@ -206,8 +207,8 @@ def playground(): advanced_search_wine = build_advanced_search_wine("Nostr.wine Search", "discovery_content_searchwine") advanced_search_wine.run() - profile_search = build_user_search("Profile Searcher", "profile_search") - profile_search.run() + #profile_search = build_user_search("Profile Searcher", "profile_search") + #profile_search.run() diff --git a/tests/simplebot.py b/tests/simplebot.py index edcd7ab..3e020d1 100644 --- a/tests/simplebot.py +++ b/tests/simplebot.py @@ -50,7 +50,7 @@ async def handle(self, relay_url, subscription_id, event: Event): print("Decrypting NIP59 event") try: # Extract rumor - unwrapped_gift = UnwrappedGift.from_gift_wrap(keys, event) + unwrapped_gift = UnwrappedGift.from_gift_wrap(NostrSigner(keys), event) sender = unwrapped_gift.sender() rumor: UnsignedEvent = unwrapped_gift.rumor() diff --git a/tests/summarization_duck.py b/tests/summarization_duck.py index 674ce79..7f74233 100644 --- a/tests/summarization_duck.py +++ b/tests/summarization_duck.py @@ -24,8 +24,8 @@ def playground(announce=False): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I summarize Text", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": {} } diff --git a/tests/test_dvm_client.py b/tests/test_dvm_client.py index 3b707ee..c6c09e0 100644 --- a/tests/test_dvm_client.py +++ b/tests/test_dvm_client.py @@ -7,7 +7,7 @@ import dotenv from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, HandleNotification, Timestamp, nip04_decrypt, \ - nip04_encrypt, NostrSigner, Event, Kind, RelayOptions + nip44_encrypt, Nip44Version, NostrSigner, Event, Kind, RelayOptions from nostr_dvm.utils.dvmconfig import DVMConfig from nostr_dvm.utils.nostr_utils import send_event, check_and_set_private_key @@ -377,8 +377,8 @@ async def nostr_client_test_image_private(prompt, cashutoken): encrypted_params_string = json.dumps([i_tag.as_vec(), outTag.as_vec(), paramTag1.as_vec(), bid_tag.as_vec(), relays_tag.as_vec(), alt_tag.as_vec(), cashu_tag.as_vec()]) - encrypted_params = nip04_encrypt(keys.secret_key(), receiver_keys.public_key(), - encrypted_params_string) + encrypted_params = nip44_encrypt(keys.secret_key(), receiver_keys.public_key(), + encrypted_params_string, Nip44Version.V2) encrypted_tag = Tag.parse(['encrypted']) nip90request = EventBuilder(EventDefinitions.KIND_NIP90_GENERATE_IMAGE, encrypted_params).tags( diff --git a/tests/tts.py b/tests/tts.py index 59c5259..83bb929 100644 --- a/tests/tts.py +++ b/tests/tts.py @@ -34,8 +34,8 @@ "name": name, "picture": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "about": "I Generate Speech from Text", - "encryptionSupported": True, - "cashuAccepted": True, + "supportsEncryption": True, + "acceptsNutZaps": dvm_config.ENABLE_NUTZAP, "nip90Params": { "language": { "required": False, diff --git a/tutorials/05_announce_dvm.py b/tutorials/05_announce_dvm.py index 18eebf0..d647956 100644 --- a/tutorials/05_announce_dvm.py +++ b/tutorials/05_announce_dvm.py @@ -55,7 +55,7 @@ def run_dvm(identifier, announce): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm a very simply DVM that always responds with the same message.", - "encryptionSupported": True, + "supportsEncryption": True, "nip90Params": { "some_option": { "required": False, diff --git a/tutorials/06_dvm_config.py b/tutorials/06_dvm_config.py index cf61845..21549ba 100644 --- a/tutorials/06_dvm_config.py +++ b/tutorials/06_dvm_config.py @@ -119,7 +119,7 @@ def run_dvm(identifier, announce): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm a very simply DVM that always responds with the same message.", - "encryptionSupported": True, + "supportsEncryption": True, "nip90Params": { "some_option": { "required": False, diff --git a/tutorials/07_admin_config.py b/tutorials/07_admin_config.py index eff01ba..fb6571a 100644 --- a/tutorials/07_admin_config.py +++ b/tutorials/07_admin_config.py @@ -94,7 +94,7 @@ def run_dvm(identifier, announce): "name": name, "picture": "https://image.nostr.build/28da676a19841dcfa7dcf7124be6816842d14b84f6046462d2a3f1268fe58d03.png", "about": "I'm a very simply DVM that always responds with the same message.", - "encryptionSupported": True, + "supportsEncryption": True, "nip90Params": { "some_option": { "required": False, diff --git a/ui/noogle/src/components/ChatGeneration.vue b/ui/noogle/src/components/ChatGeneration.vue index 73e5643..82da529 100644 --- a/ui/noogle/src/components/ChatGeneration.vue +++ b/ui/noogle/src/components/ChatGeneration.vue @@ -181,7 +181,7 @@ async function listen() { if (JSON.parse(el.event).pubkey === event.author.toHex().toString() && el.kind === "5050") { jsonentry.name = el.name jsonentry.about = el.about - jsonentry.image = el.image + jsonentry.picture = el.picture jsonentry.nip90Params = el.nip90Params //jsonentry.reactions = await dvmreactions(PublicKey.parse(el.id), store.state.followings) //jsonentry.reactions.negativeUser = false diff --git a/ui/noogle/src/components/FilterGeneration.vue b/ui/noogle/src/components/FilterGeneration.vue index 3cb520b..a53c364 100644 --- a/ui/noogle/src/components/FilterGeneration.vue +++ b/ui/noogle/src/components/FilterGeneration.vue @@ -67,7 +67,6 @@ async function generate_feed(id) { try { let client = store.state.client - //console.log(dvms.find(i => i.id === id).encryptionSupported) let current_dvm = dvms.find(i => i.id === id) @@ -85,7 +84,7 @@ async function generate_feed(id) { let requestid; // for now we only want to use encrypted events for subscribed dvms (might change later, also we dont encrypt on amber because decryption and update doesnt work) - if (current_dvm.encryptionSupported && current_dvm.nip88 && current_dvm.nip88.hasActiveSubscription && localStorage.getItem('nostr-key-method') !== 'android-signer' && localStorage.getItem('nostr-key-method') !== 'nostr-login') { + if (current_dvm.supportsEncryption && current_dvm.nip88 && current_dvm.nip88.hasActiveSubscription && localStorage.getItem('nostr-key-method') !== 'android-signer' && localStorage.getItem('nostr-key-method') !== 'nostr-login') { let tags_str = [] for (let tag of tags) { @@ -101,7 +100,7 @@ async function generate_feed(id) { let pk = PublicKey.parse(id) - let content = await signer.nip04Encrypt(pk, params_as_str) + let content = await signer.nip44Encrypt(pk, params_as_str) let tags_t = [] tags_t.push(Tag.parse(["p", id])) @@ -150,7 +149,7 @@ async function listen() { let client = store.state.client let pubkey = store.state.pubkey - const filter = new Filter().kinds([7000, 6301]).pubkey(pubkey).since(Timestamp.now()); + const filter = new Filter().kinds([Kind(7000), Kind(6301)]).pubkey(pubkey).since(Timestamp.now()); await client.subscribe([filter]); const handle = { @@ -197,7 +196,7 @@ async function listen() { return // tags_str = await amberSignerService.nip04Decrypt(event.author.toHex(), event.content) } else { - tags_str = await signer.nip04Decrypt(event.author, event.content) + tags_str = await signer.nip44Decrypt(event.author, event.content) } @@ -301,7 +300,7 @@ async function listen() { if (is_encrypted) { if (ptag === store.state.pubkey.toHex()) { let signer = store.state.signer - content = await signer.nip04Decrypt(event.author, event.content) + content = await signer.nip44Decrypt(event.author, event.content) } else { console.log("not addressed to us") @@ -465,7 +464,7 @@ async function addAllContentDVMs() { console.log(active_dvms) - const filtera = new Filter().authors(relevant_dvms).kinds([6301, 7000]) + const filtera = new Filter().authors(relevant_dvms).kinds([Kind(6301), Kind(7000)]) let client = store.state.client let activities = await client.getEventsOf([filtera], Duration.fromSecs(1)) @@ -503,8 +502,8 @@ async function addAllContentDVMs() { about: el.about, image: el.image, amount: el.amount, - encryptionSupported: el.encryptionSupported, - cashuAccepted: el.cashuAccepted, + supportsEncryption: el.supportsEncryption, + acceptsNutZaps: el.acceptsNutZaps, bolt11: "", lud16: el.lud16, subscription: "", @@ -538,8 +537,8 @@ async function addDVM(event) { bolt11: "", lud16: "", subscription: "", - encryptionSupported: false, - cashuAccepted: false + supportsEncryption: false, + acceptsNutZaps: false } for (const tag in event.tags) { @@ -584,8 +583,8 @@ async function addDVM(event) { jsonentry.about = el.about jsonentry.image = el.image jsonentry.lud16 = el.lud16 - jsonentry.encryptionSupported = el.encryptionSupported - jsonentry.cashuAccepted = el.cashuAccepted + jsonentry.supportsEncryption = el.supportsEncryption + jsonentry.acceptsNutZaps = el.acceptsNutZaps jsonentry.action = el.action console.log(jsonentry) @@ -713,7 +712,7 @@ async function subscribe_to_dvm() { try { - let msg = await (await nclient.signer()).nip04Encrypt(nwcdvm, tags_as_str) + let msg = await (await nclient.signer()).nip44Encrypt(nwcdvm, tags_as_str) let tags_t = [] tags_t.push(Tag.parse(["p", store.state.subscription_verifier_pubkey])) tags_t.push(Tag.parse(["encrypted"])) @@ -789,7 +788,7 @@ async function mute_all(results) { try { let eventasjson = JSON.parse(list.asJson()) - let content = await (await signer).nip04Decrypt(store.state.pubkey, list.content) + let content = await (await signer).nip44Decrypt(store.state.pubkey, list.content) let jsonObject = JSON.parse(content) console.log(content) @@ -817,7 +816,7 @@ async function mute_all(results) { let newcontent = JSON.stringify(jsonObject) console.log(newcontent) let lol = "[]" - eventasjson.content = await (await signer).nip04Encrypt(store.state.pubkey, newcontent) + eventasjson.content = await (await signer).nip44Encrypt(store.state.pubkey, newcontent) let newList = new EventBuilder(list.kind, eventasjson.content, list.tags).toUnsignedEvent(store.state.pubkey) try { @@ -841,7 +840,7 @@ async function mute_all(results) { let newcontent = JSON.stringify(jsonObject) - let content = await (await signer).nip04Encrypt(store.state.pubkey, newcontent) + let content = await (await signer).nip44Encrypt(store.state.pubkey, newcontent) let tags = [] let newList = new EventBuilder(10000, content, tags).toUnsignedEvent(store.state.pubkey) try { @@ -873,7 +872,7 @@ async function mute(result) { try { // console.log(list.content) let signer = await store.state.signer - content = await signer.nip04Decrypt(store.state.pubkey, list.content) + content = await signer.nip44Decrypt(store.state.pubkey, list.content) // console.log(content) } catch (error) { @@ -895,7 +894,7 @@ async function mute(result) { store.state.mutes.push(result.authorid) let newcontent = JSON.stringify(jsonObject) console.log(newcontent) - eventasjson.content = await store.state.signer.nip04Encrypt(store.state.pubkey, newcontent) + eventasjson.content = await store.state.signer.nip44Encrypt(store.state.pubkey, newcontent) let newList = new EventBuilder(list.kind, eventasjson.content, list.tags).toUnsignedEvent(store.state.pubkey) //console.log(signedMuteList.asJson()) try { @@ -924,7 +923,7 @@ async function mute(result) { let newcontent = JSON.stringify(jsonObject) - let content = await (await signer).nip04Encrypt(store.state.pubkey, newcontent) + let content = await (await signer).nip44Encrypt(store.state.pubkey, newcontent) let tags = [] let newList = new EventBuilder(10000, content, tags).toUnsignedEvent(store.state.pubkey) try { @@ -1301,7 +1300,7 @@ const submitHandler = async () => {
-

{{ dvm.name }}

-
DVM Picture +
DVM Picture
diff --git a/ui/noogle/src/components/SummarizationGeneration.vue b/ui/noogle/src/components/SummarizationGeneration.vue index 56b0940..e1a512d 100644 --- a/ui/noogle/src/components/SummarizationGeneration.vue +++ b/ui/noogle/src/components/SummarizationGeneration.vue @@ -170,7 +170,7 @@ async function listen() { if (JSON.parse(el.event).pubkey === event.author.toHex().toString()) { jsonentry.name = el.name jsonentry.about = el.about - jsonentry.image = el.image + jsonentry.picture = el.picture console.log(jsonentry) From 74fd47cb743bd05a683c1f6702dd7c05b88f68a4 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:09:12 +0100 Subject: [PATCH 23/26] fix subscription with latest sdk --- nostr_dvm/bot.py | 2 +- nostr_dvm/subscription.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nostr_dvm/bot.py b/nostr_dvm/bot.py index c1a4917..518da3f 100644 --- a/nostr_dvm/bot.py +++ b/nostr_dvm/bot.py @@ -265,7 +265,7 @@ async def handle_dm(nostr_event, giftwrap): "100 sats (or any other amount) " "to top up your balance") if giftwrap: - event = await make_private_msg(NostrSigner.keys(self.keys), PublicKey.parse(sender), message) + event = await make_private_msg(self.signer, PublicKey.parse(sender), message) await self.client.send_event(event) else: await send_nip04_dm(self.client, message, PublicKey.parse(sender), self.dvm_config) diff --git a/nostr_dvm/subscription.py b/nostr_dvm/subscription.py index 3cc8ed8..01b7707 100644 --- a/nostr_dvm/subscription.py +++ b/nostr_dvm/subscription.py @@ -353,8 +353,7 @@ async def handle_nwc_request(nostr_event): Timestamp.from_secs(end).to_human_datetime().replace("Z", " ").replace("T", " ") + " GMT")) - event = await make_private_msg(self.keys, PublicKey.parse(subscriber), message, - None) + event = await make_private_msg(NostrSigner.keys(self.keys), PublicKey.parse(subscriber), message) await self.client.send_event(event) @@ -414,8 +413,7 @@ async def handle_subscription_renewal(subscription): Timestamp.from_secs(end).to_human_datetime().replace("Z", " ").replace("T", " "))) # await self.client.send_direct_msg(PublicKey.parse(subscription.subscriber), message, None) - event = await make_private_msg(self.keys, PublicKey.parse(subscription.subscriber), message, - None) + event = await make_private_msg(NostrSigner.keys(self.keys), PublicKey.parse(subscription.subscriber), message) await self.client.send_event(event) async def check_subscriptions(): From 184d809603e07a3f2f44fcfae5490d893de810a2 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:15:41 +0100 Subject: [PATCH 24/26] remove print --- nostr_dvm/dvm.py | 2 +- tests/search.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 1ec639b..d239c78 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -635,7 +635,7 @@ async def send_nostr_reply_event(content, original_event_as_str): reply_event = EventBuilder(Kind(original_event.kind().as_u16() + 1000), str(content)).tags(reply_tags).sign_with_keys( self.keys) - print(reply_event) + #print(reply_event) # send_event(reply_event, client=self.client, dvm_config=self.dvm_config) await send_event_outbox(reply_event, client=self.client, dvm_config=self.dvm_config) if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: diff --git a/tests/search.py b/tests/search.py index 2cb264f..07e5629 100644 --- a/tests/search.py +++ b/tests/search.py @@ -207,8 +207,8 @@ def playground(): advanced_search_wine = build_advanced_search_wine("Nostr.wine Search", "discovery_content_searchwine") advanced_search_wine.run() - #profile_search = build_user_search("Profile Searcher", "profile_search") - #profile_search.run() + profile_search = build_user_search("Profile Searcher", "profile_search") + profile_search.run() From 8099df69dce4996c01a0fcad54620307629168d0 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:52:41 +0100 Subject: [PATCH 25/26] delete db if over certain limit on startup --- .../content_discovery_currently_popular.py | 2 ++ .../tasks/content_discovery_update_db_only.py | 7 ++++- nostr_dvm/utils/database_utils.py | 30 ++++++++++++++++++- tests/discovery.py | 15 +++++----- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index d939c90..c69bd37 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -9,6 +9,7 @@ from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils import definitions from nostr_dvm.utils.admin_utils import AdminConfig +from nostr_dvm.utils.database_utils import init_db from nostr_dvm.utils.definitions import EventDefinitions from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88 @@ -171,6 +172,7 @@ async def sync_db(self): try: sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) + database = NostrDatabase.lmdb(self.db_name) cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(database).build() diff --git a/nostr_dvm/tasks/content_discovery_update_db_only.py b/nostr_dvm/tasks/content_discovery_update_db_only.py index f2f8f86..74ddf4e 100644 --- a/nostr_dvm/tasks/content_discovery_update_db_only.py +++ b/nostr_dvm/tasks/content_discovery_update_db_only.py @@ -11,6 +11,7 @@ from nostr_dvm.interfaces.dvmtaskinterface import DVMTaskInterface, process_venv from nostr_dvm.utils import definitions from nostr_dvm.utils.admin_utils import AdminConfig +from nostr_dvm.utils.database_utils import init_db from nostr_dvm.utils.definitions import EventDefinitions from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88 @@ -43,6 +44,7 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface): result = "" database = None wot_counter = 0 + max_db_size = 280 async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, nip88config: NIP88Config = None, admin_config: AdminConfig = None, options=None): @@ -63,6 +65,8 @@ async def init_dvm(self, name, dvm_config: DVMConfig, nip89config: NIP89Config, self.db_name = self.options.get("db_name") if self.options.get("db_since"): self.db_since = int(self.options.get("db_since")) + if self.options.get("max_db_size"): + self.max_db_size = int(self.options.get("max_db_size")) use_logger = False if use_logger: @@ -136,7 +140,8 @@ async def sync_db(self): sk = SecretKey.from_hex(self.dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) if self.database is None: - self.database = NostrDatabase.lmdb(self.db_name) + self.database = await init_db(self.db_name, True, self.max_db_size) + #self.database = NostrDatabase.lmdb(self.db_name) cli = ClientBuilder().signer(NostrSigner.keys(keys)).database(self.database).opts(opts).build() diff --git a/nostr_dvm/utils/database_utils.py b/nostr_dvm/utils/database_utils.py index 9ef2c6b..6ce7ba9 100644 --- a/nostr_dvm/utils/database_utils.py +++ b/nostr_dvm/utils/database_utils.py @@ -1,11 +1,15 @@ # DATABASE LOGIC import json +import os +import pathlib +import shutil import sqlite3 from dataclasses import dataclass from logging import Filter from sqlite3 import Error +from tkinter.filedialog import Directory -from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind, make_private_msg, NostrSigner +from nostr_sdk import Timestamp, Keys, PublicKey, Filter, Kind, make_private_msg, NostrSigner, NostrDatabase from nostr_dvm.utils.definitions import relay_timeout from nostr_dvm.utils.nostr_utils import send_nip04_dm @@ -246,6 +250,30 @@ async def get_or_add_user(db, npub, client, config, update=False, skip_meta=Fals return user +async def init_db(database, wipe=False, limit=1000, print_filesize=True): + # LMDB can't grow smaller, so by using this function we can wipe the database on init to avoid + # it growing too big. If wipe is set to true, the database will be deleted once the size is above the limit param. + database_content = database + "/data.mdb" + if os.path.isfile(database_content): + file_stats = os.stat(database_content) + sizeinmb = file_stats.st_size / (1024 * 1024) + if print_filesize: + print("Filesize of database \"" + database + "\": " + str(sizeinmb) + " Mb.") + + if wipe and sizeinmb > limit: + try: + shutil.rmtree(database) + print("Removed database due to large file size. Waiting for resync") + except OSError as e: + print("Error: %s - %s." % (e.filename, e.strerror)) + else: + print("Creating database: " + database) + + + return NostrDatabase.lmdb(database) + + + async def fetch_user_metadata(npub, client): name = "" nip05 = "" diff --git a/tests/discovery.py b/tests/discovery.py index f9670e4..93f8b70 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -1,6 +1,7 @@ import asyncio import json import os +import shutil import threading from pathlib import Path @@ -22,6 +23,7 @@ from nostr_dvm.tasks.content_discovery_update_db_only import DicoverContentDBUpdateScheduler from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand from nostr_dvm.utils.admin_utils import AdminConfig +from nostr_dvm.utils.database_utils import init_db from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88 from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag @@ -606,25 +608,24 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c admin_config=admin_config, options=options) -async def init_db(database): - return NostrDatabase.lmdb(database) - - def playground(): main_db = "db/nostr_recent_notes.db" - DATABASE = asyncio.run(init_db(main_db)) + main_db_limit = 1024 # in mb + + DATABASE = asyncio.run(init_db(main_db, wipe=True, limit=main_db_limit, print_filesize=True)) # DB Scheduler, do not announce, just use it to update the DB for the other DVMs. admin_config_db_scheduler = AdminConfig() - options_animal = { + options_db = { "db_name": main_db, "db_since": max_sync_duration_in_h * 60 * 60, # 48h since gmt, "personalized": False, + "max_db_size" : main_db_limit, "logger": False} image = "" about = "I just update the Database based on my schedule" db_scheduler = build_db_scheduler("DB Scheduler", "db_scheduler", - admin_config_db_scheduler, options_animal, + admin_config_db_scheduler, options_db, image=image, description=about, update_rate=global_update_rate, From 704470d44d9ad23a631dcc1e0db3d31e903c1111 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:51:01 +0100 Subject: [PATCH 26/26] bump sdk and version --- .idea/dataSources.xml | 14 +++++++------- .idea/dvm.iml | 2 +- .idea/misc.xml | 2 +- setup.py | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index 817b2e9..79fa4ec 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -9,7 +9,7 @@ $ProjectFileDir$ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/bot.db @@ -21,7 +21,7 @@ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/subscriptions.db @@ -33,7 +33,7 @@ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/Translator.db @@ -45,7 +45,7 @@ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/Unstable Diffusion.db @@ -57,7 +57,7 @@ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/nostr_mostr.db @@ -69,7 +69,7 @@ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/nostr_profiles.db @@ -102,7 +102,7 @@ $ProjectFileDir$ - sqlite.xerial + 038acd88-11f0-4c07-ae7d-36e6f74bad7c true org.sqlite.JDBC jdbc:sqlite:$PROJECT_DIR$/db/subscriptions diff --git a/.idea/dvm.iml b/.idea/dvm.iml index 3c35999..f3dc204 100644 --- a/.idea/dvm.iml +++ b/.idea/dvm.iml @@ -14,7 +14,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 83b7974..80b51eb 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/setup.py b/setup.py index 54dc80a..d346c06 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.9.11' +VERSION = '0.9.12' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information') @@ -14,7 +14,7 @@ long_description=LONG_DESCRIPTION, packages=find_packages(include=['nostr_dvm', 'nostr_dvm.*']), - install_requires=["nostr-sdk==0.36.0", + install_requires=["nostr-sdk==0.37.0", "bech32==1.2.0", "pycryptodome==3.20.0", "yt-dlp==2024.11.04",