diff --git a/setup.py b/setup.py index 646fe9a..8b6d30f 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.2.6' +VERSION = '0.3.0' 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. ' 'This is an early stage release. Interfaces might change/brick') diff --git a/ui/noogle/src/components/RecommendationGeneration.vue b/ui/noogle/src/components/RecommendationGeneration.vue index 56a29eb..3383a13 100644 --- a/ui/noogle/src/components/RecommendationGeneration.vue +++ b/ui/noogle/src/components/RecommendationGeneration.vue @@ -70,10 +70,6 @@ async function generate_feed(id) { try { - - //dvms = [] - //store.commit('set_recommendation_dvms', dvms) - let client = store.state.client let content = "NIP 90 Content Discovery request" @@ -135,18 +131,10 @@ async function listen() { const handle = { // Handle event handleEvent: async (relayUrl, event) => { - /* if (store.state.recommendationehasEventListener === false){ - return true - }*/ - //const dvmname = getNamefromId(event.author.toHex()) - //console.log("Received new event from", relayUrl); - //console.log(event.asJson()) let resonsetorequest = false sleep(1200).then(async () => { for (let tag in event.tags) { if (event.tags[tag].asVec()[0] === "e") { - //console.log(event.tags[tag].asVec()[1]) - //console.log(test) if (event.tags[tag].asVec()[1] === store.state.requestidRecommendation) { resonsetorequest = true @@ -157,7 +145,7 @@ async function listen() { if (resonsetorequest === true) { if (event.kind === 7000) { try { - console.log("7000: ", event.content); + //console.log("7000: ", event.content); // console.log("DVM: " + event.author.toHex()) //miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info) dvms.find(i => i.id === event.author.toHex()).laststatusid = event.id.toHex() @@ -195,15 +183,8 @@ async function listen() { let profiles = await get_user_infos([event.author]) let created = 0 if (profiles.length > 0) { - // for (const profile of profiles){ console.log(profiles[0].profile) let current = profiles[0] - // if (profiles[0].profile.createdAt > created){ - // created = profile.profile.createdAt - // current = profile - // } - - let lud16 = current.profile.lud16 if (lud16 !== null && lud16 !== "") { console.log("LUD16: " + lud16) @@ -460,13 +441,7 @@ async function addDVM(event){ // for (const profile of profiles){ console.log(profiles[0].profile) let current = profiles[0] - // if (profiles[0].profile.createdAt > created){ - // created = profile.profile.createdAt - // current = profile - // } - - - let lud16 = current.profile.lud16 + let lud16 = current.profile.lud16 if (lud16 !== null && lud16 !== ""){ console.log("LUD16: " + lud16) jsonentry.bolt11 = await createBolt11Lud16(lud16, jsonentry.amount) @@ -486,14 +461,8 @@ async function addDVM(event){ } } } - - - - - } - //let dvm = store.state.nip89dvms.find(x => JSON.parse(x.event).pubkey === event.author.toHex()) for (const el of store.state.nip89dvms) { if (JSON.parse(el.event).pubkey === event.author.toHex()) { @@ -523,7 +492,6 @@ async function addDVM(event){ } - async function cancelSubscription(kind7001, recipent){ console.log(kind7001) console.log(recipent) @@ -544,13 +512,8 @@ async function cancelSubscription(kind7001, recipent){ dvms.find(x => x.nip88.eventid === this.current_subscription_dvm.nip88.eventid).nip88.hasActiveSubscription = true dvms.find(x => x.nip88.eventid === this.current_subscription_dvm.nip88.eventid).nip88.expires = true - - - } - - async function subscribe_to_dvm() { if (!localStorage.getItem("nostr-key-method") || localStorage.getItem("nostr-key-method") === "anon"){ @@ -559,16 +522,7 @@ async function subscribe_to_dvm() { } // We only arrive here if no subscription exists, we might create a 7001 if it doesnt exist and we zap it - let client = store.state.client - - console.log(this.current_subscription_dvm.nip88) - console.log(this.current_subscription_nwc) - // console.log(JSON.stringify(dvm.event)) - console.log(this.current_subscription_amount) - console.log(this.current_subscription_cadence) - // console.log(dvm.p) - - + let client = store.state.client if (this.current_subscription_dvm.nip88.subscriptionId === ""){ console.log("Creating 7001 event") let tags = [ @@ -576,9 +530,6 @@ async function subscribe_to_dvm() { Tag.parse([ "e" , this.current_subscription_dvm.nip88.eventid]), Tag.parse([ "event", JSON.stringify(this.current_subscription_dvm.nip88.event)]), Tag.parse([ "amount", (this.current_subscription_amount).toString(), "msats", this.current_subscription_cadence]), - // Zap-splits todo order and splits - // Tag.parse([ "zap", authorid, "19" ]), // 95% - // Tag.parse([ "zap", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52", "1" ]), // 5% to client developer where subscription was created ] console.log(this.current_subscription_dvm.nip88.zaps) @@ -587,12 +538,6 @@ async function subscribe_to_dvm() { let zaptag = Tag.parse([ "zap", zap.key, zap.split]) tags.push(zaptag) } -/* - - - */ - - let evt = new EventBuilder(7001, "Subscription from noogle.lol", tags) let res = await client.sendEventBuilder(evt); @@ -601,28 +546,8 @@ async function subscribe_to_dvm() { } - /* let overallsplit = 0 - for (let zap of this.current_subscription_dvm.nip88.zaps){ - overallsplit += parseInt(zap.split) - } - for (let zap of this.current_subscription_dvm.nip88.zaps) { - let profiles = await get_user_infos([PublicKey.parse(zap.key)]) - if (profiles.length > 0) { - let current = profiles[0] - let lud16 = current.profile.lud16 - let splitted_amount = Math.floor((zap.split / overallsplit) * this.current_subscription_amount / 1000) - console.log(splitted_amount) - console.log(overallsplit) - console.log(this.current_subscription_dvm.nip88.subscriptionId) - } - - } */ - try{ - let receiver = PublicKey.parse(store.state.subscription_verifier_pubkey) - /*if (this.current_subscription_dvm.nip88.p !== ""){ - receiver = PublicKey.parse(this.current_subscription_dvm.nip88.p) - }*/ + let receiver = PublicKey.parse(store.state.subscription_verifier_pubkey) let signer = NostrSigner.keys(Keys.parse(store.state.nooglekey)) let nclient = new Client(signer) @@ -644,8 +569,6 @@ async function subscribe_to_dvm() { "subscriber" : store.state.pubkey.toHex(), "zaps" : this.current_subscription_dvm.nip88.zaps - - } // TODO this is only for viewing, check event (happens on page reload now) @@ -678,48 +601,6 @@ async function subscribe_to_dvm() { console.log(error) } - - //TODO send info to Subscription service - /* - let invoice = await zaprequest(lud16, splitted_amount, "paid for " + cadence + " from noogle.lol", activesubscriptioneventid, dvmid, store.state.relays) - console.log(invoice) - await zapSubscription(invoice) - } - } - -*/ - - - - - // next, the dvm should listen to these 7001 events addressed to it and (or rather 9735 tagging the 7001 and the subscription should be considered valid for both) - - -} - -async function zapSubscription(invoice) { - let webln; - - //this.dvmpaymentaddr = `https://chart.googleapis.com/chart?cht=qr&chl=${invoice}&chs=250x250&chld=M|0`; - //this.dvminvoice = invoice - try { - webln = await requestProvider(); - } catch (err) { - await copyinvoice(invoice) - } - - if (webln) { - try{ - let response = await webln.sendPayment(invoice) - - //dvms.find(i => i.bolt11 === invoice).status = "paid" - // store.commit('set_recommendation_dvms', dvms) - } - catch(err){ - console.log(err) - await copyinvoice(invoice) - } - } } async function zap_local(invoice) { @@ -732,26 +613,22 @@ async function zap_local(invoice) { } +async function store_nwc(){ + if (this.nwcalby.startsWith("nostr")){ - async function store_nwc(){ + this.current_subscription_nwc = this.nwcalby + } + else if (this.nwcmutiny.startsWith("nostr") ){ - if (this.nwcalby.startsWith("nostr")){ - - this.current_subscription_nwc = this.nwcalby - } - else if (this.nwcmutiny.startsWith("nostr") ){ - - this.current_subscription_nwc = this.nwcmutiny - } - else{ - - this.current_subscription_nwc = this.nwc - } - - } + this.current_subscription_nwc = this.nwcmutiny + } + else{ + this.current_subscription_nwc = this.nwc + } +} async function connect_alby_nwc(){ const alby = webln.NostrWebLNProvider.withNewSecret(); @@ -797,13 +674,6 @@ const nwcconnector= ref("user"); const openModal = result => { datetopost.value = Date.now(); isModalOpened.value = true; - - - - //let resevents = "" - //for (let evt of result){ - // resevents = resevents + "nostr:" + (evt.id.toBech32()) + "\n" - //} modalcontent.value = result }; const closeModal = () => { @@ -838,393 +708,278 @@ const closeNWCModal = () => {

Algorithms, but you are the one in control.

-
- - - -
- - - - - - - - - - - + + + + +
-
- - - - -
- -
-
- DVM Picture - -
- - -

{{ dvm.name }}

-
-

- - -
- +
+
+
+ DVM Picture + +
+

{{ dvm.name }}

+
+

+
- - - + + + - - + + - -

Subscription required

+ +

Subscription required

- + - - + + - + - + -
- - - - -
- -
-

Free

-

Flexible

-

Subscription

- -
-
-
- - - - - - - - - - - - - -
- - - - - -

+
+ +
+ +
+

Nostr Wallet Connect

+

Manually connect with NWC string

+
-

- {{dvm.amount/1000}}

-
+ +
+
+ + +
+
+ + + +
+ +
+ + + +
+

Manage your Subscription

+ +
+ +

{{dvm.nip88.title}}

+ +

{{dvm.nip88.description}}

+
+

Perks:

+
+

{{perk}}

+
+
+

Subscription renewing at + {{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[2].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[1].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[0].trim().slice(2)}} {{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[1].split("Z")[0].trim()}} GMT

+ +

Subscription expires on + {{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[2].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[1].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[0].split("-")[0].trim().slice(2)}} {{Timestamp.fromSecs(parseInt(dvm.nip88.subscribedUntil)).toHumanDatetime().split("T")[1].split("Z")[0].trim()}} GMT

+

Changed your mind? Resubscribe! The current subscription will continue with a new NWC string

+
+
+

Subscribe and pay {{amount_item.cadence}}

+ + + + +
+ + + + +
+ +
+
+
-
-
Show/Hide Results
-
- +
+
- -
- +

+

+ {{dvm.amount/1000}}

+
-
- +
+
Show/Hide Results
+
+ +
+
+
+ +
-
- - diff --git a/ui/noogle/src/components/RecommendationGeneration_old.vue b/ui/noogle/src/components/RecommendationGeneration_old.vue deleted file mode 100644 index c948ef0..0000000 --- a/ui/noogle/src/components/RecommendationGeneration_old.vue +++ /dev/null @@ -1,574 +0,0 @@ - - - - - - -