noogle: cleanup / add first version of profile filter

This commit is contained in:
Believethehype
2024-04-22 16:11:54 +02:00
parent a450db4f5d
commit 032a3a2ec8
12 changed files with 1572 additions and 106 deletions

View File

@@ -25,8 +25,8 @@ Params: None
class DiscoverInactiveFollows(DVMTaskInterface): class DiscoverInactiveFollows(DVMTaskInterface):
KIND: Kind = EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY KIND: Kind = EventDefinitions.KIND_NIP90_PEOPLE_DISCOVERY
TASK: str = "inactive-follows" TASK: str = "inactive-followings"
FIX_COST: float = 0 FIX_COST: float = 100
client: Client client: Client
dvm_config: DVMConfig dvm_config: DVMConfig
@@ -204,6 +204,7 @@ def build_example(name, identifier, admin_config):
"name": name, "name": name,
"image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg", "image": "https://image.nostr.build/c33ca6fc4cc038ca4adb46fdfdfda34951656f87ee364ef59095bae1495ce669.jpg",
"about": "I discover users you follow, but that have been inactive on Nostr", "about": "I discover users you follow, but that have been inactive on Nostr",
"action": "unfollow", #follow, mute, unmute
"encryptionSupported": True, "encryptionSupported": True,
"cashuAccepted": True, "cashuAccepted": True,
"nip90Params": { "nip90Params": {

File diff suppressed because one or more lines are too long

View File

@@ -36,16 +36,11 @@ import StringUtil from "@/components/helper/string.ts";
let dvms =[] let dvms =[]
let hasmultipleinputs = false let hasmultipleinputs = false
let requestids = []
async function generate_image(message) { async function generate_image(message) {
if (!store.state.imagehasEventListener){
store.commit('set_imagehasEventListener', true)
listen()
} listen()
else{
console.log("Already has event listener")
}
try { try {
if (message === undefined){ if (message === undefined){
@@ -89,7 +84,8 @@ async function generate_image(message) {
res = await amberSignerService.signEvent(draft) res = await amberSignerService.signEvent(draft)
requestid = res.id requestid = res.id
store.commit('set_current_request_id_image', requestid) requestids.push(requestid)
store.commit('set_current_request_id_image', requestids)
await client.sendEvent(Event.fromJson(JSON.stringify(res))) await client.sendEvent(Event.fromJson(JSON.stringify(res)))
} }
@@ -106,7 +102,8 @@ async function generate_image(message) {
let signedEvent = await (await client.signer()).signEvent(unsigned) let signedEvent = await (await client.signer()).signEvent(unsigned)
console.log(signedEvent.id.toHex()) console.log(signedEvent.id.toHex())
requestid = signedEvent.id.toHex() requestid = signedEvent.id.toHex()
store.commit('set_current_request_id_image', requestid) requestids.push(requestid)
store.commit('set_current_request_id_image', requestids)
await client.sendEvent(signedEvent) await client.sendEvent(signedEvent)
@@ -139,9 +136,7 @@ async function listen() {
sleep(0).then(async () => { sleep(0).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("IMAGE ETAG: " + event.tags[tag].asVec()[1]) if (store.state.requestidImage.includes(event.tags[tag].asVec()[1])){
//console.log("IMAGE LISTEN TO : " + store.state.requestidImage)
if (event.tags[tag].asVec()[1] === store.state.requestidImage) {
resonsetorequest = true resonsetorequest = true
} }
} }
@@ -182,7 +177,7 @@ async function listen() {
jsonentry.bolt11 = event.tags[tag].asVec()[2] jsonentry.bolt11 = event.tags[tag].asVec()[2]
} }
else{ else{
let profiles = await get_user_infos([event.author]) let profiles = await get_user_infos([event.author.toHex()])
let created = 0 let created = 0
let current let current
console.log("NUM KIND0 FOUND " + profiles.length) console.log("NUM KIND0 FOUND " + profiles.length)

View File

@@ -189,7 +189,7 @@ import {
Options, Options,
Duration, Duration,
PublicKey, PublicKey,
Nip46Signer, NegentropyDirection, NegentropyOptions, NostrSigner, RelayLimits Nip46Signer, NegentropyDirection, NegentropyOptions, NostrSigner, RelayLimits, Contact
} from "@rust-nostr/nostr-sdk"; } from "@rust-nostr/nostr-sdk";
import VueNotifications from "vue-notifications"; import VueNotifications from "vue-notifications";
import store from '../store'; import store from '../store';
@@ -372,7 +372,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', pubkey) store.commit('set_pubkey', pubkey)
store.commit('set_hasEventListener', false)
localStorage.setItem('nostr-key-method', "nostr-login") localStorage.setItem('nostr-key-method', "nostr-login")
localStorage.setItem('nostr-key', pubkey.toHex()) localStorage.setItem('nostr-key', pubkey.toHex())
console.log("Client Nip46 connected") console.log("Client Nip46 connected")
@@ -426,7 +425,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', pubkey) store.commit('set_pubkey', pubkey)
store.commit('set_hasEventListener', false)
console.log("LOGINANON") console.log("LOGINANON")
localStorage.setItem('nostr-key-method', "anon") localStorage.setItem('nostr-key-method', "anon")
localStorage.setItem('nostr-key', "") localStorage.setItem('nostr-key', "")
@@ -489,7 +487,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', pubkey) store.commit('set_pubkey', pubkey)
store.commit('set_hasEventListener', false)
console.log("LOGIN with Key") console.log("LOGIN with Key")
localStorage.setItem('nostr-key-method', "nsec") localStorage.setItem('nostr-key-method', "nsec")
localStorage.setItem('nostr-key', keys.publicKey.toHex()) localStorage.setItem('nostr-key', keys.publicKey.toHex())
@@ -557,7 +554,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', pubkey) store.commit('set_pubkey', pubkey)
store.commit('set_hasEventListener', false)
localStorage.setItem('nostr-key-method', "nip07") localStorage.setItem('nostr-key-method', "nip07")
localStorage.setItem('nostr-key', pubkey.toHex()) localStorage.setItem('nostr-key', pubkey.toHex())
@@ -629,7 +625,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', pubkey) store.commit('set_pubkey', pubkey)
store.commit('set_hasEventListener', false)
localStorage.setItem('nostr-key-method', "nip46") localStorage.setItem('nostr-key-method', "nip46")
localStorage.setItem('nostr-key', connectionstring) localStorage.setItem('nostr-key', connectionstring)
console.log("Client connected") console.log("Client connected")
@@ -692,7 +687,6 @@ export default {
store.commit('set_client', client) store.commit('set_client', client)
store.commit('set_signer', this.signer) store.commit('set_signer', this.signer)
store.commit('set_pubkey', publicKey) store.commit('set_pubkey', publicKey)
store.commit('set_hasEventListener', false)
localStorage.setItem('nostr-key-method', "android-signer") localStorage.setItem('nostr-key-method', "android-signer")
localStorage.setItem('nostr-key', hexKey) localStorage.setItem('nostr-key', hexKey)
@@ -789,6 +783,10 @@ export default {
jsonentry.encryptionSupported = false jsonentry.encryptionSupported = false
} }
if(!jsonentry.action){
jsonentry.action = "None"
}
if(!jsonentry.cashuAccepted){ if(!jsonentry.cashuAccepted){
jsonentry.cashuAccepted = false jsonentry.cashuAccepted = false
} }
@@ -904,7 +902,8 @@ export default {
let opts = new NegentropyOptions().direction(direction); let opts = new NegentropyOptions().direction(direction);
let followings = [] let followings = [] //TODO legacy, try to remove with contacts
let contacts = []
let ids = [] let ids = []
let followers_filter = new Filter().author(publicKey).kind(3).limit(1) let followers_filter = new Filter().author(publicKey).kind(3).limit(1)
let followers = await dbclient.getEventsOf([followers_filter], Duration.fromSecs(5)) let followers = await dbclient.getEventsOf([followers_filter], Duration.fromSecs(5))
@@ -917,19 +916,22 @@ export default {
for (let tag of followers[0].tags) { for (let tag of followers[0].tags) {
if (tag.asVec()[0] === "p") { if (tag.asVec()[0] === "p") {
let following = tag.asVec()[1] let following = tag.asVec()[1]
let contact = new Contact(PublicKey.parse(tag.asVec()[1]), tag.asVec()[2], tag.asVec()[3])
contacts.push(contact)
followings.push(PublicKey.parse(following)) followings.push(PublicKey.parse(following))
ids.push((following)) ids.push(following)
} }
} }
} }
console.log("Followings: " + (followings.length).toString()) console.log("Contacts: " + (contacts.length).toString())
//console.log(followings) //console.log(followings)
let filter = new Filter().kind(0).authors(followings) let filter = new Filter().kind(0).authors(followings)
store.commit('set_followings', ids) store.commit('set_followings', ids)
store.commit('set_contacts', contacts)
let mute_filter = new Filter().author(publicKey).kind(10000) let mute_filter = new Filter().author(publicKey).kind(10000)
let mutes = await dbclient.getEventsOf([mute_filter], Duration.fromSecs(5)) let mutes = await dbclient.getEventsOf([mute_filter], Duration.fromSecs(5))

View File

@@ -1,27 +0,0 @@
<script>
import ImageGeneration from "@/components/ImageGeneration.vue";
import Donate from "@/components/Donate.vue";
import RecommendationGeneration from "@/components/RecommendationGeneration.vue";
export default {
name: "Recommendation",
components: {RecommendationGeneration}
}
</script>
<template>
<div class="center">
<br>
<RecommendationGeneration/>
<br>
</div>
</template>
<style scoped>
.center {
text-align: center;
justify-content: center;
}
</style>

View File

@@ -326,7 +326,7 @@ async function listen() {
if (event.tags[tag].asVec().length > 2) { if (event.tags[tag].asVec().length > 2) {
dvms.find(i => i.id === event.author.toHex()).bolt11 = event.tags[tag].asVec()[2] dvms.find(i => i.id === event.author.toHex()).bolt11 = event.tags[tag].asVec()[2]
} else { } else {
let profiles = await get_user_infos([event.author]) let profiles = await get_user_infos([event.author.toHex()])
let created = 0 let created = 0
if (profiles.length > 0) { if (profiles.length > 0) {
console.log(profiles[0].profile) console.log(profiles[0].profile)
@@ -408,7 +408,7 @@ async function listen() {
for (const evt of events) { for (const evt of events) {
try{ try{
authors.push(evt.author) authors.push(evt.author.toHex())
} }
catch(error){ catch(error){
//console.log(error) //console.log(error)
@@ -594,7 +594,8 @@ async function addAllContentDVMs() {
bolt11: "", bolt11: "",
lud16: el.lud16, lud16: el.lud16,
subscription: "", subscription: "",
nip88: el.nip88 nip88: el.nip88,
action: el.action
} }
@@ -638,7 +639,7 @@ async function addDVM(event){
jsonentry.bolt11 = event.tags[tag].asVec()[2] jsonentry.bolt11 = event.tags[tag].asVec()[2]
} }
else{ else{
let profiles = await get_user_infos([event.author]) let profiles = await get_user_infos([event.author.toHex()])
let created = 0 let created = 0
if (profiles.length > 0){ if (profiles.length > 0){
// for (const profile of profiles){ // for (const profile of profiles){
@@ -1291,6 +1292,8 @@ const submitHandler = async () => {
<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>

View File

@@ -278,7 +278,7 @@ async function listen() {
const events = await getEvents(entries) const events = await getEvents(entries)
let authors = [] let authors = []
for (const evt of events) { for (const evt of events) {
authors.push(evt.author) authors.push(evt.author.toHex())
} }
if (authors.length > 0) { if (authors.length > 0) {
let profiles = await get_user_infos(authors) let profiles = await get_user_infos(authors)
@@ -337,7 +337,7 @@ async function listen() {
let authors = [] let authors = []
if (event_ptags.length > 0) { if (event_ptags.length > 0) {
for (let ptag of event_ptags) { for (let ptag of event_ptags) {
authors.push(PublicKey.parse(ptag[1])) authors.push(ptag[1])
} }
if (authors.length > 0) { if (authors.length > 0) {

View File

@@ -32,15 +32,13 @@ import {zap} from "@/components/helper/Zap.vue";
import index from "vuex"; import index from "vuex";
let dvms =[] let dvms =[]
let requestids = []
async function summarizefeed(eventids) { async function summarizefeed(eventids) {
if (!store.state.summarizationhasEventListener){
store.commit('set_summariarizationEventListener', true)
listen() listen()
}
else{
console.log("Already has event listener")
}
let sortedIds = eventids.sort(function(a,b) {return (a.index > b.index) ? 1 : ((b.index > a.index) ? -1 : 0);} ); let sortedIds = eventids.sort(function(a,b) {return (a.index > b.index) ? 1 : ((b.index > a.index) ? -1 : 0);} );
try { try {
@@ -94,8 +92,8 @@ let sortedIds = eventids.sort(function(a,b) {return (a.index > b.index) ? 1 : ((
} }
requestids.push(requestid)
store.commit('set_current_request_id_summarization', requestid) store.commit('set_current_request_id_summarization', requestids)
} catch (error) { } catch (error) {
@@ -125,7 +123,7 @@ async function listen() {
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") {
if (event.tags[tag].asVec()[1] === store.state.requestidSummarization) { if (store.state.requestidSummarization.includes(event.tags[tag].asVec()[1])){
resonsetorequest = true resonsetorequest = true
} }
} }
@@ -163,7 +161,7 @@ async function listen() {
jsonentry.bolt11 = event.tags[tag].asVec()[2] jsonentry.bolt11 = event.tags[tag].asVec()[2]
} }
else{ else{
let profiles = await get_user_infos([event.author]) let profiles = await get_user_infos([event.author.toHex()])
let created = 0 let created = 0
let current let current
console.log("NUM KIND0 FOUND " + profiles.length) console.log("NUM KIND0 FOUND " + profiles.length)

View File

@@ -65,9 +65,7 @@ export async function react_to_dvm(dvm, reaction) {
} }
let pk = PublicKey.parse(store.state.pubkey.toHex()) let users = await get_user_infos([store.state.pubkey])
let users = await get_user_infos([pk])
console.log(users[0]) console.log(users[0])
if (reaction === "👎"){ if (reaction === "👎"){
dvm.reactions.negativeUser = true dvm.reactions.negativeUser = true
@@ -165,9 +163,13 @@ export function nextInput(e) {
} }
export async function get_user_infos(pubkeys){ export async function get_user_infos(pubkeys){
let pkeys = []
for (let pk of pubkeys){
pkeys.push(PublicKey.parse(pk))
}
let profiles = [] let profiles = []
let client = store.state.client let client = store.state.client
const profile_filter = new Filter().kind(0).authors(pubkeys) const profile_filter = new Filter().kind(0).authors(pkeys)
let evts = await client.getEventsOf([profile_filter], Duration.fromSecs(10)) let evts = await client.getEventsOf([profile_filter], Duration.fromSecs(10))
for (const entry of evts){ for (const entry of evts){
@@ -351,7 +353,7 @@ export async function parseandreplacenpubs(note){
//console.log(pk.toBech32()) //console.log(pk.toBech32())
try{ try{
let pk = PublicKey.parse(myArray[word].replace("nostr:", "")) let pk = PublicKey.parse(myArray[word].replace("nostr:", ""))
let profiles = await get_user_infos([pk]) let profiles = await get_user_infos([pk.toHex()])
console.log(profiles) console.log(profiles)
//console.log(profiles[0].profile.nip05) //console.log(profiles[0].profile.nip05)
myArray[word] = profiles[0].profile.nip05 // replace with nip05 for now myArray[word] = profiles[0].profile.nip05 // replace with nip05 for now
@@ -392,7 +394,7 @@ export async function parseandreplacenpubsName(note){
//console.log(pk.toBech32()) //console.log(pk.toBech32())
try{ try{
let pk = PublicKey.parse(myArray[word].replace("nostr:", "")) let pk = PublicKey.parse(myArray[word].replace("nostr:", ""))
let profiles = await get_user_infos([pk]) let profiles = await get_user_infos([pk.toHex()])
//console.log(profiles[0].profile.nip05) //console.log(profiles[0].profile.nip05)
// myArray[word] = "<a class='purple' target=\"_blank\" href=\"https://njump.com/" + myArray[word].replace("nostr:", "") +" \">" + profiles[0].profile.name + "</a> " // myArray[word] = "<a class='purple' target=\"_blank\" href=\"https://njump.com/" + myArray[word].replace("nostr:", "") +" \">" + profiles[0].profile.name + "</a> "
@@ -444,7 +446,7 @@ export async function dvmreactions(dvmid, authors) {
let evts = await client.getEventsOf([reactionfilter], Duration.fromSecs(5)) let evts = await client.getEventsOf([reactionfilter], Duration.fromSecs(5))
let npubs = [] let npubs = []
for (let evt of evts){ for (let evt of evts){
npubs.push(evt.author) npubs.push(evt.author.toHex())
} }
let users = await get_user_infos(npubs) let users = await get_user_infos(npubs)

View File

@@ -10,11 +10,15 @@ import {isVisible} from "bootstrap/js/src/util/index.js";
</div> </div>
<div className="flex-1"> <div className="flex-1">
<div class="scroll">
<router-link class="menu" to="/">Search</router-link> <router-link class="menu" to="/">Search</router-link>
<router-link class="menu" to="/discover">Discover</router-link> <router-link class="menu" to="/discover">Discover</router-link>
<router-link class="menu" to="/image">Create</router-link> <router-link class="menu" to="/image">Create</router-link>
<router-link class="menu" to="/filter">Filter</router-link>
<router-link class="menu" to="/nip89">DVMs</router-link> <router-link class="menu" to="/nip89">DVMs</router-link>
</div> </div>
</div>
<Login/> <Login/>
</div> </div>
@@ -50,6 +54,16 @@ import {isVisible} from "bootstrap/js/src/util/index.js";
"aside" "aside"
"footer"; "footer";
div.scroll {
margin: 4px;
padding: 4px;
background-color: #08c708;
width: 300px;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
}
header { header {
grid-area: header; grid-area: header;
margin-top: 30px; margin-top: 30px;

View File

@@ -8,7 +8,9 @@ const routes = [
{ path: "/donate", component: () => import("@/components/Donate.vue") }, { path: "/donate", component: () => import("@/components/Donate.vue") },
{ path: "/nip89", component: () => import("@/components/Nip89view.vue") }, { path: "/nip89", component: () => import("@/components/Nip89view.vue") },
{ path: "/image", component: () => import("@/components/Image.vue") }, { path: "/image", component: () => import("@/components/Image.vue") },
{ path: "/discover", component: () => import("@/components/Recommendation.vue") }, { path: "/filter", component: () => import("@/components/FilterGeneration.vue") },
{ path: "/discover", component: () => import("@/components/RecommendationGeneration.vue") },
{ path: "/article/:id", component: () => import("@/components/Home.vue") }, { path: "/article/:id", component: () => import("@/components/Home.vue") },
{ path: '/:pathMatch(.*)*', component: () => import("@/components/Home.vue") }, { path: '/:pathMatch(.*)*', component: () => import("@/components/Home.vue") },
]; ];

View File

@@ -10,30 +10,27 @@ const store = createStore({
dbclient: Client, dbclient: Client,
pubkey: PublicKey, pubkey: PublicKey,
followings: [], followings: [],
contacts: [],
mutes: [], mutes: [],
nooglekey: import.meta.env.VITE_NOOGLE_PK, nooglekey: import.meta.env.VITE_NOOGLE_PK,
subscription_verifier_pubkey: import.meta.env.VITE_SUBSCRIPTIPON_VERIFIER_PUBKEY, subscription_verifier_pubkey: import.meta.env.VITE_SUBSCRIPTIPON_VERIFIER_PUBKEY,
requestidSearch: String, requestidSearch: String,
requestidSearchProfile: String, requestidSearchProfile: String,
requestidImage: String, requestidImage: [],
requestidRecommendation: [], requestidRecommendation: [],
requestidSummarization: String, requestidSummarization: [],
hasEventListener: false, requestidFilter: [],
imagehasEventListener: false,
recommendationehasEventListener: false,
summarizationhasEventListener: false,
imagedvmreplies: [], imagedvmreplies: [],
nip89dvms: [], nip89dvms: [],
activesearchdvms: [], activesearchdvms: [],
recommendationdvms: [], recommendationdvms: [],
filterdvms: [],
summarizationdvms: [], summarizationdvms: [],
results: [], results: [],
profile_results: [], profile_results: [],
relays: [ relays: ["wss://relay.damus.io", "wss://nos.lol", "wss://nostr.wine",
"wss://relay.damus.io", "wss://nostr.mom", "wss://nostr.oxtr.dev", "wss://relay.nostr.bg",
"wss://nos.lol", "wss://pablof7z.nostr1.com", "wss://relay.nostr.net", "wss://140.f7z.io",
"wss://pablof7z.nostr1.com",
], ],
} }
}, },
@@ -57,25 +54,17 @@ const store = createStore({
state.followings.length = 0 state.followings.length = 0
state.followings.push.apply(state.followings, items) state.followings.push.apply(state.followings, items)
}, },
set_contacts(state, items) {
state.contacts.length = 0
state.contacts.push.apply(state.contacts, items)
},
set_mutes(state, items) { set_mutes(state, items) {
state.mutes.length = 0 state.mutes.length = 0
state.mutes.push.apply(state.mutes, items) state.mutes.push.apply(state.mutes, items)
}, },
set_hasEventListener(state, hasEventListener) {
state.hasEventListener = hasEventListener
},
set_imagehasEventListener(state, imagehasEventListener) {
state.imagehasEventListener = imagehasEventListener
},
set_recommendationEventListener(state, recommendationehasEventListener) {
state.recommendationehasEventListener = recommendationehasEventListener
},
set_summariarizationEventListener(state, summarizationhasEventListener) {
state.summarizationhasEventListener = summarizationhasEventListener
},
set_nip89dvms(state, nip89dvms) { set_nip89dvms(state, nip89dvms) {
state.nip89dvms.length = 0 state.nip89dvms.length = 0
@@ -91,9 +80,14 @@ const store = createStore({
}, },
set_current_request_id_summarization(state, requestid){ set_current_request_id_summarization(state, requestid){
state.requestidSummarization = String(requestid) state.requestidSummarization.length = 0
state.requestidSummarization.push.apply(state.requestidSummarization, requestid)
}, },
set_current_request_id_filter(state, requestid){
state.requestidFilter.length = 0
state.requestidFilter.push.apply(state.requestidFilter, requestid)
},
set_current_request_profile_id_search(state, requestid){ set_current_request_profile_id_search(state, requestid){
state.requestidSearchProfile = String(requestid) state.requestidSearchProfile = String(requestid)
}, },
@@ -106,6 +100,11 @@ const store = createStore({
state.recommendationdvms.push.apply(state.recommendationdvms, dvms) state.recommendationdvms.push.apply(state.recommendationdvms, dvms)
}, },
set_filter_dvms(state, dvms) {
state.filterdvms.length = 0
state.filterdvms.push.apply(state.filterdvms, dvms)
},
set_summarization_dvms(state, dvms) { set_summarization_dvms(state, dvms) {
state.summarizationdvms.length = 0 state.summarizationdvms.length = 0
state.summarizationdvms.push.apply(state.summarizationdvms, dvms) state.summarizationdvms.push.apply(state.summarizationdvms, dvms)
@@ -115,7 +114,8 @@ const store = createStore({
state.profile_results.push.apply(state.profile_results, items) state.profile_results.push.apply(state.profile_results, items)
}, },
set_current_request_id_image(state, requestid){ set_current_request_id_image(state, requestid){
state.requestidImage = requestid state.requestidImage.length = 0
state.requestidImage.push.apply(state.requestidImage, requestid)
}, },
set_current_request_id_recommendation(state, requestid){ set_current_request_id_recommendation(state, requestid){
state.requestidRecommendation.length = 0 state.requestidRecommendation.length = 0