allow user to configure if they want messages to auto send to propagation node on failure
This commit is contained in:
@@ -1291,6 +1291,10 @@ class ReticulumMeshChat:
|
||||
value = bool(data["allow_auto_resending_failed_messages_with_attachments"])
|
||||
self.config.allow_auto_resending_failed_messages_with_attachments.set(value)
|
||||
|
||||
if "auto_send_failed_messages_to_propagation_node" in data:
|
||||
value = bool(data["auto_send_failed_messages_to_propagation_node"])
|
||||
self.config.auto_send_failed_messages_to_propagation_node.set(value)
|
||||
|
||||
if "show_suggested_community_interfaces" in data:
|
||||
value = bool(data["show_suggested_community_interfaces"])
|
||||
self.config.show_suggested_community_interfaces.set(value)
|
||||
@@ -1470,6 +1474,7 @@ class ReticulumMeshChat:
|
||||
"last_announced_at": self.config.last_announced_at.get(),
|
||||
"auto_resend_failed_messages_when_announce_received": self.config.auto_resend_failed_messages_when_announce_received.get(),
|
||||
"allow_auto_resending_failed_messages_with_attachments": self.config.allow_auto_resending_failed_messages_with_attachments.get(),
|
||||
"auto_send_failed_messages_to_propagation_node": self.config.auto_send_failed_messages_to_propagation_node.get(),
|
||||
"show_suggested_community_interfaces": self.config.show_suggested_community_interfaces.get(),
|
||||
"lxmf_preferred_propagation_node_destination_hash": self.config.lxmf_preferred_propagation_node_destination_hash.get(),
|
||||
"lxmf_preferred_propagation_node_auto_sync_interval_seconds": self.config.lxmf_preferred_propagation_node_auto_sync_interval_seconds.get(),
|
||||
@@ -1844,7 +1849,7 @@ class ReticulumMeshChat:
|
||||
|
||||
# create lxmf message
|
||||
lxmf_message = LXMF.LXMessage(lxmf_destination, self.local_lxmf_destination, content, desired_method=LXMF.LXMessage.DIRECT)
|
||||
lxmf_message.try_propagation_on_fail = True
|
||||
lxmf_message.try_propagation_on_fail = self.config.auto_send_failed_messages_to_propagation_node.get()
|
||||
|
||||
lxmf_message.fields = {}
|
||||
|
||||
@@ -2242,6 +2247,7 @@ class Config:
|
||||
last_announced_at = IntConfig("last_announced_at", None)
|
||||
auto_resend_failed_messages_when_announce_received = BoolConfig("auto_resend_failed_messages_when_announce_received", True)
|
||||
allow_auto_resending_failed_messages_with_attachments = BoolConfig("allow_auto_resending_failed_messages_with_attachments", False)
|
||||
auto_send_failed_messages_to_propagation_node = BoolConfig("auto_send_failed_messages_to_propagation_node", False)
|
||||
show_suggested_community_interfaces = BoolConfig("show_suggested_community_interfaces", True)
|
||||
lxmf_delivery_transfer_limit_in_bytes = IntConfig("lxmf_delivery_transfer_limit_in_bytes", 1000 * 1000 * 10) # 10MB
|
||||
lxmf_preferred_propagation_node_destination_hash = StringConfig("lxmf_preferred_propagation_node_destination_hash", None)
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
<div class="text-sm text-gray-700">When enabled, failed messages that have attachments are allowed to auto resend.</div>
|
||||
</div>
|
||||
|
||||
<div class="p-2">
|
||||
<div class="flex items-start">
|
||||
<div class="flex items-center h-5">
|
||||
<input v-model="config.auto_send_failed_messages_to_propagation_node" @change="onAutoSendFailedMessagesToPropagationNodeChange" type="checkbox" class="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300">
|
||||
</div>
|
||||
<label class="ml-2 text-sm font-medium text-gray-900">Auto send to propagation node</label>
|
||||
</div>
|
||||
<div class="text-sm text-gray-700">When enabled, messages that fail to send will be sent to the configured propagation node.</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -69,7 +79,7 @@
|
||||
<div class="flex">
|
||||
<input v-model="config.lxmf_preferred_propagation_node_destination_hash" @input="onLxmfPreferredPropagationNodeDestinationHashChange" type="text" placeholder="Destination Hash. e.g: a39610c89d18bb48c73e429582423c24" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5">
|
||||
</div>
|
||||
<div class="text-sm text-gray-700">When provided, messages that fail to send will automatically send to this propagation node.</div>
|
||||
<div class="text-sm text-gray-700">This is the propagation node your messages will be sent to and retrieved from.</div>
|
||||
</div>
|
||||
|
||||
<div class="p-2">
|
||||
@@ -110,6 +120,7 @@ export default {
|
||||
config: {
|
||||
auto_resend_failed_messages_when_announce_received: null,
|
||||
allow_auto_resending_failed_messages_with_attachments: null,
|
||||
auto_send_failed_messages_to_propagation_node: null,
|
||||
show_suggested_community_interfaces: null,
|
||||
lxmf_preferred_propagation_node_destination_hash: null,
|
||||
},
|
||||
@@ -167,6 +178,11 @@ export default {
|
||||
"allow_auto_resending_failed_messages_with_attachments": this.config.allow_auto_resending_failed_messages_with_attachments,
|
||||
});
|
||||
},
|
||||
async onAutoSendFailedMessagesToPropagationNodeChange() {
|
||||
await this.updateConfig({
|
||||
"auto_send_failed_messages_to_propagation_node": this.config.auto_send_failed_messages_to_propagation_node,
|
||||
});
|
||||
},
|
||||
async onShowSuggestedCommunityInterfacesChange() {
|
||||
await this.updateConfig({
|
||||
"show_suggested_community_interfaces": this.config.show_suggested_community_interfaces,
|
||||
|
||||
Reference in New Issue
Block a user