Browse Source

show warning about using nostr, and show errors if location was enabled but data is missing

master
Trent Larson 6 days ago
parent
commit
be010f7777
  1. 95
      src/views/NewEditProjectView.vue

95
src/views/NewEditProjectView.vue

@ -152,11 +152,13 @@
<div class="flex" @click="sendToTrustroots = !sendToTrustroots"> <div class="flex" @click="sendToTrustroots = !sendToTrustroots">
<input type="checkbox" class="mr-2" v-model="sendToTrustroots" /> <input type="checkbox" class="mr-2" v-model="sendToTrustroots" />
<label>Send to Trustroots</label> <label>Send to Trustroots</label>
<fa icon="circle-info" class="text-blue-500 ml-2 cursor-pointer" @click.stop="showNostrPartnerInfo" />
</div> </div>
<!-- <!--
<div class="flex" @click="sendToTripHopping = !sendToTripHopping"> <div class="flex" @click="sendToTripHopping = !sendToTripHopping">
<input type="checkbox" class="mr-2" v-model="sendToTripHopping" /> <input type="checkbox" class="mr-2" v-model="sendToTripHopping" />
<label>Send to TripHopping</label> <label>Send to TripHopping</label>
<fa icon="circle-info" class="text-blue-500 ml-2 cursor-pointer" @click.stop="showNostrPartnerInfo" />
</div> </div>
--> -->
</div> </div>
@ -408,13 +410,26 @@ export default class NewEditProjectView extends Vue {
delete vcClaim.image; delete vcClaim.image;
} }
if (this.includeLocation) { if (this.includeLocation) {
vcClaim.location = { if (!this.latitude || !this.longitude) {
geo: { this.$notify(
"@type": "GeoCoordinates", {
latitude: this.latitude, group: "alert",
longitude: this.longitude, 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 { } else {
delete vcClaim.location; delete vcClaim.location;
} }
@ -431,7 +446,7 @@ export default class NewEditProjectView extends Vue {
{ {
group: "alert", group: "alert",
type: "danger", type: "danger",
title: "Error", title: "Date Error",
text: "The date was invalid so it was not set.", text: "The date was invalid so it was not set.",
}, },
5000, 5000,
@ -455,26 +470,40 @@ export default class NewEditProjectView extends Vue {
const projectPath = encodeURIComponent(resp.data.success.handleId); const projectPath = encodeURIComponent(resp.data.success.handleId);
let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey if (this.sendToTrustroots || this.sendToTripHopping) {
if (this.sendToTrustroots) { if (this.latitude && this.longitude) {
signedPayload = await this.signPayload(); let signedPayload: VerifiedEvent | undefined; // sign something to prove ownership of pubkey
this.sendToNostrPartner( if (this.sendToTrustroots) {
"NOSTR-EVENT-TRUSTROOTS", signedPayload = await this.signPayload();
"Trustroots", this.sendToNostrPartner(
resp.data.success.claimId, "NOSTR-EVENT-TRUSTROOTS",
signedPayload, "Trustroots",
); resp.data.success.claimId,
} signedPayload,
if (this.sendToTripHopping) { );
if (!signedPayload) { }
signedPayload = await this.signPayload(); 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 }); (this.$router as Router).push({ path: "/project/" + projectPath });
@ -689,5 +718,17 @@ export default class NewEditProjectView extends Vue {
public onCancelClick() { public onCancelClick() {
(this.$router as Router).back(); (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,
);
}
} }
</script> </script>

Loading…
Cancel
Save