mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-11-27 12:21:56 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14b9e031d5 | |||
| 523b7f9846 | |||
| 5018b01542 | |||
| 40c97359ae | |||
| 6a8bbb4525 | |||
| 66ce01cb40 | |||
| 5435d914b3 | |||
| fc4e34da61 | |||
| 730873a347 | |||
| 9f05b1c134 | |||
| 2c244beaaa | |||
| c5d33fdae8 | |||
| b17b09109f | |||
| 0a798d6e94 |
+2
-2
@@ -24,8 +24,8 @@ RUN addgroup -g 1000 upsnap &&\
|
||||
WORKDIR /app
|
||||
COPY --from=downloader /app/upsnap upsnap
|
||||
LABEL org.opencontainers.image.source="https://github.com/seriousm4x/UpSnap" \
|
||||
org.opencontainers.image.url="https://github.com/seriousm4x/UpSnap" \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
org.opencontainers.image.url="https://github.com/seriousm4x/UpSnap" \
|
||||
org.opencontainers.image.licenses="MIT"
|
||||
HEALTHCHECK --interval=10s \
|
||||
CMD curl -fs "http://${UPSNAP_HTTP_LISTEN}/api/health" || exit 1
|
||||
CMD ["serve","--http","${UPSNAP_HTTP_LISTEN}"]
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM node:alpine AS node
|
||||
FROM node:bookworm AS node
|
||||
WORKDIR /app
|
||||
COPY frontend/ .
|
||||
RUN npm i -g pnpm &&\
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
- 🔌 Ping Any Port You Choose
|
||||
- 🔍 Discover Devices with Network Scanning (nmap required)
|
||||
- 📌 Optional IP Address Tracking per Device via periodic ARP scan (nmap required, no extra privileges beyond network scanning)
|
||||
- 📡 Support using a Fully Qualified Domain Name for a device (refer to the Wiki: [Use FQDN](https://github.com/seriousm4x/UpSnap/wiki/Use-FQDN))
|
||||
- ❎️ Shutdown Devices with a Custom Command
|
||||
- 👤 Secured User Management
|
||||
- 📋 Superuser Logs Page
|
||||
|
||||
@@ -20,6 +20,7 @@ builds:
|
||||
- amd64
|
||||
- arm64
|
||||
- arm
|
||||
- riscv64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package cronjobs
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/seriousm4x/upsnap/iptracking"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
@@ -96,10 +96,19 @@ func SetPingJobs(app core.App) {
|
||||
log.Error("Failed to load device ports", "device", d.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
deviceIP, resolveErr := networking.ResolveToIPAddr(d.GetString("ip"))
|
||||
if resolveErr != nil {
|
||||
log.Error("Failed to resolve device IP", "device", d.GetString("name"), "error", resolveErr)
|
||||
}
|
||||
for _, port := range ports {
|
||||
isUp, err := networking.CheckPort(d.GetString("ip"), port.GetString("number"))
|
||||
if err != nil {
|
||||
log.Error("Failed to check port", "device", d.GetString("name"), "port", port.GetString("number"), "error", err)
|
||||
isUp := false
|
||||
// No IP found means the device is down.
|
||||
if resolveErr == nil && deviceIP != "" {
|
||||
var checkErr error
|
||||
isUp, checkErr = networking.CheckPort(deviceIP, port.GetString("number"))
|
||||
if checkErr != nil {
|
||||
log.Error("Failed to check port", "device", d.GetString("name"), "port", port.GetString("number"), "error", checkErr)
|
||||
}
|
||||
}
|
||||
if isUp != port.GetBool("status") {
|
||||
port.Set("status", isUp)
|
||||
@@ -200,10 +209,9 @@ func SetWakeShutdownJobs(app core.App) {
|
||||
if !isOnline {
|
||||
return
|
||||
}
|
||||
status := d.GetString("status")
|
||||
if status != "online" {
|
||||
return
|
||||
}
|
||||
// The status can be stale when lazy ping marks devices offline after
|
||||
// the last client disconnects. The reachability check above is the
|
||||
// authoritative signal for whether a shutdown command may run.
|
||||
d.Set("status", "pending")
|
||||
if err := app.Save(d); err != nil {
|
||||
log.Error("Failed to save pending device status", "device", d.GetString("name"), "error", err)
|
||||
|
||||
+18
-17
@@ -3,50 +3,51 @@ module github.com/seriousm4x/upsnap
|
||||
go 1.27
|
||||
|
||||
require (
|
||||
ganigeorgiev.com/pocketbase/dbx v1.13.0
|
||||
ganigeorgiev.com/pocketbase/pocketbase v0.41.1
|
||||
github.com/godbus/dbus/v5 v5.2.2
|
||||
github.com/holoplot/go-avahi v1.0.1
|
||||
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a
|
||||
github.com/pocketbase/dbx v1.12.0
|
||||
github.com/pocketbase/pocketbase v0.40.3
|
||||
github.com/prometheus-community/pro-bing v0.9.1
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
golang.org/x/sys v0.48.0
|
||||
golang.org/x/net v0.62.0
|
||||
golang.org/x/sys v0.49.0
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.78
|
||||
)
|
||||
|
||||
require (
|
||||
ganigeorgiev.com/fexpr v0.7.0 // indirect
|
||||
ganigeorgiev.com/pocketbase/ozzo-validation/v4 v4.4.1 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/disintegration/imaging v1.6.2 // indirect
|
||||
github.com/domodwyer/mailyak/v3 v3.6.2 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/dustin/go-humanize v1.1.0 // indirect
|
||||
github.com/fatih/color v1.19.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.10.1 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.15 // indirect
|
||||
github.com/ganigeorgiev/fexpr v0.6.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.9.3 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/josharian/native v1.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.15 // indirect
|
||||
github.com/mattn/go-colorable v0.1.16 // indirect
|
||||
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||
github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 // indirect
|
||||
github.com/mdlayher/packet v1.1.2 // indirect
|
||||
github.com/mdlayher/packet v1.2.0 // indirect
|
||||
github.com/mdlayher/socket v0.7.0 // indirect
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
github.com/pocketbase/ozzo-validation/v4 v4.3.0 // indirect
|
||||
github.com/ncruces/go-strftime v1.1.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/cobra v1.10.2 // indirect
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/stretchr/testify v1.11.1 // indirect
|
||||
golang.org/x/crypto v0.57.0 // indirect
|
||||
golang.org/x/image v0.46.0 // indirect
|
||||
golang.org/x/net v0.59.0 // indirect
|
||||
golang.org/x/crypto v0.58.0 // indirect
|
||||
golang.org/x/image v0.47.0 // indirect
|
||||
golang.org/x/oauth2 v0.37.0 // indirect
|
||||
golang.org/x/sync v0.23.0 // indirect
|
||||
golang.org/x/text v0.42.0 // indirect
|
||||
golang.org/x/sync v0.24.0 // indirect
|
||||
golang.org/x/text v0.43.0 // indirect
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.78 // indirect
|
||||
modernc.org/libc v1.74.4 // indirect
|
||||
modernc.org/libc v1.77.1 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.12.1 // indirect
|
||||
modernc.org/sqlite v1.57.0 // indirect
|
||||
modernc.org/sqlite v1.60.1 // indirect
|
||||
)
|
||||
|
||||
+49
-46
@@ -1,5 +1,13 @@
|
||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||
ganigeorgiev.com/fexpr v0.7.0 h1:Os5bP9dU13UNo5qDTsTPTTkodLM96kO52WIEmMmCt30=
|
||||
ganigeorgiev.com/fexpr v0.7.0/go.mod h1:XrG5iYw+AGq55zq2+QY1zQvO+ovbEca08u7q0hucPdY=
|
||||
ganigeorgiev.com/pocketbase/dbx v1.13.0 h1:t8S5CaMv93tEOqaOToFaVQ994zldshdhIrVHKmxRjwc=
|
||||
ganigeorgiev.com/pocketbase/dbx v1.13.0/go.mod h1:QefEiWbbE/YoSipLGg33FbNc/GAX/2f3ymz02j2MGKo=
|
||||
ganigeorgiev.com/pocketbase/ozzo-validation/v4 v4.4.1 h1:teL3Lw7HCGZRdIQdqE/gV5DueFaN5Wj+/r4Ewg3M2WA=
|
||||
ganigeorgiev.com/pocketbase/ozzo-validation/v4 v4.4.1/go.mod h1:oV1SPPkS3PlKYYj+r9YDs48ooAWgC736cuFanXDXxbM=
|
||||
ganigeorgiev.com/pocketbase/pocketbase v0.41.1 h1:qIDj5ZE8ysev7LJNcLR4eeYICme5hDF/Ry3bQ9nOcTA=
|
||||
ganigeorgiev.com/pocketbase/pocketbase v0.41.1/go.mod h1:PBkQKVnCfL7Hi9MnXY9bJDME/sfEEbZ6VwAb+8xXQXE=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
@@ -11,8 +19,8 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
|
||||
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
||||
github.com/domodwyer/mailyak/v3 v3.6.2 h1:x3tGMsyFhTCaxp6ycgR0FE/bu5QiNp+hetUuCOBXMn8=
|
||||
github.com/domodwyer/mailyak/v3 v3.6.2/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c=
|
||||
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/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
|
||||
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
|
||||
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
|
||||
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
@@ -21,11 +29,12 @@ github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx5
|
||||
github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
|
||||
github.com/gabriel-vasile/mimetype v1.4.15 h1:05iP/CYtZ/w455R/KZM6rZ5ieAdh99UPtd+d3YzLmaI=
|
||||
github.com/gabriel-vasile/mimetype v1.4.15/go.mod h1:azpTcoLcDZRNgFou5j+APrqQx9HqVPWa6ijYQIIVswQ=
|
||||
github.com/ganigeorgiev/fexpr v0.6.0 h1:Fza3O/QMBKEudUvxV862qe6GjxM60GJjjKytdp+VQus=
|
||||
github.com/ganigeorgiev/fexpr v0.6.0/go.mod h1:RyGiGqmeXhEQ6+mlGdnUleLHgtzzu/VGO2WtJkF5drE=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
|
||||
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
|
||||
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
@@ -34,47 +43,41 @@ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/pprof v0.0.0-20260902005441-ca85771921e4 h1:/6mPXfWmhv8eKck12I0YNIcIjwHtxP3YRIMKiEgTjWg=
|
||||
github.com/google/pprof v0.0.0-20260902005441-ca85771921e4/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
|
||||
github.com/google/pprof v0.0.0-20261016150608-1facf8f91b50 h1:PlNWJRxu5APSV0pWqfIsZ0qt9OOGHSWfZQ4zvx+WgWs=
|
||||
github.com/google/pprof v0.0.0-20261016150608-1facf8f91b50/go.mod h1:yUo1AMMpsPIDFGuwDK8nLcf8+vvAd5l2O6JDZ6hpwrM=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||
github.com/holoplot/go-avahi v1.0.1 h1:XcqR2keL4qWRnlxHD5CAOdWpLFZJ+EOUK0vEuylfvvk=
|
||||
github.com/holoplot/go-avahi v1.0.1/go.mod h1:qH5psEKb0DK+BRplMfc+RY4VMOlbf6mqfxgpMy6aP0M=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
|
||||
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A=
|
||||
github.com/mattn/go-colorable v0.1.16/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
|
||||
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
|
||||
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/go.mod h1:eE7/ctqDhoiRhQ44ko5JZU2zxB88g+JH/6jmnjzPjOU=
|
||||
github.com/mdlayher/packet v1.1.2 h1:3Up1NG6LZrsgDVn6X4L9Ge/iyRyxFEFD9o6Pr3Q1nQY=
|
||||
github.com/mdlayher/packet v1.1.2/go.mod h1:GEu1+n9sG5VtiRE4SydOmX5GTwyyYlteZiFU+x0kew4=
|
||||
github.com/mdlayher/packet v1.2.0 h1:SX7/oY0+nkKo7p4Sv30+TIc3YuWgvDEf0eucTXRyPqk=
|
||||
github.com/mdlayher/packet v1.2.0/go.mod h1:UtYVnQt+Zj6UD0F89HfzkqGXaYqys1NwkrS86wlLCv4=
|
||||
github.com/mdlayher/raw v0.0.0-20190313224157-43dbcdd7739d/go.mod h1:r1fbeITl2xL/zLbVnNHFyOzQJTgr/3fpf1lJX/cjzR8=
|
||||
github.com/mdlayher/socket v0.2.1/go.mod h1:QLlNPkFR88mRUNQIzRBMfXxwKal8H7u1h3bL1CV+f0E=
|
||||
github.com/mdlayher/socket v0.7.0 h1:qVREPVwtUMg17pwvveQxpurq0PVisMxi3FGgpsorMYQ=
|
||||
github.com/mdlayher/socket v0.7.0/go.mod h1:f7iKql2EK/rfsWYDKofKjk2Ig7I+6HQWdMIdn1tO4A4=
|
||||
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/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
||||
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
|
||||
github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g=
|
||||
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.12.0 h1:/oLErM+A0b4xI0PWTGPqSDVjzix48PqI/bng2l0PzoA=
|
||||
github.com/pocketbase/dbx v1.12.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/ozzo-validation/v4 v4.3.0 h1:uKBDVma7bZqgR2a6AwE+k9hkuDFfiZMpBHQdZ1z3iQs=
|
||||
github.com/pocketbase/ozzo-validation/v4 v4.3.0/go.mod h1:6XNjSTw/Jb2F8LOkKO3oyzIWExbrGiYoS4uVxVwz90g=
|
||||
github.com/pocketbase/pocketbase v0.40.3 h1:iLq2DPQjcBRDJ2sjM5ssc7eLV7LmPtCKx4Xs8Rkgud8=
|
||||
github.com/pocketbase/pocketbase v0.40.3/go.mod h1:T5rHKBqPqzEOesla8gqBnwqnceXfeHVuGt/MekG00TU=
|
||||
github.com/prometheus-community/pro-bing v0.9.1 h1:kpuAr6AU2oRtzGihJSUcetHtjc7ku7h6PxeuW9RVrQw=
|
||||
github.com/prometheus-community/pro-bing v0.9.1/go.mod h1:z79wYTxAOf6FpTng0QdIhZ3j/Nd5l3+gnFSCIT+SiSQ=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
@@ -97,36 +100,36 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
|
||||
golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
|
||||
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
|
||||
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.46.0 h1:b1+oYj0Jbp6K5MDT4i4/eZpYlk3V8SJhhDKh6LBHAyQ=
|
||||
golang.org/x/image v0.46.0/go.mod h1:3B3W05VGVQyuXucLINLjXKrqISASfi4Xj+iCVkLMwew=
|
||||
golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
|
||||
golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
|
||||
golang.org/x/image v0.47.0 h1:za/8gVz++PPZqmZJBNSISICN5Rrj5zixP/8K++fgmqo=
|
||||
golang.org/x/image v0.47.0/go.mod h1:IkN5o4A7vq55vXN8FWjjnhg9Rs2GOtffqsSi9mWAKYE=
|
||||
golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg=
|
||||
golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs=
|
||||
golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues=
|
||||
golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
|
||||
golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
|
||||
golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
|
||||
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
|
||||
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
|
||||
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
|
||||
golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
|
||||
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
|
||||
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
|
||||
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
|
||||
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
|
||||
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI=
|
||||
golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo=
|
||||
golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs=
|
||||
golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@@ -137,20 +140,20 @@ kernel.org/pub/linux/libs/security/libcap/cap v1.2.78 h1:jgqg4gyu2BaYW9L6uzEtGLf
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.78/go.mod h1:VjuVda6m2qGkpCVfrFkpTGyvkdlZ2N5/yfo89tujlg8=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.78 h1:PC3yNs51cX5LZ7U57a7xielBcoXB3xnV+rXD8V0H0DQ=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.78/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24=
|
||||
modernc.org/cc/v4 v4.29.1 h1:MKgdCV3WykTSPqpVrnxdEDS0HEd2FHpKZDzxzU5LyeI=
|
||||
modernc.org/cc/v4 v4.29.1/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
||||
modernc.org/ccgo/v4 v4.34.6 h1:sBgfIwyN0TQ9C5hwIeuqyeAKyMWnbvj2fvpF4L11uzU=
|
||||
modernc.org/ccgo/v4 v4.34.6/go.mod h1:SZ8YcN9NG7XVsQYdm6jYBvi8PQP1qi+kqB6OhjqI3Fk=
|
||||
modernc.org/cc/v4 v4.29.7 h1:q+NXGJ0bK3b4TXFYQQVr9pYETGnmwFWkrUzJnMya/Tg=
|
||||
modernc.org/cc/v4 v4.29.7/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
||||
modernc.org/ccgo/v4 v4.36.1 h1:ZNIUZAryN0UgnJwtyxrdEzcFc3yD4Cu4AzjfPXsLsIE=
|
||||
modernc.org/ccgo/v4 v4.36.1/go.mod h1:rrtGc2QkS239nYb/mQNuBMyjq3/y3ZXWbBjPoV3wqzA=
|
||||
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
|
||||
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
|
||||
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||
modernc.org/gc/v3 v3.1.4 h1:2g65LGVSmFQrXeITAw97x7hCRvZFcyE1uDP+7Vng7JI=
|
||||
modernc.org/gc/v3 v3.1.4/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
||||
modernc.org/gc/v3 v3.1.5 h1:21ldfPfRYE31Tb7B3mwAK8gy1AxP4+dKjrOQPfqakoc=
|
||||
modernc.org/gc/v3 v3.1.5/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
||||
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
||||
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
||||
modernc.org/libc v1.74.4 h1:fX1Omw4o2/1C2iRkkIsrQTasJQldLhRmuPreXLoWs9k=
|
||||
modernc.org/libc v1.74.4/go.mod h1:eeQAS9W3sZeKYMFubydxJpII9ybHWshk+7or7bLG9co=
|
||||
modernc.org/libc v1.77.1 h1:Ct8j47QtiZ1Enj2DtFXQtUqrPCAjdCmPjtCuvrYQ0Hs=
|
||||
modernc.org/libc v1.77.1/go.mod h1:87/pZ4L6nD1zqW4nItuS12YO7hN1igAah34xjnQo/W0=
|
||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
|
||||
@@ -159,8 +162,8 @@ modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
|
||||
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
||||
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
||||
modernc.org/sqlite v1.57.0 h1:qNQP6xnx5M0ISNtlnxoOX0+cD5bJ0/gr9aMmndFczzg=
|
||||
modernc.org/sqlite v1.57.0/go.mod h1:yCJ2cmAaIkHQ25oXWrF8H4O1lIfPYPR26yCEDj2P3pQ=
|
||||
modernc.org/sqlite v1.60.1 h1:/blz53O951KWFOso4QQvEs/Fq6cDBKLtMVrYNSeJVKw=
|
||||
modernc.org/sqlite v1.60.1/go.mod h1:1dIoEagfDE72QytD5scH1lxARtaUgKgHC/NuApA27r0=
|
||||
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
||||
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/tests"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
|
||||
// register the app migrations so test apps get the real schema
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
var consoleHandler slog.Handler
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"embed"
|
||||
"log"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"github.com/seriousm4x/upsnap/pb"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -3,8 +3,8 @@ package migrations
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
m "ganigeorgiev.com/pocketbase/pocketbase/migrations"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(2, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "1si6ajha",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "ip",
|
||||
"pattern": "^(?:(?:[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,61}[\\p{L}\\p{N}])?\\.)+[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,61}[\\p{L}\\p{N}])?|(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(4, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "s8c5z7n0",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "netmask",
|
||||
"pattern": "^(?:255\\.255\\.255\\.(?:255|254|252|248|240|224|192|128|0)|255\\.255\\.(?:255|254|252|248|240|224|192|128|0)\\.0|255\\.(?:255|254|252|248|240|224|192|128|0)\\.0\\.0|(?:255|254|252|248|240|224|192|128|0)\\.0\\.0\\.0)$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(2, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "1si6ajha",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "ip",
|
||||
"pattern": "^(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(4, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "s8c5z7n0",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "netmask",
|
||||
"pattern": "^(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -5,12 +5,15 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/mdlayher/wol"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
func SendMagicPacket(device *core.Record) error {
|
||||
ip := device.GetString("ip")
|
||||
ip, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mac := device.GetString("mac")
|
||||
netmask := device.GetString("netmask")
|
||||
password := device.GetString("password")
|
||||
@@ -20,24 +23,45 @@ func SendMagicPacket(device *core.Record) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !ValidateSubnetMask(netmask) {
|
||||
return fmt.Errorf("%q is not a valid subnet mask", netmask)
|
||||
}
|
||||
|
||||
// calculate broadcast IP, if possible
|
||||
var broadcastIp string
|
||||
// an IP was provided or FQDN resolved to an IP so calculate broadcast destination based on that
|
||||
if ip != "" {
|
||||
broadcastIp, err = getBroadcastIp(ip, netmask)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// No IP available, so no broadcast IP can be calculated. This occurs if FQDN is .local and the device is powered off
|
||||
broadcastIp = ""
|
||||
}
|
||||
|
||||
var bytePassword []byte
|
||||
if len(password) == 0 || len(password) == 4 || len(password) == 6 {
|
||||
bytePassword = []byte(password)
|
||||
} else {
|
||||
return fmt.Errorf("error: password must be 0, 4 or 6 characters long")
|
||||
return errors.New("error: password must be 0, 4 or 6 characters long")
|
||||
}
|
||||
|
||||
// get target addr
|
||||
broadcastIp, err := getBroadcastIp(ip, netmask)
|
||||
if err != nil {
|
||||
return err
|
||||
// an IP was provided or FQDN resolved to an IP so calculate broadcast destination based on that
|
||||
if ip != "" {
|
||||
broadcastIp, err = getBroadcastIp(ip, netmask)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// No IP available, so no broadcast IP can be calculated. This occurs if FQDN is .local and the device is powered off
|
||||
broadcastIp = ""
|
||||
}
|
||||
|
||||
// send wake via udp port 9
|
||||
// send wake
|
||||
if err := wakeUDP(broadcastIp, ip, parsedMac, bytePassword); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -48,46 +72,48 @@ func wakeUDP(broadcastIp string, deviceIp string, target net.HardwareAddr, passw
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
// send 6 magic packets to different addresses to enhance chance of waking up
|
||||
destinations := []string{
|
||||
// default user-calculated broadcast to port 9
|
||||
fmt.Sprintf("%s:9", broadcastIp),
|
||||
// user-calculated broadcast to port alternative port 7
|
||||
fmt.Sprintf("%s:7", broadcastIp),
|
||||
// broadcast to port 9
|
||||
"255.255.255.255:9",
|
||||
// broadcast to alternative port 7
|
||||
"255.255.255.255:7",
|
||||
// send direct to device via port 9 (for routed network WOL)
|
||||
fmt.Sprintf("%s:9", deviceIp),
|
||||
// send direct to device via alternative port 7 (for routed network WOL)
|
||||
fmt.Sprintf("%s:7", deviceIp),
|
||||
var destinations []string
|
||||
|
||||
// Broadcast IP available, add to destinations
|
||||
if broadcastIp != "" {
|
||||
// user-calculated broadcast packet to port 9 and alternative port 7
|
||||
destinations = append(destinations,
|
||||
fmt.Sprintf("%s:9", broadcastIp),
|
||||
fmt.Sprintf("%s:7", broadcastIp),
|
||||
)
|
||||
}
|
||||
|
||||
if deviceIp != "" {
|
||||
// For routed network WOL, send a unicast packet to device IP on port 9 and alternative port 7
|
||||
destinations = append(destinations,
|
||||
fmt.Sprintf("%s:9", deviceIp),
|
||||
fmt.Sprintf("%s:7", deviceIp),
|
||||
)
|
||||
}
|
||||
|
||||
// No IP for the device is available, broadcast WOL packet to all interfaces
|
||||
if deviceIp == "" {
|
||||
allBroadcastDests, err := getAllBroadcastDests()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
destinations = append(destinations, allBroadcastDests...)
|
||||
}
|
||||
for _, dest := range destinations {
|
||||
if err := c.WakePassword(dest, target, password); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getBroadcastIp(ipStr, maskStr string) (string, error) {
|
||||
ip := net.ParseIP(ipStr)
|
||||
if ip == nil {
|
||||
return "", errors.New("ip not a valid ipv4 address")
|
||||
}
|
||||
ip = ip.To4()
|
||||
ip := net.ParseIP(ipStr).To4()
|
||||
if ip == nil {
|
||||
return "", errors.New("ip not a valid ipv4 address")
|
||||
}
|
||||
|
||||
mask := net.ParseIP(maskStr)
|
||||
if mask == nil {
|
||||
return "", errors.New("subnet mask not a valid ipv4 address")
|
||||
}
|
||||
mask = mask.To4()
|
||||
mask := net.ParseIP(maskStr).To4()
|
||||
if mask == nil {
|
||||
return "", errors.New("subnet mask not a valid ipv4 address")
|
||||
}
|
||||
@@ -99,3 +125,42 @@ func getBroadcastIp(ipStr, maskStr string) (string, error) {
|
||||
|
||||
return broadcast.String(), nil
|
||||
}
|
||||
|
||||
// Returns a slice of all broadcast addresses for ports 9 and 7 using local interfaces
|
||||
func getAllBroadcastDests() ([]string, error) {
|
||||
var allIps []string
|
||||
interfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Iterate through all the interfaces
|
||||
for _, iface := range interfaces {
|
||||
isRunning := iface.Flags&net.FlagRunning != 0
|
||||
isLoopback := iface.Flags&net.FlagLoopback != 0
|
||||
isNotBroadcast := iface.Flags&net.FlagBroadcast == 0
|
||||
// exclude interfaces that are not running, are loopback, or can't broadcast
|
||||
if !isRunning || isLoopback || isNotBroadcast {
|
||||
continue
|
||||
}
|
||||
addrs, err := iface.Addrs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Iterate through each interface's address
|
||||
for _, addr := range addrs {
|
||||
if ipNet, ok := addr.(*net.IPNet); ok {
|
||||
ip := ipNet.IP
|
||||
// Only use IPv4
|
||||
if ip.To4() != nil {
|
||||
bcastip, err := getBroadcastIp(ip.String(), net.IP(ipNet.Mask).String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
allIps = append(allIps, fmt.Sprintf("%s:9", bcastip), fmt.Sprintf("%s:7", bcastip))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return allIps, nil
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
type Device struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package networking
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
func TestPingDevice(t *testing.T) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
probing "github.com/prometheus-community/pro-bing"
|
||||
"kernel.org/pub/linux/libs/security/libcap/cap"
|
||||
)
|
||||
@@ -17,7 +17,14 @@ import (
|
||||
func PingDevice(device *core.Record) (bool, error) {
|
||||
ping_cmd := device.GetString("ping_cmd")
|
||||
if ping_cmd == "" {
|
||||
pinger, err := probing.NewPinger(device.GetString("ip"))
|
||||
ip, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if ip == "" {
|
||||
return false, nil
|
||||
}
|
||||
pinger, err := probing.NewPinger(ip)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -9,14 +9,18 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
probing "github.com/prometheus-community/pro-bing"
|
||||
)
|
||||
|
||||
func PingDevice(device *core.Record) (bool, error) {
|
||||
ping_cmd := device.GetString("ping_cmd")
|
||||
if ping_cmd == "" {
|
||||
pinger, err := probing.NewPinger(device.GetString("ip"))
|
||||
ip, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil || ip == "" {
|
||||
return false, err
|
||||
}
|
||||
pinger, err := probing.NewPinger(ip)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//go:build windows || darwin
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
/*
|
||||
Takes one parameter 'host' and returns its IP. If 'host' is already formatted
|
||||
as an IP, simply return it. If 'host' is formatted as an FQDN, attempt to
|
||||
resolve it with mDNS (if .local suffix) or else use a DNS lookup with
|
||||
net.DefaultResolver
|
||||
|
||||
Windows and MacOS can resolve mDNS/DNS with one call to net.DefaultResolver
|
||||
*/
|
||||
func ResolveToIPAddr(host string) (string, error) {
|
||||
// If host is already an IP, simply return it
|
||||
addr, err := netip.ParseAddr(host)
|
||||
if err == nil && addr.Is4() {
|
||||
return host, nil
|
||||
}
|
||||
if err := ValidateFQDN(host); err != nil {
|
||||
return "", fmt.Errorf("%q is the host", host)
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
ips, err := net.DefaultResolver.LookupNetIP(ctx, "ip4", host)
|
||||
if err != nil {
|
||||
if strings.HasSuffix(strings.ToLower(host), ".local") {
|
||||
var dnsErr *net.DNSError
|
||||
isNotFound := errors.As(err, &dnsErr) && dnsErr.IsNotFound
|
||||
isTimeout := errors.Is(err, context.DeadlineExceeded) || ctx.Err() == context.DeadlineExceeded
|
||||
if isTimeout || isNotFound {
|
||||
return "", nil
|
||||
}
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
if len(ips) > 0 {
|
||||
// only return one result
|
||||
return ips[0].String(), nil
|
||||
}
|
||||
// No results, but it's expected for a .local FQDN device that is offline. Don't return an error.
|
||||
if strings.HasSuffix(strings.ToLower(host), ".local") {
|
||||
return "", nil
|
||||
} else {
|
||||
// No results, but FQDN should have resolved since it's not .local. Return an error.
|
||||
return "", fmt.Errorf("No IP address found for %s", host)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
//go:build linux || freebsd
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/godbus/dbus/v5"
|
||||
"github.com/holoplot/go-avahi"
|
||||
)
|
||||
|
||||
var (
|
||||
avahiServer *avahi.Server
|
||||
avahiErr error
|
||||
avahiOnce sync.Once
|
||||
)
|
||||
|
||||
// getAvahiServer initializes and returns a shared, long-lived Avahi client.
|
||||
// It handles high throughput gracefully by using a single D-Bus socket connection.
|
||||
func getAvahiServer() (*avahi.Server, error) {
|
||||
avahiOnce.Do(func() {
|
||||
// Using the cached system bus here is safe because we never call server.Close() on it.
|
||||
conn, err := dbus.SystemBus()
|
||||
if err != nil {
|
||||
avahiErr = fmt.Errorf("failed to connect to dbus: %w", err)
|
||||
return
|
||||
}
|
||||
server, err := avahi.ServerNew(conn)
|
||||
if err != nil {
|
||||
avahiErr = fmt.Errorf("failed to create avahi server: %w", err)
|
||||
return
|
||||
}
|
||||
avahiServer = server
|
||||
})
|
||||
return avahiServer, avahiErr
|
||||
}
|
||||
|
||||
/*
|
||||
Takes one parameter 'host' and returns its IP. If 'host' is already formatted
|
||||
as an IP, simply return it. If 'host' is formatted as an FQDN, attempt to
|
||||
resolve it with mDNS (if .local suffix) or else use a DNS lookup with
|
||||
net.DefaultResolver
|
||||
|
||||
Linux and FreeBSD require dbus and avahi for mDNS lookups
|
||||
*/
|
||||
func ResolveToIPAddr(host string) (string, error) {
|
||||
// If host is already an IP, simply return it
|
||||
addr, err := netip.ParseAddr(host)
|
||||
if err == nil && addr.Is4() {
|
||||
return host, nil
|
||||
}
|
||||
if err := ValidateFQDN(host); err != nil {
|
||||
return "", err
|
||||
}
|
||||
// attempt mDNS query first
|
||||
if strings.HasSuffix(strings.ToLower(host), ".local") {
|
||||
// conn, err := dbus.Dial("unix:path=/var/run/dbus/system_bus_socket")
|
||||
server, err := getAvahiServer()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Failed to create connection: %w", err)
|
||||
}
|
||||
// defer conn.Close()
|
||||
|
||||
// server, err := avahi.ServerNew(conn)
|
||||
// if err != nil {
|
||||
// return "", fmt.Errorf("Failed to create avahi server: %w", err)
|
||||
// }
|
||||
// defer server.Close()
|
||||
|
||||
// set a context with 2 secs and only wait that long for an mDNS response. otherwise, avahi takes 5 secs
|
||||
ctx1, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
type result struct {
|
||||
address string
|
||||
err error
|
||||
}
|
||||
ch := make(chan result, 1)
|
||||
|
||||
go func() {
|
||||
resolved, err := server.ResolveHostName(
|
||||
avahi.InterfaceUnspec,
|
||||
avahi.ProtoInet,
|
||||
host,
|
||||
avahi.ProtoInet,
|
||||
0,
|
||||
)
|
||||
if err != nil {
|
||||
ch <- result{"", err}
|
||||
return
|
||||
}
|
||||
// mDNS result received
|
||||
ch <- result{resolved.Address, nil}
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-ctx1.Done():
|
||||
// 2 second timeout reached,
|
||||
return "", nil
|
||||
|
||||
case res := <-ch:
|
||||
if res.err != nil {
|
||||
var dbusErr *dbus.Error
|
||||
// in theory we shouldn't encounter this error since the 2 second context always beats the race
|
||||
if errors.As(res.err, &dbusErr) && dbusErr.Name == "org.freedesktop.Avahi.TimeoutError" {
|
||||
return "", nil
|
||||
}
|
||||
return "", fmt.Errorf("%s: %w", host, res.err)
|
||||
}
|
||||
return res.address, nil
|
||||
}
|
||||
}
|
||||
// Not .local, attempt unicast (regular) DNS lookup
|
||||
ctx2, cancel2 := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel2()
|
||||
ips, err := net.DefaultResolver.LookupNetIP(ctx2, "ip4", host)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(ips) > 0 {
|
||||
// only return one result
|
||||
return ips[0].String(), nil
|
||||
}
|
||||
// No results, but FQDN should have resolved since it's not .local. Return an error.
|
||||
return "", err
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ func ShutdownDevice(app core.App, device *core.Record, trigger string) error {
|
||||
log.Info("Shutdown triggered", "device", device.GetString("name"), "trigger", trigger)
|
||||
shutdown_cmd := device.GetString("shutdown_cmd")
|
||||
if shutdown_cmd == "" {
|
||||
return fmt.Errorf("%s: no shutdown_cmd definded", device.GetString("name"))
|
||||
return fmt.Errorf("%s: no shutdown_cmd defined", device.GetString("name"))
|
||||
}
|
||||
|
||||
var shell string
|
||||
@@ -32,18 +32,19 @@ func ShutdownDevice(app core.App, device *core.Record, trigger string) error {
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
// Validate IP and MAC addresses before replacing placeholders to prevent command injection
|
||||
deviceIP := device.GetString("ip")
|
||||
if net.ParseIP(deviceIP) == nil {
|
||||
return fmt.Errorf("invalid device IP address: %q", deviceIP)
|
||||
// Validate IP or resolve FQDN to IP
|
||||
deviceIP, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil || deviceIP == "" {
|
||||
return fmt.Errorf("Unable to resolve %s to an IP address", device.GetString("ip"))
|
||||
}
|
||||
// Validate MAC address before replacing placeholder to prevent command injection
|
||||
deviceMAC := device.GetString("mac")
|
||||
if _, err := net.ParseMAC(deviceMAC); err != nil {
|
||||
return fmt.Errorf("invalid device MAC address: %q", deviceMAC)
|
||||
}
|
||||
|
||||
shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_IP }}", device.GetString("ip"))
|
||||
shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_MAC }}", device.GetString("mac"))
|
||||
shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_IP }}", deviceIP)
|
||||
shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_MAC }}", deviceMAC)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
@@ -21,11 +21,15 @@ func SleepDevice(app core.App, device *core.Record) (SolResponse, error) {
|
||||
var solResp SolResponse
|
||||
var url string
|
||||
|
||||
deviceIP, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil || deviceIP == "" {
|
||||
return solResp, fmt.Errorf("Unable to resolve %s to an IP address: %w", device.GetString("ip"), err)
|
||||
}
|
||||
if device.GetBool("sol_auth") {
|
||||
url = fmt.Sprintf("http://%s:%s@%s:%d/sleep?format=JSON",
|
||||
device.GetString("sol_user"), device.GetString("sol_password"), device.GetString("ip"), device.GetInt("sol_port"))
|
||||
device.GetString("sol_user"), device.GetString("sol_password"), deviceIP, device.GetInt("sol_port"))
|
||||
} else {
|
||||
url = fmt.Sprintf("http://%s:%d/sleep?format=JSON", device.GetString("ip"), device.GetInt("sol_port"))
|
||||
url = fmt.Sprintf("http://%s:%d/sleep?format=JSON", deviceIP, device.GetInt("sol_port"))
|
||||
}
|
||||
|
||||
resp, err := http.Get(url)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/net/idna"
|
||||
)
|
||||
|
||||
var fqdnRegex = regexp.MustCompile(`^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9-]{2,63}$`)
|
||||
|
||||
/*
|
||||
Validate's FQDN by converting it to Punycode and checking it against several criteria
|
||||
*/
|
||||
func ValidateFQDN(host string) error {
|
||||
// Remove trailing . just in case, but DB and form validation should already prevent that
|
||||
trimmedHost := strings.TrimSuffix(host, ".")
|
||||
if len(trimmedHost) == 0 {
|
||||
return fmt.Errorf("%q: invalid length of 0. original %q", trimmedHost, host)
|
||||
}
|
||||
|
||||
// convert to punycode
|
||||
punycodeHost, err := idna.Lookup.ToASCII(trimmedHost)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%q: failed to convert to punycode - %w", trimmedHost, err)
|
||||
}
|
||||
|
||||
if len(punycodeHost) < 1 || len(punycodeHost) > 253 {
|
||||
return fmt.Errorf("%q -> %q: invalid length %d bytes. Must be 1-253 bytes (chars) after conversion.", trimmedHost, punycodeHost, len(punycodeHost))
|
||||
}
|
||||
|
||||
if !fqdnRegex.MatchString(punycodeHost) {
|
||||
return fmt.Errorf("%q -> %q: Failed validation.", trimmedHost, punycodeHost)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ValidateSubnetMask(mask string) bool {
|
||||
addr, err := netip.ParseAddr(mask)
|
||||
if err != nil || !addr.Is4() {
|
||||
return false
|
||||
}
|
||||
|
||||
byteArray := addr.As4()
|
||||
maskInt := uint32(byteArray[0])<<24 | uint32(byteArray[1])<<16 | uint32(byteArray[2])<<8 | uint32(byteArray[3])
|
||||
inverted := ^maskInt
|
||||
return (inverted & (inverted + 1)) == 0
|
||||
}
|
||||
+17
-11
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
@@ -35,11 +35,14 @@ func WakeDevice(app core.App, device *core.Record, trigger string) error {
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
// Validate IP and MAC addresses before replacing placeholders to prevent command injection
|
||||
deviceIP := device.GetString("ip")
|
||||
if net.ParseIP(deviceIP) == nil {
|
||||
return fmt.Errorf("invalid device IP address: %q", deviceIP)
|
||||
deviceIP, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if deviceIP == "" {
|
||||
deviceIP = device.GetString("ip")
|
||||
}
|
||||
// Validate MAC address before replacing placeholders to prevent command injection
|
||||
deviceMAC := device.GetString("mac")
|
||||
if _, err := net.ParseMAC(deviceMAC); err != nil {
|
||||
return fmt.Errorf("invalid device MAC address: %q", deviceMAC)
|
||||
@@ -68,29 +71,30 @@ func WakeDevice(app core.App, device *core.Record, trigger string) error {
|
||||
}()
|
||||
|
||||
start := time.Now()
|
||||
commandFinished := false
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(1 * time.Second):
|
||||
if time.Since(start) >= time.Duration(wakeTimeout)*time.Second {
|
||||
if cmd.Process != nil {
|
||||
if !commandFinished && cmd.Process != nil {
|
||||
if err := KillProcess(app, cmd.Process); err != nil {
|
||||
log.Error("Failed to kill wake command", "error", err)
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%s not online after %d seconds", device.GetString("name"), wakeTimeout)
|
||||
}
|
||||
// Reachability alone does not mean a custom wake command has finished.
|
||||
// For example, a Mac can respond to ping while it is still in DarkWake.
|
||||
if !commandFinished {
|
||||
continue
|
||||
}
|
||||
isOnline, err := PingDevice(device)
|
||||
if err != nil {
|
||||
log.Error("Failed to ping device after wake", "error", err)
|
||||
return err
|
||||
}
|
||||
if isOnline {
|
||||
if cmd.Process != nil {
|
||||
if err := KillProcess(app, cmd.Process); err != nil {
|
||||
// Process might have already finished
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
case err := <-done:
|
||||
@@ -102,6 +106,8 @@ func WakeDevice(app core.App, device *core.Record, trigger string) error {
|
||||
}
|
||||
return fmt.Errorf("%s", stderr.String())
|
||||
}
|
||||
commandFinished = true
|
||||
done = nil
|
||||
// Command finished successfully, but we continue the loop until device is online or timeout
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//go:build !windows
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func newWakeTestDevice(t *testing.T, command, pingCommand string, timeout int) (core.App, *core.Record) {
|
||||
t.Helper()
|
||||
app, err := tests.NewTestApp(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(app.Cleanup)
|
||||
device := core.NewRecord(&core.Collection{})
|
||||
device.Set("name", "test-device")
|
||||
device.Set("ip", "127.0.0.1")
|
||||
device.Set("mac", "02:00:00:00:00:01")
|
||||
device.Set("wake_cmd", command)
|
||||
device.Set("ping_cmd", pingCommand)
|
||||
device.Set("wake_timeout", timeout)
|
||||
return app, device
|
||||
}
|
||||
|
||||
func TestCustomWakeWaitsForCommandWhenDeviceIsAlreadyOnline(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
t.Setenv("UPSNAP_WAKE_TEST_DIR", dir)
|
||||
app, device := newWakeTestDevice(t,
|
||||
`sleep 2; printf done > "$UPSNAP_WAKE_TEST_DIR/completed"`, "exit 0", 10)
|
||||
|
||||
if err := WakeDevice(app, device, "test"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := os.ReadFile(filepath.Join(dir, "completed"))
|
||||
if err != nil || string(data) != "done" {
|
||||
t.Fatalf("wake command was interrupted despite successful ping: data=%q err=%v", data, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomWakeReturnsFailureWhenDeviceIsAlreadyOnline(t *testing.T) {
|
||||
app, device := newWakeTestDevice(t, "sleep 2; echo wake-failed >&2; exit 7", "exit 0", 10)
|
||||
err := WakeDevice(app, device, "test")
|
||||
if err == nil || !strings.Contains(err.Error(), "wake-failed") {
|
||||
t.Fatalf("expected wake command failure despite successful ping, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomWakeStillWaitsForReachabilityAfterCommandFinishes(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
t.Setenv("UPSNAP_WAKE_TEST_DIR", dir)
|
||||
app, device := newWakeTestDevice(t, "exit 0",
|
||||
`if [ -f "$UPSNAP_WAKE_TEST_DIR/pinged" ]; then exit 0; fi; touch "$UPSNAP_WAKE_TEST_DIR/pinged"; exit 1`, 10)
|
||||
|
||||
if err := WakeDevice(app, device, "test"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(dir, "pinged")); err != nil {
|
||||
t.Fatalf("wake returned without checking reachability: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomWakeTimesOutWhenCommandSucceedsButDeviceStaysOffline(t *testing.T) {
|
||||
app, device := newWakeTestDevice(t, "exit 0", "exit 1", 2)
|
||||
err := WakeDevice(app, device, "test")
|
||||
if err == nil || !strings.Contains(err.Error(), "not online after 2 seconds") {
|
||||
t.Fatalf("expected reachability timeout, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCustomWakeTimeoutStillStopsRunningCommand(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
t.Setenv("UPSNAP_WAKE_TEST_DIR", dir)
|
||||
app, device := newWakeTestDevice(t,
|
||||
`sleep 3; touch "$UPSNAP_WAKE_TEST_DIR/completed"`, "exit 0", 1)
|
||||
err := WakeDevice(app, device, "test")
|
||||
if err == nil || !strings.Contains(err.Error(), "not online after 1 seconds") {
|
||||
t.Fatalf("expected command timeout even though ping succeeds, got %v", err)
|
||||
}
|
||||
// A surviving shell/child would write this file after its sleep finishes.
|
||||
time.Sleep(3 * time.Second)
|
||||
if _, err := os.Stat(filepath.Join(dir, "completed")); !os.IsNotExist(err) {
|
||||
t.Fatalf("timed-out wake command continued running: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tools/router"
|
||||
"ganigeorgiev.com/pocketbase/dbx"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/tools/router"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
@@ -169,7 +169,7 @@ func HandlerShutdown(e *core.RequestEvent) error {
|
||||
}
|
||||
|
||||
func HandlerWakeGroup(e *core.RequestEvent) error {
|
||||
records, err := e.App.FindRecordsByFilter("devices", "groups.id = {:grpId} && status = 'offline'", "", 0, 0,
|
||||
records, err := e.App.FindRecordsByFilter("devices", "groups.id ?= {:grpId} && status = 'offline'", "", 0, 0,
|
||||
dbx.Params{"grpId": e.Request.PathValue("id")},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -203,7 +203,7 @@ func HandlerWakeGroup(e *core.RequestEvent) error {
|
||||
}
|
||||
|
||||
func HandlerShutdownGroup(e *core.RequestEvent) error {
|
||||
records, err := e.App.FindRecordsByFilter("devices", "groups.id = {:grpId} && status = 'online'", "", 0, 0,
|
||||
records, err := e.App.FindRecordsByFilter("devices", "groups.id ?= {:grpId} && status = 'online'", "", 0, 0,
|
||||
dbx.Params{"grpId": e.Request.PathValue("id")},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"kernel.org/pub/linux/libs/security/libcap/cap"
|
||||
)
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
func HandlerScan(e *core.RequestEvent) error {
|
||||
|
||||
@@ -1,12 +1,22 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/tools/hook"
|
||||
"ganigeorgiev.com/pocketbase/dbx"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/tools/hook"
|
||||
)
|
||||
|
||||
// SkipSuccessfulHealthCheckLog prevents routine Docker health checks from being
|
||||
// persisted while retaining failed health checks for diagnostics.
|
||||
func SkipSuccessfulHealthCheckLog(e *core.RequestEvent) error {
|
||||
if e.Request.URL.Path == "/api/health" {
|
||||
return apis.SkipSuccessActivityLog().Func(e)
|
||||
}
|
||||
|
||||
return e.Next()
|
||||
}
|
||||
|
||||
func RequireScanDevicesPermission() *hook.Handler[*core.RequestEvent] {
|
||||
return &hook.Handler[*core.RequestEvent]{
|
||||
Func: func(e *core.RequestEvent) error {
|
||||
|
||||
+30
-9
@@ -3,22 +3,22 @@ package pb
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/pocketbase/pocketbase/plugins/ghupdate"
|
||||
"github.com/pocketbase/pocketbase/plugins/migratecmd"
|
||||
"ganigeorgiev.com/pocketbase/dbx"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/plugins/ghupdate"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/plugins/migratecmd"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/seriousm4x/upsnap/cronjobs"
|
||||
"github.com/seriousm4x/upsnap/iptracking"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
_ "github.com/seriousm4x/upsnap/migrations"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
var Version = "(untracked)"
|
||||
@@ -75,6 +75,7 @@ func StartPocketBase(distDirFS fs.FS) error {
|
||||
|
||||
// event hooks
|
||||
app.OnServe().BindFunc(func(se *core.ServeEvent) error {
|
||||
se.Router.BindFunc(SkipSuccessfulHealthCheckLog)
|
||||
se.Router.GET("/{path...}", apis.Static(distDirFS, true))
|
||||
se.Router.GET("/api/upsnap/wake/{id}", HandlerWake).Bind(RequireUpSnapPermission())
|
||||
se.Router.GET("/api/upsnap/wakegroup/{id}", HandlerWakeGroup).Bind(RequireUpSnapPermission())
|
||||
@@ -191,8 +192,7 @@ func StartPocketBase(distDirFS fs.FS) error {
|
||||
})
|
||||
|
||||
app.OnRecordValidate("devices").BindFunc(func(e *core.RecordEvent) error {
|
||||
ip := net.ParseIP(e.Record.GetString("netmask"))
|
||||
if ip == nil {
|
||||
if !networking.ValidateSubnetMask(e.Record.GetString("netmask")) {
|
||||
logging.Logger(e.App).Warn("Device has invalid netmask; using broadcast default", "device", e.Record.GetString("name"), "netmask", "255.255.255.255")
|
||||
e.Record.Set("netmask", "255.255.255.255")
|
||||
saveErr := e.App.Save(e.Record)
|
||||
@@ -222,6 +222,17 @@ func StartPocketBase(distDirFS fs.FS) error {
|
||||
// distinguish a refresh from a genuine disconnect.
|
||||
clientID := e.Client.Id()
|
||||
defer func() {
|
||||
// with lazy ping disabled the ping cron keeps updating device
|
||||
// statuses while no clients are connected, so there is nothing
|
||||
// to compensate for here
|
||||
settings, err := e.App.FindFirstRecordByFilter("settings_private", "")
|
||||
if err != nil {
|
||||
logging.Logger(e.App).Error("Failed to load private settings for offline transition", "error", err)
|
||||
return
|
||||
}
|
||||
if !settings.GetBool("lazy_ping") {
|
||||
return
|
||||
}
|
||||
if len(e.App.SubscriptionsBroker().Clients()) != 0 {
|
||||
return
|
||||
}
|
||||
@@ -237,12 +248,22 @@ func StartPocketBase(distDirFS fs.FS) error {
|
||||
logging.Logger(app).Error("Failed to load devices for offline transition", "error", err)
|
||||
return
|
||||
}
|
||||
marked := 0
|
||||
for _, device := range allDevices {
|
||||
// leave devices that are already offline alone so the
|
||||
// "offline since" timestamp keeps its real meaning
|
||||
if device.GetString("status") == "offline" {
|
||||
continue
|
||||
}
|
||||
device.Set("status", "offline")
|
||||
if err := app.Save(device); err != nil {
|
||||
logging.Logger(app).Error("Failed to save offline device status", "device", device.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
marked++
|
||||
}
|
||||
if marked > 0 {
|
||||
logging.Logger(app).Info("Marked devices offline after the last client disconnected", "count", marked)
|
||||
}
|
||||
})
|
||||
}()
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
services:
|
||||
upsnap:
|
||||
cap_add:
|
||||
- NET_RAW # Required for privileged ping, network device scan, and IP address tracking (nmap)
|
||||
cap_drop:
|
||||
- ALL
|
||||
container_name: upsnap
|
||||
build:
|
||||
dockerfile: Dockerfile.dev
|
||||
@@ -7,6 +11,10 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/app/pb_data
|
||||
# # If you want to use FQDN instead of an IP and it is a ".local" domain, avahi and dbus must be installed on
|
||||
# # the host, and the host dbus must be mounted in the container.
|
||||
# # Before uncommmenting, ensure you are familiar with potential security implications of mounting dbus
|
||||
# - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
|
||||
# # To use a non-root user, create the mountpoint first before starting
|
||||
# # the container (mkdir data) so that it has the right permissions.
|
||||
# user: 1000:1000
|
||||
|
||||
@@ -10,6 +10,11 @@ services:
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/app/pb_data
|
||||
# # If you want to use FQDN instead of an IP and it is a ".local" domain, avahi and dbus must be installed on
|
||||
# # the host, and the host dbus must be mounted in the container.
|
||||
# # Before uncommmenting, ensure you are familiar with potential security implications of mounting dbus
|
||||
# - /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:ro
|
||||
|
||||
# # To use a non-root user, create the mountpoint first (mkdir data) so that it has the right permission.
|
||||
# user: 1000:1000
|
||||
# environment:
|
||||
|
||||
+19
-19
@@ -17,27 +17,27 @@
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^2.1.1",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@inlang/cli": "^3.3.5",
|
||||
"@inlang/paraglide-js": "^2.25.1",
|
||||
"@sveltejs/adapter-static": "^3.0.10",
|
||||
"@sveltejs/kit": "^2.70.3",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
||||
"daisyui": "^5.7.28",
|
||||
"eslint": "^10.10.0",
|
||||
"@inlang/cli": "^3.6.0",
|
||||
"@inlang/paraglide-js": "^2.29.3",
|
||||
"@sveltejs/adapter-static": "^3.0.11",
|
||||
"@sveltejs/kit": "^2.70.4",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
||||
"daisyui": "^5.7.50",
|
||||
"eslint": "^10.14.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.23.0",
|
||||
"globals": "^17.12.0",
|
||||
"eslint-plugin-svelte": "^3.24.0",
|
||||
"globals": "^17.14.0",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.9.6",
|
||||
"prettier": "^3.9.10",
|
||||
"prettier-plugin-svelte": "^4.1.1",
|
||||
"prettier-plugin-tailwindcss": "^0.8.1",
|
||||
"svelte": "^5.57.0",
|
||||
"svelte-check": "^4.7.6",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"tslib": "^2.8.1",
|
||||
"svelte": "^5.57.3",
|
||||
"svelte-check": "^4.7.8",
|
||||
"tailwindcss": "^4.3.4",
|
||||
"tslib": "^2.9.1",
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.70.0",
|
||||
"vite": "^8.2.2"
|
||||
"typescript-eslint": "^8.72.1",
|
||||
"vite": "^8.3.6"
|
||||
},
|
||||
"type": "module",
|
||||
"lint-staged": {
|
||||
@@ -46,10 +46,10 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/free-solid-svg-icons": "^7.3.1",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"cron-parser": "^5.10.0",
|
||||
"@tailwindcss/vite": "^4.3.4",
|
||||
"cron-parser": "^5.10.3",
|
||||
"date-fns": "^4.4.0",
|
||||
"pocketbase": "^0.28.1",
|
||||
"pocketbase": "^0.28.2",
|
||||
"svelte-fa": "^4.0.4",
|
||||
"svelte-french-toast": "github:seriousm4x/svelte-french-toast#fix-72-build",
|
||||
"theme-change": "^2.5.2"
|
||||
|
||||
Generated
+1219
-1757
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,11 @@
|
||||
#
|
||||
# Inlang handles the gitignore itself starting with version ^2.5.
|
||||
#
|
||||
# everything is ignored except settings.json
|
||||
# everything is ignored except settings.json and Paraglide configuration
|
||||
*
|
||||
!settings.json
|
||||
!settings.json
|
||||
!descriptions.json
|
||||
!paraglide.config.js
|
||||
!paraglide.config.mjs
|
||||
!paraglide.config.ts
|
||||
!paraglide.config.cjs
|
||||
@@ -22,11 +22,25 @@
|
||||
await getGroups();
|
||||
});
|
||||
|
||||
const fqdnPattern =
|
||||
/^(?:[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?\.)+[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?$/u;
|
||||
const ipPattern =
|
||||
'^(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}$';
|
||||
const macPattern = '^([0-9A-Fa-f]{2}[:\\-]){5}([0-9A-Fa-f]{2})$';
|
||||
/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/;
|
||||
const macPattern = '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$';
|
||||
const netmaskPattern =
|
||||
'^(?:255\\.255\\.255\\.(?:255|254|252|248|240|224|192|128|0)|255\\.255\\.(?:255|254|252|248|240|224|192|128|0)\\.0|255\\.(?:255|254|252|248|240|224|192|128|0)\\.0\\.0|(?:255|254|252|248|240|224|192|128|0)\\.0\\.0\\.0)$';
|
||||
|
||||
$: if ($settingsPriv?.track_ip_interval === '' || !ipPattern.test(device.ip)) {
|
||||
device.track_ip = false;
|
||||
}
|
||||
|
||||
async function save() {
|
||||
// validate FQDN/IP
|
||||
if (!(ipPattern.test(device.ip) || fqdnPattern.test(device.ip))) {
|
||||
toast.error(m.settings_invalid_fqdnip());
|
||||
throw new Error('fqdn_ip not valid');
|
||||
}
|
||||
|
||||
// validate crons
|
||||
if (device.wake_cron_enabled && !(await validateCron(device.wake_cron))) {
|
||||
toast.error(m.settings_invalid_cron());
|
||||
@@ -230,7 +244,7 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_ip()}
|
||||
class="input"
|
||||
pattern={ipPattern}
|
||||
maxlength="255"
|
||||
bind:value={device.ip}
|
||||
required
|
||||
/>
|
||||
@@ -243,6 +257,7 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_mac()}
|
||||
class="input"
|
||||
maxlength="18"
|
||||
pattern={macPattern}
|
||||
bind:value={device.mac}
|
||||
required
|
||||
@@ -256,7 +271,8 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_netmask()}
|
||||
class="input"
|
||||
pattern={ipPattern}
|
||||
maxlength="16"
|
||||
pattern={netmaskPattern}
|
||||
bind:value={device.netmask}
|
||||
required
|
||||
/>
|
||||
@@ -282,7 +298,7 @@
|
||||
type="checkbox"
|
||||
bind:checked={device.track_ip}
|
||||
class="toggle toggle-success"
|
||||
disabled={$settingsPriv?.track_ip_interval === ''}
|
||||
disabled={$settingsPriv?.track_ip_interval === '' || !ipPattern.test(device.ip)}
|
||||
/>
|
||||
{m.device_general_track_ip()}
|
||||
</label>
|
||||
|
||||
@@ -100,14 +100,6 @@
|
||||
await $pocketbase
|
||||
.collection('users')
|
||||
.authRefresh()
|
||||
.then(async () => {
|
||||
// set settingsPriv store on load
|
||||
if (!$settingsPriv) {
|
||||
const res = await $pocketbase.collection('settings_private').getFirstListItem('');
|
||||
settingsPriv.set(res as SettingsPrivate);
|
||||
}
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
// clear the store only on invalidated/expired token
|
||||
const status = err?.status << 0;
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "عام",
|
||||
"device_general_description": "الوصف",
|
||||
"device_general_description_placeholder": "وصف للجهاز",
|
||||
"device_general_ip": "عنوان IP",
|
||||
"device_general_ip": "عنوان IP/FQDN",
|
||||
"device_general_mac": "عنوان Mac",
|
||||
"device_general_name": "الاسم",
|
||||
"device_general_netmask": "قناع الشبكة",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "تعيين أيقونة مفضلة مخصصة. أنواع الملفات المدعومة هي:",
|
||||
"settings_icon_title": "الأيقونة",
|
||||
"settings_invalid_cron": "❌ صيغة cron غير صالحة",
|
||||
"settings_invalid_fqdnip": "❌ عنوان FQDN/IPv4 غير صالح",
|
||||
"settings_lazy_ping_desc": "عندما يتم تشغيل الـ ping خامل سيقوم UpSnap بفحص الأجهزة فقط إذا كان هناك مستخدم نشط يزور الموقع. إذا تم إيقاف تشغيله، سيقوم UpSnap دائماً بفحص الأجهزة.",
|
||||
"settings_lazy_ping_enable": "تفعيل",
|
||||
"settings_lazy_ping_title": "Ping خامل",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Общи",
|
||||
"device_general_description": "Описание",
|
||||
"device_general_description_placeholder": "Описание на устройството",
|
||||
"device_general_ip": "IP адрес",
|
||||
"device_general_ip": "IP адрес/FQDN",
|
||||
"device_general_mac": "MAC адрес",
|
||||
"device_general_name": "Име",
|
||||
"device_general_netmask": "Мрежова маска",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Задайте персонализирана икона. Поддържани типове файлове:",
|
||||
"settings_icon_title": "Икона",
|
||||
"settings_invalid_cron": "❌ Невалиден cron синтаксис",
|
||||
"settings_invalid_fqdnip": "❌ Невалиден FQDN/IPv4 адрес",
|
||||
"settings_lazy_ping_desc": "Когато „мързелив ping“ е активиран, UpSnap ще ping-ва устройства само когато потребител действително посети сайта. Ако е деактивиран, UpSnap винаги ще ping-ва.",
|
||||
"settings_lazy_ping_enable": "Активиране",
|
||||
"settings_lazy_ping_title": "Мързелив ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Obecné",
|
||||
"device_general_description": "Popisek",
|
||||
"device_general_description_placeholder": "Stručný popis zařízení",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC",
|
||||
"device_general_name": "Jméno",
|
||||
"device_general_netmask": "Síťová maska",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Nastavit vlastní ikonu. Podporované typy souborů jsou:",
|
||||
"settings_icon_title": "Ikona",
|
||||
"settings_invalid_cron": "❌ Neplatná syntaxe cronu",
|
||||
"settings_invalid_fqdnip": "❌ Neplatná adresa FQDN/IPv4",
|
||||
"settings_lazy_ping_desc": "Když je funkce líného pingu zapnutá, UpSnap bude pingovat zařízení pouze v případě, že web navštíví aktivní uživatel. Pokud je tato funkce vypnutá, UpSnap bude pingovat zařízení vždy.",
|
||||
"settings_lazy_ping_enable": "Povolit",
|
||||
"settings_lazy_ping_title": "Líný ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Allgemein",
|
||||
"device_general_description": "Beschreibung",
|
||||
"device_general_description_placeholder": "Eine Beschreibung des Geräts",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Name",
|
||||
"device_general_netmask": "Netmask",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Eigenes Favicon nutzen. Unterstützte Dateitypen sind:",
|
||||
"settings_icon_title": "Icon",
|
||||
"settings_invalid_cron": "❌ Ungültige cron Syntax",
|
||||
"settings_invalid_fqdnip": "❌ Ungültige FQDN-/IPv4-Adresse",
|
||||
"settings_lazy_ping_desc": "Wenn Lazy Ping aktiviert ist, pingt UpSnap die Geräte nur an, wenn ein aktiver Benutzer die Website besucht. Wenn es ausgeschaltet ist, pingt UpSnap die Geräte immer an.",
|
||||
"settings_lazy_ping_enable": "Aktivieren",
|
||||
"settings_lazy_ping_title": "Lazy Ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Γενικά",
|
||||
"device_general_description": "Περιγραφή",
|
||||
"device_general_description_placeholder": "Περιγραφή συσκευής",
|
||||
"device_general_ip": "IP Διεύθυνση",
|
||||
"device_general_ip": "IP Διεύθυνση/FQDN",
|
||||
"device_general_mac": "Mac Φυσική Διεύθυνση",
|
||||
"device_general_name": "Όνομα",
|
||||
"device_general_netmask": "Μάσκα δικτύου",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Προσδιορισμός προσαρμοσμένου favicon. Υποστηριζόμενοι τύποι είναι:",
|
||||
"settings_icon_title": "Εικονίδιο",
|
||||
"settings_invalid_cron": "❌ Μη έγκυρο συντακτικό πραγμαμματισμού",
|
||||
"settings_invalid_fqdnip": "❌ Μη έγκυρη διεύθυνση FQDN/IPv4",
|
||||
"settings_lazy_ping_desc": "Όταν το lazy ping είναι ενεργό, το UpSnap θα στείλει ping στις συσκευές αν υπάρχει ενεργός χρήστης εντός του ιστότοπου. Αν δεν είναι ενεργό, το UpSnap θα στέλνει πάντα ping στις συσκευές.",
|
||||
"settings_lazy_ping_enable": "Ενεργοποίηση",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"device_general": "General",
|
||||
"device_general_description": "Description",
|
||||
"device_general_description_placeholder": "Some description of the device",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Name",
|
||||
"device_general_netmask": "Netmask",
|
||||
@@ -154,6 +154,7 @@
|
||||
"settings_icon_desc": "Set a custom favicon. Supported file types are:",
|
||||
"settings_icon_title": "Icon",
|
||||
"settings_invalid_cron": "❌ Invalid cron syntax",
|
||||
"settings_invalid_fqdnip": "❌ Invalid FQDN/IPv4 address",
|
||||
"settings_lazy_ping_desc": "When lazy ping is turned on, UpSnap will only ping devices and run IP tracking scans while a user has the website open. If it's turned off, UpSnap always pings and scans.",
|
||||
"settings_lazy_ping_enable": "Enable",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "General",
|
||||
"device_general_description": "Descripción",
|
||||
"device_general_description_placeholder": "Descripción del dispositivo",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nombre",
|
||||
"device_general_netmask": "Máscara de red",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Establece un favicon personalizado. Los tipos de archivos admitidos son:",
|
||||
"settings_icon_title": "Icon",
|
||||
"settings_invalid_cron": "❌ Sintaxis cron no válida",
|
||||
"settings_invalid_fqdnip": "❌ Invalid FQDN/IPv4 address",
|
||||
"settings_lazy_ping_desc": "Cuando el ping diferido está activado, UpSnap solo hará ping a los dispositivos si hay un usuario activo visitando el sitio web. Si está desactivado, UpSnap siempre hará ping a los dispositivos.",
|
||||
"settings_lazy_ping_enable": "Activar",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Général",
|
||||
"device_general_description": "Description",
|
||||
"device_general_description_placeholder": "Description de l'appareil",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nom",
|
||||
"device_general_netmask": "Masque réseau",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Définit un favicon personnalisé. Les types de fichier compatibles sont :",
|
||||
"settings_icon_title": "Icône",
|
||||
"settings_invalid_cron": "❌ Syntaxe cron invalide",
|
||||
"settings_invalid_fqdnip": "❌ Adresse FQDN/IPv4 invalide",
|
||||
"settings_lazy_ping_desc": "Lorsque le mode ping fainéant est activé, UpSnap ne va effectuer des requêtes de ping sur les appareils que lorsqu'un utilisateur actif visite le site. Si vous désactivez cette fonction, UpSnap exécutera toujours ces requêtes.",
|
||||
"settings_lazy_ping_enable": "Activer",
|
||||
"settings_lazy_ping_title": "Ping fainéant",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "सामान्य",
|
||||
"device_general_description": "विवरण",
|
||||
"device_general_description_placeholder": "डिवाइस का कुछ विवरण",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "नाम",
|
||||
"device_general_netmask": "नेटमास्क",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "एक कस्टम favicon सेट करें। समर्थित फ़ाइल प्रकार हैं:",
|
||||
"settings_icon_title": "आइकन",
|
||||
"settings_invalid_cron": "❌ अमान्य क्रोन सिंटैक्स",
|
||||
"settings_invalid_fqdnip": "❌ अमान्य FQDN/IPv4 पता",
|
||||
"settings_lazy_ping_desc": "जब Lazy Ping चालू होता है, UpSnap केवल तब पिंग करेगा जब कोई सक्रिय उपयोगकर्ता वेबसाइट पर हो। बंद होने पर यह हमेशा पिंग करेगा।",
|
||||
"settings_lazy_ping_enable": "सक्रिय करें",
|
||||
"settings_lazy_ping_title": "Lazy पिंग",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Umum",
|
||||
"device_general_description": "Deskripsi",
|
||||
"device_general_description_placeholder": "Deskripsi perangkat ini",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nama",
|
||||
"device_general_netmask": "Netmask",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Atur favicon khusus. Jenis file yang didukung:",
|
||||
"settings_icon_title": "Ikon",
|
||||
"settings_invalid_cron": "❌ Sintaks tugas penjadwalan tidak valid",
|
||||
"settings_invalid_fqdnip": "❌ Alamat FQDN/IPv4 tidak valid",
|
||||
"settings_lazy_ping_desc": "Saat Ping Santai diaktifkan, UpSnap hanya akan memping perangkat jika ada pengguna yang mengakses situs web. Jika dinonaktifkan, UpSnap akan selalu memping perangkat.",
|
||||
"settings_lazy_ping_enable": "Aktifkan",
|
||||
"settings_lazy_ping_title": "Ping Santai",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Generale",
|
||||
"device_general_description": "Descrizione",
|
||||
"device_general_description_placeholder": "Descrizione del dispositivo",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nome",
|
||||
"device_general_netmask": "Maschera di rete",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Imposta una icona personalizzata. I tipi di file supportati sono:",
|
||||
"settings_icon_title": "Icona",
|
||||
"settings_invalid_cron": "❌ Sintassi cron non valida",
|
||||
"settings_invalid_fqdnip": "❌ Indirizzo FQDN/IPv4 non valido",
|
||||
"settings_lazy_ping_desc": "Quando il ping pigro è abilitato, UpSnap effettuerà i ping verso di dispositivi solamente quando un utente effettivamente visita il sito. Se è spento, allora UpSnap continuerà con il ping sempre.",
|
||||
"settings_lazy_ping_enable": "Abilita",
|
||||
"settings_lazy_ping_title": "Ping pigro",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "一般",
|
||||
"device_general_description": "説明",
|
||||
"device_general_description_placeholder": "装置の説明",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "名前",
|
||||
"device_general_netmask": "ネットマスク",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "カスタムファビコンを設定します。サポートされているファイルタイプ:",
|
||||
"settings_icon_title": "アイコン",
|
||||
"settings_invalid_cron": "❌ 無効なcron構文",
|
||||
"settings_invalid_fqdnip": "❌ 無効なFQDN/IPv4アドレス",
|
||||
"settings_lazy_ping_desc": "Lazy ping をオンにすると、UpSnap はアクティブなユーザーがウェブサイトを訪れている場合にのみデバイスを ping します。オフの場合、UpSnap は常にデバイスを ping します。",
|
||||
"settings_lazy_ping_enable": "有効化",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "일반",
|
||||
"device_general_description": "설명",
|
||||
"device_general_description_placeholder": "기기에 관한 설명",
|
||||
"device_general_ip": "IP 주소",
|
||||
"device_general_ip": "IP 주소/FQDN",
|
||||
"device_general_mac": "Mac 주소",
|
||||
"device_general_name": "이름",
|
||||
"device_general_netmask": "넷 마스크",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "사용자 지정 favicon을 설정하세요. 지원되는 파일 형식:",
|
||||
"settings_icon_title": "아이콘",
|
||||
"settings_invalid_cron": "❌ 잘못된 크론 구문",
|
||||
"settings_invalid_fqdnip": "❌ 유효하지 않은 FQDN/IPv4 주소입니다",
|
||||
"settings_lazy_ping_desc": "Lazy Ping이 활성화되면, UpSnap은 웹사이트를 방문하는 활성 사용자가 있을 때만 장치를 핑합니다. 비활성화되면, UpSnap은 항상 장치를 핑합니다.",
|
||||
"settings_lazy_ping_enable": "활성화",
|
||||
"settings_lazy_ping_title": "Lazy Ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Generelt",
|
||||
"device_general_description": "Beskrivelse",
|
||||
"device_general_description_placeholder": "Liten beskrivelse av enheten",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC",
|
||||
"device_general_name": "Navn",
|
||||
"device_general_netmask": "Nettmaske",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Angi et egendefinert favorittikon. Støttede filtyper er:",
|
||||
"settings_icon_title": "Ikon",
|
||||
"settings_invalid_cron": "❌ Ugyldig cron-syntaks",
|
||||
"settings_invalid_fqdnip": "❌ Ugyldig FQDN/IPv4-adresse",
|
||||
"settings_lazy_ping_desc": "Når lat ping er slått på, vil UpSnap bare pinge enheter hvis det er en aktiv bruker som besøker nettstedet. Hvis den er slått av, vil UpSnap alltid pinge enheter.",
|
||||
"settings_lazy_ping_enable": "Aktiver",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Algemeen",
|
||||
"device_general_description": "Beschrijving",
|
||||
"device_general_description_placeholder": "Enige beschrijving van het apparaat",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Naam",
|
||||
"device_general_netmask": "Subnetmask",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Stel een aangepast favicon in. Ondersteunde bestandstypen zijn:",
|
||||
"settings_icon_title": "Icoon",
|
||||
"settings_invalid_cron": "❌ Ongeldige cron syntaxis",
|
||||
"settings_invalid_fqdnip": "❌ Ongeldig FQDN/IPv4-adres",
|
||||
"settings_lazy_ping_desc": "Wanneer lazy ping is ingeschakeld, pingt UpSnap alleen apparaten als er een actieve gebruiker de website bezoekt. Als het is uitgeschakeld, pingt UpSnap altijd apparaten.",
|
||||
"settings_lazy_ping_enable": "Inschakelen",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Ogólne",
|
||||
"device_general_description": "Opis",
|
||||
"device_general_description_placeholder": "Przykładowy opis urządzenia",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC",
|
||||
"device_general_name": "Nazwa",
|
||||
"device_general_netmask": "Maska sieci",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Ustaw niestandardowy favicon. Obsługiwane są typy plików:",
|
||||
"settings_icon_title": "Ikona",
|
||||
"settings_invalid_cron": "❌ Nieprawidłowa składnia cron",
|
||||
"settings_invalid_fqdnip": "❌ Nieprawidłowy adres FQDN/IPv4",
|
||||
"settings_lazy_ping_desc": "Gdy leniwe pingowanie jest włączone, UpSnap będzie pingować urządzenia tylko wtedy, gdy użytkownicy odwiedzają stronę. Gdy ta opcja jest wyłączona, UpSnap będzie pingować urządzenia nieustannie.",
|
||||
"settings_lazy_ping_enable": "Włącz",
|
||||
"settings_lazy_ping_title": "Leniwe pingowanie",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Geral",
|
||||
"device_general_description": "Descrição",
|
||||
"device_general_description_placeholder": "Alguma descrição do dispositivo",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nome",
|
||||
"device_general_netmask": "Máscara de rede",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Define um favicon personalizado. Tipos de ficheiros suportados são:",
|
||||
"settings_icon_title": "Ícone",
|
||||
"settings_invalid_cron": "❌ Sintaxe inválida de agendamento cron",
|
||||
"settings_invalid_fqdnip": "❌ Endereço FQDN/IPv4 inválido",
|
||||
"settings_lazy_ping_desc": "Quando o lazy ping está ativo, o UpSnap irá apenas executar o ping se existir um usuário ativo no website. Se desligado, o UpSnap irá executar sempre o ping.",
|
||||
"settings_lazy_ping_enable": "Ativar",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Geral",
|
||||
"device_general_description": "Descrição",
|
||||
"device_general_description_placeholder": "Alguma descrição do dispositivo",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nome",
|
||||
"device_general_netmask": "Máscara de rede",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Define um favicon personalizado. Tipos de ficheiros suportados são:",
|
||||
"settings_icon_title": "Ícone",
|
||||
"settings_invalid_cron": "❌ Sintaxe inválida do cron",
|
||||
"settings_invalid_fqdnip": "❌ Endereço FQDN/IPv4 inválido",
|
||||
"settings_lazy_ping_desc": "Quando o lazy ping está activo, o UpSnap irá apenas executar o ping se existir um utilizador ativo no website. Se desligado, o UpSnap irá executar sempre o ping.",
|
||||
"settings_lazy_ping_enable": "Activar",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Основное",
|
||||
"device_general_description": "Описание",
|
||||
"device_general_description_placeholder": "Некоторое описание устройства",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC адрес",
|
||||
"device_general_name": "Имя",
|
||||
"device_general_netmask": "Сетевая маска",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Установить собственный фавикон. Поддерживаемые типы файлов:",
|
||||
"settings_icon_title": "Иконка",
|
||||
"settings_invalid_cron": "❌ Неверный синтаксис cron",
|
||||
"settings_invalid_fqdnip": "❌ Неверный FQDN/IPv4-адрес",
|
||||
"settings_lazy_ping_desc": "Если функция lazy ping (ленивый пинг) включена, UpSnap будет пинговать устройства только в том случае, если на сайте есть активный пользователь. Если функция отключена, UpSnap будет пинговать устройства всегда.",
|
||||
"settings_lazy_ping_enable": "Включить",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Основні",
|
||||
"device_general_description": "Опис",
|
||||
"device_general_description_placeholder": "Опису пристрою",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC адреса",
|
||||
"device_general_name": "Ім'я",
|
||||
"device_general_netmask": "Маска мережі",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Встановіть спеціальну піктограму. Підтримувані типи файлів:",
|
||||
"settings_icon_title": "Значок",
|
||||
"settings_invalid_cron": "❌ Недійсний синтаксис cron",
|
||||
"settings_invalid_fqdnip": "❌ Недійсна адреса FQDN/IPv4",
|
||||
"settings_lazy_ping_desc": "Коли ввімкнено відкладений пінг, UpSnap перевірятиме лише пристрої, якщо є активний користувач, який відвідує веб-сайт. Якщо його вимкнено, UpSnap завжди перевіряє пристрої.",
|
||||
"settings_lazy_ping_enable": "Увімкнути",
|
||||
"settings_lazy_ping_title": "Відкладений пінг",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "Tổng quan",
|
||||
"device_general_description": "Mô tả",
|
||||
"device_general_description_placeholder": "Mô tả về thiết bị",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Tên",
|
||||
"device_general_netmask": "Netmask",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "Đặt favicon tùy chỉnh. Hỗ trợ định dạng:",
|
||||
"settings_icon_title": "Biểu tượng",
|
||||
"settings_invalid_cron": "❌ Cú pháp cron không hợp lệ",
|
||||
"settings_invalid_fqdnip": "❌ Tên miền đầy đủ/Địa chỉ IPv4 không hợp lệ",
|
||||
"settings_lazy_ping_desc": "Khi bật lazy ping, UpSnap chỉ ping khi có người dùng truy cập web. Nếu tắt, UpSnap sẽ luôn ping.",
|
||||
"settings_lazy_ping_enable": "Bật",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "通用",
|
||||
"device_general_description": "说明",
|
||||
"device_general_description_placeholder": "设备的一些说明",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "名称",
|
||||
"device_general_netmask": "子网掩码",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "设置一个自定义图标. 支持的文件类型:",
|
||||
"settings_icon_title": "图标",
|
||||
"settings_invalid_cron": "❌ 无效的 cron 语法",
|
||||
"settings_invalid_fqdnip": "❌ 无效的 FQDN/IPv4 地址",
|
||||
"settings_lazy_ping_desc": "当开关打开时, UpSnap 只会在用户访问网站期间进行 ping 操作.",
|
||||
"settings_lazy_ping_enable": "启用",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"device_general": "一般",
|
||||
"device_general_description": "描述",
|
||||
"device_general_description_placeholder": "關於這個裝置的描述",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "名稱",
|
||||
"device_general_netmask": "子網域遮罩",
|
||||
@@ -152,6 +152,7 @@
|
||||
"settings_icon_desc": "設定一個自訂義圖標。支援的檔案類型:",
|
||||
"settings_icon_title": "圖標",
|
||||
"settings_invalid_cron": "❌ 「無效的 Cron 語法」",
|
||||
"settings_invalid_fqdnip": "❌ 無效的 FQDN/IPv4 位址",
|
||||
"settings_lazy_ping_desc": "當開關打開時 UpSnap 只會在有使用者訪問網站時才對裝置進行 ping 測試。反之則 UpSnap 將持續對裝置進行 ping 測試。",
|
||||
"settings_lazy_ping_enable": "啟用",
|
||||
"settings_lazy_ping_title": "Lazy ping",
|
||||
|
||||
Reference in New Issue
Block a user