Take a unique ID for maps.

I want to be able to share this without giving away my data.

The page takes a query parameter map=<ID>, which says which data file to load.

If you load the page without a map ID, it makes up a random 8-digit hex string and uses that.

The no-selection view shows a link to the map.
This commit is contained in:
Christian Lawson-Perfect 2025-02-10 11:52:12 +00:00
parent 5d69d2cad7
commit fe963ec2db
6 changed files with 67 additions and 28 deletions

51
app.js
View file

@ -5160,9 +5160,9 @@ var $elm$core$Task$perform = F2(
});
var $elm$browser$Browser$document = _Browser_document;
var $elm$json$Json$Decode$decodeValue = _Json_run;
var $author$project$App$Flags = F2(
function (emoji, markers) {
return {emoji: emoji, markers: markers};
var $author$project$App$Flags = F3(
function (emoji, markers, map_id) {
return {emoji: emoji, map_id: map_id, markers: markers};
});
var $author$project$App$Emoji = F2(
function (emoji, description) {
@ -5198,8 +5198,9 @@ var $author$project$App$decode_marker = A5(
A2($elm$json$Json$Decode$field, 'name', $elm$json$Json$Decode$string),
A2($elm$json$Json$Decode$field, 'note', $elm$json$Json$Decode$string));
var $elm$json$Json$Decode$list = _Json_decodeList;
var $author$project$App$decode_flags = A3(
$elm$json$Json$Decode$map2,
var $elm$json$Json$Decode$map3 = _Json_map3;
var $author$project$App$decode_flags = A4(
$elm$json$Json$Decode$map3,
$author$project$App$Flags,
A2(
$elm$json$Json$Decode$field,
@ -5208,7 +5209,8 @@ var $author$project$App$decode_flags = A3(
A2(
$elm$json$Json$Decode$field,
'markers',
$elm$json$Json$Decode$list($author$project$App$decode_marker)));
$elm$json$Json$Decode$list($author$project$App$decode_marker)),
A2($elm$json$Json$Decode$field, 'map_id', $elm$json$Json$Decode$string));
var $author$project$App$CurrentPositionCentre = {$: 'CurrentPositionCentre'};
var $author$project$App$NoSelection = {$: 'NoSelection'};
var $author$project$App$blank_marker = {
@ -5223,8 +5225,9 @@ var $elm$core$Basics$negate = function (n) {
var $author$project$App$init_model = {
accuracy: 0,
centre: $author$project$App$CurrentPositionCentre,
current_position: {lat: 55.05155870729228, lon: -1.4652193740914812},
current_position: {lat: 55.04, lon: -1.46},
emoji: _List_Nil,
map_id: '',
markers: _List_Nil,
new_marker: $author$project$App$blank_marker,
selection: $author$project$App$NoSelection
@ -5244,7 +5247,7 @@ var $author$project$App$init = function (vflags) {
var flags = _v0.a;
return _Utils_update(
$author$project$App$init_model,
{emoji: flags.emoji, markers: flags.markers});
{emoji: flags.emoji, map_id: flags.map_id, markers: flags.markers});
}
}());
};
@ -5731,6 +5734,7 @@ var $author$project$App$UpdateExistingMarker = F2(
var $author$project$App$UpdateNewMarker = function (a) {
return {$: 'UpdateNewMarker', a: a};
};
var $elm$html$Html$a = _VirtualDom_node('a');
var $elm$virtual_dom$VirtualDom$attribute = F2(
function (key, value) {
return A2(
@ -5841,6 +5845,12 @@ var $elm$html$Html$form = _VirtualDom_node('form');
var $elm$core$String$fromFloat = _String_fromNumber;
var $elm$html$Html$h1 = _VirtualDom_node('h1');
var $elm$html$Html$h2 = _VirtualDom_node('h2');
var $elm$html$Html$Attributes$href = function (url) {
return A2(
$elm$html$Html$Attributes$stringProperty,
'href',
_VirtualDom_noJavaScriptUri(url));
};
var $elm$html$Html$Attributes$id = $elm$html$Html$Attributes$stringProperty('id');
var $elm$html$Html$input = _VirtualDom_node('input');
var $elm$html$Html$label = _VirtualDom_node('label');
@ -5906,13 +5916,6 @@ var $author$project$LatLonDistance$lat_lon_distance = F2(
var $elm$html$Html$li = _VirtualDom_node('li');
var $elm$html$Html$Attributes$list = _VirtualDom_attribute('list');
var $elm$html$Html$main_ = _VirtualDom_node('main');
var $elm$html$Html$a = _VirtualDom_node('a');
var $elm$html$Html$Attributes$href = function (url) {
return A2(
$elm$html$Html$Attributes$stringProperty,
'href',
_VirtualDom_noJavaScriptUri(url));
};
var $elm$virtual_dom$VirtualDom$Normal = function (a) {
return {$: 'Normal', a: a};
};
@ -6390,7 +6393,23 @@ var $author$project$App$view = function (model) {
A3($author$project$App$marker_link, m.icon + (' ' + m.name), i, m)
]));
},
A2($elm$core$List$take, 3, closest_markers)))
A2($elm$core$List$take, 3, closest_markers))),
A2(
$elm$html$Html$p,
_List_Nil,
_List_fromArray(
[
A2(
$elm$html$Html$a,
_List_fromArray(
[
$elm$html$Html$Attributes$href('?map=' + model.map_id)
]),
_List_fromArray(
[
$elm$html$Html$text('🔗 Link to this map')
]))
]))
]));
}
}();