Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 39 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,27 @@

A web-based dashboard for `fail2ban` which uses the `/var/run/fail2ban/fail2ban.sock` socket to access `fail2ban`.

![Screenshot of fail2ban-dashboard](./images/screenshot.png "Screenshot of fail2ban-dashboard")

Tested with the following `fail2ban` versions
- `0.11.1`
- `0.11.2`
- `1.0.1`
- `1.0.2`
- `1.1.0`

if the deshboard should be used with another version, please switch off the version check with the `--skip-version-check` flag.
If the dashboard should be used with another version, please switch off the version check with the `--skip-version-check` flag.

## Build the application

To build the application, use make with the following options:

```
make
## Screenshots

build - Build the application

test - Run tests

clean - Remove build artifacts

help - Show this help message

all - Run tests and build the application (default)
### Light mode
![Screenshot of fail2ban-dashboard overview light](./images/overview_light.png "Screenshot of fail2ban-dashboard overview light")
![Screenshot of fail2ban-dashboard detail view light](./images/detail_light.png "Screenshot of fail2ban-dashboard detail view light")

```
### Dark mode

![Screenshot of fail2ban-dashboard overview dark](./images/overview_dark.png "Screenshot of fail2ban-dashboard overview dark")
![Screenshot of fail2ban-dashboard detail view dark](./images/detail_dark.png "Screenshot of fail2ban-dashboard detail view dark")

## Usage

Expand Down Expand Up @@ -86,16 +77,37 @@ When only `--auth-password` is provided, the user will be named `admin`.

Environment variables can be used to set parameters without using command line flags.

- `F2BD_ADDRESS`
- `F2BD_AUTH_PASSWORD`
- `F2BD_AUTH_USER`
- `F2BD_BASE_PATH`
- `F2BD_CACHE_DIR`
- `F2BD_LOG_LEVEL`
- `F2BD_REFRESH_SECONDS`
- `F2BD_SKIP_VERSION_CHECK`
- `F2BD_SOCKET`
- `F2BD_TRUST_PROXY_HEADERS`
| Environment Variable | Command Line Flag | Description | Default |
|---------------------|-------------------|-------------|---------|
| `F2BD_ADDRESS` | `-a, --address` | Address to serve the dashboard on | `127.0.0.1:3000` |
| `F2BD_AUTH_PASSWORD` | `--auth-password` | Password for basic auth | - |
| `F2BD_AUTH_USER` | `--auth-user` | Username for basic auth | - |
| `F2BD_BASE_PATH` | `--base-path` | Base path of the application | `/` |
| `F2BD_CACHE_DIR` | `-c, --cache-dir` | Directory to cache GeoIP data | Current working directory |
| `F2BD_LOG_LEVEL` | `--log-level` | Log level (trace, debug, info, warn, error) | `info` |
| `F2BD_REFRESH_SECONDS` | `--refresh-seconds` | Refresh seconds for fail2ban data (10-600) | `30` |
| `F2BD_SKIP_VERSION_CHECK` | `--skip-version-check` | Skip fail2ban version check | `false` |
| `F2BD_SOCKET` | `-s, --socket` | Fail2ban socket path | `/var/run/fail2ban/fail2ban.sock` |
| `F2BD_TRUST_PROXY_HEADERS` | `--trust-proxy-headers` | Trust proxy headers like X-Forwarded-For | `false` |

## Build the application

To build the application, use make with the following options:

```
make

build - Build the application

test - Run tests

clean - Remove build artifacts

help - Show this help message

all - Run tests and build the application (default)

```

## Inspired by

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions e2e/data/jail.d/foo.conf → e2e/data/jail.d/postfix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[foo]
[postfix]
enabled = true
filter = foo
filter = postfix
logpath = /var/log/test/foo.log
bantime = 600
4 changes: 2 additions & 2 deletions e2e/data/jail.d/bar.conf → e2e/data/jail.d/sshd.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bar]
[sshd]
enabled = true
filter = bar
filter = sshd
logpath = /var/log/test/bar.log
bantime = 300
12 changes: 6 additions & 6 deletions e2e/data/script/ban.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

echo "will add bans to 'foo' jail"
fail2ban-client set foo banip 103.59.94.155 196.251.84.225 218.92.0.247
fail2ban-client status foo
echo "will add bans to 'sshd' jail"
fail2ban-client set sshd banip 103.59.94.155 196.251.84.225 218.92.0.247 44.231.227.33 104.196.24.229 154.190.185.126 127.217.0.15 197.173.0.4 202.126.174.77 174.70.43.130 120.250.129.97 141.168.79.112 193.233.120.0 111.5.45.94 82.17.151.75 142.46.182.191 131.44.117.63 40.246.204.192 14.177.157.243 233.74.69.192 65.207.100.156 42.200.128.129 16.10.242.64 184.241.184.255 64.174.224.44 164.41.52.195 47.197.77.185 141.152.72.48 149.178.179.27 164.97.136.88 176.233.216.19 157.36.244.51 109.49.24.54
fail2ban-client status sshd

echo "will add bans to 'bar' jail"
fail2ban-client set bar banip 78.88.88.99
fail2ban-client status bar
echo "will add bans to 'postfix' jail"
fail2ban-client set postfix banip 78.88.88.99 111.151.117.83 205.66.31.57 116.248.244.228 146.89.110.76 164.23.12.99 58.167.196.83 186.198.88.118 68.73.173.96 191.38.166.106 159.80.97.239 1.253.120.60 190.65.166.192
fail2ban-client status postfix
1 change: 1 addition & 0 deletions e2e/docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
F2BD_LOG_LEVEL: "debug"
F2BD_SKIP_VERSION_CHECK: "true"
F2BD_SOCKET: "/var/run/fail2ban/fail2ban.sock"
F2BD_BASE_PATH: "/dashboard"
ports:
- "40000:40000"
- "4000:3000"
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/webishdev/fail2ban-dashboard
go 1.25.5

require (
github.com/gofiber/fiber/v2 v2.52.10
github.com/gofiber/fiber/v2 v2.52.11
github.com/kisielk/og-rek v1.3.0
github.com/nlpodyssey/gopickle v0.3.0
github.com/spf13/cobra v1.10.2
Expand All @@ -14,25 +14,25 @@ require (
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/aristanetworks/gomap v0.0.0-20240919214256-2b26376628e1 // indirect
github.com/clipperhouse/stringish v0.1.1 // indirect
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/klauspost/compress v1.18.2 // indirect
github.com/klauspost/compress v1.18.3 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.68.0 // indirect
github.com/valyala/fasthttp v1.69.0 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.30.0 // indirect
golang.org/x/sys v0.40.0 // indirect
golang.org/x/text v0.33.0 // indirect
)
16 changes: 16 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfa
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U=
github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -15,10 +17,14 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/gofiber/fiber/v2 v2.52.9 h1:YjKl5DOiyP3j0mO61u3NTmK7or8GzzWzCFzkboyP5cw=
github.com/gofiber/fiber/v2 v2.52.9/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/gofiber/fiber/v2 v2.52.10 h1:jRHROi2BuNti6NYXmZ6gbNSfT3zj/8c0xy94GOU5elY=
github.com/gofiber/fiber/v2 v2.52.10/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/gofiber/fiber/v2 v2.52.11 h1:5f4yzKLcBcF8ha1GQTWB+mpblWz3Vz6nSAbTL31HkWs=
github.com/gofiber/fiber/v2 v2.52.11/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand All @@ -31,6 +37,8 @@ github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3J
github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand All @@ -52,6 +60,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
Expand All @@ -75,15 +85,21 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.68.0 h1:v12Nx16iepr8r9ySOwqI+5RBJ/DqTxhOy1HrHoDFnok=
github.com/valyala/fasthttp v1.68.0/go.mod h1:5EXiRfYQAoiO/khu4oU9VISC/eVY6JqmSpPJoHCKsz4=
github.com/valyala/fasthttp v1.69.0 h1:fNLLESD2SooWeh2cidsuFtOcrEi4uB4m1mPrkJMZyVI=
github.com/valyala/fasthttp v1.69.0/go.mod h1:4wA4PfAraPlAsJ5jMSqCE2ug5tqUPwKXxVj8oNECGcw=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Binary file added images/detail_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/detail_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/overview_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/overview_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/screenshot.png
Binary file not shown.
4 changes: 2 additions & 2 deletions server/resources/css/daisyui@5.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/resources/css/themes.css

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions server/resources/detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
{{ template "head" . }}
<body>
{{ template "header" . }}
<main class="p-4">
<div class="jails mx-auto">
<div class="jails">
<h2 class="text-4xl font-bold mb-6">Jail: {{ .Jail.Name }}</h2>
<div class="jail stats shadow w-full">
{{ template "jailDetail" .Jail }}
</div>
</div>
</div>
{{ if .HasBanned }}
<div class="divider">Banned addresses</div>
<div class="banned shadow-md rounded-md">
<div class="banned">
<div class="overflow-x-auto">
<table class="table table-zebra">
<thead>
<tr>
<th>Address<a href="?sorting=address&order={{ .OrderAddress.Order }}"><span class="{{ .OrderAddress.Class }} inline-block">&nbsp;</span></a></th>
<th>Banned at<a href="?sorting=started&order={{ .OrderStarted.Order }}"><span class="{{ .OrderStarted.Class }} inline-block">&nbsp;</span></a></th>
<th class="hidden md:table-cell">Current penalty<a href="?sorting=penalty&order={{ .OrderPenalty.Order }}"><span class="{{ .OrderPenalty.Class }} inline-block">&nbsp;</span></a></th>
<th class="hidden md:table-cell">Ban ends at<a href="?sorting=ends&order={{ .OrderEnds.Order }}"><span class="{{ .OrderEnds.Class }} inline-block">&nbsp;</span></a>
</th>
</tr>
</thead>
<tbody>
{{ range .Banned }}
{{ template "banned" . }}
{{ end }}
</tbody>
</table>
</div>
</div>
</div>
{{ end }}
</main>
</body>
</html>
8 changes: 8 additions & 0 deletions server/resources/flags.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{ range $key, $value := . }}
.flag-{{ $key }} {
width: 21px;
height: 15px;
background: url(data:image/png;base64,{{ $value }}) no-repeat;
display: inline-block;
}
{{ end }}
74 changes: 15 additions & 59 deletions server/resources/index.html
Original file line number Diff line number Diff line change
@@ -1,71 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="refresh" content="60">
<link rel="icon" href="images/favicon.ico" sizes="48x48" >
<link href="{{ .BasePath }}/css/daisyui@5.css" rel="stylesheet" type="text/css" />
<link href="{{ .BasePath }}/css/main.css" rel="stylesheet" type="text/css" />
<script src="{{ .BasePath }}/js/browser@4.js"></script>
<title>fail2ban dashboard - {{ .Version }}</title>
<style>
{{ range $key, $value := .CountryCodes }}
.flag-{{ $key }} {
width: 21px;
height: 15px;
background: url(data:image/png;base64,{{ $value | safe }}) no-repeat;
display: inline-block;
}
{{ end }}
</style>
</head>
<html lang="en" data-theme="emerald">
{{ template "head" . }}
<body>
<div class="navbar bg-base-100 shadow-sm">
<h1 class="flex-1 text-xl font-bold"><a href="{{ .BasePath }}">fail2ban dashboard</a> - {{ .Version }} <span class="badge badge-soft badge-info">fail2ban - {{ .Fail2BanVersion }}</span></h1>
<div class="flex-none">
<ul class="menu menu-horizontal px-1">
<li><a href="https://github.com/webishdev/fail2ban-dashboard" rel="noopener" target="_blank">GitHub</a></li>
</ul>
</div>
</div>
{{ template "header" . }}
<main class="p-4">
<div class="jails">
<div class="text-base font-medium text-center"><h2>Current jails</h2></div>
<div class="jails flex justify-center gap-4 p-4 flex-wrap">
<div class="jail stats shadow stats-vertical lg:stats-horizontal">
<div class="jails flex flex-col gap-4 mx-auto">
<div class="flex items-center justify-between p-6 bg-base-100 shadow rounded-lg border border-base-300 w-full">
<div class="font-bold text-lg flex-shrink-0 min-w-48">Currently banned</div>
<div class="flex gap-8 items-center flex-1 justify-end">
<div class="text-center">
<div class="font-semibold text-secondary text-xl">{{ .BannedSum }}</div>
</div>
</div>
</div>
{{ $curBasePath := .BasePath }}
{{ range .Jails }}
<a href="{{ $curBasePath }}{{ .Name }}" class="flex items-center justify-between p-6 bg-base-100 hover:bg-base-200 shadow hover:shadow-md transition-all duration-200 rounded-lg border border-base-300 w-full">
{{ template "jailCard" . }}
</a>
{{ end }}
</div>
</div>
</div>
{{ if .HasBanned }}
<div class="banned shadow-md rounded-md">
<div class="text-base font-medium text-center pt-4"><h2>Currently banned</h2></div>
<div class="banned">
<div class="overflow-x-auto">
<table class="table table-zebra">
<thead>
<tr>
<th>Address<a href="?sorting=address&order={{ .OrderAddress.Order }}"><span class="{{ .OrderAddress.Class }} inline-block">&nbsp;</span></a></th>
<th>Jail<a href="?sorting=jail&order={{ .OrderJail.Order }}"><span class="{{ .OrderJail.Class }} inline-block">&nbsp;</span></a></th>
<th>Banned at<a href="?sorting=started&order={{ .OrderStarted.Order }}"><span class="{{ .OrderStarted.Class }} inline-block">&nbsp;</span></a></th>
<th>Curren penalty<a href="?sorting=penalty&order={{ .OrderPenalty.Order }}"><span class="{{ .OrderPenalty.Class }} inline-block">&nbsp;</span></a></th>
<th>Ban ends at<a href="?sorting=ends&order={{ .OrderEnds.Order }}"><span class="{{ .OrderEnds.Class }} inline-block">&nbsp;</span></a>
</th>
</tr>
</thead>
<tbody>
{{ range .Banned }}
{{ template "banned" . }}
{{ end }}
</tbody>
</table>
</div>
</div>
</div>
{{ end }}
</main>
</body>
</html>
6 changes: 0 additions & 6 deletions server/resources/jailcard.html

This file was deleted.

Loading