diff options
author | stuebinm | 2022-01-18 09:43:24 +0100 |
---|---|---|
committer | stuebinm | 2022-01-20 13:19:44 +0100 |
commit | 0bcabe1c4b1dd74af233674dfa6c6ec3011ce2c0 (patch) | |
tree | 5c58943f99245ff7f745f50b46c34ae288c3e503 /chaski | |
parent | db83a406bc6e63289e47ff5d2228c08430832655 (diff) |
restructuring directories
Diffstat (limited to 'chaski')
-rw-r--r-- | chaski/configuration.nix | 48 | ||||
-rw-r--r-- | chaski/hardware-configuration.nix | 23 | ||||
-rw-r--r-- | chaski/ilztal.live/geolocation/index.html | 179 | ||||
-rw-r--r-- | chaski/ilztal.live/geolocation/mapview.html | 94 | ||||
-rw-r--r-- | chaski/ilztal.live/geolocation/view.html | 77 | ||||
-rw-r--r-- | chaski/services/VaaS/.gitignore | 1 | ||||
-rw-r--r-- | chaski/services/VaaS/CHANGELOG.md | 5 | ||||
-rw-r--r-- | chaski/services/VaaS/app/Main.hs | 58 | ||||
-rw-r--r-- | chaski/services/VaaS/default.nix | 30 | ||||
-rw-r--r-- | chaski/services/VaaS/haskell.cabal | 35 | ||||
-rw-r--r-- | chaski/services/VaaS/index.html | 46 | ||||
-rw-r--r-- | chaski/services/geolocation.nix | 6 | ||||
-rw-r--r-- | chaski/services/gtfs.nix | 38 | ||||
-rw-r--r-- | chaski/services/jitsi.nix | 59 | ||||
-rw-r--r-- | chaski/services/uplcg.nix | 23 | ||||
-rw-r--r-- | chaski/services/woitb.nix | 32 | ||||
-rw-r--r-- | chaski/services/woitb/index.html | 124 | ||||
-rw-r--r-- | chaski/services/woitb/info.html | 180 |
18 files changed, 1058 insertions, 0 deletions
diff --git a/chaski/configuration.nix b/chaski/configuration.nix new file mode 100644 index 0000000..fa51fdf --- /dev/null +++ b/chaski/configuration.nix @@ -0,0 +1,48 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + # ./services/jitsi.nix + ./services/uplcg.nix + ./services/woitb.nix + ./services/geolocation.nix + ./services/gtfs.nix + ]; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + services.nginx.appendHttpConfig = '' + access_log off; + add_header Permissions-Policy "interest-cohort=()"; + ''; + + # Use the GRUB 2 boot loader. + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + + networking.hostName = "chaski"; # Define your hostname. + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.useDHCP = false; + networking.interfaces.ens10.useDHCP = true; + networking.interfaces.ens3.useDHCP = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "20.09"; # Did you read the comment? + + boot.loader.grub.devices = [ "/dev/sda" ]; + +} diff --git a/chaski/hardware-configuration.nix b/chaski/hardware-configuration.nix new file mode 100644 index 0000000..54fbcba --- /dev/null +++ b/chaski/hardware-configuration.nix @@ -0,0 +1,23 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "xhci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/5beea4aa-5ea3-4518-9b7d-97f289be92ea"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + +} diff --git a/chaski/ilztal.live/geolocation/index.html b/chaski/ilztal.live/geolocation/index.html new file mode 100644 index 0000000..052a9fa --- /dev/null +++ b/chaski/ilztal.live/geolocation/index.html @@ -0,0 +1,179 @@ +<!doctype html> +<html class="no-js" lang=""> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>geolocation tracker test</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <button id = "initialise">Start Tracking</button><br/> + <p id = "status"></p> + <a id = "map-link" target="_blank"></a> + + <p> + Latitude: <span id="latitude"></span><br> + Longitude: <span id="longitude"></span><br> + Altitude: <span id="altitude"></span><br> + Accuracy: <span id="accuracy"></span><br> + Speed: <span id="speed"></span><br> + Angle: <span id="angle"></span><br> + </p> + + <input id="note" placeholder="enter note here"> + <button id="submit-note">Submit</button> + + <p> + <button id="download">Download Log</button> + <button id="reset">Reset History</button> + </p> + <p id="error"></p> + </body> + <script> + + /* TODO: + / - how to push things to rocket? (probably just http post for now …) + / - how to rate-limit new positions (either count dates, or option in geolocation?) + / - how to get closest point on path? + */ + + let lat = document.getElementById("latitude"); + let long = document.getElementById("longitude"); + let speed = document.getElementById("speed"); + let acc = document.getElementById("accuracy"); + let angle = document.getElementById("angle"); + let alt = document.getElementById("altitude"); + + let status = document.querySelector('#status'); + let mapLink = document.querySelector('#map-link'); + + function resetDisplay () { + lat.innerText = "-"; + long.innerText = "-"; + speed.innerText = "-"; + acc.innerText = "-"; + angle.innerText = "-"; + alt.innerText = "-"; + } + + function init() { + + mapLink.href = ''; + mapLink.textContent = ''; + + resetDisplay(); + + if(!navigator.geolocation) { + status.textContent = 'Error: Geolocation API is not supported!'; + } else { + status.textContent = 'Initialising …'; + trackPosition(); + } + + } + var errcount = 1; + var geolog = []; + + function trackPosition() { + function success(position) { + const latitude = position.coords.latitude; + const longitude = position.coords.longitude; + errcount = 0; + + status.textContent = ''; + mapLink.href = `https://www.openstreetmap.org/#map=18/${latitude}/${longitude}`; + mapLink.textContent = `Latitude: ${latitude} °, Longitude: ${longitude} °`; + + lat.innerText = position.coords.latitude; + long.innerText = position.coords.longitude; + alt.innerText = position.coords.altitude; + acc.innerText = position.coords.accuracy; + speed.innerText = position.coords.speed; + angle.innerText = position.coords.heading; + + document.getElementById("error").innerText = JSON.stringify(position.coords); + + let datapoint = { + timestamp: new Date().toISOString(), + data: { + latitude: position.coords.latitude, + longitude: position.coords.longitude, + altitude: position.coords.altitude, + accuracy: position.coords.accuracy, + altitudeAccuracy: position.coords.altitudeAccuracy, + heading: position.coords.heading, + speed: position.coords.speed + } + }; + + geolog.push(datapoint); + fetch( + "https://ilztal.live/geoloc/push", + { method: "POST", body: JSON.stringify(datapoint)} + ).then(() => console.log("pushed position")) + .catch(e => console.log("some error: ", e)) + } + + function error() { + status.textContent = "("+errcount+") Error: Getting Location failed, retrying …"; + resetDisplay(); + errcount += 1; + setTimeout(trackPosition, 3000); + } + + navigator.geolocation.watchPosition(success, error); + } + + function downloadHistory () { + let json = JSON.stringify(geolog); + let a = document.createElement("a"); + console.log("attempting download!", geolog); + a.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(json)); + a.setAttribute("download","history.json"); + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + } + + document.getElementById("initialise").addEventListener('click', init); + + document.getElementById("submit-note").onclick = (a) => { + let input = document.getElementById("note"); + let text = input.value; + console.log("submitting note:", text); + geolog.push(text); + fetch("https://ilztal.live/geoloc/push", + {method:"POST", body: JSON.stringify({ + //ty: "note", + timestamp: new Date().toISOString(), + data: text + })} + ).then(() => input.value = "") + .catch(e => { + document.getElementById("error").innerText = "error:" + e; + console.log("error occurred"); + }); + }; + + document.getElementById("download").onclick = (a) => downloadHistory(); + + document.getElementById("reset").onclick = (a) => geolog = []; + + </script> + + + </body> +</html> diff --git a/chaski/ilztal.live/geolocation/mapview.html b/chaski/ilztal.live/geolocation/mapview.html new file mode 100644 index 0000000..bb62f62 --- /dev/null +++ b/chaski/ilztal.live/geolocation/mapview.html @@ -0,0 +1,94 @@ +<!doctype html> +<html class="no-js" lang=""> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>Position view</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" + integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" + crossorigin=""/> + <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" + integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" + crossorigin=""></script> + + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <div align="justify"> + <div id="MapID2" style="height:100vh; margin-left: auto; margin-right:auto; width:80%"></div> + </div> + <script> + var mymap = L.map('MapID2'); + L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA', { + attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', + maxZoom: 18, + id: 'mapbox/streets-v11', + accessToken: 'pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA' + }).addTo(mymap); + var marker = L.marker([0,0]).addTo(mymap); + marker.bindPopup("Hello Train!"); + + mymap.setView([0,0], 16); + function updateMap(pos) { + if (pos === null) { + console.log("no data yet?"); + return; + } + mymap.setView(pos); + mymap.scrollWheelZoom.disable(); + marker.setLatLng(pos); + } + updateMap([48.13716,11.57540]); + + function fetchUpdate () { + fetch("https://ilztal.live/geoloc/history") + .then((data) => { + let text = data.text().then(text => { + let hist = JSON.parse(text); + console.log(hist) + + let latlngs = hist.filter(e => e.data.latitude !== undefined).map((e) => [e.data.latitude, e.data.longitude]); + + console.log(latlngs); + let polyline = L.polyline(latlngs, {color: "red"}).addTo(mymap); + + mymap.fitBounds(polyline.getBounds()) + + for (idx in hist) { + if (hist[idx].data.latitude === undefined) { + console.log(hist[idx].data, idx, 1+parseInt(idx)) + let nidx = 1+parseInt(idx); + if (hist[nidx] !== undefined && hist[nidx].data.latitude !== undefined) { + let marker = L.marker([hist[nidx].data.latitude, hist[nidx].data.longitude]) + .addTo(mymap); + marker.bindPopup(hist[idx].data); + } + } + } + }); + + }) + .catch((e) => { + console.log("some error!", e); + setTimeout(fetchUpdate, 3000); + }) + } + + fetchUpdate() + </script> + + </body> +</html> diff --git a/chaski/ilztal.live/geolocation/view.html b/chaski/ilztal.live/geolocation/view.html new file mode 100644 index 0000000..58b4c76 --- /dev/null +++ b/chaski/ilztal.live/geolocation/view.html @@ -0,0 +1,77 @@ +<!doctype html> +<html class="no-js" lang=""> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>Position view</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + + <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" + integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" + crossorigin=""/> + <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" + integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" + crossorigin=""></script> + + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <div align="justify"> + <div id="MapID2" style="height:60vh; margin-left: auto; margin-right:auto; width:80%"></div> + </div> + <script> + var mymap = L.map('MapID2'); + L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA', { + attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', + maxZoom: 18, + id: 'mapbox/streets-v11', + accessToken: 'pk.eyJ1IjoiZmVsaXg4MTgyOTMiLCJhIjoiY2p6a2h6cjdyMGpicjNvbzlzZ3UwNmloMCJ9.a4t1KM9Gid-q29ultM7HgA' + }).addTo(mymap); + var marker = L.marker([0,0]).addTo(mymap); + marker.bindPopup("Hello Train!"); + + mymap.setView([0,0], 16); + function updateMap(pos) { + if (pos === null) { + console.log("no data yet?"); + return; + } + mymap.setView(pos); + mymap.scrollWheelZoom.disable(); + marker.setLatLng(pos); + } + updateMap([48.13716,11.57540]); + + function fetchUpdate () { + fetch("https://ilztal.live/geoloc/current") + .then((data) => { + let text = data.text().then(text => { + let pos = JSON.parse(text); + console.log(pos) + updateMap(pos.pos); + }); + + setTimeout(fetchUpdate, 3000); + }) + .catch((e) => { + console.log("some error!", e); + setTimeout(fetchUpdate, 3000); + }) + } + + fetchUpdate() + </script> + + </body> +</html> diff --git a/chaski/services/VaaS/.gitignore b/chaski/services/VaaS/.gitignore new file mode 100644 index 0000000..b5e3679 --- /dev/null +++ b/chaski/services/VaaS/.gitignore @@ -0,0 +1 @@ +dist-newstyle/* diff --git a/chaski/services/VaaS/CHANGELOG.md b/chaski/services/VaaS/CHANGELOG.md new file mode 100644 index 0000000..500a0d0 --- /dev/null +++ b/chaski/services/VaaS/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for haskell + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/chaski/services/VaaS/app/Main.hs b/chaski/services/VaaS/app/Main.hs new file mode 100644 index 0000000..b5697d7 --- /dev/null +++ b/chaski/services/VaaS/app/Main.hs @@ -0,0 +1,58 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE OverloadedStrings #-} + +module Main where + +import Control.Exception (try) +import Control.Exception.Base (handle) +import qualified Data.ByteString as BS +import Data.ByteString.Base32 +import qualified Data.ByteString.Char8 as C8 +import qualified Data.ByteString.Lazy as LB +import Data.Maybe (mapMaybe) +import Network.HTTP.Client (httpLbs, newManager, parseRequest, + responseBody) +import Network.HTTP.Client.TLS +import Network.HTTP.Types +import Network.Wai +import Network.Wai.Handler.Warp (run) +import qualified System.Environment as SE +import System.Process + +simpleResponse = responseLBS status200 [("Content-Type", "text/plain")] + +simpleError = responseLBS status400 [("Content-Type", "text/plain")] + +serveFile filename = do + content <- LB.readFile filename + pure $ responseLBS status200 [("Content-Type", "text/html")] content + +app :: FilePath -> FilePath -> Application +app validator index req respond = + case requestMethod req of + "GET" -> case pathInfo req of + [] -> serveFile index >>= respond + ["validate"] -> do + let gtfsuri = head $ mapMaybe (\case { ("gtfs",a) -> Just a; _ -> Nothing }) $ queryString req + putStrLn $ "uri is " <> show gtfsuri + case gtfsuri of + Just uri -> do + man <- newManager tlsManagerSettings + request <- parseRequest $ C8.unpack uri + gtfs <- httpLbs request man + let filename = "/tmp/" <> C8.unpack (encodeBase32' uri) <> ".zip" + LB.writeFile filename (responseBody gtfs) + readProcessWithExitCode "python" [validator,"-n", filename, "--output", "/tmp/gtfs-validated.html"] "" + + serveFile "/tmp/gtfs-validated.html" >>= respond + + Nothing -> respond $ simpleError "missing gtfs parameter" + _ -> respond $ simpleError "unknown path" + _ -> respond $ simpleError "invalid reqeust method" + +main :: IO () +main = do + args <- SE.getArgs + let validator = head args + putStrLn "http://localhost:7000/" + run 7000 $ app validator (args!!1) diff --git a/chaski/services/VaaS/default.nix b/chaski/services/VaaS/default.nix new file mode 100644 index 0000000..427270c --- /dev/null +++ b/chaski/services/VaaS/default.nix @@ -0,0 +1,30 @@ +{ pkgs, compiler ? "default", doBenchmark ? false }: + +let + + inherit pkgs; + + f = { mkDerivation, base, base32, bytestring, http-client + , http-client-tls, http-types, lib, process, wai, warp + }: + mkDerivation { + pname = "VaaS"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ + base base32 bytestring http-client http-client-tls http-types + process wai warp + ]; + license = "unknown"; + hydraPlatforms = lib.platforms.none; + }; + + haskellPackages = if compiler == "default" + then pkgs.haskellPackages + else pkgs.haskell.packages.${compiler}; + + variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; +in + variant (haskellPackages.callPackage f {}) diff --git a/chaski/services/VaaS/haskell.cabal b/chaski/services/VaaS/haskell.cabal new file mode 100644 index 0000000..262b65f --- /dev/null +++ b/chaski/services/VaaS/haskell.cabal @@ -0,0 +1,35 @@ +cabal-version: 2.4 +name: VaaS +version: 0.1.0.0 + +-- A short (one-line) description of the package. +-- synopsis: + +-- A longer description of the package. +-- description: + +-- A URL where users can report bugs. +-- bug-reports: + +-- The license under which the package is released. +-- license: +author: stuebinm +maintainer: stuebinm@disroot.org + +-- A copyright notice. +-- copyright: +-- category: +extra-source-files: CHANGELOG.md + +executable VaaS + main-is: Main.hs + + -- Modules included in this executable, other than Main. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + -- other-extensions: + build-depends: base ^>=4.14.1.0, wai, warp, http-types, bytestring, process, + http-client, http-client-tls, base32 + hs-source-dirs: app + default-language: Haskell2010 diff --git a/chaski/services/VaaS/index.html b/chaski/services/VaaS/index.html new file mode 100644 index 0000000..a7f59e0 --- /dev/null +++ b/chaski/services/VaaS/index.html @@ -0,0 +1,46 @@ +<!doctype html> +<html class="no-js" lang=""> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>GTFS Validator</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <h1>GTFS Validator</h1> + <p> + This runs the validator contained in the + <a href="https://github.com/google/transitfeed">transitfeed + git repository + </a>. + </p> + + <p>Paste the url to your GTFS zip below</p> + + <input id="url"> + <button id="submit">Validate</button> + + <script> + let submit = document.getElementById("submit"); + let url = document.getElementById("url"); + + submit.onclick = () => { + window.location = + "/validate?gtfs=" + url.value + } + </script> + </body> +</html> diff --git a/chaski/services/geolocation.nix b/chaski/services/geolocation.nix new file mode 100644 index 0000000..9fe0973 --- /dev/null +++ b/chaski/services/geolocation.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, ... }: + +{ + services.nginx.virtualHosts."ilztal.live".locations."/geolocation".root = + ../ilztal.live; +} diff --git a/chaski/services/gtfs.nix b/chaski/services/gtfs.nix new file mode 100644 index 0000000..61837a1 --- /dev/null +++ b/chaski/services/gtfs.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +let + vaas = import ./VaaS/default.nix {inherit pkgs; }; + + transitfeed = pkgs.fetchFromGitHub { + owner = "google"; + repo = "transitfeed"; + rev = "d727e97cb66ac2ca2d699a382ea1d449ee26c2a1"; + sha256 = "0kmcmdja6h7gzvi40c9qfzxh6qwv5184g2rgpqx5rhj4ql9ini3h"; + }; + + index = pkgs.copyPathToStore ./VaaS/index.html; +in +{ + systemd.services.vaas = { + enable = true; + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + description = "GTFS feed validator as a service"; + path = [ pkgs.python2 pkgs.python2Packages.pytz pkgs.python2Packages.enum34 ]; + serviceConfig = { + ExecStart = "${vaas}/bin/VaaS ${transitfeed}/feedvalidator.py ${index}"; + Restart = "always"; + PrivateTmp = "true"; + PrivateDevices = "true"; + ProtectSystem = "strict"; + ReadWritePaths = [ "/tmp" ]; + }; + + }; + + services.nginx.virtualHosts."gtfs.stuebinm.eu" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = "http://localhost:7000"; + }; +} diff --git a/chaski/services/jitsi.nix b/chaski/services/jitsi.nix new file mode 100644 index 0000000..d6f398b --- /dev/null +++ b/chaski/services/jitsi.nix @@ -0,0 +1,59 @@ +{config, pkgs, ...}: + +with pkgs.luaPackages; +with pkgs; +let extraLua = import ../../../../playground/jitsi/test.nix; +in + +{ + services.jitsi-meet = { + enable = true; + hostName = "jitsi.stuebinm.eu"; + config = { + enableWelcomePage = true; + prejoinPageEnabled = true; + }; + interfaceConfig = { + SHOW_JITSI_WATERMARK = false; + SHOW_WATERMARK_FOR_GUESTS = false; + }; + }; + services.jitsi-videobridge.openFirewall = true; + + services.nginx.virtualHosts."api.jitsi.stuebinm.eu" = { + locations."/room-size" = { + proxyPass = pkgs.lib.mkForce + "http://jitsi.stuebinm.eu:5280/room-size?$args&domain=jitsi.stuebinm.eu"; + + extraConfig = '' + add_header Access-Control-Allow-Origin *; + ''; + }; + locations."/room-list" = { + proxyPass = "http://jitsi.stuebinm.eu:5280/room-list?domain=jitsi.stuebinm.eu"; + extraConfig = '' + add_header Access-Control-Allow-Origin *; + ''; + }; + locations."/dashboard/".root = + pkgs.copyPathToStore ../../../../playground/jitsi/html; + + enableACME = true; + forceSSL = true; + }; + + services.nginx.recommendedProxySettings = false; + + services.prosody = { + #extraModules = [ "muc_size2" ]; + extraModules = [ "jitsi_bundled" ]; + extraPluginPaths = [ + (pkgs.copyPathToStore ../../../../playground/jitsi/plugins) + ]; + package = pkgs.prosody.override { + withExtraLibs = with extraLua; [ basexx luajwtjitsi net-url ]; + }; + }; + + +} diff --git a/chaski/services/uplcg.nix b/chaski/services/uplcg.nix new file mode 100644 index 0000000..5605046 --- /dev/null +++ b/chaski/services/uplcg.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ + "${inputs.uplcg.outPath}/module.nix" + ]; + + services.uplcg = { + enable = true; + port = 9080; + domain = "0.0.0.0"; + }; + + services.nginx.enable = true; + services.nginx.virtualHosts."cards.stuebinm.eu" = { + locations."/" = { + proxyPass = "http://localhost:9080"; + proxyWebsockets = true; + }; + enableACME = true; + forceSSL = true; + }; +} diff --git a/chaski/services/woitb.nix b/chaski/services/woitb.nix new file mode 100644 index 0000000..0c50617 --- /dev/null +++ b/chaski/services/woitb.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, inputs, ... }: + +let + #sources = ../../nix/sources.nix; + sources = /home/stuebinm/Dokumente/utils/playground/ilztal/server; +in +{ + # systemd.services.woitb = { + # enable = true; + # description = "wo ist die ilztalbahn?"; + # wantedBy = [ "multi-user.target" ]; + # serviceConfig.type = "simple"; + # script = "${import sources}/bin/woitb"; + # }; + + services.nginx.enable = true; + services.nginx.virtualHosts."ilztal.live" = { + enableACME = true; + forceSSL = true; + locations."/".root = pkgs.copyPathToStore ./woitb; + + # locations."/upnext".proxyPass = "http://localhost:8000"; + # locations."/geoloc".proxyPass = "http://localhost:8000"; + }; + + services.nginx.virtualHosts."track.ilztal.live" = { + enableACME = true; + forceSSL = true; + locations."/".root = inputs.tracktrain; + }; + +} diff --git a/chaski/services/woitb/index.html b/chaski/services/woitb/index.html new file mode 100644 index 0000000..8d08826 --- /dev/null +++ b/chaski/services/woitb/index.html @@ -0,0 +1,124 @@ +<!DOCTYPE html> +<html lang="de"><head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>Wo ist die Ilztalbahn?</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="https://ilztal.live/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + <style> + + body { + background-color: olivedrab; + color: white; + font-family: "Sans Serif"; + max-width: 60em; + margin-left: auto; + margin-right: auto; + margin-top: 4em; + } + + body > p, #sonst p { + text-align: center; + margin-bottom: 4rem; + } + + section > p { + text-align: center; + } + + a { + text-decoration: none; + } + + h1, h2, h3 { + font-weight: lighter + } + + h1 { + font-size: 40pt; + text-align: center; + } + + @media only screen and (max-width: 1000px) { + h1 { + font-size: 30pt; + } + body { + margin: 1em; + } + } + + h2 { + font-size: 23pt; + } + + tr { + background-color: white; + color: black; + } + + td { + margin-left: 0; + padding: 0.5em; + } + + #wo { + color: black; + background-color: white; + padding: 1em; + max-width: 40em; + margin: auto; + font-weight: bold; + } + + #wo div h2 { + margin-left: 2rem; + } + + #wo div p { + margin-left: 3rem; + } + + #fahrplan { + margin: auto; + max-width: 40em; + } + + #fahrplan table tr td:last-child { + min-width: 70%; + } + + #fahrplan table { + width: 100%; + } + + </style> + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <h1>Wo ist die <a href="https://ilztalbahn.eu/">Ilztalbahn</a> gerade?</h1> + + <p>(es gibt eh nur eine)</p> + + <div id="root"><main id=""><h2 id="">Gerade nicht unterwegs</h2><div id="wo"><h2 id="">Nächste Fahrt 2022</h2><p id="">Fahrplan ist noch nicht bekannt.</p></div></main></div> + + <section> + <p>Andere Abfahrten ab Passau <a href="https://marudor.de/NPA">via marudor.de</a> | <a href="https://iris.noncd.db.de/wbt/js/index.html?bhf=NPA&Zeilen=20">via Iris der DB</a></p> + + <p style="margin-top:3em">(Diese Seite also known as "oh, die Ilztalbahn <a href="https://ilztalbahn.eu/wp-content/uploads/2020/07/gtfs.zip">hat ja Open Data</a> 😍" – <a href="https://ilztal.live/info.html">Weitere Infos</a>)</p> + </section> + + + +</body></html> diff --git a/chaski/services/woitb/info.html b/chaski/services/woitb/info.html new file mode 100644 index 0000000..e68d728 --- /dev/null +++ b/chaski/services/woitb/info.html @@ -0,0 +1,180 @@ +<!doctype html> +<html lang="de"> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <title>Wo ist die Ilztalbahn?</title> + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1"> + + <link rel="apple-touch-icon" href="/apple-touch-icon.png"> + <!-- Place favicon.ico in the root directory --> + <style> + + body { + background-color: olivedrab; + color: white; + font-family: "Sans Serif"; + max-width: 60em; + margin-left: auto; + margin-right: auto; + margin-top: 4em; + } + + body > p, #sonst p { + text-align: center; + margin-bottom: 4rem; + } + + section > p { + text-align: center; + } + + a { + text-decoration: none; + } + + h1, h2, h3 { + font-weight: lighter + } + + h1 { + font-size: 40pt; + text-align: center; + } + + @media only screen and (max-width: 1000px) { + h1 { + font-size: 30pt; + } + body { + margin: 1em; + } + } + + h2 { + font-size: 23pt; + } + + tr { + background-color: white; + color: black; + } + + td { + margin-left: 0; + padding: 0.5em; + } + + #wo { + color: black; + background-color: white; + padding: 1em; + max-width: 40em; + margin: auto; + font-weight: bold; + } + + #wo div h2 { + margin-left: 2rem; + } + + #wo div p { + margin-left: 3rem; + } + + #fahrplan { + margin: auto; + max-width: 40em; + } + + #fahrplan table tr td:last-child { + min-width: 70%; + } + + #fahrplan table { + width: 100%; + } + + </style> + </head> + <body> + <!--[if lt IE 8]> + <p class="browserupgrade"> + You are using an <strong>outdated</strong> browser. Please + <a href="http://browsehappy.com/">upgrade your browser</a> to improve + your experience. + </p> + <![endif]--> + + <h1><a href="index.html">Wo ist die Ilztalbahn</a> – Über</h1> + + <main> + <h2>Was ist das hier?</h2> + <p> + Diese Webseite zeigt den Fahrplan der <a href="https://ilztalbahn.eu">Ilztalbahn</a> an, + und macht sonst nicht viel. Bitte beachtet, dass diese Seite nicht von der Ilztalbahn GmbH, + dem Förderverein o.ä. betrieben wird, sondern nur ein privates Projekt einer einzelnen Person + ohne jede Verfügbarkeitsgarantie ist. + </p> + + <h2>Wie funktioniert das?</h2> + <p> + Die Ilztalbahn bietet ihren Fahrplan im offenen Standard <a href="https://gtfs.org/">GTFS</a> + an. Weil GTFS an einigen Stellen ein manchmal schwer zu benutzender Standard ist (und nicht + jeder Besuch dieser Webseite einen Aufruf des GTFS der Ilztalbahn triggern muss), hängt noch + ein kleiner Server dazwischen der die relevanten Teile in JSON übersetzt. + </p> + <p> + Der Fahrplan ist jeweils für einen ganzen Sommer gültig, und wird auch währenddessen + (soweit ich sehen kann) nicht verändert oder aktualisiert — es gibt also keinerlei Garantie, + dass die Daten hier korrekt sind! + </p> + + <h2>Gibt es das auch als App?</h2> + <p> + Aktuell nicht. Wenn ihr die Webseite im Browser offen lasst, sollte sie sich aber auch offline + noch automatisch aktualisieren. + </p> + + <h2>Werden Verspätungen/etc. angezeigt?</h2> + <p> + Leider nein. Es gibt für einige Fahrten der Ilztalbahn zwar Echtzeitdaten von der DB, diese + sind aber nicht im Datensatz der Ilztalbahn enthalten. Vielleicht kommen die hier noch + irgendwann mit rein, solange könnt ihr sie (falls es sie gibt) bei + <a href="https://marudor.de/Passau%20Hbf">marudor.de</a> anschauen. + </p> + + <h2>Gibts hier Quellcode zu?</h2> + <p> + Ja klar, hier: <a href="https://stuebinm.eu/git/woitb">git-Repository</a> + </p> + + <h2>Datenschutz?</h2> + <p> + Diese Seite läuft aktuell auf einer kleinen vps bei <a href="https://hetzner.de">Hetzner</a>, + geloggt werden aktuell nur Zugriffe, aber keine IP-Adressen. + </p> + + <h2>Wer macht das hier?</h2> + <p> + Auch nur so ein Mensch im Internet. Falls ihr wollt könnt ihr + <a href="https://pleroma.stuebinm.eu/stuebinm">auf meinem Pleroma</a> vorbeischauen. + </p> + + <h2>Ich hab ne Idee für ein Feature!</h2> + <p> + Schreibt mich über Pleroma an, vielleicht habe ich Zeit und Lust es einzubauen. + </p> + + <h2>Ich hab ein Feature dazuimplementiert!</h2> + <p> + Cool! Schick mir gerne nen Patch! (Mail ist im Repository) + </p> + </main> + <section> + <p style="margin-top:3em;">(Diese Seite also known as "oh, die Ilztalbahn <a href="https://ilztalbahn.eu/wp-content/uploads/2020/07/gtfs.zip">hat ja Open Data</a> 😍" – <a href="info.html">Weitere Infos</a>)</p> + </section> + + </body> +</html> |