use a dropdown for callsign database setting; add aprs.fi

This commit is contained in:
Jakob Ketterl 2022-11-30 16:54:22 +01:00
parent 4050bd7f96
commit 64f0510da0
5 changed files with 42 additions and 19 deletions

View File

@ -32,7 +32,7 @@ $(function(){
var retention_time = 2 * 60 * 60 * 1000; var retention_time = 2 * 60 * 60 * 1000;
var strokeOpacity = 0.8; var strokeOpacity = 0.8;
var fillOpacity = 0.35; var fillOpacity = 0.35;
var callsign_url = null; var callsign_service;
var colorKeys = {}; var colorKeys = {};
var colorScale = chroma.scale(['red', 'blue', 'green']).mode('hsl'); var colorScale = chroma.scale(['red', 'blue', 'green']).mode('hsl');
@ -289,8 +289,8 @@ $(function(){
if ('map_position_retention_time' in config) { if ('map_position_retention_time' in config) {
retention_time = config.map_position_retention_time * 1000; retention_time = config.map_position_retention_time * 1000;
} }
if ('callsign_url' in config) { if ('callsign_service' in config) {
callsign_url = config['callsign_url']; callsign_service = config['callsign_service'];
} }
break; break;
case "update": case "update":
@ -361,12 +361,17 @@ $(function(){
var linkifySource = function(source) { var linkifySource = function(source) {
var callsignString = sourceToString(source); var callsignString = sourceToString(source);
if (callsign_url == null || callsign_url === '') switch (callsign_service) {
return callsignString; case "qrzcq":
else return '<a target="callsign_info" href="https://www.qrzcq.com/call/' + source.callsign + '">' + callsignString + '</a>';
return '<a target="callsign_info" href="' + case "qrz":
callsign_url.replaceAll('{}', source.callsign) + return '<a target="callsign_info" href="https://www.qrz.com/db/' + source.callsign + '">' + callsignString + '</a>';
'">' + callsignString + '</a>'; case 'aprsfi':
var callWithSsid = sourceToKey(source);
return '<a target="callsign_info" href="https://aprs.fi/info/a/' + callWithSsid + '">' + callsignString + '</a>';
default:
return callsignString;
}
}; };
var distanceKm = function(p1, p2) { var distanceKm = function(p1, p2) {

View File

@ -2,7 +2,7 @@ from owrx.property import PropertyLayer
defaultConfig = PropertyLayer( defaultConfig = PropertyLayer(
version=7, version=8,
max_clients=20, max_clients=20,
receiver_name="[Callsign]", receiver_name="[Callsign]",
receiver_location="Budapest, Hungary", receiver_location="Budapest, Hungary",
@ -147,7 +147,6 @@ defaultConfig = PropertyLayer(
squelch_auto_margin=10, squelch_auto_margin=10,
google_maps_api_key="", google_maps_api_key="",
map_position_retention_time=2 * 60 * 60, map_position_retention_time=2 * 60 * 60,
callsign_url="https://www.qrzcq.com/call/{}",
decoding_queue_workers=2, decoding_queue_workers=2,
decoding_queue_length=10, decoding_queue_length=10,
wsjt_decoding_depth=3, wsjt_decoding_depth=3,

View File

@ -111,8 +111,21 @@ class ConfigMigratorVersion6(ConfigMigrator):
config["version"] = 7 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): class Migrator(object):
currentVersion = 7 currentVersion = 8
migrators = { migrators = {
1: ConfigMigratorVersion1(), 1: ConfigMigratorVersion1(),
2: ConfigMigratorVersion2(), 2: ConfigMigratorVersion2(),
@ -120,6 +133,7 @@ class Migrator(object):
4: ConfigMigratorVersion4(), 4: ConfigMigratorVersion4(),
5: ConfigMigratorVersion5(), 5: ConfigMigratorVersion5(),
6: ConfigMigratorVersion6(), 6: ConfigMigratorVersion6(),
7: ConfigMigratorVersion7(),
} }
@staticmethod @staticmethod

View File

@ -456,7 +456,7 @@ class MapConnection(OpenWebRxClient):
"google_maps_api_key", "google_maps_api_key",
"receiver_gps", "receiver_gps",
"map_position_retention_time", "map_position_retention_time",
"callsign_url", "callsign_service",
"receiver_name", "receiver_name",
) )
filtered_config.wire(self.write_config) filtered_config.wire(self.write_config)

View File

@ -168,12 +168,17 @@ class GeneralSettingsController(SettingsFormController):
infotext="Specifies how log markers / grids will remain visible on the map", infotext="Specifies how log markers / grids will remain visible on the map",
append="s", append="s",
), ),
TextInput( DropdownInput(
"callsign_url", "callsign_service",
"Callsign database URL", "Callsign database service",
infotext="Specifies callsign lookup URL, such as QRZ.COM " infotext="Allows users to navigate to an external callsign database service by clicking on "
+ "or QRZCQ.COM. Place curly brackers ({}) where callsign " + "callsigns",
+ "is supposed to be.", options=[
Option(None, "disabled"),
Option("qrzcq", "qrzcq.com"),
Option("qrz", "qrz.com"),
Option("aprsfi", "aprs.fi"),
],
), ),
), ),
] ]