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