Compare commits

..

18 Commits

Author SHA1 Message Date
Maxi Quoß 445b735b11 dont use v 2023-01-29 16:31:46 +01:00
Maxi Quoß fb30405396 dont use v 2023-01-29 16:30:51 +01:00
Maxi Quoß 49cf2b2607 try tag 2023-01-29 16:23:31 +01:00
Maxi Quoß 57bef8bb7e rawversion 2023-01-29 16:10:28 +01:00
Maxi Quoß 51e071bf22 try again with v 2023-01-29 15:58:48 +01:00
Maxi Quoß 4ce90f1f5f try again with v 2023-01-29 15:54:10 +01:00
Maxi Quoß 6fd289e1a7 workflow: tags 2023-01-29 15:47:56 +01:00
Maxi Quoß 8e7d4e814f workflow: env is broken 2023-01-29 15:37:54 +01:00
Maxi Quoß eb311bf289 workflow: env 2023-01-29 15:30:44 +01:00
Maxi Quoß fea958c4fc workflow: env 2023-01-29 15:26:54 +01:00
Maxi Quoß 8f59fb448f workflow: env 2023-01-29 15:22:46 +01:00
Maxi Quoß e303e7af64 workflow: docker meta image name 2023-01-29 15:20:43 +01:00
Maxi Quoß d47c21c3db docker: fix unzip 2023-01-29 15:15:03 +01:00
Maxi Quoß 4eb1c98729 docker: unzip -q 2023-01-29 15:05:48 +01:00
Maxi Quoß fe042e0003 workflow: remove v from version 2023-01-29 14:58:12 +01:00
Maxi Quoß dd4bc6c1e7 workflow: fix url 2023-01-29 14:54:19 +01:00
Maxi Quoß 5ee9b43aff workflow: remove v 2023-01-29 14:49:08 +01:00
Maxi Quoß 9d598b4c09 event tag 2023-01-29 14:46:01 +01:00
33 changed files with 3210 additions and 3696 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ on:
jobs:
goreleaser:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
# pull code
- name: Checkout
@@ -26,7 +26,7 @@ jobs:
- name: Build frontend
run: |
npm --prefix=./frontend i
UPSNAP_VERSION=${GITHUB_REF##*/} npm --prefix=./frontend run build
npm --prefix=./frontend run build
cp -r ./frontend/build/* ./backend/pb_public/
# setup go
@@ -48,7 +48,7 @@ jobs:
docker:
needs: goreleaser
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
# pull code
- name: Check Out Repo
+1 -1
View File
@@ -12,7 +12,7 @@ RUN wget https://github.com/seriousm4x/UpSnap/releases/download/${VERSION}/UpSna
FROM alpine:3
RUN apk update &&\
apk add --no-cache tzdata ca-certificates nmap samba-common-tools sshpass curl &&\
apk add --no-cache ca-certificates nmap samba-common-tools &&\
rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=downloader /app/upsnap upsnap
+32 -53
View File
@@ -1,58 +1,10 @@
<div align="center" width="100%">
<img src="frontend/static/favicon.png" width="128" />
</div>
# UpSnap v3
<div align="center" width="100%">
<h2>UpSnap</h2>
<p>A simple wake on lan app written with SvelteKit, Go, PocketBase and nmap.</p>
<a target="_blank" href="https://github.com/seriousm4x/upsnap"><img src="https://img.shields.io/github/stars/seriousm4x/upsnap" /></a>
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/releases"><img src="https://img.shields.io/github/downloads/seriousm4x/upsnap/total" /></a>
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/releases"><img src="https://img.shields.io/github/v/release/seriousm4x/upsnap?display_name=tag" /></a>
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/actions"><img src="https://github.com/seriousm4x/upsnap/actions/workflows/deploy.yml/badge.svg?event=push" /></a>
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/commits/master"><img src="https://img.shields.io/github/last-commit/seriousm4x/upsnap" /></a>
<h3><a href="https://github.com/seriousm4x/UpSnap/releases/tag/3.0.0">v3 is here! 🤩 Check it out</a></h3>
</div>
## Stable version can be found on [v2 branch](https://github.com/seriousm4x/UpSnap/tree/v2)
## ✨ Features
> This is the dev branch for v3. It's very much in progress but will have a release candidate once all boxes below are checked.
- Dashboard to wake up devices with one click
- Set timed wake and shutdown events via cron
- Add custom ports to devices which will be pinged
- Discover devices by scanning network
- Dark/light or system prefered color scheme
- [Docker images](https://github.com/seriousm4x/UpSnap/pkgs/container/upsnap) for amd64, arm64, arm/v7
## 📸 Screenshots
| Dark | Light |
| ------------------------------ | ------------------------------- |
| ![](/assets/home_dark.png) | ![](/assets/home_light.png) |
| ![](/assets/device_dark.png) | ![](/assets/device_light.png) |
| ![](/assets/settings_dark.png) | ![](/assets/settings_light.png) |
## 🚀 Run the binary
Just download the latest binary from the [release page](https://github.com/seriousm4x/UpSnap/releases) and run it `./upsnap serve --http=0.0.0.0:8090`.
For more options check `./upsnap --help` or visit [PocketBase documentation](https://pocketbase.io/docs).
If you need network discovery, make sure to have `nmap` installed and run upsnap as root/admin.
## 🐳 Run in docker
Alternatively use the [docker-compose](docker-compose.yml) example. See the comments in the file for customization.
### Reverse Proxy
**Caddy example**
```
upsnap.example.com {
reverse_proxy localhost:8090
}
```
## 🔧 Help developing
## Help developing
Fork this branch and clone it.
@@ -64,7 +16,7 @@ go mod tidy
go run main.go serve
```
Log in to [http://localhost:8090/\_/](http://localhost:8090/_/), create an admin user and add some devices.
Log in to [http://127.0.0.1:8090/\_/](http://127.0.0.1:8090/_/), create an admin user and add some devices.
2. Start frontend
@@ -75,3 +27,30 @@ pnpm run dev
```
Open up [http://localhost:5173/](http://localhost:5173/)
## To do
- frontend
- [x] ~~add rest of settings page~~
- [x] ~~form for adding new devices~~
- [x] ~~add per device settings~~
- [x] ~~theme toggle button~~
- [x] ~~add device ports to cards~~
- [x] ~~settings: add network scan~~
- [x] ~~settings: add option for website title~~
- backend
- [x] ~~make sure ping works~~
- [x] ~~make sure arp works~~
- [x] ~~make sure wake works~~
- [x] ~~add shutdown command~~
- [x] ~~add scheduled wake~~
- [x] [~~#34 Add support for WOL passwords~~](https://github.com/seriousm4x/UpSnap/issues/34)
- [x] [~~#33 Seemingly High Ram usage~~](https://github.com/seriousm4x/UpSnap/issues/33)
- [x] [~~#32 API available?~~](https://github.com/seriousm4x/UpSnap/issues/32)
- [x] ~~add db import from v2~~
- [x] ~~move docker images to github packages and setup new workflow file~~
- [x] ~~create dockerfile and docker-compose.yml~~
Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 KiB

+1 -1
View File
@@ -9,7 +9,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/seriousm4x/upsnap/pb.Version={{ .Version }}
- -s -w
goos:
- linux
- windows
+9 -37
View File
@@ -4,8 +4,8 @@ import (
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/models"
"github.com/robfig/cron/v3"
"github.com/seriousm4x/upsnap/logger"
"github.com/seriousm4x/upsnap/networking"
"github.com/seriousm4x/upsnap/backend/logger"
"github.com/seriousm4x/upsnap/backend/networking"
)
var Devices []*models.Record
@@ -74,7 +74,7 @@ func RunPing(app *pocketbase.PocketBase) {
CronPing.Run()
}
func RunWakeShutdown(app *pocketbase.PocketBase) {
func RunWakeShutdown() {
CronWakeShutdown = cron.New()
for _, device := range Devices {
wake_cron := device.GetString("wake_cron")
@@ -83,47 +83,19 @@ func RunWakeShutdown(app *pocketbase.PocketBase) {
shutdown_cron_enabled := device.GetBool("shutdown_cron_enabled")
if wake_cron_enabled && wake_cron != "" {
// avoid using last element
// https://github.com/robfig/cron/issues/115
go func(d *models.Record) {
_, err := CronWakeShutdown.AddFunc(wake_cron, func() {
d.Set("status", "pending")
app.Dao().SaveRecord(d)
if err := networking.WakeDevice(d); err != nil {
logger.Error.Println(err)
d.Set("status", "offline")
app.Dao().SaveRecord(d)
} else {
d.Set("status", "online")
app.Dao().SaveRecord(d)
}
})
if err != nil {
CronWakeShutdown.AddFunc(wake_cron, func() {
if err := networking.WakeDevice(device); err != nil {
logger.Error.Println(err)
}
}(device)
})
}
if shutdown_cron_enabled && shutdown_cron != "" {
// avoid using last element
// https://github.com/robfig/cron/issues/115
go func(d *models.Record) {
_, err := CronWakeShutdown.AddFunc(shutdown_cron, func() {
d.Set("status", "pending")
app.Dao().SaveRecord(d)
if err := networking.ShutdownDevice(d); err != nil {
logger.Error.Println(err)
d.Set("status", "online")
app.Dao().SaveRecord(d)
} else {
d.Set("status", "offline")
app.Dao().SaveRecord(d)
}
})
if err != nil {
CronWakeShutdown.AddFunc(shutdown_cron, func() {
if err := networking.ShutdownDevice(device); err != nil {
logger.Error.Println(err)
}
}(device)
})
}
}
CronWakeShutdown.Run()
+20 -20
View File
@@ -1,4 +1,4 @@
module github.com/seriousm4x/upsnap
module github.com/seriousm4x/upsnap/backend
go 1.19
@@ -6,21 +6,21 @@ require (
github.com/go-ping/ping v1.1.0
github.com/labstack/echo/v5 v5.0.0-20220201181537-ed2888cfa198
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a
github.com/pocketbase/dbx v1.9.0
github.com/pocketbase/pocketbase v0.12.0
github.com/pocketbase/dbx v1.8.0
github.com/pocketbase/pocketbase v0.11.2
github.com/robfig/cron/v3 v3.0.1
)
require (
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/aws/aws-sdk-go v1.44.189 // indirect
github.com/aws/aws-sdk-go v1.44.178 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.10 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.8 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.49 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.47 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.21 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.28 // indirect
@@ -29,15 +29,15 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.22 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.21 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.1 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.12.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 // indirect
github.com/aws/smithy-go v1.13.5 // indirect
github.com/disintegration/imaging v1.6.2 // indirect
github.com/domodwyer/mailyak/v3 v3.3.4 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.1 // indirect
github.com/ganigeorgiev/fexpr v0.3.0 // indirect
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
@@ -49,16 +49,16 @@ require (
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/native v1.1.0 // indirect
github.com/josharian/native v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-sqlite3 v1.14.16 // indirect
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 // indirect
github.com/mdlayher/packet v1.1.1 // indirect
github.com/mdlayher/socket v0.4.0 // indirect
github.com/mdlayher/ethernet v0.0.0-20190313224307-5b5fc417d966 // indirect
github.com/mdlayher/packet v1.0.0 // indirect
github.com/mdlayher/socket v0.2.1 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/cobra v1.6.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
@@ -78,10 +78,10 @@ require (
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.5.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.108.0 // indirect
google.golang.org/api v0.106.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa // indirect
google.golang.org/grpc v1.52.3 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.52.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.40.0 // indirect
@@ -90,7 +90,7 @@ require (
modernc.org/mathutil v1.5.0 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/sqlite v1.20.3 // indirect
modernc.org/sqlite v1.20.2 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
)
+32 -38
View File
@@ -517,8 +517,8 @@ github.com/aws/aws-sdk-go v1.43.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4
github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.128/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.151/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.189 h1:9PBrjndH1uL5AN8818qI3duhQ4hgkMuLvqkJlg9MRyk=
github.com/aws/aws-sdk-go v1.44.189/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.178 h1:4igreoWPEA7xVLnOeSXLhDXTsTSPKQONZcQ3llWAJw0=
github.com/aws/aws-sdk-go v1.44.178/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw=
github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
@@ -527,17 +527,17 @@ github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9/go.mod h1:vCmV1q1VK
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno=
github.com/aws/aws-sdk-go-v2/config v1.18.3/go.mod h1:BYdrbeCse3ZnOD5+2/VE/nATOK8fEUpBtmPMdKSyhMU=
github.com/aws/aws-sdk-go-v2/config v1.18.10 h1:Znce11DWswdh+5kOsIp+QaNfY9igp1QUN+fZHCKmeCI=
github.com/aws/aws-sdk-go-v2/config v1.18.10/go.mod h1:VATKco+pl+Qe1WW+RzvZTlPPe/09Gg9+vM0ZXsqb16k=
github.com/aws/aws-sdk-go-v2/config v1.18.8 h1:lDpy0WM8AHsywOnVrOHaSMfpaiV2igOw8D7svkFkXVA=
github.com/aws/aws-sdk-go-v2/config v1.18.8/go.mod h1:5XCmmyutmzzgkpk/6NYTjeWb6lgo9N170m1j6pQkIBs=
github.com/aws/aws-sdk-go-v2/credentials v1.13.3/go.mod h1:/rOMmqYBcFfNbRPU0iN9IgGqD5+V2yp3iWNmIlz0wI4=
github.com/aws/aws-sdk-go-v2/credentials v1.13.10 h1:T4Y39IhelTLg1f3xiKJssThnFxsndS8B6OnmcXtKK+8=
github.com/aws/aws-sdk-go-v2/credentials v1.13.10/go.mod h1:tqAm4JmQaShel+Qi38hmd1QglSnnxaYt50k/9yGQzzc=
github.com/aws/aws-sdk-go-v2/credentials v1.13.8 h1:vTrwTvv5qAwjWIGhZDSBH/oQHuIQjGmD232k01FUh6A=
github.com/aws/aws-sdk-go-v2/credentials v1.13.8/go.mod h1:lVa4OHbvgjVot4gmh1uouF1ubgexSCN92P6CJQpT0t8=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 h1:j9wi1kQ8b+e0FBVHxCqCGo4kxDU175hoDHcWAi0sauU=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21/go.mod h1:ugwW57Z5Z48bpvUyZuaPy4Kv+vEfJWnIrky7RmkBvJg=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.42/go.mod h1:LHOsygMiW/14CkFxdXxvzKyMh3jbk/QfZVaDtCbLkl8=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.49 h1:zPFhadkmXbXu3RVXTPU4HVW+g2DStMY+01cJaj//+Cw=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.49/go.mod h1:N9gSChQkKpdAj7vRpfKma4ND88zoZM+v6W2lJgWrDh4=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.47 h1:E884ndKWVGt8IhtUuGhXbEsmaCvdAAkTTUDu7uAok1g=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.47/go.mod h1:KybsEsmXLO0u75FyS3F0sY4OQ97syDe8z+ISq8oEczA=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27 h1:I3cakv2Uy1vNmmhRQmFptYDxOvBnwCdNwyw63N0RaRU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.27/go.mod h1:a1/UpzeyBBerajpnP5nGZa9mGzsBn5cOKxm6NWQsvoI=
@@ -564,8 +564,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21 h1:vY5siRXvW5TrO
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.21/go.mod h1:WZvNXT1XuH8dnJM0HvOlvk+RNn7NbAPvA/ACO0QarSc=
github.com/aws/aws-sdk-go-v2/service/kms v1.19.0/go.mod h1:kZodDPTQjSH/qM6/OvyTfM5mms5JHB/EKYp5dhn/vI4=
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.4/go.mod h1:/NHbqPRiwxSPVOB2Xr+StDEH+GWV/64WwnUjv4KYzV0=
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.1 h1:kIgvVY7PHx4gIb0na/Q9gTWJWauTwhKdaqJjX8PkIY8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.1/go.mod h1:L2l2/q76teehcW7YEsgsDjqdsDTERJeX3nOMIFlgGUE=
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.0 h1:wddsyuESfviaiXk3w9N6/4iRwTg/a3gktjODY6jYQBo=
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.0/go.mod h1:L2l2/q76teehcW7YEsgsDjqdsDTERJeX3nOMIFlgGUE=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.8/go.mod h1:k6CPuxyzO247nYEM1baEwHH1kRtosRCvgahAepaaShw=
github.com/aws/aws-sdk-go-v2/service/sns v1.18.6/go.mod h1:2cPUjR63iE9MPMPJtSyzYmsTFCNrN/Xi9j0v9BL5OU0=
github.com/aws/aws-sdk-go-v2/service/sqs v1.19.15/go.mod h1:DKX/7/ZiAzHO6p6AhArnGdrV4r+d461weby8KeVtvC4=
@@ -577,8 +577,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcB
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0 h1:Jfly6mRxk2ZOSlbCvZfKNS7TukSx1mIzhSsqZ/IGSZI=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.0/go.mod h1:TZSH7xLO7+phDtViY/KUp9WGCJMQkLJ/VpgkTFd5gh8=
github.com/aws/aws-sdk-go-v2/service/sts v1.17.5/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4=
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2 h1:J/4wIaGInCEYCGhTSruxCxeoA5cy91a+JT7cHFKFSHQ=
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2/go.mod h1:+lGbb3+1ugwKrNTWcf2RT05Xmp543B06zDFTwiTLp7I=
github.com/aws/aws-sdk-go-v2/service/sts v1.18.0 h1:kOO++CYo50RcTFISESluhWEi5Prhg+gaSs4whWabiZU=
github.com/aws/aws-sdk-go-v2/service/sts v1.18.0/go.mod h1:+lGbb3+1ugwKrNTWcf2RT05Xmp543B06zDFTwiTLp7I=
github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8=
github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
@@ -817,9 +817,8 @@ github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3
github.com/domodwyer/mailyak/v3 v3.3.4 h1:AG/pvcz2/ocFqZkPEG7lPAa0MhCq1warfUEKJt6Fagk=
github.com/domodwyer/mailyak/v3 v3.3.4/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
@@ -850,9 +849,8 @@ github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQL
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.14.1 h1:qfhVLaG5s+nCROl1zJsZRxFeYrHLqWroPOQ8BWiNb4w=
github.com/fatih/color v1.14.1/go.mod h1:2oHN61fhTpgcxD3TSWCgKDiH1+x4OiDVVGH8WlgGZGg=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
@@ -1295,9 +1293,8 @@ github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqx
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/josharian/native v1.0.0 h1:Ts/E8zCSEsG17dUqv7joXJFybuMLjQfWE04tsBODTxk=
github.com/josharian/native v1.0.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/josharian/native v1.1.0 h1:uuaP0hAbW7Y4l0ZRQ6C9zfb7Mg1mbFKry/xzDAfmtLA=
github.com/josharian/native v1.1.0/go.mod h1:7X/raswPFr05uY3HiLlYeyQntB6OO7E/d2Cu7qoaN2w=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -1402,16 +1399,13 @@ github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY=
github.com/mdlayher/ethernet v0.0.0-20190313224307-5b5fc417d966 h1:O3p5UmisBhl3V6lgs4Vdfg8HpjzbWJPyOfGLdwVJSmI=
github.com/mdlayher/ethernet v0.0.0-20190313224307-5b5fc417d966/go.mod h1:5s5p/sMJ6sNsFl6uCh85lkFGV8kLuIYJCRJLavVJwvg=
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 h1:2oDp6OOhLxQ9JBoUuysVz9UZ9uI6oLUbvAZu0x8o+vE=
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118/go.mod h1:ZFUnHIVchZ9lJoWoEGUg8Q3M4U8aNNWA3CVSUTkW4og=
github.com/mdlayher/packet v1.0.0 h1:InhZJbdShQYt6XV2GPj5XHxChzOfhJJOMbvnGAmOfQ8=
github.com/mdlayher/packet v1.0.0/go.mod h1:eE7/ctqDhoiRhQ44ko5JZU2zxB88g+JH/6jmnjzPjOU=
github.com/mdlayher/packet v1.1.1 h1:7Fv4OEMYqPl7//uBm04VgPpnSNi8fbBZznppgh6WMr8=
github.com/mdlayher/packet v1.1.1/go.mod h1:DRvYY5mH4M4lUqAnMg04E60U4fjUKMZ/4g2cHElZkKo=
github.com/mdlayher/raw v0.0.0-20190313224157-43dbcdd7739d/go.mod h1:r1fbeITl2xL/zLbVnNHFyOzQJTgr/3fpf1lJX/cjzR8=
github.com/mdlayher/socket v0.2.1 h1:F2aaOwb53VsBE+ebRS9bLd7yPOfYUMC8lOODdCBDY6w=
github.com/mdlayher/socket v0.2.1/go.mod h1:QLlNPkFR88mRUNQIzRBMfXxwKal8H7u1h3bL1CV+f0E=
github.com/mdlayher/socket v0.4.0 h1:280wsy40IC9M9q1uPGcLBwXpcTQDtoGwVt+BNoITxIw=
github.com/mdlayher/socket v0.4.0/go.mod h1:xxFqz5GRCUN3UEOm9CZqEJsAbe1C8OwSK46NlmWuVoc=
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a h1:fpQi42PM6HzbHwNg6a7OvLbh5l49Rgr7GCARozjHwio=
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a/go.mod h1:XX6nvyQpGc8E4KaQm62FyexOYd36ilpyfYf8wjgMDV8=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
@@ -1575,10 +1569,10 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pocketbase/dbx v1.9.0 h1:HYY0hQcbopfJFFqJqcjt39lg6VTKlIRoDbUFY6ZC4iM=
github.com/pocketbase/dbx v1.9.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
github.com/pocketbase/pocketbase v0.12.0 h1:9u7t4paIQE0JvtX9p7cgktQgaSVyO5jm85UL3Bcotw8=
github.com/pocketbase/pocketbase v0.12.0/go.mod h1:pKq7Zp2jwzMbyK8qbi59RPvscgjXRsOfb389YgGeMtE=
github.com/pocketbase/dbx v1.8.0 h1:kjf3mgmmE12t8IG48kJOeIyBmRi0A1sl6Hsezv4PoiA=
github.com/pocketbase/dbx v1.8.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
github.com/pocketbase/pocketbase v0.11.2 h1:2rlK2m03dU3Ue4Szi5dKnsqSiZs/z629HOLb8gpU0a0=
github.com/pocketbase/pocketbase v0.11.2/go.mod h1:h1ag5dNYQLk/5n+/r7tpYGEkjDU3vrh/vdYOfeDt/KM=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
@@ -1645,8 +1639,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T
github.com/rakyll/embedmd v0.0.0-20171029212350-c8060a0752a2/go.mod h1:7jOTMgqac46PZcF54q6l2hkLEG8op93fZu61KmxWDV4=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa h1:tEkEyxYeZ43TR55QU/hsIt9aRGBxbgGuz9CGykjvogY=
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@@ -2464,8 +2458,8 @@ google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91
google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70=
google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo=
google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0=
google.golang.org/api v0.108.0 h1:WVBc/faN0DkKtR43Q/7+tPny9ZoLZdIiAyG5Q9vFClg=
google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
google.golang.org/api v0.106.0 h1:ffmW0faWCwKkpbbtvlY/K/8fUl+JKvNS5CVzRoyfCv8=
google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -2599,8 +2593,8 @@ google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZV
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa h1:GZXdWYIKckxQE2EcLHLvF+KLF+bIwoxGdMUxTZizueg=
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
@@ -2646,8 +2640,8 @@ google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ=
google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=
google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
@@ -2793,8 +2787,8 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sqlite v1.20.3 h1:SqGJMMxjj1PHusLxdYxeQSodg7Jxn9WWkaAQjKrntZs=
modernc.org/sqlite v1.20.3/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
modernc.org/sqlite v1.20.2 h1:9AaVzJH1Yf0u9iOZRjjuvqxLoGqybqVFbAUC5rvi9u8=
modernc.org/sqlite v1.20.2/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"embed"
"github.com/labstack/echo/v5"
"github.com/seriousm4x/upsnap/pb"
"github.com/seriousm4x/upsnap/backend/pb"
)
//go:embed all:pb_public
+5 -2
View File
@@ -2,11 +2,12 @@ package networking
import (
"net"
"runtime"
"time"
"github.com/go-ping/ping"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/logger"
"github.com/seriousm4x/upsnap/backend/logger"
)
func PingDevice(device *models.Record) bool {
@@ -17,7 +18,9 @@ func PingDevice(device *models.Record) bool {
}
pinger.Count = 1
pinger.Timeout = 500 * 1000000 // 500ms
pinger.SetPrivileged(true)
if runtime.GOOS == "windows" {
pinger.SetPrivileged(true)
}
err = pinger.Run()
if err != nil {
logger.Error.Println(err)
+2 -3
View File
@@ -1,17 +1,16 @@
package networking
import (
"errors"
"fmt"
"os/exec"
"runtime"
"time"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/logger"
)
func ShutdownDevice(device *models.Record) error {
logger.Info.Println("shutdown triggered for", device.GetString("name"))
shutdown_cmd := device.GetString("shutdown_cmd")
if shutdown_cmd == "" {
return fmt.Errorf("%s: no shutdown_cmd definded", device.GetString("name"))
@@ -44,5 +43,5 @@ func ShutdownDevice(device *models.Record) error {
break
}
}
return fmt.Errorf(device.GetString("name"), "not offline after 2 min")
return errors.New("device not offline after 2 min")
}
+2 -4
View File
@@ -1,15 +1,13 @@
package networking
import (
"fmt"
"errors"
"time"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/logger"
)
func WakeDevice(device *models.Record) error {
logger.Info.Println("wake triggered for", device.GetString("name"))
err := SendMagicPacket(device)
if err != nil {
return err
@@ -27,5 +25,5 @@ func WakeDevice(device *models.Record) error {
break
}
}
return fmt.Errorf(device.GetString("name"), "not online after 2 min")
return errors.New("device not online after 2 min")
}
+26 -12
View File
@@ -2,16 +2,20 @@ package pb
import (
"encoding/xml"
"errors"
"net"
"net/http"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"github.com/labstack/echo/v5"
"github.com/pocketbase/pocketbase/apis"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/networking"
"github.com/seriousm4x/upsnap/backend/logger"
"github.com/seriousm4x/upsnap/backend/networking"
)
func HandlerWake(c echo.Context) error {
@@ -37,17 +41,11 @@ func HandlerShutdown(c echo.Context) error {
if err != nil {
return apis.NewNotFoundError("The device does not exist.", err)
}
go func(*models.Record) {
record.Set("status", "pending")
App.Dao().SaveRecord(record)
if err := networking.ShutdownDevice(record); err != nil {
record.Set("status", "online")
} else {
record.Set("status", "offline")
}
App.Dao().SaveRecord(record)
}(record)
return c.JSON(http.StatusOK, record)
if err := networking.ShutdownDevice(record); err != nil {
logger.Error.Println(err)
return apis.NewBadRequestError(err.Error(), record)
}
return nil
}
type Nmaprun struct {
@@ -61,6 +59,22 @@ type Nmaprun struct {
}
func HandlerScan(c echo.Context) error {
if runtime.GOOS == "windows" {
// check for admin on windows by trying to open physicaldrive
_, err := os.Open("\\\\.\\PHYSICALDRIVE0")
if err != nil {
err := errors.New("network scan requires upsnap to be run as administrator")
return apis.NewBadRequestError(err.Error(), nil)
}
} else {
// check for root on anything else
sudoUID := os.Getenv("SUDO_UID")
if sudoUID == "" {
err := errors.New("network scan requires upsnap to be run as root")
return apis.NewBadRequestError(err.Error(), nil)
}
}
// check if nmap installed
if _, err := exec.LookPath("nmap"); err != nil {
return apis.NewBadRequestError(err.Error(), nil)
+6 -7
View File
@@ -12,18 +12,17 @@ import (
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/plugins/migratecmd"
"github.com/seriousm4x/upsnap/cronjobs"
"github.com/seriousm4x/upsnap/logger"
_ "github.com/seriousm4x/upsnap/migrations"
"github.com/seriousm4x/upsnap/backend/cronjobs"
"github.com/seriousm4x/upsnap/backend/logger"
_ "github.com/seriousm4x/upsnap/backend/migrations"
)
var App *pocketbase.PocketBase
var Version = "(untracked)"
func StartPocketBase(distDirFS fs.FS) {
App = pocketbase.New()
App.RootCmd.Short = "UpSnap CLI"
App.RootCmd.Version = Version
App.RootCmd.Version = "3.0.0b1"
// auto migrate db
migratecmd.MustRegister(App, App.RootCmd, &migratecmd.Options{
@@ -77,7 +76,7 @@ func StartPocketBase(distDirFS fs.FS) {
// run cronjobs
go cronjobs.RunPing(App)
go cronjobs.RunWakeShutdown(App)
go cronjobs.RunWakeShutdown()
// restart ping cronjobs or wake/shutdown cronjobs on model update
// add event hook before starting server.
@@ -93,7 +92,7 @@ func StartPocketBase(distDirFS fs.FS) {
for _, job := range cronjobs.CronWakeShutdown.Entries() {
cronjobs.CronWakeShutdown.Remove(job.ID)
}
go cronjobs.RunWakeShutdown(App)
go cronjobs.RunWakeShutdown()
}
return nil
})
+2 -10
View File
@@ -1,19 +1,11 @@
version: "3"
services:
upsnap:
image: ghcr.io/seriousm4x/upsnap:3
image: ghcr.io/seriousm4x/UpSnap
network_mode: host
restart: unless-stopped
volumes:
- ./data:/app/pb_data
command: ["./upsnap", "serve", "--http", "0.0.0.0:8090"]
healthcheck:
test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
interval: 1m
timeout: 10s
retries: 3
# environment:
# - TZ=Europe/Berlin # Set container timezone for cron schedules
# - UPSNAP_INTERVAL=@every 10s # Sets the interval in which the devices are pinged
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
# - UPSNAP_WEBSITE_TITLE=Custom name # Custom website title
# command: ["./upsnap", "serve", "--http", "0.0.0.0:8090"] # Uncomment this if you want to change the port for example
+742 -407
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -12,18 +12,18 @@
},
"devDependencies": {
"@sveltejs/adapter-static": "^1.0.5",
"@sveltejs/kit": "^1.3.3",
"@sveltejs/kit": "^1.3.2",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^8.33.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-svelte3": "^4.0.0",
"eslint-plugin-svelte3": "^3.4.1",
"husky": "^8.0.3",
"lint-staged": "^13.1.0",
"prettier": "^2.8.3",
"prettier-plugin-svelte": "^2.9.0",
"svelte": "^3.55.1",
"svelte-preprocess": "^5.0.1",
"svelte-preprocess": "^4.10.7",
"typescript": "^4.9.4",
"vite": "^4.0.4"
},
+2183 -2929
View File
File diff suppressed because it is too large Load Diff
+7 -8
View File
@@ -10,17 +10,20 @@
faLock
} from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
import { sortPorts } from '../sorts';
export let device;
export let now;
function shutdown() {
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/shutdown/${device.id}`);
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/shutdown/${device.id}`);
}
function wake() {
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/wake/${device.id}`);
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/wake/${device.id}`);
}
function sortPorts(a, b) {
return a.number - b.number;
}
</script>
@@ -133,11 +136,7 @@
<Fa icon={faLock} class="mx-1" />
</span>
{/if}
<p
class="text-muted m-0"
data-toggle="tooltip"
title="Last status change: {device.updated}"
>
<p class="text-muted m-0">
{formatDistance(parseISO(device.updated), now, {
includeSeconds: true,
addSuffix: true
+20 -30
View File
@@ -1,12 +1,14 @@
<script>
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
import { pocketbase, devices } from '@stores/pocketbase';
import { pocketbase } from '@stores/pocketbase';
import { faEye, faEyeSlash, faPlus, faTrashCan } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
export let device;
export let mode;
let pb;
let timeout;
let button = {
state: 'none',
@@ -23,6 +25,12 @@
let passwordShow = false;
$: passwordType = passwordShow ? 'text' : 'password';
onMount(async () => {
pocketbase.subscribe((conn) => {
pb = conn;
});
});
async function addOrUpdateDevice() {
button.state = 'waiting';
try {
@@ -39,18 +47,16 @@
for (let i = 0; i < device.expand.ports.length; i++) {
const port = device.expand.ports[i];
if (!port.id) {
const result = await $pocketbase.collection('ports').create(port);
const result = await pb.collection('ports').create(port);
device.ports = [...device.ports, result.id];
} else {
await $pocketbase.collection('ports').update(port.id, port);
}
}
// create or update device
if (mode === 'add') {
await $pocketbase.collection('devices').create(device);
await pb.collection('devices').create(device);
} else {
await $pocketbase.collection('devices').update(device.id, device);
await pb.collection('devices').update(device.id, device);
}
// show button with timeout
@@ -73,11 +79,10 @@
async function deleteDevice() {
deleteButton.state = 'waiting';
try {
await $pocketbase.collection('devices').delete(device.id);
device.ports.forEach(async (port) => {
await $pocketbase.collection('ports').delete(port);
await pb.collection('ports').delete(port);
});
delete $devices[device.id];
await pb.collection('devices').delete(device.id);
goto('/');
} catch (error) {
clearTimeout(timeout);
@@ -95,7 +100,7 @@
// ports with id exist in db, ports without id are not created yet
const port = device.expand.ports[idx];
if (port.id) {
await $pocketbase.collection('ports').delete(port.id);
await pb.collection('ports').delete(port.id);
const i = device.ports.indexOf(port.id);
if (i !== -1) {
device.ports.splice(i, 1);
@@ -335,31 +340,16 @@
<div class="col-md-6 d-flex align-items-start flex-column">
<div class="callout callout-info mb-auto">
<h5>Optional:</h5>
<p class="m-0">(1) Same cron syntax as for ping interval.</p>
<p class="m-0">
(1) Learn more about the correct syntax for cron on
<a href="https://en.wikipedia.org/wiki/Cron" target="_blank" rel="noreferrer"
>wikipedia</a
>
or refer to the
<a
target="_blank"
rel="noreferrer"
href="https://pkg.go.dev/github.com/robfig/cron">package documentation</a
>
</p>
<p class="m-0">
(2) Shell command to be executed. "net rpc", "sshpass" and "curl" are available.
(2) Shell command to be executed. "net rpc", "sshpass" and "nmap" are available.
e.g.:
</p>
<ul>
<li>Windows: "net rpc shutdown -I 192.168.1.13 -U test%test"</li>
<li>
Windows: <code>net rpc shutdown -I 192.168.1.13 -U "user%password"</code>
</li>
<li>
Linux: <code
>sshpass -p your_password ssh -o "StrictHostKeyChecking=no"
user@hostname "sudo poweroff"</code
>
Linux: "sshpass -p your_password ssh -o 'StrictHostKeyChecking=no'
user@hostname 'sudo poweroff'"
</li>
</ul>
<p class="m-0">
+17 -8
View File
@@ -1,22 +1,31 @@
<script>
import { page } from '$app/stores';
import { theme } from '@stores/theme';
import { pocketbase, settings } from '@stores/pocketbase';
import { pocketbase } from '@stores/pocketbase';
import { faSun, faMoon, faCircleHalfStroke, faBrush } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
import { onMount } from 'svelte';
let pb;
let website_title = '';
onMount(async () => {
$pocketbase.collection('settings').subscribe('*', function (e) {
settings.set(e.record);
document.title = $settings.website_title;
pocketbase.subscribe((conn) => {
pb = conn;
});
const result = await pb.collection('settings').getList(1, 1);
website_title = result.items[0].website_title;
pb.collection('settings').subscribe('*', function (e) {
website_title = e.record.website_title;
document.title = website_title;
});
});
</script>
<svelte:head>
{#if $settings.website_title !== ''}
<title>{$settings.website_title}</title>
{#if website_title !== ''}
<title>{website_title}</title>
{:else}
<title>UpSnap</title>
{/if}
@@ -30,8 +39,8 @@
alt="UpSnap"
width="30"
height="30"
class:me-2={$settings.website_title !== ''}
/>{$settings.website_title ? $settings.website_title : ''}
class:me-2={website_title !== ''}
/>{website_title ? website_title : ''}
</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
-17
View File
@@ -4,26 +4,9 @@
import { theme } from '@stores/theme';
import Navbar from '@components/Navbar.svelte';
import Transition from '@components/Transition.svelte';
import { pocketbase, settings, devices } from '@stores/pocketbase';
let preferesDark;
onMount(async () => {
let settingsRes = {};
settingsRes = await $pocketbase.collection('settings').getList(1, 1);
settings.set(settingsRes.items[0]);
let tempDevices = {};
const devicesRes = await $pocketbase.collection('devices').getFullList(200, {
sort: 'name',
expand: 'ports'
});
devicesRes.forEach((device) => {
tempDevices[device.id] = device;
});
devices.set(tempDevices);
});
onMount(() => {
// import bootstrap js
import('bootstrap/js/dist/dropdown');
+32 -21
View File
@@ -1,35 +1,46 @@
<script>
import { onMount } from 'svelte';
import DeviceCard from '@components/DeviceCard.svelte';
import { pocketbase, devices } from '@stores/pocketbase';
import { sortDevices } from '../sorts';
import { pocketbase } from '@stores/pocketbase';
let devices = {};
onMount(async () => {
let pb;
pocketbase.subscribe((conn) => {
pb = conn;
});
// get all devices in pocketbase
const result = await pb.collection('devices').getFullList(200, {
expand: 'ports',
sort: 'name'
});
result.forEach((device) => {
devices[device.id] = device;
});
// subscribe to database events
$pocketbase.collection('devices').subscribe('*', async (e) => {
pb.collection('devices').subscribe('*', async (e) => {
if (e.action === 'create') {
$devices[e.record.id] = e.record;
devices[e.record.id] = e.record;
} else if (e.action === 'update') {
const device = await $pocketbase.collection('devices').getOne(e.record.id, {
const device = await pb.collection('devices').getOne(e.record.id, {
expand: 'ports'
});
$devices[device.id] = device;
devices[device.id] = device;
} else if (e.action === 'delete') {
delete $devices[e.record.id];
delete devices[e.record.id];
}
});
$pocketbase.collection('ports').subscribe('*', async (e) => {
pb.collection('ports').subscribe('*', async (e) => {
if (e.action === 'update') {
const device = Object.values($devices).find((dev) =>
dev.ports.includes(e.record.id)
);
if (!device) {
return;
}
// replace device.expand.ports with updated record
const portIdx = device.expand.ports.findIndex((port) => port.id === e.record.id);
$devices[device.id].expand.ports[portIdx] = e.record;
const device = await pb
.collection('devices')
.getFirstListItem(`ports.id ?= "${e.record.id}"`, {
expand: 'ports'
});
devices[device.id] = device;
}
});
});
@@ -45,10 +56,10 @@
}
</script>
<div class="container text-body-emphasis mb-4">
{#if Object.keys($devices).length > 0}
<div class="container text-body-emphasis">
{#if Object.keys(devices).length > 0}
<div class="row">
{#each Object.values($devices).sort(sortDevices) as device}
{#each Object.entries(devices) as [_, device]}
<DeviceCard {device} {now} />
{/each}
</div>
+22 -13
View File
@@ -1,21 +1,30 @@
<script>
import { devices } from '@stores/pocketbase';
import { onMount } from 'svelte';
import { pocketbase } from '@stores/pocketbase';
import DeviceForm from '@components/DeviceForm.svelte';
export let data;
let device;
const id = data.params.id;
let pb;
let device = {
id: id
};
$: {
device = $devices[data.params.id];
if (device && !device?.expand?.ports) {
device.expand.ports = [];
onMount(async () => {
pocketbase.subscribe((conn) => {
pb = conn;
});
const result = await pb.collection('devices').getOne(id, {
expand: 'ports'
});
if (!result.expand.ports) {
result.expand.ports = [];
}
}
$:;
device = result;
});
</script>
{#if device}
<div class="container">
<DeviceForm bind:device mode="edit" />
</div>
{/if}
<div class="container">
<DeviceForm bind:device mode="edit" />
</div>
+35 -41
View File
@@ -1,13 +1,14 @@
<script>
import { onMount } from 'svelte';
import { dev } from '$app/environment';
import { pocketbase, settings, devices } from '@stores/pocketbase';
import { pocketbase } from '@stores/pocketbase';
import DeviceForm from '@components/DeviceForm.svelte';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
let version = import.meta.env.UPSNAP_VERSION;
let pb;
let files;
let settings = {};
let timeout;
let buttons = {
settings: {
@@ -42,13 +43,22 @@
};
let scannedDevices = {};
onMount(async () => {
pocketbase.subscribe((conn) => {
pb = conn;
});
const result = await pb.collection('settings').getList(1, 1);
settings = result.items[0];
});
async function saveSettings() {
buttons.settings.state = 'waiting';
try {
if ($settings.interval === '') {
$settings.interval = '@every 3s';
if (settings.interval === '') {
settings.interval = '@every 3s';
}
await $pocketbase.collection('settings').update($settings.id, $settings);
await pb.collection('settings').update(settings.id, settings);
clearTimeout(timeout);
timeout = setTimeout(() => {
buttons.settings.state = 'none';
@@ -67,9 +77,9 @@
async function scanDevices() {
buttons.scan.state = 'waiting';
await $pocketbase.collection('settings').update($settings.id, $settings);
await pb.collection('settings').update(settings.id, settings);
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/scan`)
fetch(`${dev ? 'http://127.0.0.1:8090' : ''}/api/upsnap/scan`)
.then((res) => res.json())
.then((data) => {
if (data.message) {
@@ -101,8 +111,7 @@
}
async function addDevice(device) {
await $pocketbase.collection('devices').create(device);
$devices[device.id] = device;
await pb.collection('devices').create(device);
}
async function restoreV2Backup() {
@@ -110,14 +119,14 @@
try {
// delete all devices in pocketbase
let result = await $pocketbase.collection('devices').getFullList();
let result = await pb.collection('devices').getFullList();
for (let index = 0; index < result.length; index++) {
$pocketbase.collection('devices').delete(result[index].id);
pb.collection('devices').delete(result[index].id);
}
// delete all ports in pocketbase
result = await $pocketbase.collection('ports').getFullList();
result = await pb.collection('ports').getFullList();
for (let index = 0; index < result.length; index++) {
await $pocketbase.collection('ports').delete(result[index].id);
await pb.collection('ports').delete(result[index].id);
}
let reader = new FileReader();
@@ -137,7 +146,7 @@
let thisDevicePorts = [];
for (let index = 0; index < device.ports.length; index++) {
const port = device.ports[index];
const record = await $pocketbase.collection('ports').create({
const record = await pb.collection('ports').create({
name: port.name,
number: port.number
});
@@ -145,7 +154,7 @@
}
// create device
await $pocketbase.collection('devices').create({
await pb.collection('devices').create({
name: device.name,
ip: device.ip,
mac: device.mac,
@@ -190,7 +199,7 @@
aria-label="Interval"
aria-describedby="addon-wrapping"
type="text"
bind:value={$settings.interval}
bind:value={settings.interval}
/>
</div>
<h3 class="my-3">Website title</h3>
@@ -203,7 +212,7 @@
placeholder="e.g. 'UpSnap'"
aria-label="Website title"
aria-describedby="website-title"
bind:value={$settings.website_title}
bind:value={settings.website_title}
/>
</div>
</div>
@@ -212,18 +221,14 @@
<p class="m-0">
Leave blank to use default value of <span class="fw-bold"
>"@every 3s"</span
>. Learn more about the correct syntax for cron on
<a
href="https://en.wikipedia.org/wiki/Cron"
target="_blank"
rel="noreferrer">wikipedia</a
>
or refer to the
<a
>.
</p>
<p class="m-0">
Read more about valid cron syntax at <a
target="_blank"
rel="noreferrer"
href="https://pkg.go.dev/github.com/robfig/cron"
>package documentation</a
>pkg.go.dev/github.com/robfig/cron</a
>
</p>
</div>
@@ -264,7 +269,7 @@
placeholder="e.g. '192.168.1.0/24'"
aria-label="ip-range"
aria-describedby="ip-range"
bind:value={$settings.scan_range}
bind:value={settings.scan_range}
/>
</div>
<button
@@ -273,7 +278,7 @@
class:btn-success={buttons.scan.state === 'success' ? true : false}
class:btn-warning={buttons.scan.state === 'waiting' ? true : false}
class:btn-danger={buttons.scan.state === 'failed' ? true : false}
disabled={$settings.scan_range === '' || buttons.scan.state !== 'none'
disabled={settings.scan_range === '' || buttons.scan.state !== 'none'
? true
: false}
>
@@ -348,8 +353,7 @@
<section class="m-0 my-4 p-4 shadow-sm">
<h3 class="mb-3">Restore</h3>
<p>
If you had UpSnap &gt;=2.3.2 and &lt;3.0.0 running before, you can restore your devices
here.
If you had UpSnap v2.3.2 (or higher) running before, you can restore your devices here.
</p>
<div class="callout callout-danger fw-bold">This will wipe the existing database!</div>
<input
@@ -380,14 +384,4 @@
{/if}
</button>
</section>
<p class="m-0 my-4 p-4 text-center text-muted">
{#if version !== undefined}
UpSnap version: <a
href="https://github.com/seriousm4x/UpSnap/releases/tag/{version}"
class="text-reset">{version}</a
>
{:else}
UpSnap version: (untracked)
{/if}
</p>
</div>
-7
View File
@@ -1,7 +0,0 @@
export function sortDevices(a, b) {
return a.name > b.name;
}
export function sortPorts(a, b) {
return a.number - b.number;
}
+1 -14
View File
@@ -1,20 +1,7 @@
import { writable } from 'svelte/store';
import PocketBase from 'pocketbase';
// set backend url based on environment
let backend_url = '/';
let isDevMode = import.meta.env.DEV;
if (isDevMode) {
backend_url = 'http://127.0.0.1:8090';
}
// get default values for stores
const pb = new PocketBase(backend_url);
const pb = new PocketBase('http://127.0.0.1:8090');
pb.autoCancellation(false);
// export stores
export const pocketbase = writable(pb);
export const settings = writable({
website_title: ''
});
export const devices = writable({});
+5 -5
View File
@@ -1,7 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()],
envPrefix: 'UPSNAP'
});
const config = {
plugins: [sveltekit()]
};
export default config;