ctucx.git: nixfiles

ctucx' nixfiles

commit 33a6f3d9ef63055cea11c711e16d710d20733102
parent d37edb2820febe4b01e9bdb81751b7f49c3ef267
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 30 May 2022 23:06:52 +0200

machines/osterei/websites: add wifionic.de
4 files changed, 82 insertions(+), 315 deletions(-)
M
machines/osterei/websites/ctu.cx.nix
|
21
+--------------------
D
machines/osterei/websites/ctu.cx/netzabdeckung.html
|
295
-------------------------------------------------------------------------------
M
machines/osterei/websites/default.nix
|
1
+
A
machines/osterei/websites/wifionic.de.nix
|
80
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/machines/osterei/websites/ctu.cx.nix b/machines/osterei/websites/ctu.cx.nix
@@ -9,26 +9,7 @@
       forceSSL   = true;
       locations  = {
         "/".root = ./ctu.cx;
-
-        "/vodafone-map" = {
-          proxyPass   = "https://netmap.vodafone.de/arcgis/rest/services/CoKart/netzabdeckung_mobilfunk_4x/MapServer";
-          extraConfig = "proxy_set_header Accept-Encoding '';";
-        };
-
-        "/magenta-at-map" = {
-          proxyPass   = "https://app.wigeogis.com/kunden/tmobile/data/geoserver.php";
-          extraConfig = "proxy_set_header Accept-Encoding '';";
-        };
-
-        "/drei-at-data" = {
-          proxyPass   = "https://www.drei.at/media/common/netzabdeckung";
-          extraConfig = ''
-            proxy_set_header Accept-Encoding "";
-            proxy_hide_header "access-control-allow-origin";
-            add_header "access-control-allow-origin" "*";
-          '';
-        };
-
+        "/netzabdeckung.html".return = "307 https://wifionic.de/";
       };
     };
   };
diff --git a/machines/osterei/websites/ctu.cx/netzabdeckung.html b/machines/osterei/websites/ctu.cx/netzabdeckung.html
@@ -1,295 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset="utf-8" />
-  <title>Mobilfunk-Netzabdeckung</title>
-  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
-
-  <!-- Load Leaflet from CDN -->
-  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
-    integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
-    crossorigin=""/>
-  <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
-    integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
-    crossorigin=""></script>
-
-  <!-- Load Esri Leaflet from CDN -->
-  <script src="https://unpkg.com/esri-leaflet@2.5.0/dist/esri-leaflet.js"
-    integrity="sha512-ucw7Grpc+iEQZa711gcjgMBnmd9qju1CICsRaryvX7HJklK0pGl/prxKvtHwpgm5ZHdvAil7YPxI1oWPOWK3UQ=="
-    crossorigin=""></script>
-
-  <script src="https://cdn.jsdelivr.net/gh/calvinmetcalf/leaflet-ajax/dist/leaflet.ajax.min.js"></script>
-
-  <style>
-    body { margin:0; padding:0; }
-    #info { position: absolute; bottom: 3px; text-align: center; width: 100%; }
-    #map { position: absolute; top:0; bottom:25px; right:0; left:0; }
-  </style>
-</head>
-<body>
-<span id="info">Sollten Layer auf der Karte kaputt sein, kann dies gerne unter netzkarte:at:ctu.cx gemeldet werden. :)</span>
-<div id="map"></div>
-
-<script>
-var osmde = L.tileLayer('https://gauss.openstreetmap.de/{z}/{x}/{y}.png', {
-	id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
-      });
-
-
-var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
-	id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
-      });
-
-
-var telefonica_version = 'v237';
-
-var telefonica_nr = L.tileLayer('https://dccb7552-tiles.spatialbuzz.net/tiles/o2_de-' + telefonica_version + '/styles/o2_de_' + telefonica_version + '_5g/{z}/{x}/{y}.png', {
-	id: 'map',
-	minZoom: 11,
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://www.o2online.de/service/netzabdeckung/" target="_blank">O2 Netzabdeckung</a>',
-		opacity: 0.3
-      });
-
-var telefonica_lte = L.tileLayer('https://dccb7552-tiles.spatialbuzz.net/tiles/o2_de-' + telefonica_version + '/styles/o2_de_' + telefonica_version + '_4g/{z}/{x}/{y}.png', {
-		id: 'map',
-		minZoom: 11,
-        maxZoom: 19,
-		attribution: '&copy; <a href="https://www.o2online.de/service/netzabdeckung/" target="_blank">O2 Netzabdeckung</a>',
-		opacity: 0.3
-      });
-
-var telefonica_umts = L.tileLayer('https://dccb7552-tiles.spatialbuzz.net/tiles/o2_de-' + telefonica_version + '/styles/o2_de_' + telefonica_version + '_3g/{z}/{x}/{y}.png', {
-		id: 'map',
-		minZoom: 11,
-        maxZoom: 19,
-		attribution: '&copy; <a href="https://www.o2online.de/service/netzabdeckung/" target="_blank">O2 Netzabdeckung</a>',
-		opacity: 0.3
-      });
-
-var telefonica_gsm = L.tileLayer('https://dccb7552-tiles.spatialbuzz.net/tiles/o2_de-' + telefonica_version + '/styles/o2_de_' + telefonica_version + '_2g/{z}/{x}/{y}.png', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://www.o2online.de/service/netzabdeckung/" target="_blank">O2 Netzabdeckung</a>',
-		opacity: 0.3
-      });
-
-
-//OpenRailwayMay
-var orm = L.tileLayer('https://c.tiles.openrailwaymap.org/standard/{z}/{x}/{y}.png', {
-	id: 'map',
-        maxZoom: 19,
-	attribution: '&copy;'
-      });
-
-//telekom
-var telekom_nr = L.esri.dynamicMapLayer({
-  url: 'https://t-map.telekom.de/arcgis/rest/services/public/coverage/MapServer/export',
-  layers: ['6'],
-  attribution: '&copy; <a href="https://t-map.telekom.de" target="_blank">Telekom Netzabdeckung</a>',
-  opacity : 0.3
-})
-
-var telekom_lte = L.esri.dynamicMapLayer({
-  url: 'https://t-map.telekom.de/arcgis/rest/services/public/coverage/MapServer/export',
-  layers: ['3'],
-  attribution: '&copy; <a href="https://t-map.telekom.de" target="_blank">Telekom Netzabdeckung</a>',
-  opacity : 0.3
-})
-
-var telekom_gsm = L.esri.dynamicMapLayer({
-  url: 'https://t-map.telekom.de/arcgis/rest/services/public/coverage/MapServer/export',
-  layers: ['5'],
-  attribution: '&copy; <a href="https://t-map.telekom.de" target="_blank">Telekom Netzabdeckung</a>',
-  opacity : 0.3
-})
-
-
-
-//vodafone
-var vodafone_nr = L.esri.dynamicMapLayer({
-  url: 'https://ctu.cx/vodafone-map',
-  layers: ['105'],
-  f: 'image',
-  attribution: '&copy; <a href="https://netmap.vodafone.de/cokart-client/index.html?lang=de&app=cokart_4x" target="_blank">Vodafone Netzkarte</a>',
-  opacity : 0.3
-})
-
-var vodafone_lte = L.esri.dynamicMapLayer({
-  url: 'https://ctu.cx/vodafone-map',
-  layers: ['110'],
-  f: 'image',
-  attribution: '&copy; <a href="https://netmap.vodafone.de/cokart-client/index.html?lang=de&app=cokart_4x" target="_blank">Vodafone Netzkarte</a>',
-  opacity : 0.3
-})
-
-var vodafone_gsm = L.esri.dynamicMapLayer({
-  url: 'https://ctu.cx/vodafone-map',
-  layers: ['4','5'],
-  f: 'image',
-  attribution: '&copy; <a href="https://netmap.vodafone.de/cokart-client/index.html?lang=de&app=cokart_4x" target="_blank">Vodafone Netzkarte</a>',
-  opacity : 0.3
-})
-
-
-
-//AT
-//A1
-var at_aone = L.tileLayer('https://cdn1.a1.net/final/tiles/a1/LIVE/tiles-0/{z}/{x}/{y}.png', {
-		id: 'map',
-        maxZoom: 19,
-		attribution: '&copy; <a href="https://www.a1.net/hilfe-support/netzabdeckung/" target="_blank">A1 Netzabdeckungz</a>',
-      });
-
-
-//Magenta
-var at_magenta_nr = L.tileLayer.wms("https://ctu.cx/magenta-at-map", {
-    layers: 'tmobile:tmobile',
-    styles: 'tmobile:tma_5g',
-    format: 'image/png',
-    srs: 'EPSG:900913',
-    uppercase: true,
-    transparent: true,
-    attribution: '&copy; <a href="https://app.wigeogis.com/kunden/tmobile/map.php" target="_blank">T-Mobile Speedmap</a>',
-});
-
-var at_magenta_internet = L.tileLayer.wms("https://ctu.cx/magenta-at-map", {
-    layers: 'tmobile:tmobile',
-    styles: 'tmobile:tma_internet',
-    format: 'image/png',
-    srs: 'EPSG:900913',
-    uppercase: true,
-    transparent: true,
-    attribution: '&copy; <a href="https://app.wigeogis.com/kunden/tmobile/map.php" target="_blank">T-Mobile Speedmap</a>',
-});
-
-var at_magenta_telefonie = L.tileLayer.wms("https://ctu.cx/magenta-at-map", {
-    layers: 'tmobile:tmobile',
-    styles: 'tmobile:tma_telefonie',
-    format: 'image/png',
-    srs: 'EPSG:900913',
-    uppercase: true,
-    transparent: true,
-    attribution: '&copy; <a href="https://app.wigeogis.com/kunden/tmobile/map.php" target="_blank">T-Mobile Speedmap</a>',
-});
-
-var at_drei_nr = new L.GeoJSON.AJAX("https://ctu.cx/drei-at-data/5g-min.json");
-var at_drei_lte = new L.GeoJSON.AJAX("https://ctu.cx/drei-at-data/lte-min.json");
-var at_drei_umts = new L.GeoJSON.AJAX("https://ctu.cx/drei-at-data/umts-min.json");
-var at_drei_gsm = new L.GeoJSON.AJAX("https://ctu.cx/drei-at-data/gsm-min.json");
-
-
-
-// CH
-// Swisscom
-
-
-var ch_swisscom_nr = L.tileLayer('https://scmplc.begasoft.ch/plcapp/netzabdeckung/swisscom?layer=newRadioWide;newRadioFast&zoom={z}&x={x}&y={y}', {
-		id: 'map',
-        maxZoom: 19,
-    	attribution: '&copy; <a href="https://scmplc.begasoft.ch/plcapp/pages/gis/netzabdeckung.jsf" target="_blank">Swisscom Mobilfunk-Abdeckung</a>',
-		opacity: 0.3
-  });
-  
-var ch_swisscom_lte = L.tileLayer('https://scmplc.begasoft.ch/plcapp/netzabdeckung/swisscom?layer=lte;lteAdvanced&zoom={z}&x={x}&y={y}', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://scmplc.begasoft.ch/plcapp/pages/gis/netzabdeckung.jsf" target="_blank">Swisscom Mobilfunk-Abdeckung</a>',
-		opacity: 0.3
-  });
-  
-var ch_swisscom_umts = L.tileLayer('https://scmplc.begasoft.ch/plcapp/netzabdeckung/swisscom?layer=umts&zoom={z}&x={x}&y={y}', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://scmplc.begasoft.ch/plcapp/pages/gis/netzabdeckung.jsf" target="_blank">Swisscom Mobilfunk-Abdeckung</a>',
-		opacity: 0.3
-  });
-  
-var ch_swisscom_gsm = L.tileLayer('https://scmplc.begasoft.ch/plcapp/netzabdeckung/swisscom?layer=gsm&zoom={z}&x={x}&y={y}', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://scmplc.begasoft.ch/plcapp/pages/gis/netzabdeckung.jsf" target="_blank">Swisscom Mobilfunk-Abdeckung</a>',
-		opacity: 0.3
-  });
-
-// Sunrise
-
-var ch_sunrise = L.tileLayer('https://maps.sunrise.ch/cgi-bin/mapserv?map=/opt/app/data/sunrise_coverages_2019.map&LAYERS=coverage&mode=tile&tilemode=gmap&tile={x}+{y}+{z}', {
-		id: 'map',
-        maxZoom: 19,
-		attribution: '&copy; <a href="https://www.sunrise.ch/de/privatkunden/mobil-abos/mobilnetz/netzabdeckung/netzabdeckungskarte.html" target="_blank">Sunrise Netzbdeckung</a>',   
-		opacity: 0.3
-  });
-
-// Salt
-
-
-var ch_salt_gsmumtslte = L.tileLayer('https://mapserver.salt.ch/public/gmaps/2G3G4G@GoogleMapsCompatible/{z}/{x}/{y}.png', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://www.salt.ch/de/coverage/" target="_blank">Salt Netzbdeckung</a>',
-		opacity: 0.3
-  });
-var ch_salt_gsmumts = L.tileLayer('https://mapserver.salt.ch/public/gmaps/2G3G@GoogleMapsCompatible/{z}/{x}/{y}.png', {
-		id: 'map',
-        maxZoom: 19,
-        attribution: '&copy; <a href="https://www.salt.ch/de/coverage/" target="_blank">Salt Netzbdeckung</a>',
-		opacity: 0.3
-  });
-
-
-var map = L.map('map', {
-	center: [ 54.397, 10.150] ,
-	zoom: 11,
-	layers: [ osmde ],
-});
-
-var baseMaps = {
-	"osm de": osmde,
-	"osm": osm,
-};
-
-var overlayMaps = {
-	"Bahnstrecken zeigen": orm,
-	"o2: 5G": telefonica_nr,
-	"o2: 4G": telefonica_lte,
-	"o2: 3G": telefonica_umts,
-	"o2: 2G": telefonica_gsm,
-
-	"Telekom: 5G": telekom_nr,
-	"Telekom: 4G": telekom_lte,
-	"Telekom: 2G": telekom_gsm,
-
-	"Vodafone: 5G": vodafone_nr,
-	"Vodafone: 4G": vodafone_lte,
-	"Vodafone: 2G": vodafone_gsm,
-
-	"AT: A1-Kombi-layer": at_aone,
-	"AT: Magenta 5G": at_magenta_nr,
-	"AT: Magenta Internet": at_magenta_internet,
-	"AT: Magenta Telefonie": at_magenta_telefonie,
-	"AT: Drei 5G": at_drei_nr,
-	"AT: Drei 4G": at_drei_lte,
-	"AT: Drei 3G": at_drei_umts,
-	"AT: Drei 2G": at_drei_gsm,
-
-	"CH: Swisscom 5G": ch_swisscom_nr,
-	"CH: Swisscom 4G": ch_swisscom_lte,
-	"CH: Swisscom 3G": ch_swisscom_umts,
-	"CH: Swisscom 2G": ch_swisscom_gsm,
-
-	"CH: Sunrise": ch_sunrise,
-
-	"CH: Salt 2G, 3G": ch_salt_gsmumts,
-	"CH: Salt 2G, 3G, 4G": ch_salt_gsmumtslte,
-};
-
-
-L.control.layers(baseMaps, overlayMaps).addTo(map);
-</script>
-</body>
-</html>
diff --git a/machines/osterei/websites/default.nix b/machines/osterei/websites/default.nix
@@ -7,6 +7,7 @@
     ./ctu.cx-bikemap
     ./photos.ctu.cx.nix
     ./flauschehorn.sexy.nix
+    ./wifionic.de.nix
   ];
 
 }
diff --git a/machines/osterei/websites/wifionic.de.nix b/machines/osterei/websites/wifionic.de.nix
@@ -0,0 +1,80 @@
+{ pkgs, ...}:
+
+let
+  version = "246";
+  webroot = pkgs.stdenv.mkDerivation {
+    name = "netzabdeckung-webroot";
+    src  = pkgs.fetchgit {
+      url    = "https://git.ctu.cx/mobile-coverage-map/";
+      rev    = "fdfca203271c84d678dd4774023eaa1f4e2dc4dd";
+      sha256 = "1r7nmbmkd0k57v4awjriqwdcn82zbqiikgr09r9apwjrj2swhq94";
+    };
+
+    installPhase = ''
+      mkdir -p $out;
+      cp $src/{index.html,bundle.js} $out;
+    '';
+  };
+
+in {
+  systemd = {
+    services.check-o2tiles = {
+      onFailure   = [ "notify-failure@%i.service" ];
+      startAt     = "*-*-* 3:00:00";
+      after       = [ "network-online.target" ];
+      path        = [ pkgs.curl ];
+      script      = ''
+        curl --fail "https://dccb7552-tiles.spatialbuzz.net/tiles/o2_de-v${version}/styles/o2_de_v${version}_4g/15/17303/10472.png" 1> /dev/null;
+      '';
+      serviceConfig = {
+        Type = "oneshot";
+
+        DynamicUser             = true;
+
+        NoNewPrivileges         = true;
+        PrivateTmp              = true;
+        PrivateDevices          = true;
+
+        RestrictAddressFamilies = "AF_INET AF_INET6";
+        RestrictNamespaces      = true;
+        RestrictRealtime        = true;
+
+        ProtectSystem           = "full";
+        ProtectControlGroups    = true;
+        ProtectKernelModules    = true;
+        ProtectKernelTunables   = true;
+
+        DevicePolicy            = "closed";
+        LockPersonality         = true;
+      };
+    };
+  };
+
+
+  services.nginx = {
+    enable = true;
+    virtualHosts."wifionic.de" = {
+      enableACME = true;
+      forceSSL   = true;
+      locations  = {
+        "/".root = webroot;
+
+        "/vodafone-map" = {
+          proxyPass   = "https://netmap.vodafone.de/arcgis/rest/services/CoKart/netzabdeckung_mobilfunk_4x";
+          extraConfig = "proxy_set_header Accept-Encoding '';";
+        };
+
+        "/magenta-at-map" = {
+          proxyPass   = "https://app.wigeogis.com/kunden/tmobile/data/geoserver.php";
+          extraConfig = ''
+            proxy_set_header Accept-Encoding "";
+            proxy_set_header Host "app.wigeogis.com";
+#            proxy_set_header Cookie "PHPSESSID=foobar123";
+          '';
+        };
+
+      };
+    };
+  };
+
+}