mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-03-17 21:31:52 +01:00
update nostr-sdk js and python, minor fixes
This commit is contained in:
parent
756fa7a5d8
commit
947ed3c146
@ -11,7 +11,7 @@ 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
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events
|
||||
|
||||
"""
|
||||
This File contains a Module to discover popular notes
|
||||
@ -154,7 +154,7 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface):
|
||||
if tag.as_vec()[0] == 'output':
|
||||
format = tag.as_vec()[1]
|
||||
if format == "text/plain": # check for output type
|
||||
result = post_process_list_to_users(result)
|
||||
result = post_process_list_to_events(result)
|
||||
|
||||
# if not text/plain, don't post-process
|
||||
return result
|
||||
@ -302,7 +302,7 @@ def build_example_subscription(name, identifier, admin_config, options, processi
|
||||
#admin_config.REBROADCAST_NIP88 = False
|
||||
|
||||
# admin_config.FETCH_NIP88 = True
|
||||
# admin_config.EVENTID = "63a791cdc7bf78c14031616963105fce5793f532bb231687665b14fb6d805fdb"
|
||||
# admin_config.EVENTID = ""
|
||||
# admin_config.PRIVKEY = dvm_config.PRIVATE_KEY
|
||||
|
||||
return DicoverContentCurrentlyPopular(name=name, dvm_config=dvm_config, nip89config=nip89config,
|
||||
|
@ -12,7 +12,7 @@ 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
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events
|
||||
|
||||
"""
|
||||
This File contains a Module to discover popular notes
|
||||
@ -171,7 +171,7 @@ class DicoverContentCurrentlyPopularFollowers(DVMTaskInterface):
|
||||
if tag.as_vec()[0] == 'output':
|
||||
format = tag.as_vec()[1]
|
||||
if format == "text/plain": # check for output type
|
||||
result = post_process_list_to_users(result)
|
||||
result = post_process_list_to_events(result)
|
||||
|
||||
# if not text/plain, don't post-process
|
||||
return result
|
||||
|
@ -11,7 +11,7 @@ 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
|
||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
|
||||
from nostr_dvm.utils.output_utils import post_process_list_to_events
|
||||
|
||||
"""
|
||||
This File contains a Module to discover popular notes
|
||||
@ -126,7 +126,7 @@ class DicoverContentCurrentlyPopularbyTopic(DVMTaskInterface):
|
||||
if tag.as_vec()[0] == 'output':
|
||||
format = tag.as_vec()[1]
|
||||
if format == "text/plain": # check for output type
|
||||
result = post_process_list_to_users(result)
|
||||
result = post_process_list_to_events(result)
|
||||
|
||||
# if not text/plain, don't post-process
|
||||
return result
|
||||
|
@ -19,14 +19,14 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
||||
if tag.as_vec()[0] == 'i':
|
||||
input_value = tag.as_vec()[1]
|
||||
input_type = tag.as_vec()[2]
|
||||
count = count+1
|
||||
count = count + 1
|
||||
|
||||
if input_type == "text":
|
||||
return len(input_value)
|
||||
|
||||
if input_type == "event": # NIP94 event
|
||||
if count > 1:
|
||||
return 1 # we ignore length for multiple event inputs for now
|
||||
return 1 # we ignore length for multiple event inputs for now
|
||||
evt = get_event_by_id(input_value, client=client, config=dvm_config)
|
||||
if evt is not None:
|
||||
input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type)
|
||||
|
@ -5,8 +5,7 @@ from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
from nostr_sdk import Filter, Tag, Keys, EventBuilder, Client, EventId, PublicKey, Event, Timestamp, SingleLetterTag, \
|
||||
Alphabet
|
||||
from nostr_sdk.nostr_sdk import Duration
|
||||
Alphabet, Kind
|
||||
|
||||
from nostr_dvm.utils import definitions
|
||||
from nostr_dvm.utils.definitions import EventDefinitions
|
||||
@ -85,7 +84,7 @@ def nip88_delete_announcement(eid: str, keys: Keys, dtag: str, client: Client, c
|
||||
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(5, "", [e_tag, a_tag]).to_event(keys)
|
||||
event = EventBuilder(Kind(5), "", [e_tag, a_tag]).to_event(keys)
|
||||
send_event(event, client, config)
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ import requests
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util.Padding import pad
|
||||
from bech32 import bech32_decode, convertbits, bech32_encode
|
||||
from nostr_sdk import nostr_sdk, PublicKey, SecretKey, Event, EventBuilder, Tag, Keys, generate_shared_key, Kind, \
|
||||
from nostr_sdk import PublicKey, SecretKey, Event, EventBuilder, Tag, Keys, generate_shared_key, Kind, \
|
||||
Timestamp
|
||||
|
||||
from nostr_dvm.utils.nostr_utils import get_event_by_id, check_and_decrypt_own_tags
|
||||
|
4
setup.py
4
setup.py
@ -1,6 +1,6 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = '0.4.2'
|
||||
VERSION = '0.4.3'
|
||||
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 @@ setup(
|
||||
long_description=LONG_DESCRIPTION,
|
||||
packages=find_packages(include=['nostr_dvm', 'nostr_dvm.*']),
|
||||
|
||||
install_requires=["nostr-sdk==0.11.0",
|
||||
install_requires=["nostr-sdk==0.12.0",
|
||||
"bech32",
|
||||
"pycryptodome==3.20.0",
|
||||
"python-dotenv==1.0.0",
|
||||
|
@ -2,7 +2,6 @@ from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
import nostr_sdk
|
||||
from nostr_sdk import Keys, Client, Tag, EventBuilder, Filter, HandleNotification, Timestamp, nip04_decrypt, \
|
||||
nip04_encrypt, EventId, Options, PublicKey, Event, NostrSigner, Nip19Event
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@getalby/sdk": "^3.4.0",
|
||||
"@rust-nostr/nostr-sdk": "^0.13.1",
|
||||
"@rust-nostr/nostr-sdk": "^0.14.0",
|
||||
"@vuepic/vue-datepicker": "^7.4.1",
|
||||
"@vueuse/core": "^10.7.2",
|
||||
"bech32": "^2.0.0",
|
||||
|
@ -869,14 +869,14 @@ export default {
|
||||
jsonentry.event = entry.asJson()
|
||||
jsonentry.kind = entry.tags[tag].asVec()[1]
|
||||
|
||||
|
||||
|
||||
//jsonentry.nip90Params = JSON.parse(jsonentry.nip90Params)
|
||||
nip89dvms.push(jsonentry);
|
||||
|
||||
if(nip89dvms.find(x=> x.id === jsonentry.id && x.kind === jsonentry.kind) === undefined)
|
||||
{
|
||||
nip89dvms.push(jsonentry);
|
||||
}
|
||||
|
||||
}
|
||||
catch (error){
|
||||
//console.log(error)
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user