From 3ea279f9508e2997851dd50900d966c646fb8a03 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:56:34 +0100 Subject: [PATCH] add relay options to tests --- tests/discovery_mostr.py | 10 ++++++++++ tests/generic_dvm_autotopic_feed.py | 16 +++++++++++++++ tests/generic_dvm_duck_chat.py | 16 +++++++++++++++ tests/generic_dvm_flux_hf.py | 16 +++++++++++++++ tests/otherstuff.py | 5 ++++- tests/search.py | 31 ++++++++++++++++++++--------- 6 files changed, 84 insertions(+), 10 deletions(-) diff --git a/tests/discovery_mostr.py b/tests/discovery_mostr.py index 7996e89..29e6153 100644 --- a/tests/discovery_mostr.py +++ b/tests/discovery_mostr.py @@ -10,6 +10,8 @@ from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverCon from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag +from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST + rebroadcast_NIP89 = False # Announce NIP89 on startup rebroadcast_NIP65_Relay_List = False @@ -24,6 +26,12 @@ if use_logger: init_logger(LogLevel.DEBUG) +RELAY_LIST = ["wss://nostr.mom", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev", + #"wss://relay.nostr.net" + ] + def build_example_mostr(name, identifier, admin_config, options, image, cost=0, update_rate=180, processing_msg=None, update_db=True): dvm_config = build_default_config(identifier) @@ -33,6 +41,8 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0, dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes dvm_config.UPDATE_DATABASE = update_db dvm_config.SYNC_DB_RELAY_LIST = ["wss://nfrelay.app/?user=activitypub"] + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST dvm_config.LOGLEVEL = LogLevel.DEBUG dvm_config.FIX_COST = cost dvm_config.CUSTOM_PROCESSING_MESSAGE = processing_msg diff --git a/tests/generic_dvm_autotopic_feed.py b/tests/generic_dvm_autotopic_feed.py index 57122cf..656f2c6 100644 --- a/tests/generic_dvm_autotopic_feed.py +++ b/tests/generic_dvm_autotopic_feed.py @@ -16,6 +16,18 @@ from nostr_dvm.utils.definitions import relay_timeout from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag from nostr_dvm.utils.output_utils import send_job_status_reaction +from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST + +RELAY_LIST = ["wss://nostr.mom", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev", + #"wss://relay.nostr.net" + ] + +SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev"] + def playground(announce=False): @@ -52,6 +64,10 @@ def playground(announce=False): dvm_config.KIND = Kind(kind) # Manually set the Kind Number (see data-vending-machines.org) dvm_config.CUSTOM_PROCESSING_MESSAGE = "Creating a personalized feed based on the topics you write about. This might take a moment." dvm_config.FIX_COST = 0 + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST + dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST + #admin_config.DELETE_NIP89 = True diff --git a/tests/generic_dvm_duck_chat.py b/tests/generic_dvm_duck_chat.py index 788f5d2..5cbc172 100644 --- a/tests/generic_dvm_duck_chat.py +++ b/tests/generic_dvm_duck_chat.py @@ -9,6 +9,18 @@ from nostr_dvm.tasks.generic_dvm import GenericDVM from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag +from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST + +RELAY_LIST = ["wss://nostr.mom", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev", + #"wss://relay.nostr.net" + ] + +SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev"] + def playground(announce=False): @@ -24,6 +36,10 @@ def playground(announce=False): dvm_config = build_default_config(identifier) dvm_config.KIND = Kind(kind) # Manually set the Kind Number (see data-vending-machines.org) dvm_config.SEND_FEEDBACK_EVENTS = False + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST + dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST + # Add NIP89 nip89info = { diff --git a/tests/generic_dvm_flux_hf.py b/tests/generic_dvm_flux_hf.py index 5cf770b..e61c5bc 100644 --- a/tests/generic_dvm_flux_hf.py +++ b/tests/generic_dvm_flux_hf.py @@ -10,6 +10,18 @@ from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import build_default_config from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag from nostr_dvm.utils.output_utils import upload_media_to_hoster +from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST + +RELAY_LIST = ["wss://nostr.mom", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev", + #"wss://relay.nostr.net" + ] + +SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev"] + def playground(announce=False): @@ -29,6 +41,10 @@ def playground(announce=False): dvm_config.CUSTOM_PROCESSING_MESSAGE = ["Generating image.."] dvm_config.SEND_FEEDBACK_EVENTS = True dvm_config.FIX_COST = 20 + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST + dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST + # Add NIP89 nip89info = { diff --git a/tests/otherstuff.py b/tests/otherstuff.py index e13f087..1c7780b 100644 --- a/tests/otherstuff.py +++ b/tests/otherstuff.py @@ -39,7 +39,7 @@ SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", RELAY_LIST = ["wss://nostr.mom", #"wss://relay.primal.net", "wss://nostr.oxtr.dev", - "wss://relay.nostr.net" + #"wss://relay.nostr.net" ] if use_logger: @@ -413,6 +413,9 @@ def build_replicate_fluxpro(name, identifier, announce): def playground(announce=False): #bot_config = DVMConfig() bot_config = build_default_config("bot") + bot_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + bot_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST + bot_config.RELAY_LIST = RELAY_LIST #bot_config.PRIVATE_KEY = check_and_set_private_key("bot") #npub = Keys.parse(bot_config.PRIVATE_KEY).public_key().to_bech32() #invoice_key, admin_key, wallet_id, lnaddress = check_and_set_ln_bits_keys("bot",npub) diff --git a/tests/search.py b/tests/search.py index 618d2fd..a3bef47 100644 --- a/tests/search.py +++ b/tests/search.py @@ -13,6 +13,7 @@ from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag from nostr_dvm.utils.nostr_utils import check_and_set_private_key +from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys rebroadcast_NIP89 = False # Announce NIP89 on startup Only do this if you know what you're doing. @@ -27,19 +28,28 @@ if use_logger: init_logger(log_level) -RELAY_LIST = ["wss://relay.primal.net", - "wss://nostr.mom", "wss://nostr.oxtr.dev", "wss://relay.nostr.bg", - "wss://relay.nostr.net" +RELAY_LIST = ["wss://nostr.mom", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev", + #"wss://relay.nostr.net" ] +SYNC_DB_RELAY_LIST = ["wss://relay.damus.io", + #"wss://relay.primal.net", + "wss://nostr.oxtr.dev"] + + + def build_advanced_search(name, identifier): dvm_config = DVMConfig() 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 dvm_config = build_default_config(identifier) # dvm_config.LNBITS_URL = os.getenv("LNBITS_HOST") - dvm_config.FIX_COST = 5 + dvm_config.FIX_COST = 0 + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST + dvm_config.SYNC_DB_RELAY_LIST = SYNC_DB_RELAY_LIST admin_config = AdminConfig() @@ -95,6 +105,9 @@ def build_advanced_search_wine(name, identifier): 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") + dvm_config.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST + 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 @@ -146,6 +159,8 @@ 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.AVOID_OUTBOX_RELAY_LIST = AVOID_OUTBOX_RELAY_LIST + dvm_config.RELAY_LIST = RELAY_LIST 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) @@ -193,12 +208,10 @@ 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() - #keep_alive() - if __name__ == '__main__': env_path = Path('.env')