mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-06-24 05:35:10 +00:00
Merge branch 'main' into 95-send-spots-to-xota
This commit is contained in:
10
README.md
10
README.md
@@ -74,7 +74,7 @@ a mapping exists.
|
|||||||
| `map-center-lon` | Numeric (decimal) | (auto) | `?map-center-lon=-0.1` | Sets the initial longitude of the map centre on the map page. If omitted, the map auto-fits to the loaded spots. |
|
| `map-center-lon` | Numeric (decimal) | (auto) | `?map-center-lon=-0.1` | Sets the initial longitude of the map centre on the map page. If omitted, the map auto-fits to the loaded spots. |
|
||||||
| `map-zoom` | Numeric (integer) | (auto) | `?map-zoom=6` | Sets the initial zoom level of the map on the map page. If omitted, the map auto-fits to the loaded spots. |
|
| `map-zoom` | Numeric (integer) | (auto) | `?map-zoom=6` | Sets the initial zoom level of the map on the map page. If omitted, the map auto-fits to the loaded spots. |
|
||||||
|
|
||||||
More will be added soon to allow customisation of filters and other display properties.
|
See the comment at the end of the next section regarding reliability and uptime of the "main" server.
|
||||||
|
|
||||||
## Writing your own client
|
## Writing your own client
|
||||||
|
|
||||||
@@ -95,7 +95,13 @@ Various approaches exist to writing your own client, but in general:
|
|||||||
* Refer to the provided HTML/JS interface for a reference on different approaches. For example, the "map" and "bands"
|
* Refer to the provided HTML/JS interface for a reference on different approaches. For example, the "map" and "bands"
|
||||||
pages simply query the main spot API on a timer, whereas the main/spots page combines this approach with using the
|
pages simply query the main spot API on a timer, whereas the main/spots page combines this approach with using the
|
||||||
Server-Sent Events (SSE) endpoint to update live.
|
Server-Sent Events (SSE) endpoint to update live.
|
||||||
* Let me know if you get stuck, I'm happy to help!
|
* Let me know if you get stuck, I'm happy to help.
|
||||||
|
|
||||||
|
Remember, here at Spothole Inc. we offer an industry-standard "five nines" uptime on our server, with our own unique
|
||||||
|
twist: we don't tell you which side of the decimal point the nines start! (Translation: This is a hobby project.
|
||||||
|
`spothole.app` runs on the same server as my blog and other stuff. It might go down without warning. By all means base
|
||||||
|
your own project on data from the main server if you like, but if you want any control over reliability and downtime,
|
||||||
|
please run your own copy instead.)
|
||||||
|
|
||||||
## Running your own copy
|
## Running your own copy
|
||||||
|
|
||||||
|
|||||||
@@ -24,70 +24,74 @@ class GMA(HTTPSpotProvider):
|
|||||||
def _http_response_to_spots(self, http_response):
|
def _http_response_to_spots(self, http_response):
|
||||||
new_spots = []
|
new_spots = []
|
||||||
# Iterate through source data
|
# Iterate through source data
|
||||||
for source_spot in http_response.json()["RCD"]:
|
if "RCD" in http_response.json():
|
||||||
# Convert to our spot format
|
for source_spot in http_response.json()["RCD"]:
|
||||||
spot = Spot(source=self.name,
|
# Convert to our spot format
|
||||||
dx_call=source_spot["ACTIVATOR"].upper(),
|
spot = Spot(source=self.name,
|
||||||
de_call=source_spot["SPOTTER"].upper(),
|
dx_call=source_spot["ACTIVATOR"].upper(),
|
||||||
freq=float(source_spot["QRG"]) * 1000 if (source_spot["QRG"] != "") else None,
|
de_call=source_spot["SPOTTER"].upper(),
|
||||||
# Seen GMA spots with no frequency
|
freq=float(source_spot["QRG"]) * 1000 if (source_spot["QRG"] != "") else None,
|
||||||
mode=source_spot["MODE"].upper() if "<>" not in source_spot["MODE"] else None,
|
# Seen GMA spots with no frequency
|
||||||
# Filter out some weird mode strings
|
mode=source_spot["MODE"].upper() if "<>" not in source_spot["MODE"] else None,
|
||||||
comment=source_spot["TEXT"],
|
# Filter out some weird mode strings
|
||||||
sig_refs=[SIGRef(id=source_spot["REF"], sig="", name=source_spot["NAME"])],
|
comment=source_spot["TEXT"],
|
||||||
time=datetime.strptime(source_spot["DATE"] + source_spot["TIME"], "%Y%m%d%H%M").replace(
|
sig_refs=[SIGRef(id=source_spot["REF"], sig="", name=source_spot["NAME"])],
|
||||||
tzinfo=pytz.UTC).timestamp(),
|
time=datetime.strptime(source_spot["DATE"] + source_spot["TIME"], "%Y%m%d%H%M").replace(
|
||||||
dx_latitude=float(source_spot["LAT"]) if (
|
tzinfo=pytz.UTC).timestamp(),
|
||||||
source_spot["LAT"] and source_spot["LAT"] != "") else None,
|
dx_latitude=float(source_spot["LAT"]) if (
|
||||||
# Seen GMA spots with no (or empty) lat/lon
|
source_spot["LAT"] and source_spot["LAT"] != "") else None,
|
||||||
dx_longitude=float(source_spot["LON"]) if (
|
# Seen GMA spots with no (or empty) lat/lon
|
||||||
source_spot["LON"] and source_spot["LON"] != "") else None)
|
dx_longitude=float(source_spot["LON"]) if (
|
||||||
|
source_spot["LON"] and source_spot["LON"] != "") else None)
|
||||||
|
|
||||||
# GMA doesn't give what programme (SIG) the reference is for until we separately look it up.
|
# GMA doesn't give what programme (SIG) the reference is for until we separately look it up.
|
||||||
if "REF" in source_spot:
|
if "REF" in source_spot:
|
||||||
try:
|
try:
|
||||||
ref_response = SEMI_STATIC_URL_DATA_CACHE.get(self.REF_INFO_URL_ROOT + source_spot["REF"],
|
ref_response = SEMI_STATIC_URL_DATA_CACHE.get(self.REF_INFO_URL_ROOT + source_spot["REF"],
|
||||||
headers=HTTP_HEADERS)
|
headers=HTTP_HEADERS)
|
||||||
# Sometimes this is blank, so handle that
|
# Sometimes this is blank, so handle that
|
||||||
if ref_response.text is not None and ref_response.text != "":
|
if ref_response.text is not None and ref_response.text != "":
|
||||||
ref_info = ref_response.json()
|
ref_info = ref_response.json()
|
||||||
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. POTA and WWFF
|
# If this is POTA, SOTA or WWFF data we already have it through other means, so ignore. POTA and WWFF
|
||||||
# spots come through with reftype=POTA or reftype=WWFF. SOTA is harder to figure out because both SOTA
|
# spots come through with reftype=POTA or reftype=WWFF. SOTA is harder to figure out because both SOTA
|
||||||
# and GMA summits come through with reftype=Summit, so we must check for the presence of a "sota" entry
|
# and GMA summits come through with reftype=Summit, so we must check for the presence of a "sota" entry
|
||||||
# to determine if it's a SOTA summit.
|
# to determine if it's a SOTA summit.
|
||||||
if spot.sig_refs and "reftype" in ref_info and ref_info["reftype"] not in ["POTA", "WWFF"] and (
|
if spot.sig_refs and "reftype" in ref_info and ref_info["reftype"] not in ["POTA", "WWFF"] and (
|
||||||
ref_info["reftype"] != "Summit" or "sota" not in ref_info or ref_info["sota"] == ""):
|
ref_info["reftype"] != "Summit" or "sota" not in ref_info or ref_info["sota"] == ""):
|
||||||
match ref_info["reftype"]:
|
match ref_info["reftype"]:
|
||||||
case "Summit":
|
case "Summit":
|
||||||
spot.sig_refs[0].sig = "GMA"
|
spot.sig_refs[0].sig = "GMA"
|
||||||
spot.sig = "GMA"
|
spot.sig = "GMA"
|
||||||
case "IOTA Island":
|
case "IOTA Island":
|
||||||
spot.sig_refs[0].sig = "IOTA"
|
spot.sig_refs[0].sig = "IOTA"
|
||||||
spot.sig = "IOTA"
|
spot.sig = "IOTA"
|
||||||
case "Lighthouse (ILLW)":
|
case "Lighthouse (ILLW)":
|
||||||
spot.sig_refs[0].sig = "ILLW"
|
spot.sig_refs[0].sig = "ILLW"
|
||||||
spot.sig = "ILLW"
|
spot.sig = "ILLW"
|
||||||
case "Lighthouse (ARLHS)":
|
case "Lighthouse (ARLHS)":
|
||||||
spot.sig_refs[0].sig = "ARLHS"
|
spot.sig_refs[0].sig = "ARLHS"
|
||||||
spot.sig = "ARLHS"
|
spot.sig = "ARLHS"
|
||||||
case "Castle":
|
case "Castle":
|
||||||
spot.sig_refs[0].sig = "WCA"
|
spot.sig_refs[0].sig = "WCA"
|
||||||
spot.sig = "WCA"
|
spot.sig = "WCA"
|
||||||
case "Mill":
|
case "Mill":
|
||||||
spot.sig_refs[0].sig = "MOTA"
|
spot.sig_refs[0].sig = "MOTA"
|
||||||
spot.sig = "MOTA"
|
spot.sig = "MOTA"
|
||||||
case _:
|
case _:
|
||||||
logging.warning("GMA spot found with ref type " + ref_info[
|
logging.warning("GMA spot found with ref type " + ref_info[
|
||||||
"reftype"] + ", developer needs to add support for this!")
|
"reftype"] + ", developer needs to add support for this!")
|
||||||
spot.sig_refs[0].sig = ref_info["reftype"]
|
spot.sig_refs[0].sig = ref_info["reftype"]
|
||||||
spot.sig = ref_info["reftype"]
|
spot.sig = ref_info["reftype"]
|
||||||
|
|
||||||
|
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
||||||
|
# that for us.
|
||||||
|
new_spots.append(spot)
|
||||||
|
except:
|
||||||
|
logging.warning("Exception when looking up " + self.REF_INFO_URL_ROOT + source_spot[
|
||||||
|
"REF"] + ", ignoring this spot for now")
|
||||||
|
else:
|
||||||
|
logging.warning("The GMA API returned an unexpected response.")
|
||||||
|
|
||||||
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point; other code will do
|
|
||||||
# that for us.
|
|
||||||
new_spots.append(spot)
|
|
||||||
except:
|
|
||||||
logging.warning("Exception when looking up " + self.REF_INFO_URL_ROOT + source_spot[
|
|
||||||
"REF"] + ", ignoring this spot for now")
|
|
||||||
return new_spots
|
return new_spots
|
||||||
|
|
||||||
def can_submit_spot(self, sig):
|
def can_submit_spot(self, sig):
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/add-spot.js?v=1781954233"></script>
|
<script src="/js/add-spot.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/alerts.js?v=1781954233"></script>
|
<script src="/js/alerts.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -77,8 +77,8 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1781954233"></script>
|
<script src="/js/spotsbandsandmap.js?v=1781958515"></script>
|
||||||
<script src="/js/bands.js?v=1781954233"></script>
|
<script src="/js/bands.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "skeleton.html" %}
|
{% extends "skeleton.html" %}
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/css/style.css?v=1781954233" type="text/css">
|
<link rel="stylesheet" href="/css/style.css?v=1781958515" type="text/css">
|
||||||
<link href="/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
<link href="/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
||||||
<link href="/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
<link href="/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||||
<link href="/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
<link href="/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||||
@@ -10,10 +10,10 @@
|
|||||||
<script src="/vendor/js/bootstrap-5.3.8.bundle.min.js"></script>
|
<script src="/vendor/js/bootstrap-5.3.8.bundle.min.js"></script>
|
||||||
<script src="/vendor/js/tinycolor2-1.6.0.min.js"></script>
|
<script src="/vendor/js/tinycolor2-1.6.0.min.js"></script>
|
||||||
|
|
||||||
<script src="/js/utils.js?v=1781954233"></script>
|
<script src="/js/utils.js?v=1781958515"></script>
|
||||||
<script src="/js/ui-ham.js?v=1781954233"></script>
|
<script src="/js/ui-ham.js?v=1781958515"></script>
|
||||||
<script src="/js/geo.js?v=1781954233"></script>
|
<script src="/js/geo.js?v=1781958515"></script>
|
||||||
<script src="/js/common.js?v=1781954233"></script>
|
<script src="/js/common.js?v=1781958515"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/vendor/js/chart-4.4.9.umd.min.js"></script>
|
<script src="/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||||
<script src="/js/conditions.js?v=1781954233"></script>
|
<script src="/js/conditions.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -95,8 +95,8 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1781954233"></script>
|
<script src="/js/spotsbandsandmap.js?v=1781958515"></script>
|
||||||
<script src="/js/map.js?v=1781954233"></script>
|
<script src="/js/map.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -116,8 +116,8 @@
|
|||||||
<script>
|
<script>
|
||||||
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
let spotProvidersEnabledByDefault = {% raw json_encode(web_ui_options["spot-providers-enabled-by-default"]) %};
|
||||||
</script>
|
</script>
|
||||||
<script src="/js/spotsbandsandmap.js?v=1781954233"></script>
|
<script src="/js/spotsbandsandmap.js?v=1781958515"></script>
|
||||||
<script src="/js/spots.js?v=1781954233"></script>
|
<script src="/js/spots.js?v=1781958515"></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>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/js/status.js?v=1781954233"></script>
|
<script src="/js/status.js?v=1781958515"></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