Compare commits

...

29 Commits

Author SHA1 Message Date
Maxi Quoß 482a9884a4 add some error logging 2023-02-01 17:51:34 +01:00
Maxi Quoß ed285f502e fix openssh not working, close #37 2023-02-01 17:06:59 +01:00
Maxi Quoß b6f76c55c9 replace go-ping/ping (deprecated) 2023-01-31 13:47:13 +01:00
Maxi Quoß 7bdb99c066 fix top level await and fix broken device delete 2023-01-30 14:06:51 +01:00
Maxi Quoß e07755f3b9 delete port relations if device is deleted 2023-01-30 13:13:56 +01:00
Maxi Quoß 9b7a7632e6 fix error 500 on device settings without ports 2023-01-30 13:13:43 +01:00
Maxi Quoß 8c8671908c fix save new ports 2023-01-30 13:13:09 +01:00
Maxi Quoß 288baf0217 improve svelte stores 2023-01-30 12:17:01 +01:00
Maxi Quoß 647dfe3e9e device settings: update existing ports 2023-01-30 09:53:27 +01:00
Maxi Quoß b0452aa82d simpify pocketbase store 2023-01-30 09:35:05 +01:00
Maxi Quoß b5258bbb03 update readme 2023-01-30 02:49:46 +01:00
Maxi Quoß f77c2c0146 update readme 2023-01-30 02:46:04 +01:00
Maxi Quoß b68bb20e06 update readme 2023-01-30 02:41:46 +01:00
Maxi Quoß bb00b613e2 add tooltip for last status change 2023-01-30 01:34:12 +01:00
Maxi Quoß 82cc4004c0 improve english 2023-01-30 01:31:55 +01:00
Maxi Quoß e515ee2fae better cron cmd info 2023-01-30 01:21:03 +01:00
Maxi Quoß 1039fc2a46 go mod update 2023-01-30 01:06:01 +01:00
Maxi Quoß cda3cba9ca only version clickable 2023-01-30 01:05:40 +01:00
Maxi Quoß 737507faef update npm 2023-01-30 00:58:58 +01:00
Maxi Quoß 4ff62b1a3f add upsnap version to frontend 2023-01-30 00:51:45 +01:00
Maxi Quoß 62cec056b9 rename package, auto add version to binary 2023-01-30 00:41:49 +01:00
Maxi Quoß e78b66c920 include device name in error msg 2023-01-30 00:29:55 +01:00
Maxi Quoß 3018394888 change wake/shutdown log level 2023-01-30 00:26:04 +01:00
Maxi Quoß 4c91967d6e docker restart unless-stopped 2023-01-30 00:25:03 +01:00
Maxi Quoß 3fc2031914 set device status in shutdown handler 2023-01-30 00:23:54 +01:00
Maxi Quoß 1de83d0e34 remove debug prints 2023-01-30 00:18:58 +01:00
Maxi Quoß 2cc9dde62a fix cron running always for last device 2023-01-30 00:16:25 +01:00
Maxi Quoß 1f433dd40b set device status on cron wake/shutdown 2023-01-29 21:26:48 +01:00
Maxi Quoß 969d1545b4 add debug output 2023-01-29 21:20:30 +01:00
26 changed files with 890 additions and 1301 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
- name: Build frontend
run: |
npm --prefix=./frontend i
npm --prefix=./frontend run build
UPSNAP_VERSION=${GITHUB_REF##*/} npm --prefix=./frontend run build
cp -r ./frontend/build/* ./backend/pb_public/
# setup go
+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 &&\
apk add --no-cache tzdata ca-certificates nmap samba-common-tools openssh sshpass curl &&\
rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=downloader /app/upsnap upsnap
+6 -5
View File
@@ -8,8 +8,9 @@
<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://img.shields.io/github/actions/workflow/status/seriousm4x/upsnap/deploy.yml" /></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>
## ✨ Features
@@ -31,11 +32,11 @@
## 🚀 Run the binary
Just download the latest binary from the [release page](https://github.com/seriousm4x/UpSnap/releases) and run it.
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`.
Run `./upsnap serve --http=0.0.0.0:8090`. For more options check `./upsnap --help`.
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.
If you need network discovery, make sure to have `nmap` installed and run upsnap as root/admin.
## 🐳 Run in docker
@@ -51,7 +52,7 @@ upsnap.example.com {
}
```
## Help developing
## 🔧 Help developing
Fork this branch and clone it.
+1 -1
View File
@@ -9,7 +9,7 @@ builds:
env:
- CGO_ENABLED=0
ldflags:
- -s -w
- -s -w -X github.com/seriousm4x/upsnap/pb.Version={{ .Version }}
goos:
- linux
- windows
+37 -9
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/backend/logger"
"github.com/seriousm4x/upsnap/backend/networking"
"github.com/seriousm4x/upsnap/logger"
"github.com/seriousm4x/upsnap/networking"
)
var Devices []*models.Record
@@ -74,7 +74,7 @@ func RunPing(app *pocketbase.PocketBase) {
CronPing.Run()
}
func RunWakeShutdown() {
func RunWakeShutdown(app *pocketbase.PocketBase) {
CronWakeShutdown = cron.New()
for _, device := range Devices {
wake_cron := device.GetString("wake_cron")
@@ -83,19 +83,47 @@ func RunWakeShutdown() {
shutdown_cron_enabled := device.GetBool("shutdown_cron_enabled")
if wake_cron_enabled && wake_cron != "" {
CronWakeShutdown.AddFunc(wake_cron, func() {
if err := networking.WakeDevice(device); err != nil {
// 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 {
logger.Error.Println(err)
}
})
}(device)
}
if shutdown_cron_enabled && shutdown_cron != "" {
CronWakeShutdown.AddFunc(shutdown_cron, func() {
if err := networking.ShutdownDevice(device); err != nil {
// 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 {
logger.Error.Println(err)
}
})
}(device)
}
}
CronWakeShutdown.Run()
+21 -21
View File
@@ -1,26 +1,26 @@
module github.com/seriousm4x/upsnap/backend
module github.com/seriousm4x/upsnap
go 1.19
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.8.0
github.com/pocketbase/pocketbase v0.11.2
github.com/pocketbase/dbx v1.9.0
github.com/pocketbase/pocketbase v0.12.0
github.com/prometheus-community/pro-bing v0.1.0
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.178 // indirect
github.com/aws/aws-sdk-go v1.44.189 // 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.8 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // 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/feature/ec2/imds v1.12.21 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.47 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.49 // 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.0 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.1 // 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.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.18.2 // 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.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fatih/color v1.14.1 // 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.0.0 // indirect
github.com/josharian/native v1.1.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-20190313224307-5b5fc417d966 // indirect
github.com/mdlayher/packet v1.0.0 // indirect
github.com/mdlayher/socket v0.2.1 // 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/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // 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.106.0 // indirect
google.golang.org/api v0.108.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.52.0 // indirect
google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa // indirect
google.golang.org/grpc v1.52.3 // 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.2 // indirect
modernc.org/sqlite v1.20.3 // indirect
modernc.org/strutil v1.1.3 // indirect
modernc.org/token v1.1.0 // indirect
)
+40 -34
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.178 h1:4igreoWPEA7xVLnOeSXLhDXTsTSPKQONZcQ3llWAJw0=
github.com/aws/aws-sdk-go v1.44.178/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-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.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/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/credentials v1.13.3/go.mod h1:/rOMmqYBcFfNbRPU0iN9IgGqD5+V2yp3iWNmIlz0wI4=
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/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/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.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/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/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.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/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/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.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/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/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,8 +817,9 @@ 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=
@@ -849,8 +850,9 @@ 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=
@@ -932,8 +934,6 @@ github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/e
github.com/go-openapi/validate v0.21.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg=
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es=
github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew=
github.com/go-ping/ping v1.1.0 h1:3MCGhVX4fyEUuhsfwPrsEdQw6xspHkv5zHsiSoDFZYw=
github.com/go-ping/ping v1.1.0/go.mod h1:xIFjORFzTxqIV/tDVGO4eDy/bLuSyawEeojSm3GfRGk=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
@@ -1293,8 +1293,9 @@ 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=
@@ -1399,13 +1400,16 @@ 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/packet v1.0.0 h1:InhZJbdShQYt6XV2GPj5XHxChzOfhJJOMbvnGAmOfQ8=
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/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=
@@ -1569,14 +1573,16 @@ 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.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/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/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=
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
github.com/prometheus-community/pro-bing v0.1.0 h1:zjzLGhfNPP0bP1OlzGB+SJcguOViw7df12LPg2vUJh8=
github.com/prometheus-community/pro-bing v0.1.0/go.mod h1:BpWlHurD9flHtzq8wrh8QGWYz9ka9z9ZJAyOel8ej58=
github.com/prometheus/alertmanager v0.24.0/go.mod h1:r6fy/D7FRuZh5YbnX6J3MBY0eI4Pb5yPYS7/bPSXXqI=
github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -1639,8 +1645,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-20220927061507-ef77025ab5aa h1:tEkEyxYeZ43TR55QU/hsIt9aRGBxbgGuz9CGykjvogY=
github.com/remyoudompheng/bigfft v0.0.0-20220927061507-ef77025ab5aa/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/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=
@@ -2458,8 +2464,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.106.0 h1:ffmW0faWCwKkpbbtvlY/K/8fUl+JKvNS5CVzRoyfCv8=
google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
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/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=
@@ -2593,8 +2599,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-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
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/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=
@@ -2640,8 +2646,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.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=
google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
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/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=
@@ -2787,8 +2793,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.2 h1:9AaVzJH1Yf0u9iOZRjjuvqxLoGqybqVFbAUC5rvi9u8=
modernc.org/sqlite v1.20.2/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
modernc.org/sqlite v1.20.3 h1:SqGJMMxjj1PHusLxdYxeQSodg7Jxn9WWkaAQjKrntZs=
modernc.org/sqlite v1.20.3/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/backend/pb"
"github.com/seriousm4x/upsnap/pb"
)
//go:embed all:pb_public
+3 -3
View File
@@ -4,13 +4,13 @@ import (
"net"
"time"
"github.com/go-ping/ping"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/backend/logger"
probing "github.com/prometheus-community/pro-bing"
"github.com/seriousm4x/upsnap/logger"
)
func PingDevice(device *models.Record) bool {
pinger, err := ping.NewPinger(device.GetString("ip"))
pinger, err := probing.NewPinger(device.GetString("ip"))
if err != nil {
logger.Error.Println(err)
return false
+9 -2
View File
@@ -1,16 +1,18 @@
package networking
import (
"errors"
"bytes"
"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"))
@@ -27,9 +29,14 @@ func ShutdownDevice(device *models.Record) error {
}
cmd := exec.Command(shell, shell_arg, shutdown_cmd)
var stderr bytes.Buffer
cmd.Stderr = &stderr
if err := cmd.Run(); err != nil {
return err
}
if stderr.Len() > 0 {
return fmt.Errorf("%s", stderr.String())
}
// check state every second for 2 min
start := time.Now()
@@ -43,5 +50,5 @@ func ShutdownDevice(device *models.Record) error {
break
}
}
return errors.New("device not offline after 2 min")
return fmt.Errorf(device.GetString("name"), "not offline after 2 min")
}
+4 -2
View File
@@ -1,13 +1,15 @@
package networking
import (
"errors"
"fmt"
"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
@@ -25,5 +27,5 @@ func WakeDevice(device *models.Record) error {
break
}
}
return errors.New("device not online after 2 min")
return fmt.Errorf(device.GetString("name"), "not online after 2 min")
}
+15 -7
View File
@@ -11,8 +11,8 @@ import (
"github.com/labstack/echo/v5"
"github.com/pocketbase/pocketbase/apis"
"github.com/pocketbase/pocketbase/models"
"github.com/seriousm4x/upsnap/backend/logger"
"github.com/seriousm4x/upsnap/backend/networking"
"github.com/seriousm4x/upsnap/logger"
"github.com/seriousm4x/upsnap/networking"
)
func HandlerWake(c echo.Context) error {
@@ -24,6 +24,7 @@ func HandlerWake(c echo.Context) error {
record.Set("status", "pending")
App.Dao().SaveRecord(record)
if err := networking.WakeDevice(record); err != nil {
logger.Error.Println(err)
record.Set("status", "offline")
} else {
record.Set("status", "online")
@@ -38,11 +39,18 @@ func HandlerShutdown(c echo.Context) error {
if err != nil {
return apis.NewNotFoundError("The device does not exist.", err)
}
if err := networking.ShutdownDevice(record); err != nil {
logger.Error.Println(err)
return apis.NewBadRequestError(err.Error(), record)
}
return nil
go func(*models.Record) {
record.Set("status", "pending")
App.Dao().SaveRecord(record)
if err := networking.ShutdownDevice(record); err != nil {
logger.Error.Println(err)
record.Set("status", "online")
} else {
record.Set("status", "offline")
}
App.Dao().SaveRecord(record)
}(record)
return c.JSON(http.StatusOK, record)
}
type Nmaprun struct {
+8 -8
View File
@@ -2,7 +2,6 @@ package pb
import (
"io/fs"
"log"
"net/http"
"os"
@@ -12,17 +11,18 @@ import (
"github.com/pocketbase/pocketbase/core"
"github.com/pocketbase/pocketbase/models"
"github.com/pocketbase/pocketbase/plugins/migratecmd"
"github.com/seriousm4x/upsnap/backend/cronjobs"
"github.com/seriousm4x/upsnap/backend/logger"
_ "github.com/seriousm4x/upsnap/backend/migrations"
"github.com/seriousm4x/upsnap/cronjobs"
"github.com/seriousm4x/upsnap/logger"
_ "github.com/seriousm4x/upsnap/migrations"
)
var App *pocketbase.PocketBase
var Version = "(untracked)"
func StartPocketBase(distDirFS fs.FS) {
App = pocketbase.New()
App.RootCmd.Short = "UpSnap CLI"
App.RootCmd.Version = "3.0.0b1"
App.RootCmd.Version = Version
// auto migrate db
migratecmd.MustRegister(App, App.RootCmd, &migratecmd.Options{
@@ -76,7 +76,7 @@ func StartPocketBase(distDirFS fs.FS) {
// run cronjobs
go cronjobs.RunPing(App)
go cronjobs.RunWakeShutdown()
go cronjobs.RunWakeShutdown(App)
// restart ping cronjobs or wake/shutdown cronjobs on model update
// add event hook before starting server.
@@ -92,7 +92,7 @@ func StartPocketBase(distDirFS fs.FS) {
for _, job := range cronjobs.CronWakeShutdown.Entries() {
cronjobs.CronWakeShutdown.Remove(job.ID)
}
go cronjobs.RunWakeShutdown()
go cronjobs.RunWakeShutdown(App)
}
return nil
})
@@ -111,7 +111,7 @@ func StartPocketBase(distDirFS fs.FS) {
// start pocketbase
if err := App.Start(); err != nil {
log.Fatal(err)
logger.Error.Fatalln(err)
}
}
+1
View File
@@ -3,6 +3,7 @@ services:
upsnap:
image: ghcr.io/seriousm4x/upsnap:3
network_mode: host
restart: unless-stopped
volumes:
- ./data:/app/pb_data
healthcheck:
+407 -742
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.2",
"@sveltejs/kit": "^1.3.3",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"eslint": "^7.32.0",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-svelte3": "^3.4.1",
"eslint-plugin-svelte3": "^4.0.0",
"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": "^4.10.7",
"svelte-preprocess": "^5.0.1",
"typescript": "^4.9.4",
"vite": "^4.0.4"
},
+179 -326
View File
@@ -4,14 +4,14 @@ specifiers:
'@fortawesome/free-solid-svg-icons': ^6.2.1
'@popperjs/core': ^2.11.6
'@sveltejs/adapter-static': ^1.0.5
'@sveltejs/kit': ^1.3.2
'@sveltejs/kit': ^1.3.3
'@typescript-eslint/eslint-plugin': ^5.49.0
'@typescript-eslint/parser': ^5.49.0
bootstrap: 5.3.0-alpha1
date-fns: ^2.29.3
eslint: ^7.32.0
eslint: ^8.33.0
eslint-config-prettier: ^8.6.0
eslint-plugin-svelte3: ^3.4.1
eslint-plugin-svelte3: ^4.0.0
husky: ^8.0.3
lint-staged: ^13.1.0
pocketbase: ^0.10.1
@@ -20,7 +20,7 @@ specifiers:
sass: ^1.57.1
svelte: ^3.55.1
svelte-fa: ^3.0.3
svelte-preprocess: ^4.10.7
svelte-preprocess: ^5.0.1
typescript: ^4.9.4
vite: ^4.0.4
@@ -34,52 +34,23 @@ dependencies:
svelte-fa: 3.0.3
devDependencies:
'@sveltejs/adapter-static': 1.0.5_@sveltejs+kit@1.3.2
'@sveltejs/kit': 1.3.2_svelte@3.55.1+vite@4.0.4
'@typescript-eslint/eslint-plugin': 5.49.0_mkxcjaly3h5h3xlopwmx7wpgya
'@typescript-eslint/parser': 5.49.0_yfqovispp7u7jaktymfaqwl2py
eslint: 7.32.0
eslint-config-prettier: 8.6.0_eslint@7.32.0
eslint-plugin-svelte3: 3.4.1_ky47wof2jags4esujrawigm3eq
'@sveltejs/adapter-static': 1.0.5_@sveltejs+kit@1.3.3
'@sveltejs/kit': 1.3.3_svelte@3.55.1+vite@4.0.4
'@typescript-eslint/eslint-plugin': 5.49.0_rsaczafy73x3xqauzesvzbsgzy
'@typescript-eslint/parser': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
eslint: 8.33.0
eslint-config-prettier: 8.6.0_eslint@8.33.0
eslint-plugin-svelte3: 4.0.0_4omm2ewoudhgnmf7aocafatnc4
husky: 8.0.3
lint-staged: 13.1.0
prettier: 2.8.3
prettier-plugin-svelte: 2.9.0_kdmmghgdi3ngrsq6otxkjilbry
svelte: 3.55.1
svelte-preprocess: 4.10.7_feqgtmonqoj7yjk2wjndla2xcu
svelte-preprocess: 5.0.1_feqgtmonqoj7yjk2wjndla2xcu
typescript: 4.9.4
vite: 4.0.4_sass@1.57.1
packages:
/@babel/code-frame/7.12.11:
resolution:
{
integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==
}
dependencies:
'@babel/highlight': 7.18.6
dev: true
/@babel/helper-validator-identifier/7.19.1:
resolution:
{
integrity: sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
}
engines: { node: '>=6.9.0' }
dev: true
/@babel/highlight/7.18.6:
resolution:
{
integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==
}
engines: { node: '>=6.9.0' }
dependencies:
'@babel/helper-validator-identifier': 7.19.1
chalk: 2.4.2
js-tokens: 4.0.0
dev: true
/@esbuild/android-arm/0.16.17:
resolution:
{
@@ -344,20 +315,20 @@ packages:
dev: true
optional: true
/@eslint/eslintrc/0.4.3:
/@eslint/eslintrc/1.4.1:
resolution:
{
integrity: sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==
integrity: sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==
}
engines: { node: ^10.12.0 || >=12.0.0 }
engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 }
dependencies:
ajv: 6.12.6
debug: 4.3.4
espree: 7.3.1
espree: 9.4.1
globals: 13.20.0
ignore: 4.0.6
ignore: 5.2.4
import-fresh: 3.3.0
js-yaml: 3.14.1
js-yaml: 4.1.0
minimatch: 3.1.2
strip-json-comments: 3.1.1
transitivePeerDependencies:
@@ -384,10 +355,10 @@ packages:
'@fortawesome/fontawesome-common-types': 6.2.1
dev: false
/@humanwhocodes/config-array/0.5.0:
/@humanwhocodes/config-array/0.11.8:
resolution:
{
integrity: sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==
integrity: sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==
}
engines: { node: '>=10.10.0' }
dependencies:
@@ -398,6 +369,14 @@ packages:
- supports-color
dev: true
/@humanwhocodes/module-importer/1.0.1:
resolution:
{
integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==
}
engines: { node: '>=12.22' }
dev: true
/@humanwhocodes/object-schema/1.2.1:
resolution:
{
@@ -456,7 +435,7 @@ packages:
}
dev: false
/@sveltejs/adapter-static/1.0.5_@sveltejs+kit@1.3.2:
/@sveltejs/adapter-static/1.0.5_@sveltejs+kit@1.3.3:
resolution:
{
integrity: sha512-W5jbgvy9sbYEHs27NQOSFEun+zQwdcL4kpk5qc2kSHl8cKsP5wfXuWDTDRmD1Co40aFcesi5Az5ZzdnPI8KCVg==
@@ -464,13 +443,13 @@ packages:
peerDependencies:
'@sveltejs/kit': ^1.0.0
dependencies:
'@sveltejs/kit': 1.3.2_svelte@3.55.1+vite@4.0.4
'@sveltejs/kit': 1.3.3_svelte@3.55.1+vite@4.0.4
dev: true
/@sveltejs/kit/1.3.2_svelte@3.55.1+vite@4.0.4:
/@sveltejs/kit/1.3.3_svelte@3.55.1+vite@4.0.4:
resolution:
{
integrity: sha512-sCJORYwK/DY4SEmlmaGSzO/7K/dpb2QXJIHy6di5FV/9p8OSeMjlbOFxZMKzW7PHH6jCaKkoApgjkbI+A/y/qw==
integrity: sha512-z/Of+rnKhNCvFArymTpmiNsAZZnclD8qR9d/YZJi3ZziLh/OI7L/Ca8/n6Hnd5NqLKB6/NzOC0Fgr12VHMY3nQ==
}
engines: { node: ^16.14 || >=18 }
hasBin: true
@@ -564,7 +543,7 @@ packages:
}
dev: true
/@typescript-eslint/eslint-plugin/5.49.0_mkxcjaly3h5h3xlopwmx7wpgya:
/@typescript-eslint/eslint-plugin/5.49.0_rsaczafy73x3xqauzesvzbsgzy:
resolution:
{
integrity: sha512-IhxabIpcf++TBaBa1h7jtOWyon80SXPRLDq0dVz5SLFC/eW6tofkw/O7Ar3lkx5z5U6wzbKDrl2larprp5kk5Q==
@@ -578,12 +557,12 @@ packages:
typescript:
optional: true
dependencies:
'@typescript-eslint/parser': 5.49.0_yfqovispp7u7jaktymfaqwl2py
'@typescript-eslint/parser': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
'@typescript-eslint/scope-manager': 5.49.0
'@typescript-eslint/type-utils': 5.49.0_yfqovispp7u7jaktymfaqwl2py
'@typescript-eslint/utils': 5.49.0_yfqovispp7u7jaktymfaqwl2py
'@typescript-eslint/type-utils': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
'@typescript-eslint/utils': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
debug: 4.3.4
eslint: 7.32.0
eslint: 8.33.0
ignore: 5.2.4
natural-compare-lite: 1.4.0
regexpp: 3.2.0
@@ -594,7 +573,7 @@ packages:
- supports-color
dev: true
/@typescript-eslint/parser/5.49.0_yfqovispp7u7jaktymfaqwl2py:
/@typescript-eslint/parser/5.49.0_zkdaqh7it7uc4cvz2haft7rc6u:
resolution:
{
integrity: sha512-veDlZN9mUhGqU31Qiv2qEp+XrJj5fgZpJ8PW30sHU+j/8/e5ruAhLaVDAeznS7A7i4ucb/s8IozpDtt9NqCkZg==
@@ -611,7 +590,7 @@ packages:
'@typescript-eslint/types': 5.49.0
'@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4
debug: 4.3.4
eslint: 7.32.0
eslint: 8.33.0
typescript: 4.9.4
transitivePeerDependencies:
- supports-color
@@ -628,7 +607,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.49.0
dev: true
/@typescript-eslint/type-utils/5.49.0_yfqovispp7u7jaktymfaqwl2py:
/@typescript-eslint/type-utils/5.49.0_zkdaqh7it7uc4cvz2haft7rc6u:
resolution:
{
integrity: sha512-eUgLTYq0tR0FGU5g1YHm4rt5H/+V2IPVkP0cBmbhRyEmyGe4XvJ2YJ6sYTmONfjmdMqyMLad7SB8GvblbeESZA==
@@ -642,9 +621,9 @@ packages:
optional: true
dependencies:
'@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4
'@typescript-eslint/utils': 5.49.0_yfqovispp7u7jaktymfaqwl2py
'@typescript-eslint/utils': 5.49.0_zkdaqh7it7uc4cvz2haft7rc6u
debug: 4.3.4
eslint: 7.32.0
eslint: 8.33.0
tsutils: 3.21.0_typescript@4.9.4
typescript: 4.9.4
transitivePeerDependencies:
@@ -683,7 +662,7 @@ packages:
- supports-color
dev: true
/@typescript-eslint/utils/5.49.0_yfqovispp7u7jaktymfaqwl2py:
/@typescript-eslint/utils/5.49.0_zkdaqh7it7uc4cvz2haft7rc6u:
resolution:
{
integrity: sha512-cPJue/4Si25FViIb74sHCLtM4nTSBXtLx1d3/QT6mirQ/c65bV8arBEebBJJizfq8W2YyMoPI/WWPFWitmNqnQ==
@@ -697,9 +676,9 @@ packages:
'@typescript-eslint/scope-manager': 5.49.0
'@typescript-eslint/types': 5.49.0
'@typescript-eslint/typescript-estree': 5.49.0_typescript@4.9.4
eslint: 7.32.0
eslint: 8.33.0
eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@7.32.0
eslint-utils: 3.0.0_eslint@8.33.0
semver: 7.3.8
transitivePeerDependencies:
- supports-color
@@ -717,7 +696,7 @@ packages:
eslint-visitor-keys: 3.3.0
dev: true
/acorn-jsx/5.3.2_acorn@7.4.1:
/acorn-jsx/5.3.2_acorn@8.8.2:
resolution:
{
integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
@@ -725,13 +704,13 @@ packages:
peerDependencies:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies:
acorn: 7.4.1
acorn: 8.8.2
dev: true
/acorn/7.4.1:
/acorn/8.8.2:
resolution:
{
integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
}
engines: { node: '>=0.4.0' }
hasBin: true
@@ -760,26 +739,6 @@ packages:
uri-js: 4.4.1
dev: true
/ajv/8.12.0:
resolution:
{
integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==
}
dependencies:
fast-deep-equal: 3.1.3
json-schema-traverse: 1.0.0
require-from-string: 2.0.2
uri-js: 4.4.1
dev: true
/ansi-colors/4.1.3:
resolution:
{
integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==
}
engines: { node: '>=6' }
dev: true
/ansi-escapes/4.3.2:
resolution:
{
@@ -806,16 +765,6 @@ packages:
engines: { node: '>=12' }
dev: true
/ansi-styles/3.2.1:
resolution:
{
integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
}
engines: { node: '>=4' }
dependencies:
color-convert: 1.9.3
dev: true
/ansi-styles/4.3.0:
resolution:
{
@@ -844,13 +793,11 @@ packages:
normalize-path: 3.0.0
picomatch: 2.3.1
/argparse/1.0.10:
/argparse/2.0.1:
resolution:
{
integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
}
dependencies:
sprintf-js: 1.0.3
dev: true
/array-union/2.1.0:
@@ -938,18 +885,6 @@ packages:
engines: { node: '>=6' }
dev: true
/chalk/2.4.2:
resolution:
{
integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
}
engines: { node: '>=4' }
dependencies:
ansi-styles: 3.2.1
escape-string-regexp: 1.0.5
supports-color: 5.5.0
dev: true
/chalk/4.1.2:
resolution:
{
@@ -1018,15 +953,6 @@ packages:
string-width: 5.1.2
dev: true
/color-convert/1.9.3:
resolution:
{
integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
}
dependencies:
color-name: 1.1.3
dev: true
/color-convert/2.0.1:
resolution:
{
@@ -1037,13 +963,6 @@ packages:
color-name: 1.1.4
dev: true
/color-name/1.1.3:
resolution:
{
integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
}
dev: true
/color-name/1.1.4:
resolution:
{
@@ -1187,16 +1106,6 @@ packages:
}
dev: true
/enquirer/2.3.6:
resolution:
{
integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
}
engines: { node: '>=8.6' }
dependencies:
ansi-colors: 4.1.3
dev: true
/es6-promise/3.3.1:
resolution:
{
@@ -1237,14 +1146,6 @@ packages:
'@esbuild/win32-x64': 0.16.17
dev: true
/escape-string-regexp/1.0.5:
resolution:
{
integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
}
engines: { node: '>=0.8.0' }
dev: true
/escape-string-regexp/4.0.0:
resolution:
{
@@ -1253,7 +1154,7 @@ packages:
engines: { node: '>=10' }
dev: true
/eslint-config-prettier/8.6.0_eslint@7.32.0:
/eslint-config-prettier/8.6.0_eslint@8.33.0:
resolution:
{
integrity: sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==
@@ -1262,20 +1163,19 @@ packages:
peerDependencies:
eslint: '>=7.0.0'
dependencies:
eslint: 7.32.0
eslint: 8.33.0
dev: true
/eslint-plugin-svelte3/3.4.1_ky47wof2jags4esujrawigm3eq:
/eslint-plugin-svelte3/4.0.0_4omm2ewoudhgnmf7aocafatnc4:
resolution:
{
integrity: sha512-7p59WG8qV8L6wLdl4d/c3mdjkgVglQCdv5XOTk/iNPBKXuuV+Q0eFP5Wa6iJd/G2M1qR3BkLPEzaANOqKAZczw==
integrity: sha512-OIx9lgaNzD02+MDFNLw0GEUbuovNcglg+wnd/UY0fbZmlQSz7GlQiQ1f+yX0XvC07XPcDOnFcichqI3xCwp71g==
}
engines: { node: '>=10' }
peerDependencies:
eslint: '>=6.0.0'
eslint: '>=8.0.0'
svelte: ^3.2.0
dependencies:
eslint: 7.32.0
eslint: 8.33.0
svelte: 3.55.1
dev: true
@@ -1290,17 +1190,18 @@ packages:
estraverse: 4.3.0
dev: true
/eslint-utils/2.1.0:
/eslint-scope/7.1.1:
resolution:
{
integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==
integrity: sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==
}
engines: { node: '>=6' }
engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 }
dependencies:
eslint-visitor-keys: 1.3.0
esrecurse: 4.3.0
estraverse: 5.3.0
dev: true
/eslint-utils/3.0.0_eslint@7.32.0:
/eslint-utils/3.0.0_eslint@8.33.0:
resolution:
{
integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==
@@ -1309,18 +1210,10 @@ packages:
peerDependencies:
eslint: '>=5'
dependencies:
eslint: 7.32.0
eslint: 8.33.0
eslint-visitor-keys: 2.1.0
dev: true
/eslint-visitor-keys/1.3.0:
resolution:
{
integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==
}
engines: { node: '>=4' }
dev: true
/eslint-visitor-keys/2.1.0:
resolution:
{
@@ -1337,54 +1230,53 @@ packages:
engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 }
dev: true
/eslint/7.32.0:
/eslint/8.33.0:
resolution:
{
integrity: sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==
integrity: sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==
}
engines: { node: ^10.12.0 || >=12.0.0 }
engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 }
hasBin: true
dependencies:
'@babel/code-frame': 7.12.11
'@eslint/eslintrc': 0.4.3
'@humanwhocodes/config-array': 0.5.0
'@eslint/eslintrc': 1.4.1
'@humanwhocodes/config-array': 0.11.8
'@humanwhocodes/module-importer': 1.0.1
'@nodelib/fs.walk': 1.2.8
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.4
doctrine: 3.0.0
enquirer: 2.3.6
escape-string-regexp: 4.0.0
eslint-scope: 5.1.1
eslint-utils: 2.1.0
eslint-visitor-keys: 2.1.0
espree: 7.3.1
eslint-scope: 7.1.1
eslint-utils: 3.0.0_eslint@8.33.0
eslint-visitor-keys: 3.3.0
espree: 9.4.1
esquery: 1.4.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1
functional-red-black-tree: 1.0.1
glob-parent: 5.1.2
find-up: 5.0.0
glob-parent: 6.0.2
globals: 13.20.0
ignore: 4.0.6
grapheme-splitter: 1.0.4
ignore: 5.2.4
import-fresh: 3.3.0
imurmurhash: 0.1.4
is-glob: 4.0.3
js-yaml: 3.14.1
is-path-inside: 3.0.3
js-sdsl: 4.3.0
js-yaml: 4.1.0
json-stable-stringify-without-jsonify: 1.0.1
levn: 0.4.1
lodash.merge: 4.6.2
minimatch: 3.1.2
natural-compare: 1.4.0
optionator: 0.9.1
progress: 2.0.3
regexpp: 3.2.0
semver: 7.3.8
strip-ansi: 6.0.1
strip-json-comments: 3.1.1
table: 6.8.1
text-table: 0.2.0
v8-compile-cache: 2.3.0
transitivePeerDependencies:
- supports-color
dev: true
@@ -1396,25 +1288,16 @@ packages:
}
dev: true
/espree/7.3.1:
/espree/9.4.1:
resolution:
{
integrity: sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==
integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==
}
engines: { node: ^10.12.0 || >=12.0.0 }
engines: { node: ^12.22.0 || ^14.17.0 || >=16.0.0 }
dependencies:
acorn: 7.4.1
acorn-jsx: 5.3.2_acorn@7.4.1
eslint-visitor-keys: 1.3.0
dev: true
/esprima/4.0.1:
resolution:
{
integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
}
engines: { node: '>=4' }
hasBin: true
acorn: 8.8.2
acorn-jsx: 5.3.2_acorn@8.8.2
eslint-visitor-keys: 3.3.0
dev: true
/esquery/1.4.0:
@@ -1542,6 +1425,17 @@ packages:
dependencies:
to-regex-range: 5.0.1
/find-up/5.0.0:
resolution:
{
integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
}
engines: { node: '>=10' }
dependencies:
locate-path: 6.0.0
path-exists: 4.0.0
dev: true
/flat-cache/3.0.4:
resolution:
{
@@ -1584,13 +1478,6 @@ packages:
}
dev: true
/functional-red-black-tree/1.0.1:
resolution:
{
integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==
}
dev: true
/get-stream/6.0.1:
resolution:
{
@@ -1608,6 +1495,16 @@ packages:
dependencies:
is-glob: 4.0.3
/glob-parent/6.0.2:
resolution:
{
integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
}
engines: { node: '>=10.13.0' }
dependencies:
is-glob: 4.0.3
dev: true
/glob/7.2.3:
resolution:
{
@@ -1668,12 +1565,11 @@ packages:
}
dev: true
/has-flag/3.0.0:
/grapheme-splitter/1.0.4:
resolution:
{
integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==
integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==
}
engines: { node: '>=4' }
dev: true
/has-flag/4.0.0:
@@ -1711,14 +1607,6 @@ packages:
hasBin: true
dev: true
/ignore/4.0.6:
resolution:
{
integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
}
engines: { node: '>= 4' }
dev: true
/ignore/5.2.4:
resolution:
{
@@ -1834,6 +1722,14 @@ packages:
}
engines: { node: '>=0.12.0' }
/is-path-inside/3.0.3:
resolution:
{
integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
}
engines: { node: '>=8' }
dev: true
/is-stream/3.0.0:
resolution:
{
@@ -1849,22 +1745,21 @@ packages:
}
dev: true
/js-tokens/4.0.0:
/js-sdsl/4.3.0:
resolution:
{
integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==
}
dev: true
/js-yaml/3.14.1:
/js-yaml/4.1.0:
resolution:
{
integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==
integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
}
hasBin: true
dependencies:
argparse: 1.0.10
esprima: 4.0.1
argparse: 2.0.1
dev: true
/json-schema-traverse/0.4.1:
@@ -1874,13 +1769,6 @@ packages:
}
dev: true
/json-schema-traverse/1.0.0:
resolution:
{
integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
}
dev: true
/json-stable-stringify-without-jsonify/1.0.1:
resolution:
{
@@ -1963,6 +1851,16 @@ packages:
wrap-ansi: 7.0.0
dev: true
/locate-path/6.0.0:
resolution:
{
integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
}
engines: { node: '>=10' }
dependencies:
p-locate: 5.0.0
dev: true
/lodash.merge/4.6.2:
resolution:
{
@@ -1970,13 +1868,6 @@ packages:
}
dev: true
/lodash.truncate/4.4.2:
resolution:
{
integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==
}
dev: true
/log-update/4.0.0:
resolution:
{
@@ -2000,15 +1891,6 @@ packages:
yallist: 4.0.0
dev: true
/magic-string/0.25.9:
resolution:
{
integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==
}
dependencies:
sourcemap-codec: 1.4.8
dev: true
/magic-string/0.27.0:
resolution:
{
@@ -2218,6 +2100,26 @@ packages:
word-wrap: 1.2.3
dev: true
/p-limit/3.1.0:
resolution:
{
integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
}
engines: { node: '>=10' }
dependencies:
yocto-queue: 0.1.0
dev: true
/p-locate/5.0.0:
resolution:
{
integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
}
engines: { node: '>=10' }
dependencies:
p-limit: 3.1.0
dev: true
/p-map/4.0.0:
resolution:
{
@@ -2238,6 +2140,14 @@ packages:
callsites: 3.1.0
dev: true
/path-exists/4.0.0:
resolution:
{
integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
}
engines: { node: '>=8' }
dev: true
/path-is-absolute/1.0.1:
resolution:
{
@@ -2349,14 +2259,6 @@ packages:
hasBin: true
dev: true
/progress/2.0.3:
resolution:
{
integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
}
engines: { node: '>=0.4.0' }
dev: true
/punycode/2.3.0:
resolution:
{
@@ -2389,14 +2291,6 @@ packages:
engines: { node: '>=8' }
dev: true
/require-from-string/2.0.2:
resolution:
{
integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==
}
engines: { node: '>=0.10.0' }
dev: true
/resolve-from/4.0.0:
resolution:
{
@@ -2624,17 +2518,17 @@ packages:
is-fullwidth-code-point: 4.0.0
dev: true
/sorcery/0.10.0:
/sorcery/0.11.0:
resolution:
{
integrity: sha512-R5ocFmKZQFfSTstfOtHjJuAwbpGyf9qjQa1egyhvXSbM7emjrtLXtGdZsDJDABC85YBfVvrOiGWKSYXPKdvP1g==
integrity: sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==
}
hasBin: true
dependencies:
'@jridgewell/sourcemap-codec': 1.4.14
buffer-crc32: 0.2.13
minimist: 1.2.7
sander: 0.5.1
sourcemap-codec: 1.4.8
dev: true
/source-map-js/1.0.2:
@@ -2644,21 +2538,6 @@ packages:
}
engines: { node: '>=0.10.0' }
/sourcemap-codec/1.4.8:
resolution:
{
integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==
}
deprecated: Please use @jridgewell/sourcemap-codec instead
dev: true
/sprintf-js/1.0.3:
resolution:
{
integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==
}
dev: true
/streamsearch/1.1.0:
resolution:
{
@@ -2745,16 +2624,6 @@ packages:
engines: { node: '>=8' }
dev: true
/supports-color/5.5.0:
resolution:
{
integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
}
engines: { node: '>=4' }
dependencies:
has-flag: 3.0.0
dev: true
/supports-color/7.2.0:
resolution:
{
@@ -2792,24 +2661,23 @@ packages:
svelte: 3.55.1
dev: true
/svelte-preprocess/4.10.7_feqgtmonqoj7yjk2wjndla2xcu:
/svelte-preprocess/5.0.1_feqgtmonqoj7yjk2wjndla2xcu:
resolution:
{
integrity: sha512-sNPBnqYD6FnmdBrUmBCaqS00RyCsCpj2BG58A1JBswNF7b0OKviwxqVrOL/CKyJrLSClrSeqQv5BXNg2RUbPOw==
integrity: sha512-0HXyhCoc9rsW4zGOgtInylC6qj259E1hpFnJMJWTf+aIfeqh4O/QHT31KT2hvPEqQfdjmqBR/kO2JDkkciBLrQ==
}
engines: { node: '>= 9.11.2' }
engines: { node: '>= 14.10.0' }
requiresBuild: true
peerDependencies:
'@babel/core': ^7.10.2
coffeescript: ^2.5.1
less: ^3.11.3 || ^4.0.0
node-sass: '*'
postcss: ^7 || ^8
postcss-load-config: ^2.1.0 || ^3.0.0 || ^4.0.0
pug: ^3.0.0
sass: ^1.26.8
stylus: ^0.55.0
sugarss: ^2.0.0
sugarss: ^2.0.0 || ^3.0.0 || ^4.0.0
svelte: ^3.23.0
typescript: ^3.9.5 || ^4.0.0
peerDependenciesMeta:
@@ -2819,8 +2687,6 @@ packages:
optional: true
less:
optional: true
node-sass:
optional: true
postcss:
optional: true
postcss-load-config:
@@ -2839,9 +2705,9 @@ packages:
'@types/pug': 2.0.6
'@types/sass': 1.43.1
detect-indent: 6.1.0
magic-string: 0.25.9
magic-string: 0.27.0
sass: 1.57.1
sorcery: 0.10.0
sorcery: 0.11.0
strip-indent: 3.0.0
svelte: 3.55.1
typescript: 4.9.4
@@ -2855,20 +2721,6 @@ packages:
engines: { node: '>= 8' }
dev: true
/table/6.8.1:
resolution:
{
integrity: sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==
}
engines: { node: '>=10.0.0' }
dependencies:
ajv: 8.12.0
lodash.truncate: 4.4.2
slice-ansi: 4.0.0
string-width: 4.2.3
strip-ansi: 6.0.1
dev: true
/text-table/0.2.0:
resolution:
{
@@ -2991,13 +2843,6 @@ packages:
punycode: 2.3.0
dev: true
/v8-compile-cache/2.3.0:
resolution:
{
integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==
}
dev: true
/vite/4.0.4_sass@1.57.1:
resolution:
{
@@ -3113,3 +2958,11 @@ packages:
}
engines: { node: '>= 14' }
dev: true
/yocto-queue/0.1.0:
resolution:
{
integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
}
engines: { node: '>=10' }
dev: true
+6 -5
View File
@@ -10,6 +10,7 @@
faLock
} from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
import { sortPorts } from '../sorts';
export let device;
export let now;
@@ -21,10 +22,6 @@
function wake() {
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/wake/${device.id}`);
}
function sortPorts(a, b) {
return a.number - b.number;
}
</script>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 g-4">
@@ -136,7 +133,11 @@
<Fa icon={faLock} class="mx-1" />
</span>
{/if}
<p class="text-muted m-0">
<p
class="text-muted m-0"
data-toggle="tooltip"
title="Last status change: {device.updated}"
>
{formatDistance(parseISO(device.updated), now, {
includeSeconds: true,
addSuffix: true
+30 -20
View File
@@ -1,14 +1,12 @@
<script>
import { onMount } from 'svelte';
import { goto } from '$app/navigation';
import { pocketbase } from '@stores/pocketbase';
import { pocketbase, devices } 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',
@@ -25,12 +23,6 @@
let passwordShow = false;
$: passwordType = passwordShow ? 'text' : 'password';
onMount(async () => {
pocketbase.subscribe((conn) => {
pb = conn;
});
});
async function addOrUpdateDevice() {
button.state = 'waiting';
try {
@@ -47,16 +39,18 @@
for (let i = 0; i < device.expand.ports.length; i++) {
const port = device.expand.ports[i];
if (!port.id) {
const result = await pb.collection('ports').create(port);
const result = await $pocketbase.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 pb.collection('devices').create(device);
await $pocketbase.collection('devices').create(device);
} else {
await pb.collection('devices').update(device.id, device);
await $pocketbase.collection('devices').update(device.id, device);
}
// show button with timeout
@@ -79,10 +73,11 @@
async function deleteDevice() {
deleteButton.state = 'waiting';
try {
await $pocketbase.collection('devices').delete(device.id);
device.ports.forEach(async (port) => {
await pb.collection('ports').delete(port);
await $pocketbase.collection('ports').delete(port);
});
await pb.collection('devices').delete(device.id);
delete $devices[device.id];
goto('/');
} catch (error) {
clearTimeout(timeout);
@@ -100,7 +95,7 @@
// ports with id exist in db, ports without id are not created yet
const port = device.expand.ports[idx];
if (port.id) {
await pb.collection('ports').delete(port.id);
await $pocketbase.collection('ports').delete(port.id);
const i = device.ports.indexOf(port.id);
if (i !== -1) {
device.ports.splice(i, 1);
@@ -340,16 +335,31 @@
<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">
(2) Shell command to be executed. "net rpc", "sshpass" and "nmap" are available.
(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.
e.g.:
</p>
<ul>
<li>Windows: "net rpc shutdown -I 192.168.1.13 -U test%test"</li>
<li>
Linux: "sshpass -p your_password ssh -o 'StrictHostKeyChecking=no'
user@hostname 'sudo poweroff'"
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
>
</li>
</ul>
<p class="m-0">
+8 -17
View File
@@ -1,31 +1,22 @@
<script>
import { page } from '$app/stores';
import { theme } from '@stores/theme';
import { pocketbase } from '@stores/pocketbase';
import { pocketbase, settings } 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.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;
$pocketbase.collection('settings').subscribe('*', function (e) {
settings.set(e.record);
document.title = $settings.website_title;
});
});
</script>
<svelte:head>
{#if website_title !== ''}
<title>{website_title}</title>
{#if $settings.website_title !== ''}
<title>{$settings.website_title}</title>
{:else}
<title>UpSnap</title>
{/if}
@@ -39,8 +30,8 @@
alt="UpSnap"
width="30"
height="30"
class:me-2={website_title !== ''}
/>{website_title ? website_title : ''}
class:me-2={$settings.website_title !== ''}
/>{$settings.website_title ? $settings.website_title : ''}
</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
+17
View File
@@ -4,9 +4,26 @@
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');
+21 -32
View File
@@ -1,46 +1,35 @@
<script>
import { onMount } from 'svelte';
import DeviceCard from '@components/DeviceCard.svelte';
import { pocketbase } from '@stores/pocketbase';
let devices = {};
import { pocketbase, devices } from '@stores/pocketbase';
import { sortDevices } from '../sorts';
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
pb.collection('devices').subscribe('*', async (e) => {
$pocketbase.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 pb.collection('devices').getOne(e.record.id, {
const device = await $pocketbase.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];
}
});
pb.collection('ports').subscribe('*', async (e) => {
$pocketbase.collection('ports').subscribe('*', async (e) => {
if (e.action === 'update') {
const device = await pb
.collection('devices')
.getFirstListItem(`ports.id ?= "${e.record.id}"`, {
expand: 'ports'
});
devices[device.id] = device;
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;
}
});
});
@@ -56,10 +45,10 @@
}
</script>
<div class="container text-body-emphasis">
{#if Object.keys(devices).length > 0}
<div class="container text-body-emphasis mb-4">
{#if Object.keys($devices).length > 0}
<div class="row">
{#each Object.entries(devices) as [_, device]}
{#each Object.values($devices).sort(sortDevices) as device}
<DeviceCard {device} {now} />
{/each}
</div>
+13 -22
View File
@@ -1,30 +1,21 @@
<script>
import { onMount } from 'svelte';
import { pocketbase } from '@stores/pocketbase';
import { devices } from '@stores/pocketbase';
import DeviceForm from '@components/DeviceForm.svelte';
export let data;
const id = data.params.id;
let pb;
let device = {
id: id
};
let device;
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 = $devices[data.params.id];
if (device && !device?.expand?.ports) {
device.expand.ports = [];
}
device = result;
});
}
$:;
</script>
<div class="container">
<DeviceForm bind:device mode="edit" />
</div>
{#if device}
<div class="container">
<DeviceForm bind:device mode="edit" />
</div>
{/if}
+40 -34
View File
@@ -1,14 +1,13 @@
<script>
import { onMount } from 'svelte';
import { dev } from '$app/environment';
import { pocketbase } from '@stores/pocketbase';
import { pocketbase, settings, devices } from '@stores/pocketbase';
import DeviceForm from '@components/DeviceForm.svelte';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
let pb;
let version = import.meta.env.UPSNAP_VERSION;
let files;
let settings = {};
let timeout;
let buttons = {
settings: {
@@ -43,22 +42,13 @@
};
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 pb.collection('settings').update(settings.id, settings);
await $pocketbase.collection('settings').update($settings.id, $settings);
clearTimeout(timeout);
timeout = setTimeout(() => {
buttons.settings.state = 'none';
@@ -77,7 +67,7 @@
async function scanDevices() {
buttons.scan.state = 'waiting';
await pb.collection('settings').update(settings.id, settings);
await $pocketbase.collection('settings').update($settings.id, $settings);
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/scan`)
.then((res) => res.json())
@@ -111,7 +101,8 @@
}
async function addDevice(device) {
await pb.collection('devices').create(device);
await $pocketbase.collection('devices').create(device);
$devices[device.id] = device;
}
async function restoreV2Backup() {
@@ -119,14 +110,14 @@
try {
// delete all devices in pocketbase
let result = await pb.collection('devices').getFullList();
let result = await $pocketbase.collection('devices').getFullList();
for (let index = 0; index < result.length; index++) {
pb.collection('devices').delete(result[index].id);
$pocketbase.collection('devices').delete(result[index].id);
}
// delete all ports in pocketbase
result = await pb.collection('ports').getFullList();
result = await $pocketbase.collection('ports').getFullList();
for (let index = 0; index < result.length; index++) {
await pb.collection('ports').delete(result[index].id);
await $pocketbase.collection('ports').delete(result[index].id);
}
let reader = new FileReader();
@@ -146,7 +137,7 @@
let thisDevicePorts = [];
for (let index = 0; index < device.ports.length; index++) {
const port = device.ports[index];
const record = await pb.collection('ports').create({
const record = await $pocketbase.collection('ports').create({
name: port.name,
number: port.number
});
@@ -154,7 +145,7 @@
}
// create device
await pb.collection('devices').create({
await $pocketbase.collection('devices').create({
name: device.name,
ip: device.ip,
mac: device.mac,
@@ -199,7 +190,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>
@@ -212,7 +203,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>
@@ -221,14 +212,18 @@
<p class="m-0">
Leave blank to use default value of <span class="fw-bold"
>"@every 3s"</span
>.
</p>
<p class="m-0">
Read more about valid cron syntax at <a
>. 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"
>pkg.go.dev/github.com/robfig/cron</a
>package documentation</a
>
</p>
</div>
@@ -269,7 +264,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
@@ -278,7 +273,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}
>
@@ -353,7 +348,8 @@
<section class="m-0 my-4 p-4 shadow-sm">
<h3 class="mb-3">Restore</h3>
<p>
If you had UpSnap v2.3.2 (or higher) running before, you can restore your devices here.
If you had UpSnap &gt;=2.3.2 and &lt;3.0.0 running before, you can restore your devices
here.
</p>
<div class="callout callout-danger fw-bold">This will wipe the existing database!</div>
<input
@@ -384,4 +380,14 @@
{/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
@@ -0,0 +1,7 @@
export function sortDevices(a, b) {
return a.name > b.name;
}
export function sortPorts(a, b) {
return a.number - b.number;
}
+10 -4
View File
@@ -1,14 +1,20 @@
import { writable } from 'svelte/store';
import PocketBase from 'pocketbase';
let backend_url;
// set backend url based on environment
let backend_url = '/';
let isDevMode = import.meta.env.DEV;
if (isDevMode) {
backend_url = 'http://localhost:8090';
} else {
backend_url = '/';
backend_url = 'http://127.0.0.1:8090';
}
// get default values for stores
const pb = new PocketBase(backend_url);
pb.autoCancellation(false);
// export stores
export const pocketbase = writable(pb);
export const settings = writable({
website_title: ''
});
export const devices = writable({});