Improve add spot page warning and server-side validation. #71

This commit is contained in:
Ian Renton
2025-11-01 10:29:18 +00:00
parent 69821f817b
commit a3ec923c56
6 changed files with 45 additions and 10 deletions

View File

@@ -493,7 +493,7 @@ paths:
tags:
- spots
summary: Add a spot
description: "Supply a new spot object, which will be added to the system. Currently, this will not be reported up the chain to a cluster, POTA, SOTA etc. This will be introduced in a future version. cURL example: `curl --request POST --header \"Content-Type: application/json\" --data '{\"dx_call\":\"M0TRT\",\"time\":1760019539, \"freq\":14200000, \"comment\":\"Test spot please ignore\", \"de_call\":\"M0TRT\"}' https://spothole.app/api/v1/spot`"
description: "Supply a new spot object, which will be added to the system. Currently, this will not be reported up the chain to a cluster, POTA, SOTA etc. This may be introduced in a future version. cURL example: `curl --request POST --header \"Content-Type: application/json\" --data '{\"dx_call\":\"M0TRT\",\"time\":1760019539, \"freq\":14200000, \"comment\":\"Test spot please ignore\", \"de_call\":\"M0TRT\"}' https://spothole.app/api/v1/spot`"
operationId: spot
requestBody:
description: The JSON spot object

View File

@@ -7,7 +7,7 @@
/* INTRO/WARNING BOXES */
#intro-box {
.permanently-dismissible-box {
display: none;
}

View File

@@ -48,7 +48,7 @@ function addSpot() {
}, 1000);
},
error: function (result) {
showAddSpotError(result.responseText);
showAddSpotError(result.responseText.slice(1,-1));
}
});
} catch (error) {
@@ -73,8 +73,20 @@ $("#mode").change(function () {
$(this).val($(this).val().trim().toUpperCase());
});
// Display the intro box, unless the user has already dismissed it once.
function displayIntroBox() {
if (localStorage.getItem("add-spot-intro-box-dismissed") == null) {
$("#add-spot-intro-box").show();
}
$("#add-spot-intro-box-dismiss").click(function() {
localStorage.setItem("add-spot-intro-box-dismissed", true);
});
}
// Startup
$(document).ready(function() {
// Load settings from settings storage
loadSettings();
// Display intro box
displayIntroBox();
});