diff --git a/meshchatx/src/frontend/components/messages/ConversationViewer.vue b/meshchatx/src/frontend/components/messages/ConversationViewer.vue
index eb5bcf6..2d8e45a 100644
--- a/meshchatx/src/frontend/components/messages/ConversationViewer.vue
+++ b/meshchatx/src/frontend/components/messages/ConversationViewer.vue
@@ -349,6 +349,31 @@
+
+
+
+
+
@@ -679,6 +704,24 @@
>
{{ $t("messages.recording", { duration: audioAttachmentRecordingDuration }) }}
+
+
chatItem.lxmf_message?.hash === lxmfMessageHash
);
if (chatItemIndex === -1) {
- console.log("did not find existing chat item index for lxmf message hash: " + lxmfMessage.hash);
return;
}
@@ -1579,6 +1629,11 @@ export default {
// build fields
const fields = {};
+ // add telemetry if present
+ if (this.newMessageTelemetry) {
+ fields["telemetry"] = this.newMessageTelemetry;
+ }
+
// add file attachments
var fileAttachmentsTotalSize = 0;
if (this.newMessageFiles.length > 0) {
@@ -1661,6 +1716,7 @@ export default {
this.newMessageImage = null;
this.newMessageImageUrl = null;
this.newMessageAudio = null;
+ this.newMessageTelemetry = null;
this.newMessageFiles = [];
this.clearFileInput();
} catch (e) {
@@ -1730,6 +1786,73 @@ export default {
console.log(e);
}
},
+ async shareLocation() {
+ try {
+ if (!navigator.geolocation) {
+ DialogUtils.alert("Geolocation is not supported by your browser");
+ return;
+ }
+
+ navigator.geolocation.getCurrentPosition(
+ (position) => {
+ this.newMessageTelemetry = {
+ latitude: position.coords.latitude,
+ longitude: position.coords.longitude,
+ altitude: position.coords.altitude || 0,
+ speed: (position.coords.speed || 0) * 3.6, // m/s to km/h to match Sideband
+ bearing: position.coords.heading || 0,
+ accuracy: position.coords.accuracy || 0,
+ last_update: Math.floor(Date.now() / 1000),
+ };
+ this.sendMessage();
+ },
+ (error) => {
+ DialogUtils.alert(`Failed to get location: ${error.message}`);
+ },
+ {
+ enableHighAccuracy: true,
+ timeout: 5000,
+ maximumAge: 0,
+ }
+ );
+ } catch (e) {
+ console.log(e);
+ }
+ },
+ async requestLocation() {
+ try {
+ if (!this.selectedPeer) return;
+
+ // Send a telemetry request command
+ await window.axios.post(`/api/v1/lxmf-messages/send`, {
+ lxmf_message: {
+ destination_hash: this.selectedPeer.destination_hash,
+ content: "",
+ fields: {
+ commands: [
+ { "0x01": Math.floor(Date.now() / 1000) }, // Sideband TELEMETRY_REQUEST
+ ],
+ },
+ },
+ });
+
+ ToastUtils.success("Location request sent");
+ } catch (e) {
+ console.log(e);
+ ToastUtils.error("Failed to send location request");
+ }
+ },
+ viewLocationOnMap(location) {
+ // navigate to map and center on location
+ this.$router.push({
+ name: "map",
+ query: {
+ lat: location.latitude,
+ lon: location.longitude,
+ zoom: 15,
+ },
+ });
+ },
formatTimeAgo: function (datetimeString) {
return Utils.formatTimeAgo(datetimeString);
},