mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-11-18 14:06:55 +01:00
noogle: more mobile optimizations
This commit is contained in:
@@ -402,7 +402,7 @@ const submitHandler = async () => {
|
|||||||
|
|
||||||
<div className="card-actions justify-end mt-auto" >
|
<div className="card-actions justify-end mt-auto" >
|
||||||
|
|
||||||
<div className="tooltip mt-auto" :data-tip="dvm.status">
|
<div className="tooltip mt-auto" >
|
||||||
|
|
||||||
|
|
||||||
<button v-if="dvm.status === 'processing'" className="btn">Processing</button>
|
<button v-if="dvm.status === 'processing'" className="btn">Processing</button>
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ export default {
|
|||||||
this.supports_android_signer = true;
|
this.supports_android_signer = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (localStorage.getItem('nostr-key-method') === 'nip07') {
|
if (localStorage.getItem('nostr-key-method') === 'nip07') {
|
||||||
await this.sign_in_nip07()
|
await this.sign_in_nip07()
|
||||||
}
|
}
|
||||||
@@ -148,10 +150,14 @@ export default {
|
|||||||
}
|
}
|
||||||
await this.sign_in_amber(key)
|
await this.sign_in_amber(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else {
|
else {
|
||||||
await this.sign_in_anon()
|
await this.sign_in_anon()
|
||||||
}
|
}
|
||||||
await this.getnip89s()
|
await this.getnip89s()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@@ -211,7 +217,7 @@ export default {
|
|||||||
localStorage.setItem('nostr-key', '')
|
localStorage.setItem('nostr-key', '')
|
||||||
console.log("Client Nip46 connected")
|
console.log("Client Nip46 connected")
|
||||||
await this.get_user_info(pubkey)
|
await this.get_user_info(pubkey)
|
||||||
await this.reconcile_all_profiles(pubkey)
|
this.reconcile_all_profiles(pubkey)
|
||||||
console.log(pubkey.toBech32())
|
console.log(pubkey.toBech32())
|
||||||
//await this.reconcile_all_profiles()
|
//await this.reconcile_all_profiles()
|
||||||
|
|
||||||
@@ -327,7 +333,7 @@ export default {
|
|||||||
localStorage.setItem('nostr-key', keys.secretKey.toBech32())
|
localStorage.setItem('nostr-key', keys.secretKey.toBech32())
|
||||||
console.log("Client key connected")
|
console.log("Client key connected")
|
||||||
await this.get_user_info(pubkey)
|
await this.get_user_info(pubkey)
|
||||||
await this.reconcile_all_profiles(pubkey)
|
this.reconcile_all_profiles(pubkey)
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -392,8 +398,8 @@ export default {
|
|||||||
localStorage.setItem('nostr-key', pubkey.toHex())
|
localStorage.setItem('nostr-key', pubkey.toHex())
|
||||||
console.log("Client Nip07 connected")
|
console.log("Client Nip07 connected")
|
||||||
await this.get_user_info(pubkey)
|
await this.get_user_info(pubkey)
|
||||||
await this.getnip89s()
|
|
||||||
await this.reconcile_all_profiles(pubkey)
|
this.reconcile_all_profiles(pubkey)
|
||||||
//await this.reconcile_all_profiles()
|
//await this.reconcile_all_profiles()
|
||||||
//miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success)
|
//miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success)
|
||||||
|
|
||||||
@@ -460,10 +466,11 @@ export default {
|
|||||||
localStorage.setItem('nostr-key', connectionstring)
|
localStorage.setItem('nostr-key', connectionstring)
|
||||||
console.log("Client connected")
|
console.log("Client connected")
|
||||||
|
|
||||||
await this.get_user_info(pubkey)
|
|
||||||
|
|
||||||
|
|
||||||
await this.reconcile_all_profiles(pubkey)
|
|
||||||
|
this.reconcile_all_profiles(pubkey)
|
||||||
|
await this.get_user_info(pubkey)
|
||||||
|
|
||||||
//miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success)
|
//miniToastr.showMessage("Login successful!", "Logged in as " + this.current_user, VueNotifications.types.success)
|
||||||
|
|
||||||
@@ -520,10 +527,9 @@ export default {
|
|||||||
localStorage.setItem('nostr-key-method', "android-signer")
|
localStorage.setItem('nostr-key-method', "android-signer")
|
||||||
localStorage.setItem('nostr-key', hexKey)
|
localStorage.setItem('nostr-key', hexKey)
|
||||||
|
|
||||||
await this.get_user_info(publicKey)
|
|
||||||
|
|
||||||
|
this.reconcile_all_profiles(publicKey)
|
||||||
await this.reconcile_all_profiles(publicKey)
|
await this.get_user_info(publicKey)
|
||||||
}
|
}
|
||||||
catch (error){
|
catch (error){
|
||||||
alert(error)
|
alert(error)
|
||||||
@@ -538,13 +544,16 @@ export default {
|
|||||||
async getnip89s(){
|
async getnip89s(){
|
||||||
|
|
||||||
//let keys = Keys.generate()
|
//let keys = Keys.generate()
|
||||||
let keys = Keys.parse("ece3c0aa759c3e895ecb3c13ab3813c0f98430c6d4bd22160b9c2219efc9cf0e")
|
let keys = Keys.parse("ece3c0aa759c3e895ecb3c13ab3813c0f98430c6d4bd22160b9c2219efc9cf0e")
|
||||||
let signer = NostrSigner.keys(keys) //TODO store keys
|
let signer = NostrSigner.keys(keys) //TODO store keys
|
||||||
let client = new ClientBuilder().signer(signer).build()
|
let client = new ClientBuilder().signer(signer).build()
|
||||||
for (const relay of store.state.relays){
|
|
||||||
await client.addRelay(relay);
|
for (const relay of store.state.relays) {
|
||||||
}
|
await client.addRelay(relay);
|
||||||
await client.connect();
|
}
|
||||||
|
await client.connect();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let dvmkinds = []
|
let dvmkinds = []
|
||||||
for (let i = 5000; i < 6000; i++) {
|
for (let i = 5000; i < 6000; i++) {
|
||||||
|
|||||||
@@ -33,16 +33,13 @@ async function generate_feed() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if(store.state.pubkey === undefined || localStorage.getItem('nostr-key-method') === "anon"){
|
if(store.state.pubkey === undefined || localStorage.getItem('nostr-key-method') === "anon"){
|
||||||
miniToastr.showMessage("In order to receive personalized recommendations, sign-in first.", "Not signed in.", VueNotifications.types.warn)
|
miniToastr.showMessage("Some algorithms may need your profile to give personalized recommendations. Sign-in for a better experience.", "Not signed in.", VueNotifications.types.warn)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let dvm of dvms){
|
|
||||||
dvm = {}
|
|
||||||
dvms.pop()
|
|
||||||
}
|
|
||||||
dvms = []
|
dvms = []
|
||||||
store.commit('set_recommendation_dvms', dvms)
|
store.commit('set_recommendation_dvms', dvms)
|
||||||
|
|
||||||
let client = store.state.client
|
let client = store.state.client
|
||||||
|
|
||||||
let content = "NIP 90 Content Discovery request"
|
let content = "NIP 90 Content Discovery request"
|
||||||
@@ -76,8 +73,6 @@ async function generate_feed() {
|
|||||||
|
|
||||||
|
|
||||||
requestid = res.toHex();
|
requestid = res.toHex();
|
||||||
console.log(requestid)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
store.commit('set_current_request_id_recommendation', requestid)
|
store.commit('set_current_request_id_recommendation', requestid)
|
||||||
@@ -96,6 +91,8 @@ async function generate_feed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function listen() {
|
async function listen() {
|
||||||
let client = store.state.client
|
let client = store.state.client
|
||||||
let pubkey = store.state.pubkey
|
let pubkey = store.state.pubkey
|
||||||
@@ -113,109 +110,26 @@ async function listen() {
|
|||||||
console.log("Received new event from", relayUrl);
|
console.log("Received new event from", relayUrl);
|
||||||
//console.log(event.asJson())
|
//console.log(event.asJson())
|
||||||
let resonsetorequest = false
|
let resonsetorequest = false
|
||||||
sleep(1500).then(async () => {
|
sleep(1200).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(event.tags[tag].asVec()[1])
|
//console.log(event.tags[tag].asVec()[1])
|
||||||
//console.log(test)
|
//console.log(test)
|
||||||
if (event.tags[tag].asVec()[1] === store.state.requestidRecommendation) {
|
if (event.tags[tag].asVec()[1] === store.state.requestidRecommendation) {
|
||||||
resonsetorequest = true
|
resonsetorequest = true
|
||||||
console.log("YES")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (resonsetorequest === true) {
|
if (resonsetorequest === true) {
|
||||||
if (event.kind === 7000) {
|
if (event.kind === 7000) {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log("7000: ", event.content);
|
console.log("7000: ", event.content);
|
||||||
console.log("DVM: " + event.author.toHex())
|
// console.log("DVM: " + event.author.toHex())
|
||||||
//miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info)
|
//miniToastr.showMessage("DVM: " + dvmname, event.content, VueNotifications.types.info)
|
||||||
|
|
||||||
let status = "unknown"
|
await addDVM(event)
|
||||||
let jsonentry = {
|
|
||||||
id: event.author.toHex(),
|
|
||||||
kind: "",
|
|
||||||
status: status,
|
|
||||||
result: [],
|
|
||||||
name: event.author.toBech32(),
|
|
||||||
about: "",
|
|
||||||
image: "",
|
|
||||||
amount: 0,
|
|
||||||
bolt11: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const tag in event.tags) {
|
|
||||||
if (event.tags[tag].asVec()[0] === "status") {
|
|
||||||
status = event.tags[tag].asVec()[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.tags[tag].asVec()[0] === "amount") {
|
|
||||||
jsonentry.amount = event.tags[tag].asVec()[1]
|
|
||||||
if (event.tags[tag].asVec().length > 2) {
|
|
||||||
jsonentry.bolt11 = event.tags[tag].asVec()[2]
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
let profiles = await get_user_infos([event.author])
|
|
||||||
let created = 0
|
|
||||||
if (profiles.length > 0){
|
|
||||||
// for (const profile of profiles){
|
|
||||||
console.log(profiles[0].profile)
|
|
||||||
let current = profiles[0]
|
|
||||||
// if (profiles[0].profile.createdAt > created){
|
|
||||||
// created = profile.profile.createdAt
|
|
||||||
// current = profile
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
let lud16 = current.profile.lud16
|
|
||||||
if (lud16 !== null && lud16 !== ""){
|
|
||||||
console.log("LUD16: " + lud16)
|
|
||||||
jsonentry.bolt11 = await createBolt11Lud16(lud16, jsonentry.amount)
|
|
||||||
console.log(jsonentry.bolt11)
|
|
||||||
if(jsonentry.bolt11 === ""){
|
|
||||||
status = "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log("NO LNURL")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
console.log("PROFILE NOT FOUND")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//let dvm = store.state.nip89dvms.find(x => JSON.parse(x.event).pubkey === event.author.toHex())
|
|
||||||
for (const el of store.state.nip89dvms) {
|
|
||||||
if (JSON.parse(el.event).pubkey === event.author.toHex().toString()) {
|
|
||||||
jsonentry.name = el.name
|
|
||||||
jsonentry.about = el.about
|
|
||||||
jsonentry.image = el.image
|
|
||||||
|
|
||||||
console.log(jsonentry)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dvms.filter(i => i.id === jsonentry.id).length === 0) {
|
|
||||||
|
|
||||||
dvms.push(jsonentry)
|
|
||||||
}
|
|
||||||
if (event.content !== ""){
|
|
||||||
status = event.content
|
|
||||||
}
|
|
||||||
|
|
||||||
dvms.find(i => i.id === jsonentry.id).status = status
|
|
||||||
|
|
||||||
store.commit('set_recommendation_dvms', dvms)
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error: ", error);
|
console.log("Error: ", error);
|
||||||
@@ -226,7 +140,7 @@ async function listen() {
|
|||||||
|
|
||||||
else if (event.kind === 6300) {
|
else if (event.kind === 6300) {
|
||||||
let entries = []
|
let entries = []
|
||||||
console.log("6300:", event.content);
|
//console.log("6300:", event.content);
|
||||||
|
|
||||||
let event_etags = JSON.parse(event.content)
|
let event_etags = JSON.parse(event.content)
|
||||||
if (event_etags.length > 0) {
|
if (event_etags.length > 0) {
|
||||||
@@ -277,10 +191,16 @@ async function listen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (dvms.find(i => i.id === event.author.toHex()) === undefined){
|
||||||
|
await addDVM(event)
|
||||||
|
console.log("add dvm because of bug")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dvms.find(i => i.id === event.author.toHex()).result.length = 0
|
dvms.find(i => i.id === event.author.toHex()).result.length = 0
|
||||||
dvms.find(i => i.id === event.author.toHex()).result.push.apply(dvms.find(i => i.id === event.author.toHex()).result, items)
|
dvms.find(i => i.id === event.author.toHex()).result.push.apply(dvms.find(i => i.id === event.author.toHex()).result, items)
|
||||||
dvms.find(i => i.id === event.author.toHex()).status = "finished"
|
dvms.find(i => i.id === event.author.toHex()).status = "finished"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
store.commit('set_recommendation_dvms', dvms)
|
store.commit('set_recommendation_dvms', dvms)
|
||||||
@@ -301,7 +221,93 @@ async function listen() {
|
|||||||
|
|
||||||
const urlinput = ref("");
|
const urlinput = ref("");
|
||||||
|
|
||||||
|
async function addDVM(event){
|
||||||
|
let status = "unknown"
|
||||||
|
let jsonentry = {
|
||||||
|
id: event.author.toHex(),
|
||||||
|
kind: "",
|
||||||
|
status: status,
|
||||||
|
result: [],
|
||||||
|
name: event.author.toBech32(),
|
||||||
|
about: "",
|
||||||
|
image: "",
|
||||||
|
amount: 0,
|
||||||
|
bolt11: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const tag in event.tags) {
|
||||||
|
if (event.tags[tag].asVec()[0] === "status") {
|
||||||
|
status = event.tags[tag].asVec()[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.tags[tag].asVec()[0] === "amount") {
|
||||||
|
jsonentry.amount = event.tags[tag].asVec()[1]
|
||||||
|
if (event.tags[tag].asVec().length > 2) {
|
||||||
|
jsonentry.bolt11 = event.tags[tag].asVec()[2]
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
let profiles = await get_user_infos([event.author])
|
||||||
|
let created = 0
|
||||||
|
if (profiles.length > 0){
|
||||||
|
// for (const profile of profiles){
|
||||||
|
console.log(profiles[0].profile)
|
||||||
|
let current = profiles[0]
|
||||||
|
// if (profiles[0].profile.createdAt > created){
|
||||||
|
// created = profile.profile.createdAt
|
||||||
|
// current = profile
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
let lud16 = current.profile.lud16
|
||||||
|
if (lud16 !== null && lud16 !== ""){
|
||||||
|
console.log("LUD16: " + lud16)
|
||||||
|
jsonentry.bolt11 = await createBolt11Lud16(lud16, jsonentry.amount)
|
||||||
|
console.log(jsonentry.bolt11)
|
||||||
|
if(jsonentry.bolt11 === ""){
|
||||||
|
status = "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("NO LNURL")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
console.log("PROFILE NOT FOUND")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//let dvm = store.state.nip89dvms.find(x => JSON.parse(x.event).pubkey === event.author.toHex())
|
||||||
|
for (const el of store.state.nip89dvms) {
|
||||||
|
if (JSON.parse(el.event).pubkey === event.author.toHex().toString()) {
|
||||||
|
jsonentry.name = el.name
|
||||||
|
jsonentry.about = el.about
|
||||||
|
jsonentry.image = el.image
|
||||||
|
|
||||||
|
console.log(jsonentry)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (event.content !== "" && status !== "payment-required" && status !== "error" && status !== "finished" && status !== "paid"){
|
||||||
|
status = event.content
|
||||||
|
}
|
||||||
|
jsonentry.status = status
|
||||||
|
console.log(dvms)
|
||||||
|
if (dvms.filter(i => i.id === jsonentry.id).length === 0) {
|
||||||
|
dvms.push(jsonentry)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//dvms.find(i => i.id === jsonentry.id).status = status
|
||||||
|
store.commit('set_recommendation_dvms', dvms)
|
||||||
|
|
||||||
|
}
|
||||||
async function zap(invoice) {
|
async function zap(invoice) {
|
||||||
let webln;
|
let webln;
|
||||||
|
|
||||||
@@ -445,10 +451,11 @@ const submitHandler = async () => {
|
|||||||
<div className="tooltip mt-auto">
|
<div className="tooltip mt-auto">
|
||||||
|
|
||||||
|
|
||||||
<button v-if="dvm.status !== 'finished' && dvm.status !== 'paid' && dvm.status !== 'payment-required' && dvm.status !== 'error'" className="btn">{{dvm.status}}</button>
|
<button v-if="dvm.status !== 'finished' && dvm.status !== 'paid' && dvm.status !== 'payment-required' && dvm.status !== 'error'" className="btn">{{dvm.status}}</button>
|
||||||
<button v-if="dvm.status === 'finished'" className="btn">Done</button>
|
<button v-if="dvm.status === 'finished'" className="btn">Done</button>
|
||||||
<button v-if="dvm.status === 'paid'" className="btn">Paid, waiting for DVM..</button>
|
<button v-if="dvm.status === 'paid'" className="btn">Paid, waiting for DVM..</button>
|
||||||
<button v-if="dvm.status === 'error'" className="btn">Error</button>
|
<button v-if="dvm.status === 'error'" className="btn">Error</button>
|
||||||
|
|
||||||
<button v-if="dvm.status === 'payment-required'" className="zap-Button" @click="zap(dvm.bolt11);">{{ dvm.amount/1000 }} Sats</button>
|
<button v-if="dvm.status === 'payment-required'" className="zap-Button" @click="zap(dvm.bolt11);">{{ dvm.amount/1000 }} Sats</button>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user