This commit is contained in:
Believethehype 2024-03-19 14:59:53 +01:00
parent 168c04d86a
commit 79164f356e
3 changed files with 241 additions and 1060 deletions

View File

@ -1,6 +1,6 @@
from setuptools import setup, find_packages 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' 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. ' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. '
'This is an early stage release. Interfaces might change/brick') 'This is an early stage release. Interfaces might change/brick')

View File

@ -70,10 +70,6 @@ async function generate_feed(id) {
try { try {
//dvms = []
//store.commit('set_recommendation_dvms', dvms)
let client = store.state.client let client = store.state.client
let content = "NIP 90 Content Discovery request" let content = "NIP 90 Content Discovery request"
@ -135,18 +131,10 @@ async function listen() {
const handle = { const handle = {
// Handle event // Handle event
handleEvent: async (relayUrl, 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 let resonsetorequest = false
sleep(1200).then(async () => { sleep(1200).then(async () => {
for (let tag in event.tags) { for (let tag in event.tags) {
if (event.tags[tag].asVec()[0] === "e") { 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) { if (event.tags[tag].asVec()[1] === store.state.requestidRecommendation) {
resonsetorequest = true resonsetorequest = true
@ -157,7 +145,7 @@ async function listen() {
if (resonsetorequest === true) { if (resonsetorequest === true) {
if (event.kind === 7000) { if (event.kind === 7000) {
try { try {
console.log("7000: ", event.content); //console.log("7000: ", event.content);
// console.log("DVM: " + event.author.toHex()) // console.log("DVM: " + event.author.toHex())
//miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info) //miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info)
dvms.find(i => i.id === event.author.toHex()).laststatusid = event.id.toHex() 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 profiles = await get_user_infos([event.author])
let created = 0 let created = 0
if (profiles.length > 0) { if (profiles.length > 0) {
// for (const profile of profiles){
console.log(profiles[0].profile) console.log(profiles[0].profile)
let current = profiles[0] 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 !== "") { if (lud16 !== null && lud16 !== "") {
console.log("LUD16: " + lud16) console.log("LUD16: " + lud16)
@ -460,12 +441,6 @@ async function addDVM(event){
// for (const profile of profiles){ // for (const profile of profiles){
console.log(profiles[0].profile) console.log(profiles[0].profile)
let current = profiles[0] 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 !== ""){ if (lud16 !== null && lud16 !== ""){
console.log("LUD16: " + lud16) console.log("LUD16: " + lud16)
@ -486,14 +461,8 @@ async function addDVM(event){
} }
} }
} }
} }
//let dvm = store.state.nip89dvms.find(x => JSON.parse(x.event).pubkey === event.author.toHex()) //let dvm = store.state.nip89dvms.find(x => JSON.parse(x.event).pubkey === event.author.toHex())
for (const el of store.state.nip89dvms) { for (const el of store.state.nip89dvms) {
if (JSON.parse(el.event).pubkey === event.author.toHex()) { if (JSON.parse(el.event).pubkey === event.author.toHex()) {
@ -523,7 +492,6 @@ async function addDVM(event){
} }
async function cancelSubscription(kind7001, recipent){ async function cancelSubscription(kind7001, recipent){
console.log(kind7001) console.log(kind7001)
console.log(recipent) 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.hasActiveSubscription = true
dvms.find(x => x.nip88.eventid === this.current_subscription_dvm.nip88.eventid).nip88.expires = true dvms.find(x => x.nip88.eventid === this.current_subscription_dvm.nip88.eventid).nip88.expires = true
} }
async function subscribe_to_dvm() { async function subscribe_to_dvm() {
if (!localStorage.getItem("nostr-key-method") || localStorage.getItem("nostr-key-method") === "anon"){ if (!localStorage.getItem("nostr-key-method") || localStorage.getItem("nostr-key-method") === "anon"){
@ -560,15 +523,6 @@ 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 // 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 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)
if (this.current_subscription_dvm.nip88.subscriptionId === ""){ if (this.current_subscription_dvm.nip88.subscriptionId === ""){
console.log("Creating 7001 event") console.log("Creating 7001 event")
let tags = [ let tags = [
@ -576,9 +530,6 @@ async function subscribe_to_dvm() {
Tag.parse([ "e" , this.current_subscription_dvm.nip88.eventid]), Tag.parse([ "e" , this.current_subscription_dvm.nip88.eventid]),
Tag.parse([ "event", JSON.stringify(this.current_subscription_dvm.nip88.event)]), Tag.parse([ "event", JSON.stringify(this.current_subscription_dvm.nip88.event)]),
Tag.parse([ "amount", (this.current_subscription_amount).toString(), "msats", this.current_subscription_cadence]), 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) 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]) let zaptag = Tag.parse([ "zap", zap.key, zap.split])
tags.push(zaptag) tags.push(zaptag)
} }
/*
*/
let evt = new EventBuilder(7001, "Subscription from noogle.lol", tags) let evt = new EventBuilder(7001, "Subscription from noogle.lol", tags)
let res = await client.sendEventBuilder(evt); 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{ try{
let receiver = PublicKey.parse(store.state.subscription_verifier_pubkey) 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 signer = NostrSigner.keys(Keys.parse(store.state.nooglekey)) let signer = NostrSigner.keys(Keys.parse(store.state.nooglekey))
let nclient = new Client(signer) let nclient = new Client(signer)
@ -644,8 +569,6 @@ async function subscribe_to_dvm() {
"subscriber" : store.state.pubkey.toHex(), "subscriber" : store.state.pubkey.toHex(),
"zaps" : this.current_subscription_dvm.nip88.zaps "zaps" : this.current_subscription_dvm.nip88.zaps
} }
// TODO this is only for viewing, check event (happens on page reload now) // 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) 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) { async function zap_local(invoice) {
@ -732,9 +613,7 @@ async function zap_local(invoice) {
} }
async function store_nwc(){
async function store_nwc(){
if (this.nwcalby.startsWith("nostr")){ if (this.nwcalby.startsWith("nostr")){
@ -749,9 +628,7 @@ async function zap_local(invoice) {
this.current_subscription_nwc = this.nwc this.current_subscription_nwc = this.nwc
} }
} }
async function connect_alby_nwc(){ async function connect_alby_nwc(){
const alby = webln.NostrWebLNProvider.withNewSecret(); const alby = webln.NostrWebLNProvider.withNewSecret();
@ -797,13 +674,6 @@ const nwcconnector= ref("user");
const openModal = result => { const openModal = result => {
datetopost.value = Date.now(); datetopost.value = Date.now();
isModalOpened.value = true; isModalOpened.value = true;
//let resevents = ""
//for (let evt of result){
// resevents = resevents + "nostr:" + (evt.id.toBech32()) + "\n"
//}
modalcontent.value = result modalcontent.value = result
}; };
const closeModal = () => { const closeModal = () => {
@ -838,70 +708,34 @@ const closeNWCModal = () => {
<h2 class="text-base-200-content text-center tracking-wide text-2xl font-thin "> <h2 class="text-base-200-content text-center tracking-wide text-2xl font-thin ">
Algorithms, but you are the one in control.</h2> Algorithms, but you are the one in control.</h2>
<br> <br>
<button v-if="store.state.recommendationdvms.length === 0" class="v-Button">Loading DVMs..</button> <button v-if="store.state.recommendationdvms.length === 0" class="v-Button">Loading DVMs..</button>
</div> </div>
<br> <br>
<ModalComponent :isOpen="isModalOpened" @modal-close="closeModal" @submit="submitHandler" name="first-modal"> <ModalComponent :isOpen="isModalOpened" @modal-close="closeModal" @submit="submitHandler" name="first-modal">
<template #header>Summarize Results <br></template> <template #header>Summarize Results <br></template>
<template #content> <template #content>
<SummarizationGeneration :events="modalcontent"></SummarizationGeneration> <SummarizationGeneration :events="modalcontent"></SummarizationGeneration>
</template> </template>
<template #footer> <template #footer>
<!-- <div>
<VueDatePicker :min-date="new Date()" :teleport="false" :dark="true" position="right" className="bg-base-200 inline-flex flex-none" style="width: 220px;" v-model="datetopost"></VueDatePicker>
<button className="v-Button" @click="schedule(modalcontent, datetopost)" @click.stop="closeModal"><img width="25px" style="margin-right: 5px" src="../../public/shipyard.ico"/>Schedule Note with Shipyard DVM</button>
<br>
or
<br>
<button className="v-Button" style="margin-bottom: 0px" @click="post_note(modalcontent)" @click.stop="closeModal"><img width="25px" style="margin-right: 5px;" src="../../public/favicon.ico"/>Post Note now</button>
</div> -->
</template> </template>
</ModalComponent> </ModalComponent>
<div class=" relative space-y-3"> <div class=" relative space-y-3">
<div class="grid grid-cols-1 gap-6"> <div class="grid grid-cols-1 gap-6">
<div className="card w-70 bg-base-100 shadow-xl flex flex-col" v-for="dvm in store.state.recommendationdvms" <div className="card w-70 bg-base-100 shadow-xl flex flex-col" v-for="dvm in store.state.recommendationdvms"
:key="dvm.id"> :key="dvm.id">
<div className="card-body"> <div className="card-body">
<div className="playeauthor-wrapper">
<div className="playeauthor-wrapper">
<figure className="w-20"> <figure className="w-20">
<img className="avatar" v-if="dvm.image" :src="dvm.image" alt="DVM Picture" /> <img className="avatar" v-if="dvm.image" :src="dvm.image" alt="DVM Picture" />
<img class="avatar" v-else src="@/assets/nostr-purple.svg" /> <img class="avatar" v-else src="@/assets/nostr-purple.svg" />
</figure> </figure>
<h2 className="card-title">{{ dvm.name }}</h2> <h2 className="card-title">{{ dvm.name }}</h2>
</div> </div>
<h3 class="fa-cut" v-html="StringUtil.parseHyperlinks(dvm.about)"></h3> <h3 class="fa-cut" v-html="StringUtil.parseHyperlinks(dvm.about)"></h3>
<div className="card-actions justify-end mt-auto" > <div className="card-actions justify-end mt-auto" >
<div className="tooltip mt-auto"> <div className="tooltip mt-auto">
@ -944,12 +778,7 @@ const closeNWCModal = () => {
</div> </div>
</div> </div>
<div style="margin-left: auto; margin-right: 3px;"> <div style="margin-left: auto; margin-right: 3px;">
<p v-if="!dvm.subscription && dvm.amount.toString().toLowerCase()==='free'" class="badge bg-nostr" >Free</p> <p v-if="!dvm.subscription && dvm.amount.toString().toLowerCase()==='free'" class="badge bg-nostr" >Free</p>
<p v-if="!dvm.subscription && dvm.amount.toString().toLowerCase()==='flexible'" class="badge bg-nostr2" >Flexible</p> <p v-if="!dvm.subscription && dvm.amount.toString().toLowerCase()==='flexible'" class="badge bg-nostr2" >Flexible</p>
@ -958,21 +787,15 @@ const closeNWCModal = () => {
</div> </div>
<div> <div>
<div class="playeauthor-wrapper" v-if="dvm.nip88"> <div class="playeauthor-wrapper" v-if="dvm.nip88">
<button v-if="!dvm.nip88.hasActiveSubscription" onclick='subscr.showModal()' class="relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800"> <button v-if="!dvm.nip88.hasActiveSubscription" onclick='subscr.showModal()' class="relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800">
<span class="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">Subscription <span class="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">Subscription
</span> </span>
</button> </button>
<button v-if="dvm.nip88.hasActiveSubscription" onclick='subscr.showModal()' class=" relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800"> <button v-if="dvm.nip88.hasActiveSubscription" onclick='subscr.showModal()' class=" relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800">
<span class="relative px-5 py-2.5 transition-all ease-in duration-75 rounded-md group-hover:bg-opacity-0"> <span class="relative px-5 py-2.5 transition-all ease-in duration-75 rounded-md group-hover:bg-opacity-0">
Active Subscription Active Subscription</span>
</span>
</button> </button>
<dialog id="nwc_modal" class="modal"> <dialog id="nwc_modal" class="modal">
<div class="modal-box rounded-3xl inner shadow-lg p-6 flex flex-col items-center transition-all duration-1000 bg-base-600/60 "> <div class="modal-box rounded-3xl inner shadow-lg p-6 flex flex-col items-center transition-all duration-1000 bg-base-600/60 ">
<h3 class="font-bold text-lg">Connect with Nostr Wallet Connect</h3> <h3 class="font-bold text-lg">Connect with Nostr Wallet Connect</h3>
@ -1020,7 +843,7 @@ const closeNWCModal = () => {
<p style="margin-top: 20px;" v-if="nwcalby.startsWith('nostr')">Connected to Alby Wallet.</p> <p style="margin-top: 20px;" v-if="nwcalby.startsWith('nostr')">Connected to Alby Wallet.</p>
</div> </div>
</div> </div>
<div class="collapse bg-base-200"> <div class="collapse bg-base-200">
<input type="radio" name="my-accordion-1" /> <input type="radio" name="my-accordion-1" />
<div class="collapse-title text-xl font-medium bg-black/30 flex"> <div class="collapse-title text-xl font-medium bg-black/30 flex">
@ -1075,7 +898,7 @@ const closeNWCModal = () => {
</div> </div>
</div> </div>
</dialog> </dialog>
<dialog id="subscr" class="modal"> <dialog id="subscr" class="modal">
<div className="modal-box rounded-3xl inner shadow-lg p-6 flex flex-col items-center transition-all duration-1000 bg-gradient-to-br from-pink-500 to-orange-400 "> <div className="modal-box rounded-3xl inner shadow-lg p-6 flex flex-col items-center transition-all duration-1000 bg-gradient-to-br from-pink-500 to-orange-400 ">
@ -1130,70 +953,10 @@ const closeNWCModal = () => {
</dialog> </dialog>
<!-- <div v-if="dvm.nip88.hasActiveSubscription" className="dropdown" >
<div tabIndex={0} role="button" >
<button class=" relative inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800">
<span class="relative px-5 py-2.5 transition-all ease-in duration-75 rounded-md group-hover:bg-opacity-0">
Active Subscription
</span>
</button>
<p class=" text-sm sub-Button text-orange-400"> Active Subscription </p>
</div>
<div style="z-index: 10000" tabIndex={0} className="dropdown-content start-12 z-[1] horizontal card card-compact w-96 p-2 shadow bg-orange-500 text-primary-content">
<img style="flex: content" :src="dvm.nip88.image"></img>
<div class="glass" className="card-body">
<h3 className="card-title">{{dvm.nip88.title}}</h3>
<h3 style="text-align: left">{{dvm.nip88.description}}</h3>
<br>
<h3 className="card-title">Perks:</h3>
<div v-for="perk in dvm.nip88.perks">
<p style="text-align: left">{{perk}}</p>
</div>
<br>
<div v-for="index in dvm.nip88.amounts">
<br>
<h3 >Subscribe and pay {{index.cadence}}</h3>
<button className="sub-Button" @click="subscribe(dvm.lud16, index.amount, index.cadence, dvm.event, dvm.eventid, dvm.id)">{{ index.amount/1000 }} Sats</button>
</div> </div>
<br>
<button class="btn">Unsubscribe (todo)</button>
</div>
</div>
</div> -->
</div>
<!-- <div tabIndex={0} role="button" class="Button" >
<p v-if="dvm.subscription!==''" class="text-sm text-gray-600 rounded" >Subscription active until
{{Timestamp.fromSecs(parseInt(dvm.subscription)).toHumanDatetime().split("T")[0].split("-")[2].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.subscription)).toHumanDatetime().split("T")[0].split("-")[1].trim()}}.{{Timestamp.fromSecs(parseInt(dvm.subscription)).toHumanDatetime().split("T")[0].split("-")[0].trim().slice(2)}} {{Timestamp.fromSecs(parseInt(dvm.subscription)).toHumanDatetime().split("T")[1].split("Z")[0].trim()}}</p>
</div> -->
<!-- <div tabIndex={0} style="z-index: 100000;" className="dropdown-content -start-56 z-[1] horizontal card card-compact w-64 p-2 shadow bg-orange-500 text-primary-content">
<div className="card-body">
<h3 className="card-title">Subscribe for a day</h3>
<button className="sub-Button" @click="subscribe(dvm.lud16, 1, dvm.amount/1000, dvm.laststatusid, dvm.id)">{{ dvm.amount/1000 }} Sats</button>
<h3 className="card-title">Subscribe for a month</h3>
<button className="sub-Button" @click="subscribe(dvm.lud16, 30, dvm.amount/1000, dvm.laststatusid, dvm.id)">{{ 30 * dvm.amount/1000 }} Sats</button>
</div>
</div>
</div>-->
<p v-if="dvm.amount.toString()===''" ></p> <p v-if="dvm.amount.toString()===''" ></p>
<p v-if="dvm.subscription ==='' && !isNaN(parseInt(dvm.amount)) && dvm.status !=='subscription-required' && dvm.status !=='subscription-success'" class="badge bg-amber" ><div class="flex"><svg style="margin-top:3px" xmlns="http://www.w3.org/2000/svg" width="14" height="16" fill="currentColor" class="bi bi-lightning" viewBox="0 0 16 20"> <p v-if="dvm.subscription ==='' && !isNaN(parseInt(dvm.amount)) && dvm.status !=='subscription-required' && dvm.status !=='subscription-success'" class="badge bg-amber" ><div class="flex"><svg style="margin-top:3px" xmlns="http://www.w3.org/2000/svg" width="14" height="16" fill="currentColor" class="bi bi-lightning" viewBox="0 0 16 20">
<path d="M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641zM6.374 1 4.168 8.5H7.5a.5.5 0 0 1 .478.647L6.78 13.04 11.478 7H8a.5.5 0 0 1-.474-.658L9.306 1z"/></svg> {{dvm.amount/1000}}</div></p> <path d="M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641zM6.374 1 4.168 8.5H7.5a.5.5 0 0 1 .478.647L6.78 13.04 11.478 7H8a.5.5 0 0 1-.474-.658L9.306 1z"/></svg> {{dvm.amount/1000}}</div></p>
</div> </div>
@ -1203,28 +966,20 @@ const closeNWCModal = () => {
<details open v-if="dvm.status === 'finished'" class="collapse bg-base"> <details open v-if="dvm.status === 'finished'" class="collapse bg-base">
<summary class="collapse-title "><div class="btn">Show/Hide Results</div></summary> <summary class="collapse-title "><div class="btn">Show/Hide Results</div></summary>
<div class="collapse-content font-size-0" className="z-10" id="collapse"> <div class="collapse-content font-size-0" className="z-10" id="collapse">
<NoteTable :data="dvm.result" ></NoteTable> <NoteTable :data="dvm.result" ></NoteTable>
</div> </div>
</details> </details>
<div data-tip="Make Summarization" v-if="dvm.status === 'finished' && store.state.pubkey.toHex() !== Keys.parse(store.state.nooglekey).publicKey.toHex()" > <div data-tip="Make Summarization" v-if="dvm.status === 'finished' && store.state.pubkey.toHex() !== Keys.parse(store.state.nooglekey).publicKey.toHex()" >
<button @click="openModal(dvm.result)" class="w-8 h-8 rounded-full bg-nostr border-white border-1 text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black tooltip" data-top='Share' aria-label="make note" role="button"> <button @click="openModal(dvm.result)" class="w-8 h-8 rounded-full bg-nostr border-white border-1 text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black tooltip" data-top='Share' aria-label="make note" role="button">
<svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"> <svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 19V.352A3.451 3.451 0 0 0 7.5 0a3.5 3.5 0 0 0-3.261 2.238A3.5 3.5 0 0 0 2.04 6.015a3.518 3.518 0 0 0-.766 1.128c-.042.1-.064.209-.1.313a3.34 3.34 0 0 0-.106.344 3.463 3.463 0 0 0 .02 1.468A4.016 4.016 0 0 0 .3 10.5l-.015.036a3.861 3.861 0 0 0-.216.779A3.968 3.968 0 0 0 0 12a4.032 4.032 0 0 0 .107.889 4 4 0 0 0 .2.659c.006.014.015.027.021.041a3.85 3.85 0 0 0 .417.727c.105.146.219.284.342.415.072.076.148.146.225.216.1.091.205.179.315.26.11.081.2.14.308.2.02.013.039.028.059.04v.053a3.506 3.506 0 0 0 3.03 3.469 3.426 3.426 0 0 0 4.154.577A.972.972 0 0 1 9 19Zm10.934-7.68a3.956 3.956 0 0 0-.215-.779l-.017-.038a4.016 4.016 0 0 0-.79-1.235 3.417 3.417 0 0 0 .017-1.468 3.387 3.387 0 0 0-.1-.333c-.034-.108-.057-.22-.1-.324a3.517 3.517 0 0 0-.766-1.128 3.5 3.5 0 0 0-2.202-3.777A3.5 3.5 0 0 0 12.5 0a3.451 3.451 0 0 0-1.5.352V19a.972.972 0 0 1-.184.546 3.426 3.426 0 0 0 4.154-.577A3.506 3.506 0 0 0 18 15.5v-.049c.02-.012.039-.027.059-.04.106-.064.208-.13.308-.2s.214-.169.315-.26c.077-.07.153-.14.225-.216a4.007 4.007 0 0 0 .459-.588c.115-.176.215-.361.3-.554.006-.014.015-.027.021-.041.087-.213.156-.434.205-.659.013-.057.024-.115.035-.173.046-.237.07-.478.073-.72a3.948 3.948 0 0 0-.066-.68Z"/> <path d="M9 19V.352A3.451 3.451 0 0 0 7.5 0a3.5 3.5 0 0 0-3.261 2.238A3.5 3.5 0 0 0 2.04 6.015a3.518 3.518 0 0 0-.766 1.128c-.042.1-.064.209-.1.313a3.34 3.34 0 0 0-.106.344 3.463 3.463 0 0 0 .02 1.468A4.016 4.016 0 0 0 .3 10.5l-.015.036a3.861 3.861 0 0 0-.216.779A3.968 3.968 0 0 0 0 12a4.032 4.032 0 0 0 .107.889 4 4 0 0 0 .2.659c.006.014.015.027.021.041a3.85 3.85 0 0 0 .417.727c.105.146.219.284.342.415.072.076.148.146.225.216.1.091.205.179.315.26.11.081.2.14.308.2.02.013.039.028.059.04v.053a3.506 3.506 0 0 0 3.03 3.469 3.426 3.426 0 0 0 4.154.577A.972.972 0 0 1 9 19Zm10.934-7.68a3.956 3.956 0 0 0-.215-.779l-.017-.038a4.016 4.016 0 0 0-.79-1.235 3.417 3.417 0 0 0 .017-1.468 3.387 3.387 0 0 0-.1-.333c-.034-.108-.057-.22-.1-.324a3.517 3.517 0 0 0-.766-1.128 3.5 3.5 0 0 0-2.202-3.777A3.5 3.5 0 0 0 12.5 0a3.451 3.451 0 0 0-1.5.352V19a.972.972 0 0 1-.184.546 3.426 3.426 0 0 0 4.154-.577A3.506 3.506 0 0 0 18 15.5v-.049c.02-.012.039-.027.059-.04.106-.064.208-.13.308-.2s.214-.169.315-.26c.077-.07.153-.14.225-.216a4.007 4.007 0 0 0 .459-.588c.115-.176.215-.361.3-.554.006-.014.015-.027.021-.041.087-.213.156-.434.205-.659.013-.057.024-.115.035-.173.046-.237.07-.478.073-.72a3.948 3.948 0 0 0-.066-.68Z"/>
</svg> </svg>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,574 +0,0 @@
<script setup>
import {
Client,
Filter,
Timestamp,
Event,
Metadata,
PublicKey,
EventBuilder,
Tag,
EventId,
Nip19Event, Alphabet, Keys, nip04_decrypt, SecretKey, Duration
} from "@rust-nostr/nostr-sdk";
import store from '../store';
import miniToastr from "mini-toastr";
import VueNotifications from "vue-notifications";
import {computed, watch} from "vue";
import deadnip89s from "@/components/data/deadnip89s.json";
import {data} from "autoprefixer";
import {requestProvider} from "webln";
import Newnote from "@/components/Newnote.vue";
import SummarizationGeneration from "@/components/SummarizationGeneration.vue"
import {post_note, schedule, copyurl, copyinvoice, sleep, getEvents, get_user_infos, nextInput, createBolt11Lud16, getEventsOriginalOrder} from "../components/helper/Helper.vue"
import amberSignerService from "./android-signer/AndroidSigner";
import StringUtil from "@/components/helper/string.ts";
let dvms =[]
async function generate_feed() {
try {
if(store.state.pubkey === undefined || localStorage.getItem('nostr-key-method') === "anon"){
miniToastr.showMessage("Some algorithms may need your profile to give personalized recommendations. Sign-in for a better experience.", "Not signed in.", VueNotifications.types.warn)
}
dvms = []
store.commit('set_recommendation_dvms', dvms)
let client = store.state.client
let content = "NIP 90 Content Discovery request"
let kind = 5300
let tags = []
let res;
let requestid;
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
let draft = {
content: content,
kind: kind,
pubkey: store.state.pubkey.toHex(),
tags: tags,
createdAt: Date.now()
};
res = await amberSignerService.signEvent(draft)
await client.sendEvent(Event.fromJson(JSON.stringify(res)))
requestid = res.id;
}
else {
let tags_t = []
for (let tag of tags){
tags_t.push(Tag.parse(tag))
}
let evt = new EventBuilder(kind, content, tags_t)
res = await client.sendEventBuilder(evt);
requestid = res.toHex();
}
store.commit('set_current_request_id_recommendation', requestid)
if (!store.state.recommendationehasEventListener){
store.commit('set_recommendationEventListener', true)
listen()
}
else{
console.log("Already has event listener")
}
} catch (error) {
console.log(error);
}
}
async function listen() {
let client = store.state.client
let pubkey = store.state.pubkey
const filter = new Filter().kinds([7000, 6300]).pubkey(pubkey).since(Timestamp.now());
await client.subscribe([filter]);
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
}
}
}
if (resonsetorequest === true) {
if (event.kind === 7000) {
try {
console.log("7000: ", event.content);
// console.log("DVM: " + event.author.toHex())
//miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info)
await addDVM(event)
} catch (error) {
console.log("Error: ", error);
}
}
else if (event.kind === 6300) {
let entries = []
//console.log("6300:", event.content);
let event_etags = JSON.parse(event.content)
if (event_etags.length > 0) {
for (let etag of event_etags) {
const eventid = EventId.fromHex(etag[1]).toHex()
entries.push(eventid)
}
const events = await getEventsOriginalOrder(entries)
let authors = []
for (const evt of events) {
authors.push(evt.author)
}
if (authors.length > 0) {
let profiles = await get_user_infos(authors)
let items = []
let index = 0
for (const evt of events) {
let p = profiles.find(record => record.author === evt.author.toHex())
let bech32id = evt.id.toBech32()
let nip19 = new Nip19Event(evt.id, evt.author, store.state.relays)
let nip19bech32 = nip19.toBech32()
let picture = p === undefined ? "../assets/nostr-purple.svg" : p["profile"]["picture"]
let name = p === undefined ? bech32id : p["profile"]["name"]
let highlighterurl = "https://highlighter.com/e/" + nip19bech32
let njumpurl = "https://njump.me/" + nip19bech32
let nostrudelurl = "https://nostrudel.ninja/#/n/" + bech32id
let uri = "nostr:" + bech32id // nip19.toNostrUri()
if (items.find(e => e.id.toHex() === evt.id.toHex()) === undefined) {
items.push({
id: evt.id,
content: evt.content,
author: name,
authorurl: "https://njump.me/" + evt.author.toBech32(),
links: {
"uri": uri,
"highlighter": highlighterurl,
"njump": njumpurl,
"nostrudel": nostrudelurl
},
avatar: picture,
index: index,
indicator: {"time": evt.createdAt.toHumanDatetime(), "index": index}
})
index = index+1
}
}
if (dvms.find(i => i.id === event.author.toHex()) === undefined){
await addDVM(event)
console.log("add dvm because of bug")
}
dvms.find(i => i.id === event.author.toHex()).result.length = 0
dvms.find(i => i.id === event.author.toHex()).result.push.apply(dvms.find(i => i.id === event.author.toHex()).result, items)
dvms.find(i => i.id === event.author.toHex()).status = "finished"
}
}
store.commit('set_recommendation_dvms', dvms)
}
}
})
},
// Handle relay message
handleMsg: async (relayUrl, message) => {
//console.log("Received message from", relayUrl, message.asJson());
}
};
client.handleNotifications(handle);
}
const urlinput = ref("");
async function addDVM(event){
let status = "unknown"
let jsonentry = {
id: event.author.toHex(),
kind: "",
status: status,
result: [],
name: event.author.toBech32(),
about: "",
image: "",
amount: 0,
bolt11: ""
}
for (const tag in event.tags) {
if (event.tags[tag].asVec()[0] === "status") {
status = event.tags[tag].asVec()[1]
}
if (event.tags[tag].asVec()[0] === "amount") {
jsonentry.amount = event.tags[tag].asVec()[1]
if (event.tags[tag].asVec().length > 2) {
jsonentry.bolt11 = event.tags[tag].asVec()[2]
}
else{
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)
jsonentry.bolt11 = await createBolt11Lud16(lud16, jsonentry.amount)
console.log(jsonentry.bolt11)
if(jsonentry.bolt11 === ""){
status = "error"
}
}
else {
console.log("NO LNURL")
}
}
else {
console.log("PROFILE NOT FOUND")
}
}
}
}
//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().toString()) {
jsonentry.name = el.name
jsonentry.about = el.about
jsonentry.image = el.image
console.log(jsonentry)
}
}
if (event.content !== "" && status !== "payment-required" && status !== "error" && status !== "finished" && status !== "paid"){
status = event.content
}
jsonentry.status = status
console.log(dvms)
if (dvms.filter(i => i.id === jsonentry.id).length === 0) {
dvms.push(jsonentry)
}
//dvms.find(i => i.id === jsonentry.id).status = status
store.commit('set_recommendation_dvms', dvms)
}
async function zap_local(invoice) {
let success = await zap(invoice)
if (success){
dvms.find(i => i.bolt11 === invoice).status = "paid"
store.commit('set_recommendation_results', dvms)
}
}
defineProps({
msg: {
type: String,
required: false
},
})
import { ref } from "vue";
import ModalComponent from "../components/Newnote.vue";
import VueDatePicker from "@vuepic/vue-datepicker";
import {timestamp} from "@vueuse/core";
import NoteTable from "@/components/NoteTable.vue";
import zap from "@/components/helper/Zap.vue";
const isModalOpened = ref(false);
const modalcontent = ref("");
const datetopost = ref(Date.now());
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 = () => {
isModalOpened.value = false;
};
const submitHandler = async () => {
}
</script>
<!-- font-thin bg-gradient-to-r from-white to-nostr bg-clip-text text-transparent -->
<template>
<div class="greetings">
<br>
<br>
<h1 class="text-7xl font-black tracking-wide">Noogle</h1>
<h1 class="text-7xl font-black tracking-wide">Content</h1>
<h1 class="text-7xl font-black tracking-wide">Discovery</h1>
<h2 class="text-base-200-content text-center tracking-wide text-2xl font-thin ">
Algorithms, but you are the one in control.</h2>
<h3>
<br>
<button class="v-Button" @click="generate_feed()">Recommend me Notes</button>
</h3>
</div>
<br>
<ModalComponent :isOpen="isModalOpened" @modal-close="closeModal" @submit="submitHandler" name="first-modal">
<template #header>Summarize Results <br></template>
<template #content>
<SummarizationGeneration :events="modalcontent"></SummarizationGeneration>
</template>
<template #footer>
<!-- <div>
<VueDatePicker :min-date="new Date()" :teleport="false" :dark="true" position="right" className="bg-base-200 inline-flex flex-none" style="width: 220px;" v-model="datetopost"></VueDatePicker>
<button className="v-Button" @click="schedule(modalcontent, datetopost)" @click.stop="closeModal"><img width="25px" style="margin-right: 5px" src="../../public/shipyard.ico"/>Schedule Note with Shipyard DVM</button>
<br>
or
<br>
<button className="v-Button" style="margin-bottom: 0px" @click="post_note(modalcontent)" @click.stop="closeModal"><img width="25px" style="margin-right: 5px;" src="../../public/favicon.ico"/>Post Note now</button>
</div> -->
</template>
</ModalComponent>
<div class=" relative space-y-3">
<div class="grid grid-cols-1 gap-6">
<div className="card w-70 bg-base-100 shadow-xl flex flex-col" v-for="dvm in store.state.recommendationdvms"
:key="dvm.id">
<div className="card-body">
<div className="playeauthor-wrapper">
<figure className="w-20">
<img className="avatar" v-if="dvm.image" :src="dvm.image" alt="DVM Picture" />
<img class="avatar" v-else src="@/assets/nostr-purple.svg" />
</figure>
<h2 className="card-title">{{ dvm.name }}</h2>
</div>
<h3 class="fa-cut" v-html="StringUtil.parseHyperlinks(dvm.about)"></h3>
<div className="card-actions justify-end mt-auto" >
<div className="tooltip mt-auto">
<button v-if="dvm.status !== 'finished' && dvm.status !== 'paid' && dvm.status !== 'payment-required' && dvm.status !== 'error'" className="btn">{{dvm.status}}</button>
<button v-if="dvm.status === 'finished'" className="btn">Done</button>
<button v-if="dvm.status === 'paid'" className="btn">Paid, waiting for DVM..</button>
<button v-if="dvm.status === 'error'" className="btn">Error</button>
<button v-if="dvm.status === 'payment-required'" className="zap-Button" @click="zap_local(dvm.bolt11);">{{ dvm.amount/1000 }} Sats</button>
</div>
</div>
<!-- <div v-if="dvm.result.length > 0" class="collapse bg-base-200">
<input type="checkbox" class="peer" />
<div class="collapse-title bg-primary text-primary-content peer-checked:bg-secondary peer-checked:text-secondary-content">
Click me to show/hide content
</div>
<div class="collapse-content bg-primary text-primary-content peer-checked:bg-base-200 peer-checked:text-accent">
</div>
</div> -->
<!-- <details open ></details> -->
<details v-if="dvm.status === 'finished'" class="collapse bg-base">
<summary class="collapse-title "><div class="btn">Show/Hide Results</div></summary>
<div class="collapse-content font-size-0" className="z-10" id="collapse">
<NoteTable :data="dvm.result" ></NoteTable>
</div>
</details>
<div data-tip="Make Summarization" v-if="dvm.result.length > 0 && store.state.pubkey.toHex() !== Keys.parse(store.state.nooglekey).publicKey.toHex()" >
<button @click="openModal(dvm.result)" class="w-8 h-8 rounded-full bg-nostr border-white border-1 text-white flex items-center justify-center focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black tooltip" data-top='Share' aria-label="make note" role="button">
<svg class="w-4 h-4 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 19V.352A3.451 3.451 0 0 0 7.5 0a3.5 3.5 0 0 0-3.261 2.238A3.5 3.5 0 0 0 2.04 6.015a3.518 3.518 0 0 0-.766 1.128c-.042.1-.064.209-.1.313a3.34 3.34 0 0 0-.106.344 3.463 3.463 0 0 0 .02 1.468A4.016 4.016 0 0 0 .3 10.5l-.015.036a3.861 3.861 0 0 0-.216.779A3.968 3.968 0 0 0 0 12a4.032 4.032 0 0 0 .107.889 4 4 0 0 0 .2.659c.006.014.015.027.021.041a3.85 3.85 0 0 0 .417.727c.105.146.219.284.342.415.072.076.148.146.225.216.1.091.205.179.315.26.11.081.2.14.308.2.02.013.039.028.059.04v.053a3.506 3.506 0 0 0 3.03 3.469 3.426 3.426 0 0 0 4.154.577A.972.972 0 0 1 9 19Zm10.934-7.68a3.956 3.956 0 0 0-.215-.779l-.017-.038a4.016 4.016 0 0 0-.79-1.235 3.417 3.417 0 0 0 .017-1.468 3.387 3.387 0 0 0-.1-.333c-.034-.108-.057-.22-.1-.324a3.517 3.517 0 0 0-.766-1.128 3.5 3.5 0 0 0-2.202-3.777A3.5 3.5 0 0 0 12.5 0a3.451 3.451 0 0 0-1.5.352V19a.972.972 0 0 1-.184.546 3.426 3.426 0 0 0 4.154-.577A3.506 3.506 0 0 0 18 15.5v-.049c.02-.012.039-.027.059-.04.106-.064.208-.13.308-.2s.214-.169.315-.26c.077-.07.153-.14.225-.216a4.007 4.007 0 0 0 .459-.588c.115-.176.215-.361.3-.554.006-.014.015-.027.021-.041.087-.213.156-.434.205-.659.013-.057.024-.115.035-.173.046-.237.07-.478.073-.72a3.948 3.948 0 0 0-.066-.68Z"/>
</svg>
</button>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.zap-Button{
@apply btn hover:bg-amber-400 border-amber-400 text-base;
bottom: 0;
}
.v-Button {
@apply bg-nostr hover:bg-nostr2 focus:ring-white mb-2 inline-flex flex-none items-center rounded-lg border border-black px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900;
height: 48px;
margin: 5px;
}
.c-Input {
@apply bg-base-200 text-accent dark:bg-black dark:text-white focus:ring-white mb-2 inline-flex flex-none items-center rounded-lg border border-transparent px-3 py-1.5 text-sm leading-4 text-accent-content transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900;
width: 350px;
height: 48px;
}
.d-Input {
@apply bg-black hover:bg-gray-900 focus:ring-white mb-2 inline-flex flex-none items-center rounded-lg border border-transparent px-3 py-1.5 text-sm leading-4 text-white transition-colors duration-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-white dark:focus:ring-offset-gray-900;
width: 300px;
color: white;
background: black;
}
.playeauthor-wrapper {
padding: 6px;
display: flex;
align-items: center;
justify-items: center;
}
.logo {
display: flex;
width:100%;
height:125px;
justify-content: center;
align-items: center;
}
h3 {
font-size: 1.0rem;
text-align: left;
}
.avatar {
margin-right: 10px;
margin-left: 0px;
display: inline-block;
width: 60px;
height: 60px;
border-radius: 50%;
object-fit: cover;
box-shadow: inset 0 4px 4px 0 rgb(0 0 0 / 10%);
}
.greetings h1,
.greetings h3 {
text-align: left;
}
.center {
text-align: center;
justify-content: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: center;
}
}
</style>