mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-06-13 13:50:54 +02:00
noogle: select search time
This commit is contained in:
parent
7a21454572
commit
9351e32c0f
@ -12,6 +12,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rust-nostr/nostr-sdk": "^0.10.0",
|
"@rust-nostr/nostr-sdk": "^0.10.0",
|
||||||
|
"@vuepic/vue-datepicker": "^7.4.1",
|
||||||
"@vueuse/core": "^10.7.2",
|
"@vueuse/core": "^10.7.2",
|
||||||
"bech32": "^2.0.0",
|
"bech32": "^2.0.0",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.2",
|
||||||
@ -25,9 +26,10 @@
|
|||||||
"webln": "^0.3.2"
|
"webln": "^0.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@tsconfig/node20": "^20.1.2",
|
||||||
|
"@types/node": "^20.11.10",
|
||||||
"@vitejs/plugin-vue": "^4.5.2",
|
"@vitejs/plugin-vue": "^4.5.2",
|
||||||
"@vue/tsconfig": "^0.5.1",
|
"@vue/tsconfig": "^0.5.1",
|
||||||
"@types/node": "^20.11.10",
|
|
||||||
"autoprefixer": "^10.4.17",
|
"autoprefixer": "^10.4.17",
|
||||||
"postcss": "^8.4.33",
|
"postcss": "^8.4.33",
|
||||||
"sass": "^1.70.0",
|
"sass": "^1.70.0",
|
||||||
@ -35,8 +37,7 @@
|
|||||||
"typescript": "~5.3.0",
|
"typescript": "~5.3.0",
|
||||||
"vite": "^5.0.10",
|
"vite": "^5.0.10",
|
||||||
"vue-router": "^4.2.5",
|
"vue-router": "^4.2.5",
|
||||||
"vue-tsc": "^1.8.27",
|
"vue-tsc": "^1.8.27"
|
||||||
"@tsconfig/node20": "^20.1.2"
|
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rollup/rollup-linux-x64-gnu": "4.6.1"
|
"@rollup/rollup-linux-x64-gnu": "4.6.1"
|
||||||
|
@ -17,7 +17,7 @@ import store from '../store';
|
|||||||
import miniToastr from "mini-toastr";
|
import miniToastr from "mini-toastr";
|
||||||
import VueNotifications from "vue-notifications";
|
import VueNotifications from "vue-notifications";
|
||||||
import searchdvms from './data/searchdvms.json'
|
import searchdvms from './data/searchdvms.json'
|
||||||
import {computed, defineEmits, watch} from "vue";
|
import {computed, watch} from "vue";
|
||||||
import countries from "@/components/data/countries.json";
|
import countries from "@/components/data/countries.json";
|
||||||
import deadnip89s from "@/components/data/deadnip89s.json";
|
import deadnip89s from "@/components/data/deadnip89s.json";
|
||||||
import {data} from "autoprefixer";
|
import {data} from "autoprefixer";
|
||||||
@ -42,18 +42,22 @@ const sleep = (ms) => {
|
|||||||
|
|
||||||
async function post_note(note){
|
async function post_note(note){
|
||||||
let client = store.state.client
|
let client = store.state.client
|
||||||
|
let tags = []
|
||||||
|
|
||||||
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
||||||
const draft = {
|
const draft = {
|
||||||
content: note,
|
content: note,
|
||||||
kind: 1,
|
kind: 1,
|
||||||
pubkey: store.state.pubkey.toHex(),
|
pubkey: store.state.pubkey.toHex(),
|
||||||
tags: [],
|
tags: tags,
|
||||||
createdAt: Date.now()
|
createdAt: Date.now()
|
||||||
};
|
};
|
||||||
const eventJson = await amberSignerService.signEvent(draft);
|
const eventJson = await amberSignerService.signEvent(draft);
|
||||||
await client.sendEvent(Event.fromJson(JSON.stringify(eventJson)));
|
await client.sendEvent(Event.fromJson(JSON.stringify(eventJson)));
|
||||||
} else {
|
}
|
||||||
await client.publishTextNote(note, []);
|
else
|
||||||
|
{
|
||||||
|
await client.publishTextNote(note, tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function generate_image(message) {
|
async function generate_image(message) {
|
||||||
@ -71,22 +75,24 @@ async function generate_image(message) {
|
|||||||
dvms = []
|
dvms = []
|
||||||
store.commit('set_imagedvm_results', dvms)
|
store.commit('set_imagedvm_results', dvms)
|
||||||
let client = store.state.client
|
let client = store.state.client
|
||||||
let tags = []
|
|
||||||
console.log(message)
|
|
||||||
tags.push(Tag.parse(["i", message, "text"]))
|
|
||||||
|
|
||||||
let evt = new EventBuilder(5100, "NIP 90 Image Generation request", tags)
|
let content = "NIP 90 Image Generation request"
|
||||||
|
let kind = 5100
|
||||||
|
let tags = [
|
||||||
|
["i", message, "text"]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let res;
|
let res;
|
||||||
let requestid;
|
let requestid;
|
||||||
|
|
||||||
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
||||||
let draft = {
|
let draft = {
|
||||||
content: "NIP 90 Image Generation request",
|
content: content,
|
||||||
kind: 5100,
|
kind: kind,
|
||||||
pubkey: store.state.pubkey.toHex(),
|
pubkey: store.state.pubkey.toHex(),
|
||||||
tags: [
|
tags: tags,
|
||||||
["i", message, "text"]
|
|
||||||
],
|
|
||||||
createdAt: Date.now()
|
createdAt: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,7 +100,15 @@ async function generate_image(message) {
|
|||||||
await client.sendEvent(Event.fromJson(JSON.stringify(res)))
|
await client.sendEvent(Event.fromJson(JSON.stringify(res)))
|
||||||
requestid = res.id;
|
requestid = res.id;
|
||||||
res = res.id;
|
res = res.id;
|
||||||
} else {
|
}
|
||||||
|
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);
|
res = await client.sendEventBuilder(evt);
|
||||||
requestid = res.toHex();
|
requestid = res.toHex();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { defineProps, defineEmits, ref } from "vue";
|
import { ref } from "vue";
|
||||||
import {onClickOutside} from '@vueuse/core'
|
import {onClickOutside} from '@vueuse/core'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -20,6 +20,8 @@ import countries from "@/components/data/countries.json";
|
|||||||
import deadnip89s from "@/components/data/deadnip89s.json";
|
import deadnip89s from "@/components/data/deadnip89s.json";
|
||||||
import Nip07 from "@/components/Nip07.vue";
|
import Nip07 from "@/components/Nip07.vue";
|
||||||
import amberSignerService from "./android-signer/AndroidSigner";
|
import amberSignerService from "./android-signer/AndroidSigner";
|
||||||
|
import VueDatePicker from '@vuepic/vue-datepicker';
|
||||||
|
import '@vuepic/vue-datepicker/dist/main.css'
|
||||||
|
|
||||||
let items = []
|
let items = []
|
||||||
let dvms =[]
|
let dvms =[]
|
||||||
@ -28,6 +30,12 @@ let searching = false
|
|||||||
|
|
||||||
const message = ref("");
|
const message = ref("");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const datefrom = ref(new Date().setFullYear(new Date().getFullYear() - 1));
|
||||||
|
const dateto = ref(Date.now());
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
let urlParams = new URLSearchParams(window.location.search);
|
let urlParams = new URLSearchParams(window.location.search);
|
||||||
if (urlParams.has('q')) {
|
if (urlParams.has('q')) {
|
||||||
@ -63,7 +71,7 @@ async function send_search_request(msg) {
|
|||||||
store.commit('set_search_results', items)
|
store.commit('set_search_results', items)
|
||||||
let client = store.state.client
|
let client = store.state.client
|
||||||
|
|
||||||
let tags = []
|
|
||||||
let users = [];
|
let users = [];
|
||||||
|
|
||||||
const taggedUsersFrom = msg.split(' ')
|
const taggedUsersFrom = msg.split(' ')
|
||||||
@ -72,9 +80,6 @@ async function send_search_request(msg) {
|
|||||||
|
|
||||||
// search
|
// search
|
||||||
let search = msg;
|
let search = msg;
|
||||||
|
|
||||||
// tags
|
|
||||||
|
|
||||||
for (let word of taggedUsersFrom) {
|
for (let word of taggedUsersFrom) {
|
||||||
search = search.replace(word, "");
|
search = search.replace(word, "");
|
||||||
if(word === "me"){
|
if(word === "me"){
|
||||||
@ -88,23 +93,27 @@ async function send_search_request(msg) {
|
|||||||
msg = search.replace(/from:|to:|@/g, '').trim();
|
msg = search.replace(/from:|to:|@/g, '').trim();
|
||||||
console.log(search);
|
console.log(search);
|
||||||
|
|
||||||
tags.push(Tag.parse(["i", msg, "text"]))
|
let content = "NIP 90 Search request"
|
||||||
tags.push(Tag.parse(["param", "max_results", "150"]))
|
let kind = 5302
|
||||||
tags.push(Tag.parse(['param', 'users', JSON.stringify(users)]))
|
console.log((datefrom.value/1000).toFixed(0))
|
||||||
|
console.log((dateto.value/1000).toFixed(0))
|
||||||
|
let tags = [
|
||||||
|
["i", msg, "text"],
|
||||||
|
["param", "max_results", "150"],
|
||||||
|
["param", "since", ((datefrom.value/1000).toFixed(0))],
|
||||||
|
["param", "until", ((dateto.value/1000).toFixed(0))],
|
||||||
|
['param', 'users', JSON.stringify(users)]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
let evt = new EventBuilder(5302, "NIP 90 Search request", tags)
|
|
||||||
let res;
|
let res;
|
||||||
let requestid;
|
let requestid;
|
||||||
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
if (localStorage.getItem('nostr-key-method') === 'android-signer') {
|
||||||
let draft = {
|
let draft = {
|
||||||
content: "NIP 90 Search request",
|
content: content,
|
||||||
kind: 5302,
|
kind: kind,
|
||||||
pubkey: store.state.pubkey.toHex(),
|
pubkey: store.state.pubkey.toHex(),
|
||||||
tags: [
|
tags: tags,
|
||||||
["i", msg, "text"],
|
|
||||||
["param", "max_results", "150"],
|
|
||||||
['param', 'users', JSON.stringify(users)]
|
|
||||||
],
|
|
||||||
createdAt: Date.now()
|
createdAt: Date.now()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -112,7 +121,15 @@ async function send_search_request(msg) {
|
|||||||
await client.sendEvent(Event.fromJson(JSON.stringify(res)))
|
await client.sendEvent(Event.fromJson(JSON.stringify(res)))
|
||||||
requestid = res.id;
|
requestid = res.id;
|
||||||
res = res.id;
|
res = res.id;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
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)
|
res = await client.sendEventBuilder(evt)
|
||||||
requestid = res.toHex()
|
requestid = res.toHex()
|
||||||
}
|
}
|
||||||
@ -379,12 +396,24 @@ defineProps({
|
|||||||
<button class="v-Button" @click="send_search_request(message)">Search the Nostr</button>
|
<button class="v-Button" @click="send_search_request(message)">Search the Nostr</button>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<!-- <details class="collapse bg-base">
|
<details class="collapse bg-base " className="advanced" >
|
||||||
<summary class="collapse-title font-thin bg ">Advanced Settings</summary>
|
<summary class="collapse-title font-thin bg">Advanced Options</summary>
|
||||||
<div class="collapse-content">
|
<div class="collapse-content font-size-0" className="z-10" id="collapse-settings">
|
||||||
<p>content</p>
|
<div>
|
||||||
|
<h4 className="inline-flex flex-none font-thin">from:</h4>
|
||||||
|
<div className="inline-flex flex-none" style="width: 10px;"></div>
|
||||||
|
<VueDatePicker :teleport="true" :dark="true" position="left" className="bg-base-200 inline-flex flex-none" style="width: 220px;" v-model="datefrom"></VueDatePicker>
|
||||||
</div>
|
</div>
|
||||||
</details> -->
|
|
||||||
|
<div className="inline-flex flex-none" style="width: 20px;"></div>
|
||||||
|
<div>
|
||||||
|
<h4 className="inline-flex font-thin ">until: </h4>
|
||||||
|
<div className="inline-flex flex-none" style="width: 10px;"></div>
|
||||||
|
<VueDatePicker :teleport="true" :dark="true" position="left" className="bg-base-200 inline-flex flex-none" style="width: 220px;" v-model="dateto"></VueDatePicker>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="max-w-5xl relative space-y-3">
|
<div class="max-w-5xl relative space-y-3">
|
||||||
@ -441,6 +470,10 @@ h3 {
|
|||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
font-size: 1.0rem;
|
||||||
|
}
|
||||||
|
|
||||||
.greetings h1,
|
.greetings h1,
|
||||||
.greetings h3 {
|
.greetings h3 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -9,6 +9,12 @@ import 'vue3-easy-data-table/dist/style.css';
|
|||||||
import router from './router'
|
import router from './router'
|
||||||
import Vue3EasyDataTable from 'vue3-easy-data-table';
|
import Vue3EasyDataTable from 'vue3-easy-data-table';
|
||||||
|
|
||||||
|
import VueDatePicker from '@vuepic/vue-datepicker';
|
||||||
|
import '@vuepic/vue-datepicker/dist/main.css'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -32,13 +38,11 @@ const options = {
|
|||||||
}
|
}
|
||||||
//This is all for notifications end
|
//This is all for notifications end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
createApp(App)
|
createApp(App)
|
||||||
.use(VueNotifications, options)
|
.use(VueNotifications, options)
|
||||||
.use(store)
|
.use(store)
|
||||||
.use(router)
|
.use(router)
|
||||||
|
|
||||||
.component('EasyDataTable', Vue3EasyDataTable)
|
.component('EasyDataTable', Vue3EasyDataTable)
|
||||||
|
.component('VueDatePicker', VueDatePicker)
|
||||||
.mount('#app')
|
.mount('#app')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user