mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-11 00:02:28 +02:00
cleanup
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -177,3 +177,6 @@ cache/
|
||||
cookies_snapshot/satoshi2077@protonmail.com.json
|
||||
Todo.md
|
||||
tests/gui/svelte/node_modules
|
||||
tests/gui/vuejs/noogle/node_modules
|
||||
tests/gui/vuejs/noogle/.idea/
|
||||
tests/gui/vuejs/noogle/package-lock.json
|
||||
|
@@ -12,55 +12,10 @@ const props = defineProps({
|
||||
author: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
avatar: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
authorurl: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
async function getEvent(eventid){
|
||||
const event_filter = new Filter().id(EventId.fromHex(eventid)).limit(1)
|
||||
let client = store.state.client
|
||||
let evts = await client.getEventsOf([event_filter], 5)
|
||||
return evts[0]
|
||||
}
|
||||
|
||||
|
||||
async function parseContent(pubkey) {
|
||||
let name = PublicKey.fromHex(pubkey).toBech32()
|
||||
let nip05 = ""
|
||||
let lud16 = ""
|
||||
let picture = ""
|
||||
const profile_filter = new Filter().kind(0).author(PublicKey.fromHex(pubkey)).limit(1)
|
||||
let client = store.state.client
|
||||
let evts = await client.getEventsOf([profile_filter], 5)
|
||||
console.log("PROFILES:" + evts.length)
|
||||
if (evts.length > 0) {
|
||||
let latest_entry = evts[0]
|
||||
let latest_time = 0
|
||||
|
||||
for (const entry of evts) {
|
||||
if (entry.createdAt.asSecs() > latest_time) {
|
||||
latest_time = entry.createdAt.asSecs();
|
||||
latest_entry = entry
|
||||
}
|
||||
}
|
||||
|
||||
let profile = JSON.parse(latest_entry.content);
|
||||
name = profile["name"]
|
||||
picture = profile["picture"]
|
||||
console.log(picture)
|
||||
return name
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async function get_user_info(pubkey){
|
||||
let client = store.state.client
|
||||
const profile_filter = new Filter().kind(0).author(PublicKey.fromHex(pubkey)).limit(1)
|
||||
@@ -85,6 +40,7 @@ async function get_user_info(pubkey){
|
||||
const content_placeholder = ref()
|
||||
const author_placeholder = ref()
|
||||
const author_image_placeholder = ref()
|
||||
const author_url_placeholder = ref()
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
@@ -92,6 +48,7 @@ onMounted(async () => {
|
||||
content_placeholder.value = "Event not found"
|
||||
author_placeholder.value = ""
|
||||
author_image_placeholder.value = ""
|
||||
author_url_placeholder.value = ""
|
||||
|
||||
|
||||
content_placeholder.value = props.content //TODO furher parse content
|
||||
@@ -100,6 +57,7 @@ onMounted(async () => {
|
||||
console.log(profile)
|
||||
author_placeholder.value = profile["name"]
|
||||
author_image_placeholder.value = profile["picture"]
|
||||
author_url_placeholder.value = "https://njump.me/" + PublicKey.fromHex(props.author).toBech32()
|
||||
|
||||
})
|
||||
|
||||
@@ -109,7 +67,7 @@ onMounted(async () => {
|
||||
|
||||
<template><div class="playeauthor-wrapper">
|
||||
<img class="avatar" :src="author_image_placeholder" alt="" />
|
||||
<a :href="author_placeholder">{{ author_placeholder}}</a> </div>
|
||||
<a :href="author_url_placeholder" target="_blank">{{ author_placeholder}}</a> </div>
|
||||
<p>{{ content_placeholder }}</p>
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<EasyDataTable table-class-name="customize-table"
|
||||
<EasyDataTable v-if="store.state.results.length != 0" table-class-name="customize-table"
|
||||
:headers="headers"
|
||||
:items="store.state.results">
|
||||
<template #item-content="{ content, author}">
|
||||
@@ -15,9 +15,6 @@ import store from '../store';
|
||||
import NoteRender from "@/components/NoteRender.vue";
|
||||
import {EventId, Filter} from "@rust-nostr/nostr-sdk";
|
||||
|
||||
|
||||
|
||||
|
||||
const headers: Header[] = [
|
||||
{ text: "Results:", value: "content", width: 400},
|
||||
{ text: "Time", value: "indicator.time", sortable: true},
|
||||
|
@@ -3,57 +3,6 @@ import {Client, Filter, Timestamp, Event, Metadata, PublicKey, EventBuilder, Tag
|
||||
import store from '../store';
|
||||
|
||||
let items = []
|
||||
async function get_some_stuff(message) {
|
||||
try {
|
||||
if (message === undefined){
|
||||
message = "Nostr"
|
||||
}
|
||||
|
||||
//console.log( store.state.test + " " + message)
|
||||
const filter = new Filter().kind(1).limit(20).search(message);
|
||||
//console.log('filter', filter.asJson());
|
||||
let client = store.state.client
|
||||
let events = await client.getEventsOf([filter], 3);
|
||||
//console.log(events.length)
|
||||
let items = []
|
||||
for (const e of events) {
|
||||
let name = e.pubkey.toBech32()
|
||||
let nip05 = ""
|
||||
let lud16 = ""
|
||||
let picture = ""
|
||||
//console.log(e.pubkey.toHex())
|
||||
const profile_filter = new Filter().kind(0).author(e.pubkey).limit(1)
|
||||
let evts = await client.getEventsOf([profile_filter], 5)
|
||||
if (evts.length > 0){
|
||||
let latest_entry = evts[0]
|
||||
let latest_time = 0
|
||||
|
||||
for (const entry of evts){
|
||||
if (entry.createdAt.asSecs() > latest_time){
|
||||
latest_time = entry.createdAt.asSecs();
|
||||
latest_entry = entry
|
||||
}
|
||||
}
|
||||
|
||||
let profile = JSON.parse(latest_entry.content);
|
||||
name = profile["name"]
|
||||
picture = profile["picture"]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
items.push({ content: e.content, author: name, authorurl: "https://njump.me/" + e.pubkey.toBech32(), avatar:
|
||||
picture, indicator: {"time": e.createdAt.toHumanDatetime()}})
|
||||
//console.log(e.asJson())
|
||||
}
|
||||
store.commit('set_search_results', items)
|
||||
|
||||
//await client.publishTextNote("Test from Rust Nostr SDK JavaScript bindings with NIP07 signer!", []);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
async function send_search_request(message) {
|
||||
try {
|
||||
@@ -135,10 +84,6 @@ defineProps({
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user