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 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 '<a target="callsign_info" href="' +
callsign_url.replaceAll('{}', source.callsign) +
'">' + callsignString + '</a>';
switch (callsign_service) {
case "qrzcq":
return '<a target="callsign_info" href="https://www.qrzcq.com/call/' + source.callsign + '">' + callsignString + '</a>';
case "qrz":
return '<a target="callsign_info" href="https://www.qrz.com/db/' + source.callsign + '">' + 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) {

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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"),
],
),
),
]