diff --git a/public/index.html b/public/index.html index 5ebb3dc..106bc6c 100644 --- a/public/index.html +++ b/public/index.html @@ -601,6 +601,7 @@ {{ chatItem.lxmf_message.state }} (attempt {{ chatItem.lxmf_message.delivery_attempts + 1 }}) {{ chatItem.lxmf_message.progress.toFixed(0) }}% + retry? @@ -1672,6 +1673,36 @@ // scroll to bottom this.scrollMessagesToBottom(); + }, + async retrySendingMessage(chatItem) { + + // do nothing if not connected to websocket + if(!this.isWebsocketConnected){ + this.alert("Not connected to WebSocket!"); + return; + } + + // force delete existing message + await this.deleteChatItem(chatItem, false); + + try { + + // send message to reticulum via websocket + this.ws.send(JSON.stringify({ + "type": "lxmf.delivery", + "lxmf_message": chatItem.lxmf_message, + })); + + } catch(e) { + + // todo handle error + console.error(e); + + } + + // scroll to bottom + this.scrollMessagesToBottom(); + }, async updateConfig(config) { @@ -2246,11 +2277,11 @@ this.alert("unsupported url: " + url); }, - async deleteChatItem(chatItem) { + async deleteChatItem(chatItem, shouldConfirm = true) { try { // ask user to confirm deleting message - if(!confirm("Are you sure you want to delete this message? This can not be undone!")){ + if(shouldConfirm && !confirm("Are you sure you want to delete this message? This can not be undone!")){ return; }