1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-07-26 12:04:06 -04:00

Add ability to change path on every TX packet

This patch adds the ability to webchat to set the path
on every outbound packet for the KISS clients as well as
the fake client.  The path dropdown includes the options for
Default path (which will default to the config setting)
WIDE1-1,WIDE2-1
ARISS
This commit is contained in:
2023-10-05 10:33:07 -04:00
parent e2f89a6043
commit ddd4d25e9d
6 changed files with 107 additions and 32 deletions
+19 -4
View File
@@ -61,6 +61,7 @@ function init_chat() {
event.preventDefault();
to_call = $('#to_call').val();
message = $('#message').val();
path = $('#pkt_path option:selected').val();
if (to_call == "") {
raise_error("You must enter a callsign to send a message")
return false;
@@ -69,7 +70,8 @@ function init_chat() {
raise_error("You must enter a message to send")
return false;
}
msg = {'to': to_call, 'message': message, }
msg = {'to': to_call, 'message': message, 'path': path};
console.log(msg);
socket.emit("send", msg);
$('#message').val('');
}
@@ -294,7 +296,7 @@ function delete_tab(callsign) {
save_data();
}
function add_callsign(callsign) {
function add_callsign(callsign, msg) {
/* Ensure a callsign exists in the left hand nav */
if (callsign in callsign_list) {
return false
@@ -306,10 +308,19 @@ function add_callsign(callsign) {
active = false;
}
create_callsign_tab(callsign, active);
callsign_list[callsign] = true;
callsign_list[callsign] = '';
return true;
}
function update_callsign_path(callsign, path) {
//Get the selected path to save for this callsign
path = msg['path']
console.log("Path is " + path);
$('#pkt_path').val(path);
callsign_list[callsign] = path;
}
function append_message(callsign, msg, msg_html) {
new_callsign = false
if (!message_list.hasOwnProperty(callsign)) {
@@ -330,7 +341,9 @@ function append_message(callsign, msg, msg_html) {
}
// Find the right div to place the html
new_callsign = add_callsign(callsign);
new_callsign = add_callsign(callsign, msg);
update_callsign_path(callsign, msg['path']);
append_message_html(callsign, msg_html, new_callsign);
if (new_callsign) {
//Now click the tab
@@ -486,4 +499,6 @@ function callsign_select(callsign) {
tab_notify_id = tab_notification_id(callsign, true);
$(tab_notify_id).addClass('visually-hidden');
$(tab_notify_id).text(0);
// Now update the path
$('#pkt_path').val(callsign_list[callsign]);
}
+10 -1
View File
@@ -90,10 +90,19 @@
</div>
<div class="row">
<form class="row gx-1 gy-1 justify-content-center align-items-center" id="sendform" name="sendmsg" action="">
<div class="col-sm-3">
<div class="col-sm-2" style="width:150px;">
<label for="to_call" class="visually-hidden">Callsign</label>
<input type="search" class="form-control mb-2 mr-sm-2" name="to_call" id="to_call" placeholder="To Callsign" size="11" maxlength="9">
</div>
<div class="col-auto">
<label for="pkt_path" class="visually-hidden">PATH</label>
<select class="form-control mb-2 mr-sm-2" name="pkt_path" id="pkt_path" style="width:auto;">
<option value="">Default Path</option>
<option value="WIDE1-1,WIDE2-2" selected>WIDE1-1,WIDE2-2</option>
<option value="WIDE1-1">WIDE1-1</option>
<option value="ARISS">ARISS</option>
</select>
</div>
<div class="col-sm-3">
<label for="message" class="visually-hidden">Message</label>
<input type="search" class="form-control mb-2 mr-sm-2" name="message" id="message" size="40" maxlength="67" placeholder="Message">