diff options
Diffstat (limited to '')
-rw-r--r-- | .github/workflows/ci.yml | 16 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | docker-compose.yml | 2 | ||||
-rw-r--r-- | html/index.html | 12 | ||||
-rwxr-xr-x | test/host/test.sh | 5 | ||||
-rw-r--r-- | test/linuxserver/docker-compose.yml | 2 |
6 files changed, 26 insertions, 13 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47df797..e72a9ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: name: Test (host) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install dependencies run: sudo apt install -y wireguard-tools - name: Test @@ -22,7 +22,7 @@ jobs: name: Test (LinuxServer) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Test run: sudo ./test/linuxserver/test.sh @@ -33,11 +33,11 @@ jobs: if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # https://github.com/docker/metadata-action#semver - id: meta name: Docker Hub metadata - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: egortensin/wg-api-web flavor: | @@ -48,11 +48,11 @@ jobs: type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: egortensin password: '${{ secrets.DOCKERHUB_TOKEN }}' @@ -66,7 +66,7 @@ jobs: echo 'platforms=amd64,armhf,arm64' >> "$GITHUB_OUTPUT" fi - name: Build and publish - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: # Without context, .dockerignore isn't respected? # https://stackoverflow.com/a/74552407/514684 @@ -6,7 +6,7 @@ wg-api-web This is a simple web monitoring tool for WireGuard connections. It uses [wg-api] to query data and formats it as a nice, sortable HTML table. -See an example setup at https://egort.name/wg-api-web/. +See an example setup at https://tensin.name/wg-api-web/. [wg-api]: https://github.com/jamescun/wg-api diff --git a/docker-compose.yml b/docker-compose.yml index 2069204..f5c2091 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,4 +26,6 @@ networks: ipam: driver: default config: + # The network is hardcoded; please don't change. If you run into + # problems, let me know. - subnet: 192.168.177.0/24 diff --git a/html/index.html b/html/index.html index 7ac4100..a78efbc 100644 --- a/html/index.html +++ b/html/index.html @@ -106,11 +106,17 @@ const MSECS_IN_DAY = 24 * MSECS_IN_HOUR; function date_to_readable(date) { const now = Date.now(); - if (Date.now() < date) { - return 'future???'; + let duration = now - date; + + if (Math.abs(duration) < 2 * MSECS_IN_SEC) { + // Most likely, the time is not synchronized either on the server or + // the client. + return 'now'; } - let duration = now - date; + if (duration < 0) { + return 'future???'; + } let days = Math.floor(duration / MSECS_IN_DAY); duration -= days * MSECS_IN_DAY; diff --git a/test/host/test.sh b/test/host/test.sh index 0088fba..33de0ec 100755 --- a/test/host/test.sh +++ b/test/host/test.sh @@ -131,7 +131,10 @@ cleanup() { echo "Removing $base_dir" rm -rf -- "$base_dir" - echo "Brining down containers..." + echo 'Showing the latest container logs...' + docker-compose logs --tail 25 + + echo "Bringing down containers..." docker-compose down -v --remove-orphans } diff --git a/test/linuxserver/docker-compose.yml b/test/linuxserver/docker-compose.yml index bba8b12..6898da7 100644 --- a/test/linuxserver/docker-compose.yml +++ b/test/linuxserver/docker-compose.yml @@ -65,4 +65,6 @@ networks: ipam: driver: default config: + # The network is hardcoded; please don't change. If you run into + # problems, let me know. - subnet: 192.168.177.0/24 |