diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index cca37f1..eba3974 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -138,7 +138,7 @@ class DVM: config=self.dvm_config, skip_meta=False) # if user is blacklisted for some reason, send an error reaction and return if user.isblacklisted: - await send_job_status_reaction(nip90_event, "error", client=self.client, dvm_config=self.dvm_config) + # await send_job_status_reaction(nip90_event, "error", client=self.client, dvm_config=self.dvm_config) print("[" + self.dvm_config.NIP89.NAME + "] Request by blacklisted user, skipped") return if self.dvm_config.LOGLEVEL.value >= LogLevel.INFO.value: diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 769bea2..dedb329 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -215,9 +215,10 @@ async def send_event_outbox(event: Event, client, dvm_config) -> SendEventOutput # 5. Otherwise, we create a new Outbox client with the inbox relays and send the event there relaylimits = RelayLimits.disable() - connection = Connection().embedded_tor().target(ConnectionTarget.ONION) + 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).timeout(timedelta(seconds=5)) + opts = Options().relay_limits(relaylimits).connection(connection) sk = SecretKey.from_hex(dvm_config.PRIVATE_KEY) keys = Keys.parse(sk.to_hex()) outboxclient = ClientBuilder().signer(NostrSigner.keys(keys)).opts(opts).build() diff --git a/nostr_dvm/utils/outbox_utils.py b/nostr_dvm/utils/outbox_utils.py index c18656f..ef60344 100644 --- a/nostr_dvm/utils/outbox_utils.py +++ b/nostr_dvm/utils/outbox_utils.py @@ -57,7 +57,7 @@ AVOID_OUTBOX_RELAY_LIST = ["wss://nos.lol", "wss://nostr.fmt.wiz.biz", "wss://no "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://nostr.social", "wss://i.nostr.build", "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", diff --git a/tests/discovery.py b/tests/discovery.py index 28f44c1..8f1f316 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -1164,12 +1164,12 @@ def playground(): "logger": False} image = "https://image.nostr.build/53536b3eccb03fdb127849b79f85b0b6ecb241d12068b65f52afe4a4650d5318.jpg" - description = "I show popular notes with < 210 symbols" + description = "I show popular tweets with < 210 symbols" custom_processing_msg = ["Tweets are short notes"] cost = 0 update_db = False # we use the DB scheduler above for a shared database. Or don't use it and let the DVM manage it - discovery_tweets = build_example_tweets("Popular Tweets", + discovery_tweets = build_example_tweets("Free Bird", "discovery_content_tweets", admin_config, options, image=image, diff --git a/tests/tor_test.py b/tests/tor_test.py new file mode 100644 index 0000000..55d48d8 --- /dev/null +++ b/tests/tor_test.py @@ -0,0 +1,32 @@ +import asyncio +from nostr_sdk import Keys, ClientBuilder, Options, EventBuilder, Connection, ConnectionTarget, init_logger, LogLevel, NostrSigner + + +async def main(): + init_logger(LogLevel.INFO) + + keys = Keys.generate() + print(keys.public_key().to_bech32()) + + # Configure client to use embedded tor for `.onion` relays + connection = Connection().embedded_tor().target(ConnectionTarget.ONION) + opts = Options().connection(connection) + signer = NostrSigner.keys(keys) + client = ClientBuilder().signer(signer).opts(opts).build() + + await client.add_relay("wss://relay.damus.io") + await client.add_relay("ws://oxtrdevav64z64yb7x6rjg4ntzqjhedm5b5zjqulugknhzr46ny2qbad.onion") + await client.add_relay("ws://2jsnlhfnelig5acq6iacydmzdbdmg7xwunm4xl6qwbvzacw4lwrjmlyd.onion") + await client.connect() + + event = EventBuilder.text_note("Hello from rust-nostr Python bindings!") + res = await client.send_event_builder(event) + print("Event sent:") + print(f" hex: {res.id.to_hex()}") + print(f" bech32: {res.id.to_bech32()}") + print(f" Successfully sent to: {res.output.success}") + print(f" Failed to send to: {res.output.failed}") + + +if __name__ == '__main__': + asyncio.run(main()) \ No newline at end of file