some cleanup

This commit is contained in:
Believethehype
2024-02-02 11:23:58 +01:00
parent 9351e32c0f
commit efc89c01cb
6 changed files with 60 additions and 47 deletions

View File

@@ -138,7 +138,7 @@ class AdvancedSearch(DVMTaskInterface):
for event in events: for event in events:
e_tag = Tag.parse(["e", event.id().to_hex()]) 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()) result_list.append(e_tag.as_vec())
return json.dumps(result_list) return json.dumps(result_list)

View File

@@ -338,6 +338,7 @@ import ModalComponent from "../components/Newnote.vue";
const isModalOpened = ref(false); const isModalOpened = ref(false);
const modalcontent = ref(""); const modalcontent = ref("");
const openModal = result => { const openModal = result => {
isModalOpened.value = true; isModalOpened.value = true;
modalcontent.value = result modalcontent.value = result
@@ -347,7 +348,7 @@ const closeModal = () => {
}; };
const submitHandler = async () => { const submitHandler = async () => {
console.log("hello")
await post_note(modalcontent) await post_note(modalcontent)
} }

View File

@@ -1,6 +1,8 @@
<script setup> <script setup>
import { ref } from "vue"; import { ref } from "vue";
import {onClickOutside} from '@vueuse/core' import {onClickOutside} from '@vueuse/core'
import store from "@/store.js";
import {EventBuilder, nip04_encrypt, Tag, Timestamp} from "@rust-nostr/nostr-sdk";
const props = defineProps({ const props = defineProps({
isOpen: Boolean, isOpen: Boolean,
@@ -11,6 +13,37 @@ const emit = defineEmits(["modal-close"]);
const target = ref(null) const target = ref(null)
onClickOutside(target, ()=>emit('modal-close')) 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> </script>
<template> <template>
@@ -27,6 +60,7 @@ onClickOutside(target, ()=>emit('modal-close'))
<slot name="footer"> <slot name="footer">
<div> <div>
<button @click.stop="emit('modal-close')">Submit</button> <button @click.stop="emit('modal-close')">Submit</button>
<button @click.stop="schedule(Date.now())">Schedule</button>
</div> </div>
</slot> </slot>
</div> </div>

View File

@@ -64,7 +64,11 @@ export default {
if (jsonentry.picture){ if (jsonentry.picture){
jsonentry.image = jsonentry.picture jsonentry.image = jsonentry.picture
} }
else if (!jsonentry.picture && !jsonentry.image){
jsonentry.image = "../assets/nostr-purple.svg"
}
jsonentry.event = entry.asJson() jsonentry.event = entry.asJson()
jsonentry.id = entry.id.toHex()
jsonentry.createdAt = entry.createdAt.asSecs() jsonentry.createdAt = entry.createdAt.asSecs()
jsonentry.kind = entry.tags[tag].asVec()[1] jsonentry.kind = entry.tags[tag].asVec()[1]
nip89dvms.push(jsonentry); nip89dvms.push(jsonentry);

View File

@@ -1,47 +1,25 @@
<template> <template>
<div class="grid gap-6 ">
<div class="max-w-5xl relative space-y-3"> <div className="card w-70 bg-base-100 shadow-xl" v-for="dvm in store.state.nip89dvms"
<div class="grid grid-cols-1 gap-6"> :key="dvm.id">
<br>
<div className="card w-70 bg-base-100 shadow-xl flex flex-col" v-for="dvm in store.state.nip89dvms" <h2 className="card-title justify-center">{{ dvm.name }}</h2>
:key="dvm.id"> <div className="card-body">
<div className="playeauthor-wrapper flex align-top">
<figure className="w-40">
<img className="avatar" :src="dvm.image" alt="DVM Picture" />
</figure>
<div className="card-body"> </div>
<br>
<div className="playeauthor-wrapper">
<figure className="w-20">
<img className="avatar" :src="dvm.image" alt="DVM Picture" />
</figure>
<h2 className="card-title">{{ dvm.name }}</h2>
</div>
<h3 class="fa-cut" >{{ dvm.about }}</h3> <h3 class="fa-cut" >{{ dvm.about }}</h3>
<div className="card-actions justify-end mt-auto" > <div className="card-actions justify-end mt-auto" >
<div className="card-actions justify-end"> <div className="card-actions justify-end">
<div className="tooltip" :data-tip="dvm.event"> <button className="btn" @click="copyDoiToClipboard(dvm.event);">Copy Event Json</button>
<button className="btn" @click="copyDoiToClipboard(dvm.event);">Copy Event</button> </div>
</div> </div>
</div>
</div>
</div> </div>
</div>
</div> </div>
</div>
</div>
</template> </template>
<script> <script>
@@ -54,10 +32,6 @@ import VueNotifications from "vue-notifications";
import deadnip89s from './data/deadnip89s.json' import deadnip89s from './data/deadnip89s.json'
export default { export default {
computed: { computed: {
Keys() { Keys() {

View File

@@ -203,8 +203,8 @@ 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") {
console.log("SEARCH ETAG: " + event.tags[tag].asVec()[1]) //console.log("SEARCH ETAG: " + event.tags[tag].asVec()[1])
console.log("SEARCH LISTEN TO : " + store.state.requestidSearch) // console.log("SEARCH LISTEN TO : " + store.state.requestidSearch)
if (event.tags[tag].asVec()[1] === store.state.requestidSearch) { if (event.tags[tag].asVec()[1] === store.state.requestidSearch) {
resonsetorequest = true resonsetorequest = true
} }