From 64f0510da09dca9d2ee6acf30facd1908e01f751 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 30 Nov 2022 16:54:22 +0100 Subject: [PATCH] use a dropdown for callsign database setting; add aprs.fi --- htdocs/map.js | 23 ++++++++++++++--------- owrx/config/defaults.py | 3 +-- owrx/config/migration.py | 16 +++++++++++++++- owrx/connection.py | 2 +- owrx/controllers/settings/general.py | 17 +++++++++++------ 5 files changed, 42 insertions(+), 19 deletions(-) diff --git a/htdocs/map.js b/htdocs/map.js index 089cc5b..5915eb7 100644 --- a/htdocs/map.js +++ b/htdocs/map.js @@ -32,7 +32,7 @@ $(function(){ var retention_time = 2 * 60 * 60 * 1000; var strokeOpacity = 0.8; var fillOpacity = 0.35; - var callsign_url = null; + var callsign_service; var colorKeys = {}; var colorScale = chroma.scale(['red', 'blue', 'green']).mode('hsl'); @@ -289,8 +289,8 @@ $(function(){ if ('map_position_retention_time' in config) { retention_time = config.map_position_retention_time * 1000; } - if ('callsign_url' in config) { - callsign_url = config['callsign_url']; + if ('callsign_service' in config) { + callsign_service = config['callsign_service']; } break; case "update": @@ -361,12 +361,17 @@ $(function(){ var linkifySource = function(source) { var callsignString = sourceToString(source); - if (callsign_url == null || callsign_url === '') - return callsignString; - else - return '' + callsignString + ''; + switch (callsign_service) { + case "qrzcq": + return '' + callsignString + ''; + case "qrz": + return '' + callsignString + ''; + case 'aprsfi': + var callWithSsid = sourceToKey(source); + return '' + callsignString + ''; + default: + return callsignString; + } }; var distanceKm = function(p1, p2) { diff --git a/owrx/config/defaults.py b/owrx/config/defaults.py index 203c257..077b72f 100644 --- a/owrx/config/defaults.py +++ b/owrx/config/defaults.py @@ -2,7 +2,7 @@ from owrx.property import PropertyLayer defaultConfig = PropertyLayer( - version=7, + version=8, max_clients=20, receiver_name="[Callsign]", receiver_location="Budapest, Hungary", @@ -147,7 +147,6 @@ defaultConfig = PropertyLayer( squelch_auto_margin=10, google_maps_api_key="", map_position_retention_time=2 * 60 * 60, - callsign_url="https://www.qrzcq.com/call/{}", decoding_queue_workers=2, decoding_queue_length=10, wsjt_decoding_depth=3, diff --git a/owrx/config/migration.py b/owrx/config/migration.py index ec0068b..5c97eee 100644 --- a/owrx/config/migration.py +++ b/owrx/config/migration.py @@ -111,8 +111,21 @@ class ConfigMigratorVersion6(ConfigMigrator): config["version"] = 7 +class ConfigMigratorVersion7(ConfigMigrator): + def migrate(self, config): + if "callsign_url" in config: + if "qrzcq.com" in config["callsign_url"]: + config["callsign_service"] = "qrzcq" + elif "qrz.com" in config["callsign_url"]: + config["callsign_service"] = "qrz" + else: + logger.warning("unable to migrate callsign_url! please check settings!") + del config["callsign_url"] + config["version"] = 8 + + class Migrator(object): - currentVersion = 7 + currentVersion = 8 migrators = { 1: ConfigMigratorVersion1(), 2: ConfigMigratorVersion2(), @@ -120,6 +133,7 @@ class Migrator(object): 4: ConfigMigratorVersion4(), 5: ConfigMigratorVersion5(), 6: ConfigMigratorVersion6(), + 7: ConfigMigratorVersion7(), } @staticmethod diff --git a/owrx/connection.py b/owrx/connection.py index dfb526c..ba900d6 100644 --- a/owrx/connection.py +++ b/owrx/connection.py @@ -456,7 +456,7 @@ class MapConnection(OpenWebRxClient): "google_maps_api_key", "receiver_gps", "map_position_retention_time", - "callsign_url", + "callsign_service", "receiver_name", ) filtered_config.wire(self.write_config) diff --git a/owrx/controllers/settings/general.py b/owrx/controllers/settings/general.py index 7958368..08dd0eb 100644 --- a/owrx/controllers/settings/general.py +++ b/owrx/controllers/settings/general.py @@ -168,12 +168,17 @@ class GeneralSettingsController(SettingsFormController): infotext="Specifies how log markers / grids will remain visible on the map", append="s", ), - TextInput( - "callsign_url", - "Callsign database URL", - infotext="Specifies callsign lookup URL, such as QRZ.COM " - + "or QRZCQ.COM. Place curly brackers ({}) where callsign " - + "is supposed to be.", + DropdownInput( + "callsign_service", + "Callsign database service", + infotext="Allows users to navigate to an external callsign database service by clicking on " + + "callsigns", + options=[ + Option(None, "disabled"), + Option("qrzcq", "qrzcq.com"), + Option("qrz", "qrz.com"), + Option("aprsfi", "aprs.fi"), + ], ), ), ]