mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-11-18 05:46:40 +01:00
some cleanup
This commit is contained in:
@@ -138,7 +138,7 @@ class AdvancedSearch(DVMTaskInterface):
|
||||
|
||||
for event in events:
|
||||
e_tag = Tag.parse(["e", event.id().to_hex()])
|
||||
print(e_tag.as_vec())
|
||||
#print(e_tag.as_vec())
|
||||
result_list.append(e_tag.as_vec())
|
||||
|
||||
return json.dumps(result_list)
|
||||
|
||||
@@ -338,6 +338,7 @@ import ModalComponent from "../components/Newnote.vue";
|
||||
const isModalOpened = ref(false);
|
||||
const modalcontent = ref("");
|
||||
|
||||
|
||||
const openModal = result => {
|
||||
isModalOpened.value = true;
|
||||
modalcontent.value = result
|
||||
@@ -347,7 +348,7 @@ const closeModal = () => {
|
||||
};
|
||||
|
||||
const submitHandler = async () => {
|
||||
console.log("hello")
|
||||
|
||||
await post_note(modalcontent)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import {onClickOutside} from '@vueuse/core'
|
||||
import store from "@/store.js";
|
||||
import {EventBuilder, nip04_encrypt, Tag, Timestamp} from "@rust-nostr/nostr-sdk";
|
||||
|
||||
const props = defineProps({
|
||||
isOpen: Boolean,
|
||||
@@ -11,6 +13,37 @@ const emit = defineEmits(["modal-close"]);
|
||||
const target = ref(null)
|
||||
onClickOutside(target, ()=>emit('modal-close'))
|
||||
|
||||
async function schedule(time) {
|
||||
time = time + 1000 * 60 * 60 //for testing move 1 hour to future, replace with actual time later.
|
||||
|
||||
let draft = {
|
||||
content: "Test",
|
||||
kind: 1,
|
||||
pubkey: store.state.pubkey.toHex(),
|
||||
tags: [],
|
||||
createdAt: Date.now()
|
||||
};
|
||||
|
||||
let stringifyiedevent = Event.fromJson(JSON.stringify(draft))
|
||||
let contenttags = []
|
||||
contenttags.push(Tag.parse(["i", stringifyiedevent, "text"]))
|
||||
contenttags.push(Tag.parse(["param", "relays", "wss://now.lol"]))
|
||||
let client = store.state.client
|
||||
client.nip04_encrypt()
|
||||
//nip04_encrypt() contenttags.toString()
|
||||
|
||||
let tags_t = []
|
||||
tags_t.push(Tag.parse(["p", "fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"]))
|
||||
tags_t.push(Tag.parse(["encrypted"]))
|
||||
|
||||
let evt = new EventBuilder(5905, content, tags_t)
|
||||
evt.customCreatedAt(Timestamp.fromSecs())
|
||||
|
||||
let res = await client.sendEventBuilder(evt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -27,6 +60,7 @@ onClickOutside(target, ()=>emit('modal-close'))
|
||||
<slot name="footer">
|
||||
<div>
|
||||
<button @click.stop="emit('modal-close')">Submit</button>
|
||||
<button @click.stop="schedule(Date.now())">Schedule</button>
|
||||
</div>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
@@ -64,7 +64,11 @@ export default {
|
||||
if (jsonentry.picture){
|
||||
jsonentry.image = jsonentry.picture
|
||||
}
|
||||
else if (!jsonentry.picture && !jsonentry.image){
|
||||
jsonentry.image = "../assets/nostr-purple.svg"
|
||||
}
|
||||
jsonentry.event = entry.asJson()
|
||||
jsonentry.id = entry.id.toHex()
|
||||
jsonentry.createdAt = entry.createdAt.asSecs()
|
||||
jsonentry.kind = entry.tags[tag].asVec()[1]
|
||||
nip89dvms.push(jsonentry);
|
||||
|
||||
@@ -1,47 +1,25 @@
|
||||
<template>
|
||||
|
||||
<div class="max-w-5xl 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.nip89dvms"
|
||||
<div class="grid gap-6 ">
|
||||
<div className="card w-70 bg-base-100 shadow-xl" v-for="dvm in store.state.nip89dvms"
|
||||
:key="dvm.id">
|
||||
|
||||
|
||||
|
||||
|
||||
<br>
|
||||
<h2 className="card-title justify-center">{{ dvm.name }}</h2>
|
||||
<div className="card-body">
|
||||
|
||||
<div className="playeauthor-wrapper">
|
||||
<figure className="w-20">
|
||||
<div className="playeauthor-wrapper flex align-top">
|
||||
<figure className="w-40">
|
||||
<img className="avatar" :src="dvm.image" alt="DVM Picture" />
|
||||
</figure>
|
||||
|
||||
|
||||
<h2 className="card-title">{{ dvm.name }}</h2>
|
||||
</div>
|
||||
<br>
|
||||
<h3 class="fa-cut" >{{ dvm.about }}</h3>
|
||||
|
||||
|
||||
|
||||
<div className="card-actions justify-end mt-auto" >
|
||||
|
||||
<div className="card-actions justify-end">
|
||||
<div className="tooltip" :data-tip="dvm.event">
|
||||
<button className="btn" @click="copyDoiToClipboard(dvm.event);">Copy Event</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<button className="btn" @click="copyDoiToClipboard(dvm.event);">Copy Event Json</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -54,10 +32,6 @@ import VueNotifications from "vue-notifications";
|
||||
|
||||
import deadnip89s from './data/deadnip89s.json'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
Keys() {
|
||||
|
||||
@@ -203,8 +203,8 @@ async function listen() {
|
||||
|
||||
for (let tag in event.tags) {
|
||||
if (event.tags[tag].asVec()[0] === "e") {
|
||||
console.log("SEARCH ETAG: " + event.tags[tag].asVec()[1])
|
||||
console.log("SEARCH LISTEN TO : " + store.state.requestidSearch)
|
||||
//console.log("SEARCH ETAG: " + event.tags[tag].asVec()[1])
|
||||
// console.log("SEARCH LISTEN TO : " + store.state.requestidSearch)
|
||||
if (event.tags[tag].asVec()[1] === store.state.requestidSearch) {
|
||||
resonsetorequest = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user