Update public source
This commit is contained in:
+288
-235
@@ -1320,63 +1320,76 @@ map.on(
|
||||
// Access Points
|
||||
// ==================================================
|
||||
|
||||
const apFeatures = [];
|
||||
const handshakeFeatures = [];
|
||||
const pmkidFeatures = [];
|
||||
const passwordFeatures = [];
|
||||
const apFeatures = [];
|
||||
const handshakeFeatures = [];
|
||||
const pmkidFeatures = [];
|
||||
const passwordFeatures = [];
|
||||
const openFeatures = [];
|
||||
|
||||
|
||||
markers.forEach(
|
||||
function(ap)
|
||||
{
|
||||
const feature = {
|
||||
type:"Feature",
|
||||
geometry:{
|
||||
type:"Point",
|
||||
coordinates:[
|
||||
ap.lon,
|
||||
ap.lat
|
||||
]
|
||||
},
|
||||
properties:{
|
||||
popup:ap.popup || "",
|
||||
handshake:ap.handshake,
|
||||
pmkid:ap.pmkid,
|
||||
cracked:ap.cracked
|
||||
}
|
||||
};
|
||||
markers.forEach(
|
||||
function(ap)
|
||||
{
|
||||
const feature = {
|
||||
type:"Feature",
|
||||
geometry:{
|
||||
type:"Point",
|
||||
coordinates:[
|
||||
ap.lon,
|
||||
ap.lat
|
||||
]
|
||||
},
|
||||
properties:{
|
||||
popup:ap.popup || "",
|
||||
handshake:ap.handshake,
|
||||
pmkid:ap.pmkid,
|
||||
cracked:ap.cracked,
|
||||
encryption:ap.encryption
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// All Access Points source.
|
||||
// Every AP belongs here so that clustering
|
||||
// represents the complete AP population.
|
||||
apFeatures.push(
|
||||
feature
|
||||
);
|
||||
// All Access Points source.
|
||||
// Every AP belongs here so that clustering
|
||||
// represents the complete AP population.
|
||||
apFeatures.push(
|
||||
feature
|
||||
);
|
||||
|
||||
|
||||
if(ap.cracked)
|
||||
{
|
||||
passwordFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
if(ap.cracked)
|
||||
{
|
||||
passwordFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
|
||||
else if(ap.pmkid)
|
||||
{
|
||||
pmkidFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
else if(ap.pmkid)
|
||||
{
|
||||
pmkidFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
|
||||
else if(ap.handshake)
|
||||
{
|
||||
handshakeFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
else if(ap.handshake)
|
||||
{
|
||||
handshakeFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
|
||||
else if(
|
||||
String(ap.encryption || "")
|
||||
.trim()
|
||||
.toUpperCase() === "OPEN"
|
||||
)
|
||||
{
|
||||
openFeatures.push(
|
||||
feature
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
const createSource =
|
||||
@@ -1454,6 +1467,13 @@ map.on(
|
||||
|
||||
);
|
||||
|
||||
createSource(
|
||||
|
||||
"open-aps",
|
||||
|
||||
openFeatures
|
||||
|
||||
);
|
||||
|
||||
// ==================================================
|
||||
// AP clusters
|
||||
@@ -1670,6 +1690,16 @@ paint:{
|
||||
|
||||
);
|
||||
|
||||
addPointLayer(
|
||||
|
||||
"open-ap-points",
|
||||
|
||||
"open-aps",
|
||||
|
||||
"#AB47BC"
|
||||
|
||||
);
|
||||
|
||||
|
||||
// ==================================================
|
||||
// Popups
|
||||
@@ -1685,153 +1715,155 @@ paint:{
|
||||
|
||||
"password-points"
|
||||
|
||||
"open-ap-points"
|
||||
|
||||
];
|
||||
|
||||
|
||||
popupLayers.forEach(
|
||||
function(layerId)
|
||||
{
|
||||
map.on(
|
||||
"click",
|
||||
layerId,
|
||||
function(e)
|
||||
{
|
||||
if(
|
||||
!e.features
|
||||
||
|
||||
!e.features.length
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
popupLayers.forEach(
|
||||
function(layerId)
|
||||
{
|
||||
map.on(
|
||||
"click",
|
||||
layerId,
|
||||
function(e)
|
||||
{
|
||||
if(
|
||||
!e.features
|
||||
||
|
||||
!e.features.length
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const feature =
|
||||
e.features[0];
|
||||
const feature =
|
||||
e.features[0];
|
||||
|
||||
if(
|
||||
!feature
|
||||
||
|
||||
!feature.properties
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(
|
||||
!feature
|
||||
||
|
||||
!feature.properties
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const popup =
|
||||
feature.properties.popup
|
||||
||
|
||||
"<b>Access Point</b>";
|
||||
const popup =
|
||||
feature.properties.popup
|
||||
||
|
||||
"<b>Access Point</b>";
|
||||
|
||||
new maplibregl.Popup()
|
||||
.setLngLat(
|
||||
feature.geometry.coordinates
|
||||
)
|
||||
.setHTML(
|
||||
popup
|
||||
)
|
||||
.addTo(map);
|
||||
}
|
||||
);
|
||||
new maplibregl.Popup()
|
||||
.setLngLat(
|
||||
feature.geometry.coordinates
|
||||
)
|
||||
.setHTML(
|
||||
popup
|
||||
)
|
||||
.addTo(map);
|
||||
}
|
||||
);
|
||||
|
||||
map.on(
|
||||
"mouseenter",
|
||||
layerId,
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"pointer";
|
||||
}
|
||||
);
|
||||
map.on(
|
||||
"mouseenter",
|
||||
layerId,
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"pointer";
|
||||
}
|
||||
);
|
||||
|
||||
map.on(
|
||||
"mouseleave",
|
||||
layerId,
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"";
|
||||
}
|
||||
);
|
||||
map.on(
|
||||
"mouseleave",
|
||||
layerId,
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"";
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ==================================================
|
||||
// Cluster click
|
||||
// ==================================================
|
||||
// ==================================================
|
||||
// Cluster click
|
||||
// ==================================================
|
||||
|
||||
map.on(
|
||||
"click",
|
||||
"ap-clusters",
|
||||
function(e)
|
||||
{
|
||||
const features =
|
||||
map.queryRenderedFeatures(
|
||||
e.point,
|
||||
{
|
||||
layers:[
|
||||
"ap-clusters"
|
||||
]
|
||||
}
|
||||
);
|
||||
map.on(
|
||||
"click",
|
||||
"ap-clusters",
|
||||
function(e)
|
||||
{
|
||||
const features =
|
||||
map.queryRenderedFeatures(
|
||||
e.point,
|
||||
{
|
||||
layers:[
|
||||
"ap-clusters"
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
if(
|
||||
!features.length
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(
|
||||
!features.length
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const clusterId =
|
||||
features[0].properties
|
||||
.cluster_id;
|
||||
const clusterId =
|
||||
features[0].properties
|
||||
.cluster_id;
|
||||
|
||||
map.getSource("aps")
|
||||
.getClusterExpansionZoom(
|
||||
clusterId,
|
||||
function(
|
||||
error,
|
||||
zoom
|
||||
)
|
||||
{
|
||||
if(error)
|
||||
{
|
||||
return;
|
||||
}
|
||||
map.getSource("aps")
|
||||
.getClusterExpansionZoom(
|
||||
clusterId,
|
||||
function(
|
||||
error,
|
||||
zoom
|
||||
)
|
||||
{
|
||||
if(error)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
map.easeTo({
|
||||
center:
|
||||
features[0]
|
||||
.geometry
|
||||
.coordinates,
|
||||
map.easeTo({
|
||||
center:
|
||||
features[0]
|
||||
.geometry
|
||||
.coordinates,
|
||||
|
||||
zoom:zoom
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
zoom:zoom
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
map.on(
|
||||
"mouseenter",
|
||||
"ap-clusters",
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"pointer";
|
||||
}
|
||||
);
|
||||
map.on(
|
||||
"mouseenter",
|
||||
"ap-clusters",
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"pointer";
|
||||
}
|
||||
);
|
||||
|
||||
map.on(
|
||||
"mouseleave",
|
||||
"ap-clusters",
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"";
|
||||
}
|
||||
);
|
||||
map.on(
|
||||
"mouseleave",
|
||||
"ap-clusters",
|
||||
function()
|
||||
{
|
||||
map.getCanvas().style.cursor =
|
||||
"";
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ==================================================
|
||||
@@ -1887,76 +1919,85 @@ paint:{
|
||||
};
|
||||
|
||||
|
||||
// ==================================================
|
||||
// Layer switcher
|
||||
// ==================================================
|
||||
// ==================================================
|
||||
// Layer switcher
|
||||
// ==================================================
|
||||
|
||||
document.querySelectorAll(
|
||||
".session-map-controls input[data-layer]"
|
||||
).forEach(
|
||||
function(input)
|
||||
{
|
||||
input.addEventListener(
|
||||
"change",
|
||||
function()
|
||||
{
|
||||
const layer =
|
||||
input.dataset.layer;
|
||||
document.querySelectorAll(
|
||||
".session-map-controls input[data-layer]"
|
||||
).forEach(
|
||||
function(input)
|
||||
{
|
||||
input.addEventListener(
|
||||
"change",
|
||||
function()
|
||||
{
|
||||
const layer =
|
||||
input.dataset.layer;
|
||||
|
||||
|
||||
layerState[layer] =
|
||||
input.checked;
|
||||
layerState[layer] =
|
||||
input.checked;
|
||||
|
||||
|
||||
if(layer === "gps")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"gps-track"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
if(layer === "gps")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"gps-track"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(layer === "handshake")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"handshake-points",
|
||||
"pmkid-points"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
if(layer === "handshake")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"handshake-points",
|
||||
"pmkid-points"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(layer === "password")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"password-points"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
if(layer === "password")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"password-points"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
|
||||
if(layer === "open")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"open-ap-points"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
|
||||
if(layer === "all")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"ap-points",
|
||||
"ap-clusters",
|
||||
"ap-cluster-count"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
if(layer === "all")
|
||||
{
|
||||
setLayerVisibility(
|
||||
[
|
||||
"ap-points",
|
||||
"ap-clusters",
|
||||
"ap-cluster-count"
|
||||
],
|
||||
input.checked
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
// ==================================================
|
||||
@@ -2054,6 +2095,18 @@ window.setTimeout(
|
||||
Password
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
data-layer="open"
|
||||
checked
|
||||
>
|
||||
<span
|
||||
class="map-layer-dot map-layer-dot-open"
|
||||
></span>
|
||||
Open AP
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
|
||||
Reference in New Issue
Block a user