mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-09-21 19:30:36 +02:00
move away from public relays
This commit is contained in:
@@ -598,6 +598,8 @@ class DVM:
|
||||
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"])
|
||||
@@ -607,9 +609,10 @@ class DVM:
|
||||
|
||||
for tag in original_event.tags().to_vec():
|
||||
if tag.as_vec()[0] == "i":
|
||||
i_tag = tag
|
||||
if not encrypted:
|
||||
reply_tags.append(i_tag)
|
||||
reply_tags.append(tag)
|
||||
elif tag.as_vec()[0] == "expiration":
|
||||
reply_tags.append(tag)
|
||||
|
||||
if encrypted:
|
||||
encryption_tags.append(p_tag)
|
||||
@@ -670,12 +673,15 @@ class DVM:
|
||||
|
||||
encrypted = False
|
||||
is_legacy_encryption = False
|
||||
expiration_tag = None
|
||||
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)
|
||||
elif tag.as_vec()[0] == "expiration":
|
||||
expiration_tag = tag
|
||||
|
||||
if encrypted:
|
||||
encryption_tags.append(p_tag)
|
||||
@@ -756,6 +762,9 @@ class DVM:
|
||||
else:
|
||||
content = reaction
|
||||
|
||||
if expiration_tag is not None:
|
||||
reply_tags.append(expiration_tag)
|
||||
|
||||
keys = Keys.parse(dvm_config.PRIVATE_KEY)
|
||||
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)
|
||||
|
@@ -187,9 +187,7 @@ class DicoverContentOnThisDay(DVMTaskInterface):
|
||||
await cli.connect()
|
||||
|
||||
timestamp_since = Timestamp.now().as_secs() - self.db_since
|
||||
print(timestamp_since)
|
||||
timestamp_until = Timestamp.now().as_secs() - (self.db_since - (60 + 60 * 24))
|
||||
print(timestamp_until)
|
||||
since = Timestamp.from_secs(timestamp_since)
|
||||
until = Timestamp.from_secs(timestamp_until)
|
||||
|
||||
|
@@ -1,14 +1,20 @@
|
||||
from nostr_sdk import Tag, Keys, EventBuilder, Kind
|
||||
|
||||
from nostr_dvm.utils.definitions import EventDefinitions
|
||||
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||
from nostr_dvm.utils.nostr_utils import send_event
|
||||
from nostr_dvm.utils.print_utils import bcolors
|
||||
|
||||
|
||||
async def announce_dm_relays(dvm_config, client):
|
||||
tags = []
|
||||
relays_to_publish = DVMConfig.RELAY_LIST
|
||||
|
||||
for relay in dvm_config.RELAY_LIST:
|
||||
if relay not in relays_to_publish:
|
||||
relays_to_publish.append(relay)
|
||||
|
||||
for relay in relays_to_publish:
|
||||
r_tag = Tag.parse(["r", relay])
|
||||
tags.append(r_tag)
|
||||
|
||||
@@ -32,7 +38,14 @@ async def nip65_announce_relays(dvm_config, client):
|
||||
|
||||
tags = []
|
||||
|
||||
relays_to_publish = DVMConfig.RELAY_LIST
|
||||
|
||||
for relay in dvm_config.RELAY_LIST:
|
||||
if relay not in relays_to_publish:
|
||||
relays_to_publish.append(relay)
|
||||
|
||||
|
||||
for relay in relays_to_publish:
|
||||
r_tag = Tag.parse(["r", relay])
|
||||
tags.append(r_tag)
|
||||
|
||||
|
@@ -27,9 +27,7 @@ if use_logger:
|
||||
init_logger(log_level)
|
||||
|
||||
|
||||
RELAY_LIST = ["wss://nostr.mom",
|
||||
"wss://relay.primal.net",
|
||||
"wss://nostr.oxtr.dev",
|
||||
RELAY_LIST = ["wss://relay.nostrdvm.com"
|
||||
]
|
||||
|
||||
SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
||||
@@ -42,6 +40,7 @@ SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
||||
def build_example_on_this_day(name, identifier, admin_config, options, image, description, update_rate=600, cost=0,
|
||||
processing_msg=None, update_db=True, database=None):
|
||||
dvm_config = build_default_config(identifier)
|
||||
|
||||
dvm_config.USE_OWN_VENV = False
|
||||
dvm_config.SHOWLOG = True
|
||||
dvm_config.SCHEDULE_UPDATES_SECONDS = update_rate # Every 10 minutes
|
||||
|
@@ -167,15 +167,16 @@ async def nostr_client_test_tts(prompt):
|
||||
async def nostr_client_test_discovery(user, ptag):
|
||||
keys = Keys.parse(check_and_set_private_key("test_client"))
|
||||
|
||||
relay_list = ["wss://relay.damus.io", "wss://blastr.f7z.xyz",
|
||||
relay_list = ["wss://relay.nostrdvm.com",
|
||||
]
|
||||
|
||||
relaysTag = Tag.parse(relay_list)
|
||||
alttag = Tag.parse(["alt", "This is a NIP90 DVM AI task to find content"])
|
||||
paramTag = Tag.parse(["param", "user", user])
|
||||
pTag = Tag.parse(["p", ptag])
|
||||
expiration_tag = Tag.parse(["expiration", str(Timestamp.now().as_secs() + 60*60)])
|
||||
|
||||
tags = [relaysTag, alttag, paramTag, pTag]
|
||||
tags = [relaysTag, alttag, paramTag, pTag, expiration_tag]
|
||||
|
||||
event = EventBuilder(EventDefinitions.KIND_NIP90_CONTENT_DISCOVERY, str("Give me content")).tags(
|
||||
tags).sign_with_keys(keys)
|
||||
@@ -184,7 +185,6 @@ async def nostr_client_test_discovery(user, ptag):
|
||||
for relay in relay_list:
|
||||
await client.add_relay(relay)
|
||||
|
||||
await client.add_relay("wss://nostr.band")
|
||||
await client.connect()
|
||||
config = DVMConfig
|
||||
await send_event(event, client=client, dvm_config=config)
|
||||
|
Reference in New Issue
Block a user