mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Improve error handling and PWA manifest
This commit is contained in:
+5
-2
@@ -48,12 +48,15 @@ class Mode(str, Enum):
|
|||||||
def from_name(name):
|
def from_name(name):
|
||||||
"""Convert a string to an enum mode using the alias table."""
|
"""Convert a string to an enum mode using the alias table."""
|
||||||
|
|
||||||
|
if not name:
|
||||||
|
return Mode.UNKNOWN
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return Mode(name.upper())
|
return Mode(name.upper())
|
||||||
except ValueError:
|
except (KeyError, ValueError):
|
||||||
try:
|
try:
|
||||||
return Mode(MODE_ALIASES[name.upper()])
|
return Mode(MODE_ALIASES[name.upper()])
|
||||||
except ValueError:
|
except (KeyError, ValueError):
|
||||||
return Mode.UNKNOWN
|
return Mode.UNKNOWN
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -42,6 +42,9 @@ def infer_mode_type_from_mode(mode: str) -> ModeType:
|
|||||||
if not mode:
|
if not mode:
|
||||||
return ModeType.UNKNOWN
|
return ModeType.UNKNOWN
|
||||||
|
|
||||||
|
if mode in MODE_ALIASES:
|
||||||
|
mode = MODE_ALIASES[mode]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mode = Mode(mode.upper())
|
mode = Mode(mode.upper())
|
||||||
if mode.is_cw:
|
if mode.is_cw:
|
||||||
@@ -118,7 +121,7 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo):
|
|||||||
|
|
||||||
country = data.get("country", None)
|
country = data.get("country", None)
|
||||||
dxcc_id = data.get("adif", None)
|
dxcc_id = data.get("adif", None)
|
||||||
continent = Continent(data.get("continent", None))
|
continent = Continent(data["continent"]) if "continent" in data else None
|
||||||
cq_zone = data.get("cqz", None)
|
cq_zone = data.get("cqz", None)
|
||||||
itu_zone = data.get("ituz", None)
|
itu_zone = data.get("ituz", None)
|
||||||
lat = float(data["latitude"]) if "latitude" in data else None
|
lat = float(data["latitude"]) if "latitude" in data else None
|
||||||
|
|||||||
+2
-2
@@ -92,8 +92,8 @@ class Alert:
|
|||||||
call_info = get_call_info(self.dx_calls[0], credentials)
|
call_info = get_call_info(self.dx_calls[0], credentials)
|
||||||
if self.dx_calls and self.dx_calls[0] and not self.dx_country:
|
if self.dx_calls and self.dx_calls[0] and not self.dx_country:
|
||||||
self.dx_country = call_info.country
|
self.dx_country = call_info.country
|
||||||
if self.dx_calls and self.dx_calls[0] and not self.dx_continent:
|
if self.dx_calls and self.dx_calls[0] and call_info.continent and not self.dx_continent:
|
||||||
self.dx_continent = Continent(call_info.continent) if call_info.continent else None
|
self.dx_continent = Continent(call_info.continent)
|
||||||
if self.dx_calls and self.dx_calls[0] and not self.dx_cq_zone:
|
if self.dx_calls and self.dx_calls[0] and not self.dx_cq_zone:
|
||||||
self.dx_cq_zone = call_info.cq_zone
|
self.dx_cq_zone = call_info.cq_zone
|
||||||
if self.dx_calls and self.dx_calls[0] and not self.dx_itu_zone:
|
if self.dx_calls and self.dx_calls[0] and not self.dx_itu_zone:
|
||||||
|
|||||||
+2
-2
@@ -184,7 +184,7 @@ class Spot:
|
|||||||
dx_call_info = get_call_info(self.dx_call, credentials)
|
dx_call_info = get_call_info(self.dx_call, credentials)
|
||||||
if self.dx_call and not self.dx_country:
|
if self.dx_call and not self.dx_country:
|
||||||
self.dx_country = dx_call_info.country
|
self.dx_country = dx_call_info.country
|
||||||
if self.dx_call and not self.dx_continent:
|
if self.dx_call and dx_call_info.continent and not self.dx_continent:
|
||||||
self.dx_continent = Continent(dx_call_info.continent)
|
self.dx_continent = Continent(dx_call_info.continent)
|
||||||
if self.dx_call and not self.dx_dxcc_id:
|
if self.dx_call and not self.dx_dxcc_id:
|
||||||
self.dx_dxcc_id = dx_call_info.dxcc_id
|
self.dx_dxcc_id = dx_call_info.dxcc_id
|
||||||
@@ -222,7 +222,7 @@ class Spot:
|
|||||||
):
|
):
|
||||||
if not self.de_country:
|
if not self.de_country:
|
||||||
self.de_country = de_call_info.country
|
self.de_country = de_call_info.country
|
||||||
if not self.de_continent:
|
if de_call_info.continent and not self.de_continent:
|
||||||
self.de_continent = Continent(de_call_info.continent)
|
self.de_continent = Continent(de_call_info.continent)
|
||||||
if not self.de_dxcc_id:
|
if not self.de_dxcc_id:
|
||||||
self.de_dxcc_id = de_call_info.dxcc_id
|
self.de_dxcc_id = de_call_info.dxcc_id
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class ParksNPeaks(HTTPAlertProvider):
|
|||||||
"POTA",
|
"POTA",
|
||||||
"SOTA",
|
"SOTA",
|
||||||
"WWFF",
|
"WWFF",
|
||||||
|
"HEMA",
|
||||||
"SIOTA",
|
"SIOTA",
|
||||||
"ZLOTA",
|
"ZLOTA",
|
||||||
"KRMNPA",
|
"KRMNPA",
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class HamQTH(APIQueryCallsignDataProvider):
|
|||||||
name=data.get("nick", None),
|
name=data.get("nick", None),
|
||||||
qth=data.get("qth", None),
|
qth=data.get("qth", None),
|
||||||
country=data.get("country", None),
|
country=data.get("country", None),
|
||||||
continent=Continent(data.get("continent", None)),
|
continent=Continent(data["continent"]) if "continent" in data else None,
|
||||||
latitude=lat,
|
latitude=lat,
|
||||||
longitude=lon,
|
longitude=lon,
|
||||||
grid=grid,
|
grid=grid,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ class QRZ(APIQueryCallsignDataProvider):
|
|||||||
name=name,
|
name=name,
|
||||||
qth=data.get("addr2", None),
|
qth=data.get("addr2", None),
|
||||||
country=data.get("country", None),
|
country=data.get("country", None),
|
||||||
continent=Continent(data.get("continent", None)),
|
continent=Continent(data["continent"]) if "continent" in data else None,
|
||||||
latitude=lat,
|
latitude=lat,
|
||||||
longitude=lon,
|
longitude=lon,
|
||||||
grid=grid,
|
grid=grid,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/add-spot.js?v=1788539927"></script>
|
<script src="/static/js/add-spot.js?v=1788540636"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-add-spot").addClass("active");
|
$("#nav-link-add-spot").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/alerts.js?v=1788539927"></script>
|
<script src="/static/js/alerts.js?v=1788540636"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-alerts").addClass("active");
|
$("#nav-link-alerts").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1788539927"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788540636"></script>
|
||||||
<script src="/static/js/bands.js?v=1788539927"></script>
|
<script src="/static/js/bands.js?v=1788540636"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-bands").addClass("active");
|
$("#nav-link-bands").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
{% extends "skeleton.html" %}
|
{% extends "skeleton.html" %}
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/css/style.css?v=1788539927" type="text/css">
|
<link rel="stylesheet" href="/static/css/style.css?v=1788540636" type="text/css">
|
||||||
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
window.fetchEventSource = fetchEventSource;
|
window.fetchEventSource = fetchEventSource;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/utils.js?v=1788539927"></script>
|
<script src="/static/js/utils.js?v=1788540636"></script>
|
||||||
<script src="/static/js/ui-ham.js?v=1788539927"></script>
|
<script src="/static/js/ui-ham.js?v=1788540636"></script>
|
||||||
<script src="/static/js/geo.js?v=1788539927"></script>
|
<script src="/static/js/geo.js?v=1788540636"></script>
|
||||||
<script src="/static/js/common.js?v=1788539927"></script>
|
<script src="/static/js/common.js?v=1788540636"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||||
<script src="/static/js/conditions.js?v=1788539927"></script>
|
<script src="/static/js/conditions.js?v=1788540636"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-conditions").addClass("active");
|
$("#nav-link-conditions").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
"src": "/static/img/icon-192-pwa.png",
|
"src": "/static/img/icon-192-pwa.png",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "192x192",
|
"sizes": "192x192",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable any"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"src": "/static/img/icon-512-pwa.png",
|
"src": "/static/img/icon-512-pwa.png",
|
||||||
"type": "image/png",
|
"type": "image/png",
|
||||||
"sizes": "512x512",
|
"sizes": "512x512",
|
||||||
"purpose": "maskable"
|
"purpose": "maskable any"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"url": "{{ baseurl }}"
|
"url": "{{ baseurl }}"
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@
|
|||||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1788539926"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788540635"></script>
|
||||||
<script src="/static/js/map.js?v=1788539926"></script>
|
<script src="/static/js/map.js?v=1788540635"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-map").addClass("active");
|
$("#nav-link-map").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -113,8 +113,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1788539926"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1788540635"></script>
|
||||||
<script src="/static/js/spots.js?v=1788539926"></script>
|
<script src="/static/js/spots.js?v=1788540635"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-spots").addClass("active");
|
$("#nav-link-spots").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/status.js?v=1788539927"></script>
|
<script src="/static/js/status.js?v=1788540636"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#nav-link-status").addClass("active");
|
$("#nav-link-status").addClass("active");
|
||||||
|
|||||||
Reference in New Issue
Block a user