#!/usr/bin/env bash

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source $SCRIPT_DIR/smoke.sh

smoke_url_ok "https://git.ingolf-wagner.de/"
smoke_assert_body "explore"

smoke_url_ok "https://bitwarden.ingolf-wagner.de/#/login"
smoke_assert_body "Vaultwarden"

smoke_url_ok "https://nextcloud.ingolf-wagner.de/login"
smoke_assert_body "Login"

smoke_url_ok "https://flix.ingolf-wagner.de/web/index.html#!/login.html"
smoke_assert_body "jellyfin"

# todo this should not show landingpage
# smoke_url_ok "http://taskserver.ingolf-wagner.de/"

# todo this should not show landingpage
# smoke_url_ok "http://taskd.ingolf-wagner.de/"

smoke_url_ok "http://sync.robi.private/"
smoke_assert_body "Transmission Web Interface"

smoke_url_ok "http://transmission.robi.private/"
smoke_assert_body "Transmission Web Interface"

smoke_url_ok "http://transmission2.robi.private/"
smoke_assert_body "Transmission Web Interface"

smoke_url_ok "http://sonarr.robi.private/"
smoke_assert_body "Sonarr"

smoke_url_ok "http://radarr.robi.private/"
smoke_assert_body "Radarr"

smoke_url_ok "http://prowlarr.robi.private/"
smoke_assert_body "Prowlarr"

smoke_url_ok "http://jellyseerr.robi.private/"
smoke_assert_body "Welcome to Jellyseerr"

smoke_url_ok "http://grafana.robi.private/login"
smoke_assert_body "Grafana"

smoke_url_ok "http://prometheus.robi.private/"
smoke_assert_body "Prometheus Time Series Collection and Processing Server"

smoke_url_ok "http://robi.private:8384/"
smoke_assert_body "Syncthing admin interface"

smoke_url_ok "http://robi.private:19999/"
smoke_assert_body "netdata dashboard"

smoke_url_ok "https://element.terranix.org/#/welcome"
smoke_assert_body "Sorry, Element requires JavaScript to be enabled"

smoke_url_ok "https://terranix.org/"
smoke_assert_body "terraform"
smoke_assert_body "terranix"
smoke_assert_body "nix"

smoke_url_ok "https://meet.ingolf-wagner.de/test"
smoke_assert_body "Jitsi"

smoke_url_ok "https://md.ingolf-wagner.de/test"
smoke_assert_body "HedgeDoc - Ideas grow better together"

smoke_report