From be010f77771365a54c6a29a965182a7f80a85234 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 12 Jan 2025 16:57:20 -0700 Subject: [PATCH] show warning about using nostr, and show errors if location was enabled but data is missing --- src/views/NewEditProjectView.vue | 95 +++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 27 deletions(-) diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index ee0fe46..0cb1593 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -152,11 +152,13 @@
+
@@ -408,13 +410,26 @@ export default class NewEditProjectView extends Vue { delete vcClaim.image; } if (this.includeLocation) { - vcClaim.location = { - geo: { - "@type": "GeoCoordinates", - latitude: this.latitude, - longitude: this.longitude, - }, - }; + if (!this.latitude || !this.longitude) { + this.$notify( + { + group: "alert", + type: "danger", + title: "Location Error", + text: "The location was invalid so it was not set.", + }, + 5000, + ); + delete vcClaim.location; + } else { + vcClaim.location = { + geo: { + "@type": "GeoCoordinates", + latitude: this.latitude, + longitude: this.longitude, + }, + }; + } } else { delete vcClaim.location; } @@ -431,7 +446,7 @@ export default class NewEditProjectView extends Vue { { group: "alert", type: "danger", - title: "Error", + title: "Date Error", text: "The date was invalid so it was not set.", }, 5000, @@ -455,26 +470,40 @@ export default class NewEditProjectView extends Vue { const projectPath = encodeURIComponent(resp.data.success.handleId); - let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey - if (this.sendToTrustroots) { - signedPayload = await this.signPayload(); - this.sendToNostrPartner( - "NOSTR-EVENT-TRUSTROOTS", - "Trustroots", - resp.data.success.claimId, - signedPayload, - ); - } - if (this.sendToTripHopping) { - if (!signedPayload) { - signedPayload = await this.signPayload(); + if (this.sendToTrustroots || this.sendToTripHopping) { + if (this.latitude && this.longitude) { + let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey + if (this.sendToTrustroots) { + signedPayload = await this.signPayload(); + this.sendToNostrPartner( + "NOSTR-EVENT-TRUSTROOTS", + "Trustroots", + resp.data.success.claimId, + signedPayload, + ); + } + if (this.sendToTripHopping) { + if (!signedPayload) { + signedPayload = await this.signPayload(); + } + this.sendToNostrPartner( + "NOSTR-EVENT-TRIPHOPPING", + "TripHopping", + resp.data.success.claimId, + signedPayload, + ); + } + } else { + this.$notify( + { + group: "alert", + type: "danger", + title: "Partner Error", + text: "A partner was selected but the location was not set, so it was not sent to any partner.", + }, + 5000, + ); } - this.sendToNostrPartner( - "NOSTR-EVENT-TRIPHOPPING", - "TripHopping", - resp.data.success.claimId, - signedPayload, - ); } (this.$router as Router).push({ path: "/project/" + projectPath }); @@ -689,5 +718,17 @@ export default class NewEditProjectView extends Vue { public onCancelClick() { (this.$router as Router).back(); } + + public showNostrPartnerInfo() { + this.$notify( + { + group: "alert", + type: "info", + title: "About Nostr Events", + text: "This will cause a submission to a partner on the nostr network. It will contain your public key data which may allow correlation, so don't allow this if you're not comfortable with that.", + }, + 7000, + ); + } }