From 92187dc638f6d96f3e32c4c7fce5376c14ae7153 Mon Sep 17 00:00:00 2001 From: Laika Date: Sat, 29 Nov 2025 13:38:17 +0100 Subject: [PATCH] feat: Bit of frontend changes --- .gitignore | 1 - README.md | 3 - backend/src/ogn/aprs/client.rs | 10 ++- docker/docker-compose.yml | 1 - docker/nginx.conf | 13 ++-- docker/privacy-policy.html | 1 - frontend/Dockerfile | 3 +- frontend/package.json | 2 +- frontend/src/index.html | 113 ++++++++++++++----------------- frontend/src/privacy-policy.html | 1 - frontend/src/style.css | 28 +++++++- 11 files changed, 87 insertions(+), 89 deletions(-) delete mode 100644 docker/privacy-policy.html delete mode 100644 frontend/src/privacy-policy.html diff --git a/.gitignore b/.gitignore index bff9624..7ca4806 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,4 @@ config.json /backend/target /frontend/node_modules /frontend/dist -/docker/privacy-policy.html .idea/ diff --git a/README.md b/README.md index e31edc4..3c2c529 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,6 @@ Configure by setting up _/docker/.env_ (copy [/docker/.env.example](docker/.env. (Please note that the _bind\_url_ should be left unconfigured as it is used in the [/docker/docker-compose.yml](docker/docker-compose.yml) config file. Otherwise the proxy-pass may break.) -### Privacy policy -The website contains links to _privacy-policy.html_. You can (and should) set up this privacy policy page. Empty dummy files already exist in the [_docker/_](docker) and [_frontend/src/_](frontend/src) directories. - ## API API-Documentation: [openapi.yml](openapi.yml) diff --git a/backend/src/ogn/aprs/client.rs b/backend/src/ogn/aprs/client.rs index 3a7ff3b..e54fa25 100644 --- a/backend/src/ogn/aprs/client.rs +++ b/backend/src/ogn/aprs/client.rs @@ -1,8 +1,4 @@ -use std::{ - collections::HashMap, - io::Error, -}; - +use std::{collections::HashMap, io::Error}; use log::{debug, error}; use serde::Deserialize; use tokio::io::{AsyncBufReadExt, BufReader, BufWriter}; @@ -113,6 +109,8 @@ pub async fn init( .await?; tcp_stream_writer.flush().await?; + debug!("Sent login: '{}'", login_message.trim()); + loop { let mut line = String::new(); @@ -131,7 +129,7 @@ pub async fn init( let current_timestamp = get_current_timestamp(); - debug!("Got line: '{line}'"); + debug!("Got line: '{}'", line.trim()); line_received_tx .send(current_timestamp) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6fc05ee..311a0a4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -20,4 +20,3 @@ services: - "127.0.0.1:9000:8080" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - - ./privacy-policy.html:/usr/share/nginx/html/privacy-policy.html:ro diff --git a/docker/nginx.conf b/docker/nginx.conf index d1e37ca..bbc2cd7 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -16,7 +16,7 @@ http { server_name _; add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' data:;"; - add_header Permissions-Policy "geolocation=(), midi=(), camera=(), usb=(), payment=(), vr=(), speaker=(), ambient-light-sensor=(), gyroscope=(), microphone=(), usb=(), interest-cohort=()"; + add_header Permissions-Policy "geolocation=(self), midi=(), camera=(), usb=(), payment=(), vr=(), speaker=(), ambient-light-sensor=(), gyroscope=(), microphone=(), usb=(), interest-cohort=()"; add_header Referer "no-referrer"; add_header Referrer-Policy "no-referrer"; add_header Strict-Transport-Security "max-age=63072000" always; @@ -26,10 +26,10 @@ http { client_max_body_size 1; + access_log off; + error_log /dev/null emerg; + location /r/ { - # Do not log location data - access_log off; - error_log /dev/null emerg; proxy_pass http://backend:9000/r/; } @@ -41,11 +41,6 @@ http { gzip_types *; expires 1d; - location = /privacy-policy.html { - root /usr/share/nginx/html; - try_files /privacy-policy.html =404; - } - location / { proxy_pass http://frontend:80/; } diff --git a/docker/privacy-policy.html b/docker/privacy-policy.html deleted file mode 100644 index a379a37..0000000 --- a/docker/privacy-policy.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 25b8b70..a914ac3 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,7 +13,7 @@ WORKDIR /app COPY src src RUN mkdir dist -RUN npx handlebars src/table.handlebars -f dist/table.handlebars.compiled.js +RUN npx handlebars src/table.handlebars -f dist/table.handlebars.dist.js COPY --from=install /app/node_modules/handlebars/dist/handlebars.min.js dist COPY --from=install /app/node_modules/bootstrap/dist/js/bootstrap.min.js dist @@ -21,7 +21,6 @@ COPY --from=install /app/node_modules/bootstrap/dist/js/bootstrap.min.js.map dis COPY --from=install /app/node_modules/bootstrap/dist/css/bootstrap.min.css dist COPY --from=install /app/node_modules/bootstrap/dist/css/bootstrap.min.css.map dist COPY src/index.html dist -COPY src/privacy-policy.html dist COPY src/main.js dist COPY src/style.css dist diff --git a/frontend/package.json b/frontend/package.json index 0e6b017..e4cbd98 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -6,7 +6,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "copy-dependencies": "rm -rf dist && rsync -av --exclude='*.handlebars' src/ dist/ && cp node_modules/handlebars/dist/handlebars.min.js dist/ && cp node_modules/bootstrap/dist/js/bootstrap.min.js dist && cp node_modules/bootstrap/dist/js/bootstrap.min.js.map dist && cp node_modules/bootstrap/dist/css/bootstrap.min.css dist && cp node_modules/bootstrap/dist/css/bootstrap.min.css.map dist", - "compile": "handlebars src/table.handlebars -f dist/table.handlebars.compiled.js", + "compile": "handlebars src/table.handlebars -f dist/table.handlebars.dist.js", "dev": "npm run copy-dependencies && npm run compile && cd dist && python3 -m http.server 8080" }, "keywords": [ diff --git a/frontend/src/index.html b/frontend/src/index.html index f9a30ff..34c0595 100644 --- a/frontend/src/index.html +++ b/frontend/src/index.html @@ -1,5 +1,5 @@ - + @@ -13,90 +13,81 @@ - -
-

See what's flying right above you!

+
+
+

+ Klicke auf Was fliegt über mir? oder gebe hier spezifische Koordinaten und einen Suchradius + ein, um zu sehen, was in deiner Nähe gerade fliegt. +

+

+ Die Daten dieser Webseite basieren auf den Services des + Open Glider Network. + (Vielen Dank für eure offenen APIs! 😊) +

+
+ aria-describedby="whats-above-me-hint">Was fliegt über mir?
- By clicking this button you accept our privacy policy and also - that - your current position is sent to the webserver. + Mit Klick auf den Button wird deine aktuelle Position vom Browser übermittelt und es werden die + Flugzeuge + in deiner Nähe abgefragt. Weder deine Position noch die Anfrage an den Server werden dabei geloggt + oder gespeichert.
-
+
+
-

- Either click What's above me? to automatically fetch your location - or enter specific coordinates and range and see whats flying above you right now. -

-

- This site works with data provided by the - Open Glider Network. - (Thank you for your open data & APIs! 😊) -

- -
-
- - + +
+ + +
+
+ + +
+
+ + +
+ Suchradius (in km) um die angegebenen Koordinaten.
-
- - +
+
+ +
+ Mit Klick auf Was fliegt hier? werden die Flugzeuge für die angegebenen Koordinaten + abgefragt. + Weder die Koordinaten noch die Anfrage an den Server werden dabei geloggt oder gespeichert.
-
- - -
- Range (in km) around given coordinates that should be filtered for. -
-
-
- -
- By clicking this button you accept our privacy policy and also - that the given position is sent to the webserver. -
-
- +
+
- + diff --git a/frontend/src/privacy-policy.html b/frontend/src/privacy-policy.html deleted file mode 100644 index a379a37..0000000 --- a/frontend/src/privacy-policy.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/src/style.css b/frontend/src/style.css index 1685b1f..cd27127 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -1,5 +1,26 @@ -nav { - margin-bottom: 3%; +html, body { + width: 100%; + height: 100%; +} + +.container { + display: grid; + + height: 100%; + width: 100%; + + grid-template-columns: 100%; + grid-template-rows: auto 1fr auto; + grid-template-areas: + "intro" + "table" + "form"; + + padding-top: 5%; +} + +.intro { + grid-area: intro; } .button-container { @@ -10,6 +31,7 @@ nav { } form { + grid-area: form; margin-top: 12.5%; } @@ -32,7 +54,7 @@ form .button-container { } #table-container { - margin: 5% 0; + grid-area: table; white-space: nowrap; }