Button to test notifications
This commit is contained in:
parent
5ea952703f
commit
9f7e8177ec
6 changed files with 45 additions and 29 deletions
|
|
@ -5,12 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [v0.9.1] - 2023-01-
|
||||
## [v0.9.1] - 2023-01-16
|
||||
### Added
|
||||
- Scan host for open ports
|
||||
- Docker image with embed CSS
|
||||
- App version on config page
|
||||
- Check if update available
|
||||
- Check if update is available
|
||||
- Button to test notifications
|
||||
|
||||
### Changed
|
||||
- Small fixes
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -1,37 +1,27 @@
|
|||
<div align="center">
|
||||
|
||||
<a href="https://github.com/aceberg/WatchYourLAN">
|
||||
<img src="https://raw.githubusercontent.com/aceberg/WatchYourLAN/main/assets/logo.png" width="200" />
|
||||
</a>
|
||||
</div>
|
||||
<h1><a href="https://github.com/aceberg/WatchYourLAN">
|
||||
<img src="https://raw.githubusercontent.com/aceberg/WatchYourLAN/main/assets/logo.png" width="20" />
|
||||
</a>WatchYourLAN</h1>
|
||||
<br/>
|
||||
|
||||
# WatchYourLAN
|
||||
|
||||
[](https://github.com/aceberg/WatchYourLAN/actions/workflows/main-docker-all.yml)
|
||||
[](https://goreportcard.com/report/github.com/aceberg/WatchYourLAN)
|
||||
[](https://codeclimate.com/github/aceberg/WatchYourLAN/maintainability)
|
||||

|
||||

|
||||
|
||||
Lightweight network IP scanner with web GUI
|
||||
https://github.com/aceberg/WatchYourLAN
|
||||
Lightweight network IP scanner with web GUI https://github.com/aceberg/WatchYourLAN
|
||||
|
||||
- [Quick start](https://github.com/aceberg/WatchYourLAN#quick-start)
|
||||
- [Config](https://github.com/aceberg/WatchYourLAN#config)
|
||||
- [Config file](https://github.com/aceberg/WatchYourLAN#config-file)
|
||||
- [Options](https://github.com/aceberg/WatchYourLAN#options)
|
||||
- [Thanks](https://github.com/aceberg/WatchYourLAN#thanks)
|
||||
|
||||

|
||||
|
||||
## Quick start
|
||||
|
||||
Replace `$YOURTIMEZONE` with correct time zone and `$YOURIFACE` with network interface you want to scan. Network mode must be `host`.
|
||||
|
||||
```sh
|
||||
docker run --name wyl \
|
||||
-e "IFACE=$YOURIFACE" \
|
||||
-e "TZ=$YOURTIMEZONE" \
|
||||
--network="host" \
|
||||
aceberg/watchyourlan
|
||||
```
|
||||
|
||||
Set `$DOCKERDATAPATH` for container to save data:
|
||||
Replace `$YOURTIMEZONE` with correct time zone and `$YOURIFACE` with network interface you want to scan. Network mode must be `host`. Set `$DOCKERDATAPATH` for container to save data:
|
||||
|
||||
```sh
|
||||
docker run --name wyl \
|
||||
|
|
@ -71,8 +61,15 @@ GUIPORT="8840"
|
|||
TIMEOUT="300" # 5 minutes
|
||||
SHOUTRRR_URL="gotify://192.168.2.1:8083/AwQqpAae.rrl5Ob/?title=Unknown host detected&DisableTLS=yes" # Url to notify
|
||||
THEME="darkly"
|
||||
IGNOREIP="no"
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Key | Description | Default |
|
||||
| -------- | ----------- | ------- |
|
||||
| -c | Path to config file | /data/config |
|
||||
|
||||
## Thanks
|
||||
- All go packages listed in [dependencies](https://github.com/aceberg/WatchYourLAN/network/dependencies)
|
||||
- Favicon and logo: [Access point icons created by Freepik - Flaticon](https://www.flaticon.com/free-icons/access-point)
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ services:
|
|||
GUIPORT: "8840" # optional, default: 8840
|
||||
TIMEOUT: "120" # optional, time in seconds, default: 60
|
||||
SHOUTRRR_URL: "" # optional, set url to notify
|
||||
THEME: "darkly" # optional
|
||||
THEME: "darkly" # optional
|
||||
IGNOREIP: "no" # optional
|
||||
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/aceberg/WatchYourLAN/internal/conf"
|
||||
"github.com/aceberg/WatchYourLAN/internal/db"
|
||||
"github.com/aceberg/WatchYourLAN/internal/models"
|
||||
"github.com/aceberg/WatchYourLAN/internal/notify"
|
||||
"github.com/aceberg/WatchYourLAN/internal/scan"
|
||||
)
|
||||
|
||||
|
|
@ -63,6 +64,8 @@ func saveConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
conf.Write(ConfigPath, AppConfig)
|
||||
|
||||
log.Println("INFO: writing new config")
|
||||
|
||||
QuitScan = make(chan bool)
|
||||
go scan.Start(AppConfig, QuitScan)
|
||||
|
||||
|
|
@ -77,3 +80,13 @@ func clearHandler(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
http.Redirect(w, r, r.Header.Get("Referer"), 302)
|
||||
}
|
||||
|
||||
func testNotifyHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
log.Println("INFO: Test notification send")
|
||||
|
||||
msg := "Test notification"
|
||||
notify.Shoutrrr(msg, AppConfig.ShoutURL)
|
||||
|
||||
http.Redirect(w, r, r.Header.Get("Referer"), 302)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>Shoutrrr URL</td>
|
||||
<td><input name="shout" type="text" class="form-control" value="{{ .Config.ShoutURL }}"></td>
|
||||
<td>
|
||||
<textarea name="shout" class="form-control" style="width: 100%;" rows="3" wrap="soft">{{ .Config.ShoutURL }}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme</td>
|
||||
|
|
@ -51,9 +53,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td><button type="submit" class="btn btn-primary">Save</button></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</form>
|
||||
<td>
|
||||
<a href="/test_notify/"><button style="float: right;" class="btn btn-success">Test notification</button></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
|
@ -64,7 +68,7 @@
|
|||
<div class="alert alert-info" role="alert">
|
||||
<p>● There can be one or more <b>Interfaces</b>, space separated</p>
|
||||
<p>● After changing <b>Host</b>, <b>Port</b> or <b>Path to DB</b> you need to restart the app</p>
|
||||
<p>● <b>Timeout</b> means time between scans</p>
|
||||
<p>● <b>Timeout</b> means time between scans (in seconds)</p>
|
||||
<p>● <b>Shoutrrr URL</b> provides notifications to Discord, Email, Gotify, Telegram and other services. <a href="https://containrrr.dev/shoutrrr/v0.5/services/overview/" target="_blank">Link to documentation</a></p>
|
||||
<p>● If you want to detect unknown hosts by MAC only, set <b>Ignore IP</b> to "yes"</p>
|
||||
<p>● The <b>Clear table</b> button below will delete all records from table. If you want to delete a single host, click on its MAC and press <b>Delete host</b> button</p>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ func Gui(configPath, bootPath string) {
|
|||
http.HandleFunc("/save_config/", saveConfigHandler)
|
||||
http.HandleFunc("/search_hosts/", searchHandler)
|
||||
http.HandleFunc("/sort_hosts/", sortHandler)
|
||||
http.HandleFunc("/test_notify/", testNotifyHandler)
|
||||
http.HandleFunc("/update_host/", updateHandler)
|
||||
err := http.ListenAndServe(address, nil)
|
||||
check.IfError(err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue