mirror of
https://github.com/aljazceru/nostrdvm.git
synced 2025-12-23 17:04:27 +01:00
announce to more relays
This commit is contained in:
@@ -16,14 +16,19 @@ class DVMConfig:
|
|||||||
FIX_COST: float = None
|
FIX_COST: float = None
|
||||||
PER_UNIT_COST: float = None
|
PER_UNIT_COST: float = None
|
||||||
|
|
||||||
RELAY_LIST = ["wss://relay.primal.net",
|
# The relays the dvm is operating on and announces in its inbox relays
|
||||||
"wss://nostr.mom",
|
RELAY_LIST = ["wss://relay.nostrdvm.com",
|
||||||
"wss://nostr.oxtr.dev",
|
|
||||||
]
|
]
|
||||||
|
# DBs to sync with
|
||||||
SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
||||||
"wss://nostr.oxtr.dev",
|
"wss://nostr.oxtr.dev",
|
||||||
]
|
]
|
||||||
|
# announce inbox relays, dm relays and NIP89 announcement to
|
||||||
|
ANNOUNCE_RELAY_LIST = ["wss://relay.primal.net",
|
||||||
|
"wss://nostr.mom", "wss://relay.damus.io",
|
||||||
|
"wss://nostr.oxtr.dev", "wss://nostr.mom",
|
||||||
|
"wss://relay.nostrdvm.com"
|
||||||
|
]
|
||||||
|
|
||||||
# Straight Censorship (reply guy spam)
|
# Straight Censorship (reply guy spam)
|
||||||
WOT_FILTERING = False
|
WOT_FILTERING = False
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from nostr_dvm.utils.print_utils import bcolors
|
|||||||
|
|
||||||
async def announce_dm_relays(dvm_config, client):
|
async def announce_dm_relays(dvm_config, client):
|
||||||
tags = []
|
tags = []
|
||||||
relays_to_publish = DVMConfig.RELAY_LIST
|
relays_to_publish = DVMConfig.ANNOUNCE_RELAY_LIST
|
||||||
|
|
||||||
for relay in dvm_config.RELAY_LIST:
|
for relay in dvm_config.RELAY_LIST:
|
||||||
if relay not in relays_to_publish:
|
if relay not in relays_to_publish:
|
||||||
@@ -38,7 +38,7 @@ async def nip65_announce_relays(dvm_config, client):
|
|||||||
|
|
||||||
tags = []
|
tags = []
|
||||||
|
|
||||||
relays_to_publish = DVMConfig.RELAY_LIST
|
relays_to_publish = DVMConfig.ANNOUNCE_RELAY_LIST
|
||||||
|
|
||||||
for relay in dvm_config.RELAY_LIST:
|
for relay in dvm_config.RELAY_LIST:
|
||||||
if relay not in relays_to_publish:
|
if relay not in relays_to_publish:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import dotenv
|
|||||||
from nostr_sdk import Tag, Keys, EventBuilder, Filter, Alphabet, PublicKey, Client, EventId, SingleLetterTag, Kind
|
from nostr_sdk import Tag, Keys, EventBuilder, Filter, Alphabet, PublicKey, Client, EventId, SingleLetterTag, Kind
|
||||||
|
|
||||||
from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout
|
from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout
|
||||||
|
from nostr_dvm.utils.dvmconfig import DVMConfig
|
||||||
from nostr_dvm.utils.nostr_utils import send_event
|
from nostr_dvm.utils.nostr_utils import send_event
|
||||||
from nostr_dvm.utils.print_utils import bcolors
|
from nostr_dvm.utils.print_utils import bcolors
|
||||||
|
|
||||||
@@ -30,6 +31,12 @@ async def nip89_announce_tasks(dvm_config, client):
|
|||||||
keys = Keys.parse(dvm_config.NIP89.PK)
|
keys = Keys.parse(dvm_config.NIP89.PK)
|
||||||
content = dvm_config.NIP89.CONTENT
|
content = dvm_config.NIP89.CONTENT
|
||||||
event = EventBuilder(EventDefinitions.KIND_ANNOUNCEMENT, content).tags([k_tag, d_tag]).sign_with_keys(keys)
|
event = EventBuilder(EventDefinitions.KIND_ANNOUNCEMENT, content).tags([k_tag, d_tag]).sign_with_keys(keys)
|
||||||
|
|
||||||
|
new_dvm_config = DVMConfig()
|
||||||
|
new_dvm_config.RELAY_LIST = new_dvm_config.ANNOUNCE_RELAY_LIST
|
||||||
|
for relay in dvm_config.RELAY_LIST:
|
||||||
|
if relay not in new_dvm_config.RELAY_LIST:
|
||||||
|
new_dvm_config.RELAY_LIST.append(relay)
|
||||||
eventid = await send_event(event, client=client, dvm_config=dvm_config)
|
eventid = await send_event(event, client=client, dvm_config=dvm_config)
|
||||||
|
|
||||||
print(
|
print(
|
||||||
@@ -70,7 +77,14 @@ async def nip89_delete_announcement(eid: str, keys: Keys, dtag: str, client: Cli
|
|||||||
["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag])
|
["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag])
|
||||||
event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys)
|
event = EventBuilder(Kind(5), "").tags([e_tag, a_tag]).sign_with_keys(keys)
|
||||||
print(f"Deletion event: {event.as_json()}")
|
print(f"Deletion event: {event.as_json()}")
|
||||||
await send_event(event, client, config)
|
|
||||||
|
new_dvm_config = DVMConfig()
|
||||||
|
new_dvm_config.RELAY_LIST = new_dvm_config.ANNOUNCE_RELAY_LIST
|
||||||
|
for relay in config.RELAY_LIST:
|
||||||
|
if relay not in new_dvm_config.RELAY_LIST:
|
||||||
|
new_dvm_config.RELAY_LIST.append(relay)
|
||||||
|
|
||||||
|
await send_event(event, client, new_dvm_config)
|
||||||
|
|
||||||
|
|
||||||
async def nip89_delete_announcement_pow(eid: str, keys: Keys, dtag: str, client: Client, config):
|
async def nip89_delete_announcement_pow(eid: str, keys: Keys, dtag: str, client: Client, config):
|
||||||
@@ -79,7 +93,13 @@ async def nip89_delete_announcement_pow(eid: str, keys: Keys, dtag: str, client:
|
|||||||
["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag])
|
["a", str(EventDefinitions.KIND_ANNOUNCEMENT.as_u16()) + ":" + keys.public_key().to_hex() + ":" + dtag])
|
||||||
event = EventBuilder(Kind(5), "").tags([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()}")
|
print(f"POW event: {event.as_json()}")
|
||||||
await send_event(event, client, config)
|
new_dvm_config = DVMConfig()
|
||||||
|
new_dvm_config.RELAY_LIST = new_dvm_config.ANNOUNCE_RELAY_LIST
|
||||||
|
for relay in config.RELAY_LIST:
|
||||||
|
if relay not in new_dvm_config.RELAY_LIST:
|
||||||
|
new_dvm_config.RELAY_LIST.append(relay)
|
||||||
|
|
||||||
|
await send_event(event, client, new_dvm_config)
|
||||||
|
|
||||||
|
|
||||||
async def nip89_fetch_all_dvms(client):
|
async def nip89_fetch_all_dvms(client):
|
||||||
|
|||||||
Reference in New Issue
Block a user