From 69c3a6379438b30894ba2170c75a852352f1157c Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 14 Jul 2019 14:33:30 +0200 Subject: [PATCH] link the map in wpsr messages, too --- htdocs/openwebrx.js | 21 ++++++++++++++++++--- owrx/wsjt.py | 6 +++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index c47786e..2952057 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1376,14 +1376,29 @@ function update_metadata(meta) { } +function html_escape(input) { + return $('
').text(input).html() +} + function update_wsjt_panel(msg) { var $b = $('#openwebrx-panel-wsjt-message tbody'); var t = new Date(msg['timestamp']); var pad = function(i) { return ('' + i).padStart(2, "0"); } var linkedmsg = msg['msg']; - var matches = linkedmsg.match(/(.*\s[A-Z0-9]+\s)([A-R]{2}[0-9]{2})$/); - if (matches && matches[2] != 'RR73') { - linkedmsg = matches[1] + '' + matches[2] + ''; + if (msg['mode'] == 'FT8') { + var matches = linkedmsg.match(/(.*\s[A-Z0-9]+\s)([A-R]{2}[0-9]{2})$/); + if (matches && matches[2] != 'RR73') { + linkedmsg = html_escape(matches[1]) + '' + matches[2] + ''; + } else { + linkedmsg = html_escape(linkedmsg); + } + } else if (msg['mode'] == 'WSPR') { + var matches = linkedmsg.match(/([A-Z0-9]*\s)([A-R]{2}[0-9]{2})(\s[0-9]+)/); + if (matches) { + linkedmsg = html_escape(matches[1]) + '' + matches[2] + '' + html_escape(matches[3]); + } else { + linkedmsg = html_escape(linkedmsg); + } } $b.append($( '' + diff --git a/owrx/wsjt.py b/owrx/wsjt.py index 5d0c447..925b3b0 100644 --- a/owrx/wsjt.py +++ b/owrx/wsjt.py @@ -148,7 +148,7 @@ class WsjtParser(object): locator_pattern = re.compile(".*\\s([A-Z0-9]+)\\s([A-R]{2}[0-9]{2})$") jt9_pattern = re.compile("^[0-9]{6} .*") wspr_pattern = re.compile("^[0-9]{4} .*") - wspr_splitter_pattern = re.compile("([A-Z0-9]*)\\s([A-R]{2}[0-9]{2})\\s([0-90]+)") + wspr_splitter_pattern = re.compile("([A-Z0-9]*)\\s([A-R]{2}[0-9]{2})\\s([0-9]+)") def __init__(self, handler): self.handler = handler @@ -213,8 +213,8 @@ class WsjtParser(object): out["dt"] = float(msg[9:13]) out["freq"] = float(msg[14:24]) out["drift"] = int(msg[25:28]) - out["mode"] = "wspr" - wsjt_msg = msg[29:60].strip() + out["mode"] = "WSPR" + wsjt_msg = msg[29:].strip() out["msg"] = wsjt_msg self.parseWsprMessage(wsjt_msg) return out