Compare commits

..
Author SHA1 Message Date
Copilot
aa6ef7f362
fix: Pin PHP to php2shell-patched release
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 40s
Build (and tag) Images / Build web Image (push) Successful in 55s
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-15 14:24:47 +01:00
13f0211624
revert: Uses previous port mapping 2026-11-15 14:24:25 +01:00
3013bf42b1
fix: Adds missing documentation hint for secret replacement 2026-11-15 14:24:25 +01:00
f5ef9adc4d
docs: Adds information about changes when running in a development environment 2026-11-15 14:24:25 +01:00
b6c05e5265
docs: Removes incorrect comment 2026-11-15 14:24:12 +01:00
ea5e305304
fix: Handles issue where error handler was skipped, if database DNS request fails 2026-11-15 14:24:12 +01:00
d9529cf6c0
fix: Enables PHP log output when running in development 2026-11-15 14:24:12 +01:00
54e78f3f4e
docs: Adds instructions about dev override
chore: Applies docker naming convention to files
2026-11-15 14:24:12 +01:00
7727c56351
feat: web healthcheck returns 503 status code if database is unavailable 2026-11-15 14:24:12 +01:00
aso
c186886df7
modified health check for web 2026-11-15 14:24:12 +01:00
aso
6f633a400c
first changes for sync of instances 2026-11-15 14:24:12 +01:00
f1dd6f9b2f
fix: Restarts any container unless stopped by user 2026-11-15 14:24:11 +01:00
c53b37e8f0
feat: Adds healthcheck that restarts data_handler, when any error is printed to log files 2026-11-15 14:23:58 +01:00
ddc73f7207
chore: Immediately starts update_camera on container startup 2026-11-15 14:23:58 +01:00
7332dd8d3c
refactor: Increases verbosity of data_handler 2026-11-15 14:23:58 +01:00
d794ee032c
feat: Adds healthcheck to web server 2026-11-15 14:23:57 +01:00
stb
60694442c2 Merge pull request 'Fix security issues' (#38) from security-fixes into main
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 41s
Build (and tag) Images / Build web Image (push) Successful in 55s
Reviewed-on: #38
2026-11-15 13:42:03 +01:00
stb
2b47d340c3 Merge branch 'main' into security-fixes
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 42s
Build (and tag) Images / Build web Image (push) Successful in 57s
2026-11-15 13:38:04 +01:00
stb
9623b53bd1 Merge pull request 'Removes offline and unavailable links' (#33) from link-updates into main
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 50s
Build (and tag) Images / Build web Image (push) Successful in 1m9s
Reviewed-on: #33
Reviewed-by: stb <stb@noreply.git.hamburg.ccc.de>
2026-11-15 13:37:56 +01:00
stb
1f1219d772 Merge branch 'main' into link-updates
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 41s
Build (and tag) Images / Build web Image (push) Successful in 59s
2026-11-15 13:29:08 +01:00
stb
bef369d002 Merge branch 'main' into security-fixes
All checks were successful
Build (and tag) Images / Build data_handler Image (push) Successful in 40s
Build (and tag) Images / Build web Image (push) Successful in 1m2s
2026-11-15 13:28:46 +01:00
d724be54bf chore: Reverts workflow changes
Some checks failed
Build (and tag) Images / build (push) Has been cancelled
The image build workflow is handled separately in the kaniko-build branch;
this pull request no longer changes it.
2026-11-15 11:57:20 +01:00
46b7509c37 chore: Reverts workflow changes
Some checks failed
Build (and tag) Images / build (push) Has been cancelled
The image build workflow is handled separately in the kaniko-build branch;
this pull request no longer changes it.
2026-11-15 11:57:18 +01:00
6ec1b9fc5a fix: Builds images with kaniko
All checks were successful
Build (and tag) Images / build (push) Successful in 1m23s
There are no Windows runners; build the images with kaniko in a container
on the `docker` runner, as on the link-updates branch, while keeping the
publishing restrictions:

- only pushes to refs/heads/main publish, as `latest` and `sha-<commit>`
- other refs build with --no-push under a ci-<commit> tag
- registry credentials are only passed to the build when publishing

The docker compose smoke test is dropped, as there is no Docker daemon
inside the kaniko container.
2026-11-15 11:48:03 +01:00
da84719d3c fix: Removes trailing comma from links.json
All checks were successful
Build (and tag) Images / build (push) Successful in 1m34s
Removing the last German entry left a trailing comma, which makes json_decode() fail and hides the whole links section.
2026-11-15 11:47:13 +01:00
9d7b66cb3c Merge remote-tracking branch 'origin/main' into link-updates 2026-11-15 11:47:13 +01:00
3211e0f355 Merge remote-tracking branch 'origin/main' into security-fixes
Some checks failed
Build (and tag) Images / build (push) Has been cancelled
2026-11-15 11:45:52 +01:00
cdf90a04d3 fix: Corrects country code check in statistics filter
Some checks failed
Build (and tag) Images / build (push) Failing after 12s
Operator precedence made the check always true; it now accepts two capital letters or '--' as intended.
2026-11-15 11:36:49 +01:00
3b28280333 fix: Escapes generated SQL and validates sequence number
create_camera_update_statements.php wrote OSM tag keys and values unescaped
into /migrations/*.sql. Values are now escaped and node ids cast to int.
The sequence number argument must be numeric and is bound as a parameter
instead of being concatenated into SQL and the output path.
2026-11-15 11:36:49 +01:00
189105075c fix: Publishes images only from main
Every pushed ref built and pushed images, with the tag derived from the ref
name. A branch named "latest" or a git tag named "main" therefore
overwrote the production image, and ref names were interpolated into shell
scripts unquoted (script injection).

- images are only pushed for pushes to refs/heads/main
- other refs are built and tested with a ci-<sha> tag, never pushed
- registry login happens only when publishing, after the compose test
- main additionally pushes an immutable sha-<sha> tag for pinning
- expression values are passed to scripts via env

The registry credentials still need to be restricted to main on the
Forgejo side, since a pushed branch can modify this workflow.
2026-11-15 11:36:49 +01:00
344232fb75 fix: Hardens web container
- document root is owned by root and not writable by www-data
  (the base image ships /var/www/html as www-data with mode 1777)
- uses php.ini-production, so errors are not shown to clients
- disables directory listings, expose_php and the detailed server signature
2026-11-15 11:36:49 +01:00
6a64083175 fix: Escapes location search results
Nominatim results were inserted via innerHTML and loaded as a JSONP script
with an unencoded query. Results are now fetched as JSON, the query is URL
encoded, text is escaped and coordinates must be numeric.
2026-11-15 11:36:49 +01:00
100762ea2e fix: Escapes OSM tag data in camera popups
camera.php built its JSON by hand with htmlentities(), which leaves
backslashes intact, and the client parsed it with eval() and inserted tag
values into the popup as HTML. A tag value such as <img ...> therefore
became live markup (stored XSS for anyone able to edit OSM data), and a lone
backslash broke parsing of the whole response.

- camera.php now builds the response with json_encode() and returns raw values
- tags named lat, lon, id, count, multi or poly no longer override the
  fields set by the server
- error responses no longer include database error messages
- the client uses JSON.parse() and escapes all keys and values; only
  http(s) URLs are rendered as links/images
2026-11-15 11:36:49 +01:00
b2544cf267 refactor: Uses kaniko builder
All checks were successful
Build (and tag) Images / build (push) Successful in 1m47s
2026-06-17 17:02:05 +02:00
f407b077f2 fix: Uses docker binary
Some checks failed
Build (and tag) Images / build (push) Failing after 15s
2026-06-17 16:59:21 +02:00
c6d87997b0 fix: Removes buildx
Some checks failed
Build (and tag) Images / build (push) Failing after 19s
2026-06-17 16:56:15 +02:00
3590da7e26 fix: Removes offline and unavailable links
Some checks failed
Build (and tag) Images / build (push) Failing after 27s
2026-06-17 16:50:13 +02:00
10 changed files with 166 additions and 122 deletions

View file

@ -58,7 +58,7 @@ To run Surveillance using docker, decide between development/testing or producti
3. Run `docker compose up` and wait for services to start up
3. Visit `http://localhost:8081/` in a browser; you should see an interactive OpenStreetMap
3. Visit `http://localhost:8081/` in a browser to open the web interface
4. You can see most cameras on the map immediately; the `data_handler` background process continuously applies updates from OpenStreetMap which become visible after refrshing the page

View file

@ -2,6 +2,18 @@
include "config.php";
$seqNum = $_SERVER['argv'][1] ?? '';
if (!ctype_digit($seqNum)) {
echo "Invalid sequence number\n";
exit(1);
}
// Quote a value for the generated SQL file. Values come from OSM data and are untrusted.
function sqlString($value) {
global $mysqli;
return "'" . $mysqli->real_escape_string((string) $value) . "'";
}
$elementTypes = array();
$count = 0;
$countDelete = 0;
@ -91,7 +103,7 @@ function endElement ($parser, $name) {
$mode = '';
} else if ($name == 'node') {
if ($mode == 'delete') {
$id = $curNodeAttrs['id'];
$id = (int) $curNodeAttrs['id'];
if (! $deleteTagStmt->execute()) {
echo "***** Error : Deleting tags $id : ". $deleteTagStmt->error . "\n";
@ -119,7 +131,7 @@ function endElement ($parser, $name) {
$id = $curNodeAttrs['id'];
$id = (int) $curNodeAttrs['id'];
if ($mode == 'modify') {
if (! $deleteTagStmt->execute()) {
@ -140,36 +152,36 @@ function endElement ($parser, $name) {
$k = 'lat';
$v = $curNodeAttrs['lat'];
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
$k = 'lon';
$v = $curNodeAttrs['lon'];
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
$k = 'userid';
$v = $curNodeAttrs['user'];
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
$k = 'version';
$v = $curNodeAttrs['version'];
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
$k = 'timestamp';
$v = $curNodeAttrs['timestamp'];
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
foreach($curNodeTags as $k => $v) {
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, '$k', '$v');\n";
$sql_statement = $sql_statement . "INSERT INTO tag (id, k, v) VALUES ($id, " . sqlString($k) . ", " . sqlString($v) . ");\n";
}
} else if ($mode == 'modify') {
// delete former surveillance nodes that were modified to non-surveillance nodes
$id = $curNodeAttrs['id'];
$id = (int) $curNodeAttrs['id'];
if (! $deleteTagStmt->execute()) {
echo "***** Error : Deleting tags $id for non-surveillance node : ". $deleteTagStmt->error . "\n";
@ -208,11 +220,13 @@ while ($data = fread($fp, 4096)) {
}
}
$sql="UPDATE sync_state SET v='" . $_SERVER['argv'][1] ."' WHERE k='sequenceNumber';";
$mysqli->query($sql);
$sql_statement = $sql_statement . "UPDATE sync_state SET v='" . $_SERVER['argv'][1] ."' WHERE k='sequenceNumber';\n";
$syncStmt = $mysqli->prepare("UPDATE sync_state SET v=? WHERE k='sequenceNumber'");
$syncStmt->bind_param('s', $seqNum);
$syncStmt->execute();
$syncStmt->close();
$sql_statement = $sql_statement . "UPDATE sync_state SET v='" . $seqNum ."' WHERE k='sequenceNumber';\n";
$sql_statement = $sql_statement . "COMMIT;";
$sql_file = "/migrations/".$_SERVER['argv'][1].".sql";
$sql_file = "/migrations/".$seqNum.".sql";
file_put_contents($sql_file, $sql_statement);
$mysqli->close();

View file

@ -2,6 +2,12 @@
include "config.php";
$seqNum = $_SERVER['argv'][1] ?? '';
if (!ctype_digit($seqNum)) {
echo "Invalid sequence number\n";
exit(1);
}
$elementTypes = array();
$count = 0;
$countDelete = 0;
@ -281,8 +287,10 @@ while ($data = fread($fp, 4096)) {
}
}
$sql="UPDATE sync_state SET v='" . $_SERVER['argv'][1] ."' WHERE k='sequenceNumber';";
$mysqli->query($sql);
$syncStmt = $mysqli->prepare("UPDATE sync_state SET v=? WHERE k='sequenceNumber'");
$syncStmt->bind_param('s', $seqNum);
$syncStmt->execute();
$syncStmt->close();
$mysqli->commit();
printDebug();

View file

@ -31,7 +31,7 @@ services:
DEFAULT_LANGUAGE: en
IMPRESSUM_URL: https://hamburg.ccc.de/imprint/
ports:
- "8081:80"
- "8080:80"
depends_on:
db:
condition: service_started

View file

@ -1,4 +1,17 @@
FROM docker.io/library/php:apache
FROM docker.io/library/php:8.5.12-apache
RUN docker-php-ext-install mysqli bcmath
COPY ./www/* /var/www/html
# Use PHP's production defaults (no error output to clients) and hide the PHP version.
RUN cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& printf 'expose_php = Off\n' > "$PHP_INI_DIR/conf.d/zz-hardening.ini"
# Disable directory listings and reduce the server signature.
RUN sed -i 's/^\(\s*Options\) Indexes FollowSymLinks/\1 FollowSymLinks/' /etc/apache2/apache2.conf \
&& sed -i -e 's/^ServerTokens .*/ServerTokens Prod/' -e 's/^ServerSignature .*/ServerSignature Off/' /etc/apache2/conf-available/security.conf
COPY ./www/* /var/www/html
# The web server must not be able to create or modify files in the document root.
RUN chown -R root:root /var/www/html \
&& chmod -R u=rwX,go=rX /var/www/html

View file

@ -3,6 +3,17 @@
define('MAX_POINTS_FOR_QUICKHULL', 3000);
// Fields set by this script; OSM tags with these keys are not passed on.
define('RESERVED_KEYS', array('lat', 'lon', 'id', 'count', 'multi', 'poly'));
define('JSON_FLAGS', JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_INVALID_UTF8_SUBSTITUTE);
function exitWithError($message) {
header('Content-type: application/json; charset=utf-8');
echo json_encode(array('error' => $message), JSON_FLAGS);
exit;
}
class OsmPoint {
var $id;
var $lat;
@ -178,63 +189,47 @@
|| !array_key_exists('zoom', $_GET)
|| !array_key_exists('width', $_GET)
|| !array_key_exists('height', $_GET)) {
header('Content-type: application/json');
$result = '{"error":"bbox, zoom, width and height parameters are required. '
exitWithError('bbox, zoom, width and height parameters are required. '
.(array_key_exists('bbox', $_GET) ? '' : 'bbox is empty. ')
.(array_key_exists('zoom', $_GET) ? '' : 'zoom is empty. ')
.(array_key_exists('width', $_GET) ? '' : 'width is empty. ')
.(array_key_exists('height', $_GET) ? '' : 'height is empty. ')
.'"}';
echo $result;
exit;
.(array_key_exists('height', $_GET) ? '' : 'height is empty. '));
}
/* Check zoom */
$zoom = $_GET['zoom'];
if ( !is_numeric($zoom)
if ( !is_string($zoom)
|| !is_numeric($zoom)
|| intval($zoom) < 1
|| intval($zoom) > 19) {
header('Content-type: application/json');
$result = '{"error":"unexpected zoom value : '
.htmlentities($zoom)
.'"}';
echo $result;
exit;
exitWithError('unexpected zoom value');
}
/* Check bounds box --> bbox=boundsSW.lng,boundsSW.lat,boundsNE.lng,boundsNE.lat */
if (!is_string($_GET['bbox'])) {
exitWithError('unexpected bbox value');
}
$bbox = explode(',', $_GET['bbox']);
if ( !is_numeric($bbox[0]) || $bbox[0] > 180 // 0 = SW.lng
if ( count($bbox) != 4
|| !is_numeric($bbox[0]) || $bbox[0] > 180 // 0 = SW.lng
|| !is_numeric($bbox[2]) || $bbox[2] < -180 // 2 = NE.lng
|| !is_numeric($bbox[1]) || $bbox[1] < -90 || $bbox[1] > 90 // 1 = SW.lat
|| !is_numeric($bbox[3]) || $bbox[3] < -90 || $bbox[3] > 90) { // 3 = NE.lat
header('Content-type: application/json');
$result = '{"error":"unexpected bbox longitude and latitude values : '
.'lon ['.htmlentities($bbox[0]).', '.htmlentities($bbox[2]).'], '
.'lat ['.htmlentities($bbox[1]).', '.htmlentities($bbox[3]).']'
.'"}';
echo $result;
exit;
exitWithError('unexpected bbox longitude and latitude values : '
.'lon ['.$bbox[0].', '.$bbox[2].'], '
.'lat ['.$bbox[1].', '.$bbox[3].']');
}
if ($bbox[0] >= $bbox[2]) { // 0 = SW.lng | 2 = NE.lng
header('Content-type: application/json');
$result = '{"error":"min longitude greater than max longitude : '
.'lon ['.htmlentities($bbox[0]).', '.htmlentities($bbox[2]).']'
.'"}';
echo $result;
exit;
exitWithError('min longitude greater than max longitude : '
.'lon ['.$bbox[0].', '.$bbox[2].']');
}
if ($bbox[1] >= $bbox[3]) { // 1 = SW.lat | 3 = NE.lat
header('Content-type: application/json');
$result = '{"error":"min latitude greater than max latitude : '
.'lat ['.htmlentities($bbox[1]).', '.htmlentities($bbox[3]).']'
.'"}';
echo $result;
exit;
exitWithError('min latitude greater than max latitude : '
.'lat ['.$bbox[1].', '.$bbox[3].']');
}
$lonMin = $bbox[0]; // 0 = SW.lng
@ -246,12 +241,7 @@
$pixelHeight = (int) $_GET['height'];
if ($pixelWidth == 0 || $pixelHeight == 0) {
header('Content-type: application/json');
$result = '{"error":"width or height is null : '
.htmlentities($pixelWidth).'x'.htmlentities($pixelHeight)
.'"}';
echo $result;
exit;
exitWithError('width or height is null : '.$pixelWidth.'x'.$pixelHeight);
}
$lonWidth = $lonMax - $lonMin; // NE.lng - SW.lng
@ -267,10 +257,7 @@
/* Connect to database */
$mysqli = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB);
if($mysqli->connect_errno) {
header('Content-type: application/json');
$result = '{"error":"error while connecting to db : ' . $mysqli->error . '"}';
echo $result;
exit;
exitWithError('error while connecting to db');
}
$rqtLonMin = $lonMin; // SW.lng
@ -364,10 +351,7 @@
$stmt->close();
} else {
$mysqli->close();
header('Content-type: application/json');
$result = '{"error":"Error while request : ' . $mysqli->error . '"}';
echo $result;
exit;
exitWithError('error while querying db');
}
/* Unify some clusters if nodes center are near */
@ -379,8 +363,7 @@
}
}
$result='[';
$separator='';
$result = array();
/* Writing selected points */
$sql='SELECT k, v
@ -392,53 +375,49 @@
$stmt->bind_param('d', $id);
$stmt->bind_result($k, $v);
/* Writing grouped items or not */
/* Writing grouped items or not. All values are passed on unescaped; the client
must escape them before inserting them into HTML. */
foreach($resArray as $val) {
if ($val['count'] > 0) {
$result = $result.$separator
.'{"lat":"'.($val['latitude'] / $val['count']).'"'
.',"lon":"'.($val['longitude'] / $val['count']).'"';
$entry = array(
'lat' => (string) ($val['latitude'] / $val['count']),
'lon' => (string) ($val['longitude'] / $val['count']));
if ($val['count'] == 1) {
$id = $val['points'][0]->id;
$result = $result.',"id":"'.$id.'"';
$entry['id'] = (string) $id;
$stmt->execute();
while($stmt->fetch()) {
$result = $result.',"'.htmlentities($k).'":"'.htmlentities($v, ENT_COMPAT, 'UTF-8').'"';
if (!in_array($k, RESERVED_KEYS, true)) {
$entry[$k] = (string) $v;
}
}
} else {
$result = $result
.',"count":"'.$val['count'].'"'
.',"multi":"yes"'
.',"poly":[';
$entry['count'] = (string) $val['count'];
$entry['multi'] = 'yes';
$entry['poly'] = array();
if ($pointsCount < MAX_POINTS_FOR_QUICKHULL) {
$convexPoly = quickHull($val['points'], $val['count']);
$sepPoly = '';
foreach($convexPoly as $point) {
$result = $result.$sepPoly.'{'
.'"lat":"'.$point->lat.'"'
.',"id":"'.$point->id.'"'
.',"lon":"'.$point->lon.'"}';
$sepPoly=',';
$entry['poly'][] = array(
'lat' => (string) $point->lat,
'id' => (string) $point->id,
'lon' => (string) $point->lon);
}
}
$result=$result.']';
}
$result = $result.'}';
$separator=',';
$result[] = $entry;
}
}
$stmt->close();
$result = $result . ']';
$mysqli->close();
header('Content-type: application/json; Charset : utf-8');
echo $result;
header('Content-type: application/json; charset=utf-8');
echo json_encode($result, JSON_FLAGS);
?>

View file

@ -129,7 +129,11 @@ function onClick(e) {
function onStateChanged() {
if (ajaxRequest.readyState == 4) { // 0 = UNSENT, 1 = OPENED, 2 = HEADERS_RECEIVED, 3 = LOADING, 4 = DONE
if (ajaxRequest.status == 200) { // 200 = OK, 404 = Page not found
plotList = eval('(' + ajaxRequest.responseText + ')');
try {
plotList = JSON.parse(ajaxRequest.responseText);
} catch(e) {
return;
}
removeMarkers();
for (i=0; i<plotList.length; i++) {
var plotLatLng;
@ -421,26 +425,39 @@ function drawCameraFocusDome(plotLatLng, focusRadius, focusColor) {
return(new L.Circle(plotLatLng, focusRadius, { weight:1, color:focusColor, fillOpacity:0.1 }));
}
// Escape a value for use in HTML text and in double-quoted attributes.
function escapeHtml(value) {
return String(value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
// Add camera popup to camera marker.
// All values in plot come unescaped from OSM data and must be escaped.
function addCameraDetailsData(plotMarker, plot) {
var id = escapeHtml(plot.id);
popupDataTable = '<table class="popup-content">'
+ '<tr><td>id</td><td><a href="https://www.openstreetmap.org/node/' + (plot.id) + '">' + (plot.id) + '</a></td></tr>'
// + '<tr><td>user osm</td><td>' + (plot.userid) + '</td></tr>'
+ '<tr><td>latitude</td><td>' + (plot.lat) + '</td></tr>'
+ '<tr><td>longitude</td><td>' + (plot.lon) + '</td></tr>';
+ '<tr><td>id</td><td><a href="https://www.openstreetmap.org/node/' + encodeURIComponent(plot.id) + '">' + id + '</a></td></tr>'
// + '<tr><td>user osm</td><td>' + escapeHtml(plot.userid) + '</td></tr>'
+ '<tr><td>latitude</td><td>' + escapeHtml(plot.lat) + '</td></tr>'
+ '<tr><td>longitude</td><td>' + escapeHtml(plot.lon) + '</td></tr>';
for (x in plot) {
if (plot[x] !== '' && x != 'multi' && x != 'id' && x != 'userid' && x != 'lat' && x != 'lon') {
popupDataTable = popupDataTable + '<tr><td>' + x + '</td><td>';
var descr = plot[x];
if (descr.substr(0, 4) == 'http') {
popupDataTable = popupDataTable + '<tr><td>' + escapeHtml(x) + '</td><td>';
var descr = String(plot[x]);
if (/^https?:\/\//i.test(descr)) {
var url = escapeHtml(descr);
var suffix = descr.slice(-3).toLowerCase();
if (suffix == 'jpg' || suffix == 'gif' || suffix == 'png') {
popupDataTable = popupDataTable + '<a href="' + descr + '"><img alt="Link" src="' + descr + '" width="200"/></a>';
popupDataTable = popupDataTable + '<a href="' + url + '"><img alt="Link" src="' + url + '" width="200"/></a>';
} else {
popupDataTable = popupDataTable + '<a href="' + descr + '">Link</a>';
popupDataTable = popupDataTable + '<a href="' + url + '">Link</a>';
}
} else {
popupDataTable = popupDataTable + plot[x];
popupDataTable = popupDataTable + escapeHtml(descr);
}
popupDataTable = popupDataTable + '</td></tr>';
}

View file

@ -37,15 +37,32 @@ function searchLocation(maxResults) {
searchLimit = 11;
}
var searchScript = document.createElement('script');
searchScript.src = 'https://nominatim.openstreetmap.org/search.php?q=' + searchString + '&format=json&json_callback=parseResult&limit=' + searchLimit;
document.body.appendChild(searchScript);
var searchUrl = 'https://nominatim.openstreetmap.org/search?q=' + encodeURIComponent(searchString)
+ '&format=json&limit=' + encodeURIComponent(searchLimit);
fetch(searchUrl)
.then(function(response) { return response.json(); })
.then(parseResult)
.catch(function() { parseResult([]); });
}
}
// Escape a value for use in HTML text and in double-quoted attributes.
function escapeSearchHtml(value) {
return String(value)
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}
function parseResult(response) {
var searchResultDivs = '';
if (!Array.isArray(response)) {
response = [];
}
if (response.length == searchLimit) {
var lastResultIndex = searchLimit - 1;
var nextSearchLimit = searchLimit + 10;
@ -67,10 +84,15 @@ function parseResult(response) {
// Show the current 10 search results.
for (var i=searchLimit-11; i<lastResultIndex; i++) {
searchResult = response[i];
var lat = Number(searchResult.lat);
var lon = Number(searchResult.lon);
if (!isFinite(lat) || !isFinite(lon)) {
continue;
}
searchResultDivs +=
'<div class="search-result" onClick="gotoLocation(' + searchResult.lat + ', ' + searchResult.lon + ');return false;">' +
'<div class="text-medium">' + searchResult.class + ' / ' + searchResult.type + '</div>' +
'<div>' + searchResult.display_name + '</div>' +
'<div class="search-result" onClick="gotoLocation(' + lat + ', ' + lon + ');return false;">' +
'<div class="text-medium">' + escapeSearchHtml(searchResult.class) + ' / ' + escapeSearchHtml(searchResult.type) + '</div>' +
'<div>' + escapeSearchHtml(searchResult.display_name) + '</div>' +
'</div>';
}

View file

@ -3,22 +3,17 @@
{ "sectionTitle": "", "isExpandable": false, "isExpandedByDefault": true, "listEntries": [
{ "sourceText": "1984 Actionday", "href": "https://1984actionday.wordpress.com/", "linkText": "When will you fight back?" },
{ "sourceText": "ACLU", "href": "https://www.aclu.org/sites/default/files/field_document/061819-robot_surveillance.pdf", "linkText": "The Dawn of Robot Surveillance" },
{ "sourceText": "Adversarial Fashion", "href": "https://adversarialfashion.com/", "linkText": "Patterns on goods designed to trigger Automated License Plate Readers" },
{ "sourceText": "Atlas of Surveillance", "href": "https://atlasofsurveillance.org/", "linkText": "Documenting Police Tech in Our Communities" },
{ "sourceText": "Ban Facial Recognition", "href": "https://www.banfacialrecognition.com/", "linkText": "Ban Facial Recognition" },
{ "sourceText": "Ban Facial Recognition", "href": "https://www.banfacialrecognition.com/festivals/", "linkText": "Ban Facial Recognition at Festivals" },
{ "sourceText": "Ban Facial Recognition", "href": "https://ban-facial-recognition.wesign.it/droitshumains/ban-facial-recognition-europe", "linkText": "Ban Facial Recognition Europe!" },
{ "sourceText": "Electronic Frontier Foundation", "href": "https://www.eff.org/sls", "linkText": "Street Level Surveillance" },
{ "sourceText": "Every Two Years", "href": "https://everytwoyears.org/", "linkText": "Help Make Democracy" },
{ "sourceText": "Fawkes", "href": "http://sandlab.cs.uchicago.edu/fawkes/", "linkText": "Image “Cloaking” for Personal Privacy" },
{ "sourceText": "GitHub", "href": "https://github.com/unsurv", "linkText": "unsurv" },
{ "sourceText": "Insecam", "href": "https://www.insecam.org/", "linkText": "World biggest online cameras directory" },
{ "sourceText": "Insecam", "href": "http://www.insecam.org/", "linkText": "World biggest online cameras directory" },
{ "sourceText": "No CCTV", "href": "http://www.no-cctv.org.uk/", "linkText": "Campaigning against camera surveillance in the UK & beyond" },
{ "sourceText": "NYC Surveillance Camera Project", "href": "http://www.mediaeater.com/cameras/", "linkText": "NYC Surveillance Camera Project" },
{ "sourceText": "Reclaim Your Face", "href": "https://reclaimyourface.eu/", "linkText": "Reclaim Your Face" },
{ "sourceText": "S.T.O.P.", "href": "https://www.stopspying.org/", "linkText": "The Surveillance Technology Oversight Project" },
{ "sourceText": "Spy Blog", "href": "https://p10.secure.hostingprod.com/@spyblog.org.uk/ssl/spyblog/cctv-surveillance-cameras/", "linkText": "Category: CCTV surveillance cameras" },
{ "sourceText": "unsurv", "href": "https://www.unsurv.org/", "linkText": "unsurv.org" },
{ "sourceText": "Wikipedia", "href": "https://www.wikipedia.org/wiki/Mass_surveillance_in_the_United_States", "linkText": "Mass Surveillance in the United States" },
{ "sourceText": "Yale University", "href": "https://privacylab.yale.edu/", "linkText": "Privacy Lab" }
] }
@ -27,7 +22,6 @@
{ "listTitle": "fra",
"sections": [
{ "sectionTitle": "", "isExpandable": false, "isExpandedByDefault": true, "listEntries": [
{ "sourceText": "Ban Facial Recognition", "href": "https://ban-facial-recognition.wesign.it/droitshumains/bannissons-la-reconnaissance-faciale-en-europe", "linkText": "Bannissons la reconnaissance faciale en Europe!" },
{ "sourceText": "BUG BROTHER", "href": "http://bugbrother.blog.lemonde.fr/", "linkText": "Qui surveillera les surveillants?" },
{ "sourceText": "LA QUADRATURE DU NET", "href": "https://www.laquadrature.net/fr", "linkText": "Internet & Libertés" },
{ "sourceText": "Reclaim Your Face", "href": "https://reclaimyourface.eu/fr/", "linkText": "Reclaim Your Face FR" },
@ -38,20 +32,17 @@
{ "listTitle": "ger",
"sections": [
{ "sectionTitle": "", "isExpandable": false, "isExpandedByDefault": true, "listEntries": [
{ "sourceText": "AK Vorrat", "href": "http://wiki.vorratsdatenspeicherung.de/Arbeitsgruppe_Video%C3%BCberwachung", "linkText": "Arbeitsgruppe Videoüberwachung" },
{ "sourceText": "AK Vorrat", "href": "http://wiki.vorratsdatenspeicherung.de/Arbeitsgruppe_Videoüberwachung", "linkText": "Arbeitsgruppe Videoüberwachung" },
{ "sourceText": "AK Vorrat", "href": "http://wiki.vorratsdatenspeicherung.de/images/Folder_cctv.pdf", "linkText": "Infobroschüre: Videoüberwachung? Sicherheit geht anders!" },
{ "sourceText": "AK Vorrat, Ortsgruppe Hannover", "href": "http://wiki.vorratsdatenspeicherung.de/Ortsgruppen/Hannover/Videoueberwachung_in_Hannover", "linkText": "Videoüberwachung in Hannover" },
{ "sourceText": "AKTION FREIHEIT STATT ANGST", "href": "https://www.aktion-freiheitstattangst.org/", "linkText": "Aktion Freiheit statt Angst e.V." },
{ "sourceText": "Ban Facial Recognition", "href": "https://ban-facial-recognition.wesign.it/droitshumains/verbot-der-gesichtserkennung-in-europa", "linkText": "Verbot der Gesichtserkennung in Europa!" },
{ "sourceText": "Benjamin J. Kees", "href": "https://algoropticon.de/", "linkText": "Algorithmisches Panopticon" },
{ "sourceText": "dieDatenschützer Rhein-Main", "href": "https://ddrm.de/category/videouberwachung-2/", "linkText": "Kategoriearchiv: Videoüberwachung" },
{ "sourceText": "EPICENTER.WORKS", "href": "https://epicenter.works/thema/face-recognition", "linkText": "Face Recognition - Gesichtserkennung" },
{ "sourceText": "EPICENTER.WORKS", "href": "https://überwachungspaket.at/", "linkText": "Stoppt das Überwachungspaket!" },
{ "sourceText": "Frag den Staat", "href": "https://fragdenstaat.de/anfrage/informationen-zum-projekt-sicherheitsbahnhof-berlin-sudkreuz/", "linkText": "Informationen zum „Projekt Sicherheitsbahnhof“ Berlin Südkreuz" },
{ "sourceText": "Frag den Staat", "href": "https://fragdenstaat.de/anfrage/datenschutzkonzept-fur-videouberwachung-am-bahnhof-berlin-sudkreuz/", "linkText": "Datenschutzkonzept für Videoüberwachung am Bahnhof Berlin Südkreuz" },
{ "sourceText": "Kassel-Watch-Log", "href": "https://www.ks-watch.de/", "linkText": "Videoüberwachung im öffentlichen Raum Kassel" },
{ "sourceText": "Reclaim Your Face", "href": "https://reclaimyourface.eu/de/", "linkText": "Reclaim Your Face DE" },
{ "sourceText": "_STATTKAMERAS", "href": "https://stattkameras.de/", "linkText": "Gegen Videoüberwachung am Hansaplatz" }
{ "sourceText": "Reclaim Your Face", "href": "https://reclaimyourface.eu/de/", "linkText": "Reclaim Your Face DE" }
] }
]
}

View file

@ -84,8 +84,8 @@
} else {
$i18n = $i18nCountries;
$i18nDefault = $i18nCountriesDefault;
// Check if $key consists of 2 capital letters.
$key = preg_match('/\b[A-Z]{2}\b/', $valsArray[$i]) === 1 || '--' ? $valsArray[$i] : 'dontfindme';
// Check if $key consists of 2 capital letters or is '--' (unknown country).
$key = (preg_match('/^[A-Z]{2}$/', $valsArray[$i]) === 1 || $valsArray[$i] === '--') ? $valsArray[$i] : 'dontfindme';
}
if (!isValidValue($i18n, $i18nDefault, $key)) {
// ignore 'vals' and 'cols'