mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-11-27 12:21:56 +00:00
Compare commits
131 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 85b49defa9 | |||
| 66e08ade4e | |||
| 285f8dcacf | |||
| 9c0f6e114e | |||
| d31a6ef254 | |||
| c2bf398a69 | |||
| 9dac3e982e | |||
| 48a8c736b2 | |||
| 1d361e3f8b | |||
| 611c4d29c5 | |||
| d6604b2df3 | |||
| 52f00c4847 | |||
| 2e69ba9b61 | |||
| 9bed4f4c74 | |||
| c5613a5272 | |||
| 3caa62b609 | |||
| ed83590a62 | |||
| 5c5b908d37 | |||
| 88d333d79e | |||
| 9f00286931 | |||
| b39857b653 | |||
| e09b96813c | |||
| 1273d1b907 | |||
| faeed49bc5 | |||
| 0acba76481 | |||
| 07664829ba | |||
| 78068c1042 | |||
| 3bf1ba517b | |||
| 457a17c259 | |||
| 29c99eda93 | |||
| cddad0f756 | |||
| 84a362a361 | |||
| 190f87d1fa | |||
| f794681ee0 | |||
| ca3fb1c42d | |||
| 7f3020d975 | |||
| 6cf9539871 | |||
| b09510f5e4 | |||
| 07d7becaf8 | |||
| 8301cadba1 | |||
| c57adf8548 | |||
| e6d2992de2 | |||
| 969ded61e6 | |||
| d6300e819d | |||
| ebd3e01af1 | |||
| 13a06a5037 | |||
| 06b46266f2 | |||
| fb0f9f0d0f | |||
| 4f1ec6c90f | |||
| ad36a40f17 | |||
| db528a9b9b | |||
| 7498a699d7 | |||
| 81e252b8a5 | |||
| d99d19b3a0 | |||
| 1e168d473c | |||
| 835f5b9957 | |||
| be94f35455 | |||
| a2d6d7305c | |||
| 2d55e9f168 | |||
| 0232a43e71 | |||
| 6819248815 | |||
| cea0136f83 | |||
| 01dcca3a5d | |||
| 0b7c4a61e7 | |||
| 745094b03a | |||
| 0bead881ef | |||
| 58136f2da3 | |||
| f299c9dd32 | |||
| e4ab3c37ca | |||
| e997211a15 | |||
| 20e25201d0 | |||
| 91eab529ef | |||
| 28ef84db36 | |||
| 288deda98b | |||
| 9e6c2eb372 | |||
| 423b2cec72 | |||
| 85280034ce | |||
| 5440ab3b25 | |||
| 8ae36d61cc | |||
| 16d4b8ecb7 | |||
| 37943f8412 | |||
| c5295d5f2d | |||
| 8dcb32f8cd | |||
| ddea25d934 | |||
| c033f25309 | |||
| ecac90ecb4 | |||
| d3daeeb061 | |||
| 46bc7195d6 | |||
| 6392527d80 | |||
| dc49e87993 | |||
| 9b0e58af44 | |||
| e3e6626f9f | |||
| 4778f5e1af | |||
| cd64c270f3 | |||
| b3895dc97f | |||
| 8f2e538ce1 | |||
| c7c31fd796 | |||
| 34282ec9af | |||
| 6270ebfb51 | |||
| cb7c13bce3 | |||
| cfe488da1b | |||
| 7062a479d7 | |||
| 4ed1e44d4b | |||
| 43cc9c358f | |||
| b533c1c9d4 | |||
| 484a13f687 | |||
| 758534bd65 | |||
| 2bbaedf7f5 | |||
| cb55969cc3 | |||
| b239031834 | |||
| a6402fc6c5 | |||
| f52a9fe805 | |||
| 14dc3072de | |||
| 2db3082488 | |||
| d71fd94abd | |||
| 4ec5c7d1d5 | |||
| 33143a1de4 | |||
| c759a14160 | |||
| ec533cd47d | |||
| ed7afbead1 | |||
| c204c18be2 | |||
| 05e266dc8d | |||
| 88d1edb617 | |||
| b50951bfa3 | |||
| c57f12eb61 | |||
| 4299799be5 | |||
| 3e645d4d6a | |||
| c0668bfb3b | |||
| 02b4f2099b | |||
| 7afdc41c17 | |||
| 04b3e27d8e |
@@ -33,7 +33,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v5
|
||||
with:
|
||||
version: latest
|
||||
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
tar -czf frontend-dist.tar.gz -C frontend/build .
|
||||
|
||||
- name: Upload frontend artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend-dist.tar.gz
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download frontend artifact
|
||||
uses: actions/download-artifact@v7
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: frontend-dist
|
||||
|
||||
@@ -105,7 +105,7 @@ jobs:
|
||||
${{ runner.os }}-go-
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
uses: goreleaser/goreleaser-action@v7
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: "~> v2"
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
||||
|
||||
- name: Upload backend artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: backend-dist
|
||||
path: backend/dist
|
||||
@@ -133,14 +133,14 @@ jobs:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download backend artifact
|
||||
uses: actions/download-artifact@v7
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: backend-dist
|
||||
path: backend/dist
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@v6
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/seriousm4x/UpSnap
|
||||
@@ -152,27 +152,27 @@ jobs:
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
||||
|
||||
+3
-2
@@ -11,7 +11,7 @@ RUN wget https://github.com/seriousm4x/UpSnap/releases/download/${VERSION}/UpSna
|
||||
chmod +x upsnap &&\
|
||||
apk update &&\
|
||||
apk add --no-cache libcap &&\
|
||||
setcap 'cap_net_raw=+ep' ./upsnap
|
||||
setcap 'cap_net_raw=+p' ./upsnap
|
||||
|
||||
FROM alpine:3
|
||||
ARG UPSNAP_HTTP_LISTEN=0.0.0.0:8090
|
||||
@@ -23,4 +23,5 @@ WORKDIR /app
|
||||
COPY --from=downloader /app/upsnap upsnap
|
||||
HEALTHCHECK --interval=10s \
|
||||
CMD curl -fs "http://${UPSNAP_HTTP_LISTEN}/api/health" || exit 1
|
||||
ENTRYPOINT ["sh", "-c", "./upsnap serve --http ${UPSNAP_HTTP_LISTEN}"]
|
||||
CMD ["serve","--http","${UPSNAP_HTTP_LISTEN}"]
|
||||
ENTRYPOINT ["/app/upsnap"]
|
||||
@@ -61,10 +61,10 @@ Just download the latest binary from the [release page](https://github.com/serio
|
||||
sudo ./upsnap serve --http=0.0.0.0:8090
|
||||
```
|
||||
|
||||
### Non-root:
|
||||
### Non-root on linux only:
|
||||
|
||||
```bash
|
||||
sudo setcap cap_net_raw=+ep ./upsnap # only once after downloading
|
||||
sudo setcap cap_net_raw=+p ./upsnap # only once after downloading to allow for pinging devices
|
||||
./upsnap serve --http=0.0.0.0:8090
|
||||
```
|
||||
|
||||
|
||||
+17
-16
@@ -1,14 +1,15 @@
|
||||
module github.com/seriousm4x/upsnap
|
||||
|
||||
go 1.24.1
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/mdlayher/wol v0.0.0-20220221231636-b763a792253a
|
||||
github.com/pocketbase/dbx v1.11.0
|
||||
github.com/pocketbase/pocketbase v0.35.0
|
||||
github.com/prometheus-community/pro-bing v0.7.0
|
||||
github.com/pocketbase/dbx v1.12.0
|
||||
github.com/pocketbase/pocketbase v0.36.7
|
||||
github.com/prometheus-community/pro-bing v0.8.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
golang.org/x/sys v0.39.0
|
||||
golang.org/x/sys v0.42.0
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.77
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -17,11 +18,11 @@ require (
|
||||
github.com/domodwyer/mailyak/v3 v3.6.2 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
|
||||
github.com/ganigeorgiev/fexpr v0.5.0 // indirect
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.9.3 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
@@ -37,15 +38,15 @@ require (
|
||||
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.46.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
|
||||
golang.org/x/image v0.34.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/oauth2 v0.34.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
modernc.org/libc v1.66.10 // indirect
|
||||
golang.org/x/crypto v0.49.0 // indirect
|
||||
golang.org/x/image v0.37.0 // indirect
|
||||
golang.org/x/net v0.52.0 // indirect
|
||||
golang.org/x/oauth2 v0.36.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
golang.org/x/text v0.35.0 // indirect
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.77 // indirect
|
||||
modernc.org/libc v1.70.0 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.41.0 // indirect
|
||||
modernc.org/sqlite v1.46.2 // indirect
|
||||
)
|
||||
|
||||
+48
-42
@@ -17,8 +17,8 @@ github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/ganigeorgiev/fexpr v0.5.0 h1:XA9JxtTE/Xm+g/JFI6RfZEHSiQlk+1glLvRK1Lpv/Tk=
|
||||
github.com/ganigeorgiev/fexpr v0.5.0/go.mod h1:RyGiGqmeXhEQ6+mlGdnUleLHgtzzu/VGO2WtJkF5drE=
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es=
|
||||
@@ -26,18 +26,20 @@ github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRi
|
||||
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/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
|
||||
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=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
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-20251007162407-5df77e3f7d1d h1:KJIErDwbSHjnp/SGzE5ed8Aol7JsKiI5X7yWKAtzhM0=
|
||||
github.com/google/pprof v0.0.0-20251007162407-5df77e3f7d1d/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U=
|
||||
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc=
|
||||
github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI=
|
||||
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/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=
|
||||
@@ -67,12 +69,12 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF
|
||||
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||
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.11.0 h1:LpZezioMfT3K4tLrqA55wWFw1EtH1pM4tzSVa7kgszU=
|
||||
github.com/pocketbase/dbx v1.11.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/pocketbase v0.35.0 h1:MW905RYJnpwl8bvFDPCn+/5Y/TGKbf+kpdKiZmqx/1s=
|
||||
github.com/pocketbase/pocketbase v0.35.0/go.mod h1:eA9IKEvGYhdVbngBzgXPDZ2aNAGfDBkB6kcuLnHLTag=
|
||||
github.com/prometheus-community/pro-bing v0.7.0 h1:KFYFbxC2f2Fp6c+TyxbCOEarf7rbnzr9Gw8eIb0RfZA=
|
||||
github.com/prometheus-community/pro-bing v0.7.0/go.mod h1:Moob9dvlY50Bfq6i88xIwfyw7xLFHH69LUgx9n5zqCE=
|
||||
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/pocketbase v0.36.7 h1:MrViB7BptPYrf2Nt25pJEYBqUdFjuhRKu1p5GTrkvPA=
|
||||
github.com/pocketbase/pocketbase v0.36.7/go.mod h1:qX4HuVjoKXtEg41fSJVM0JLfGWXbBmHxVv/FaE446r4=
|
||||
github.com/prometheus-community/pro-bing v0.8.0 h1:CEY/g1/AgERRDjxw5P32ikcOgmrSuXs7xon7ovx6mNc=
|
||||
github.com/prometheus-community/pro-bing v0.8.0/go.mod h1:Idyxz8raDO6TgkUN6ByiEGvWJNyQd40kN9ZUeho3lN0=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
@@ -93,57 +95,61 @@ 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.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0=
|
||||
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU=
|
||||
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
|
||||
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.34.0 h1:33gCkyw9hmwbZJeZkct8XyR11yH889EQt/QH4VmXMn8=
|
||||
golang.org/x/image v0.34.0/go.mod h1:2RNFBZRB+vnwwFil8GkMdRvrJOFd1AzdZI6vOY+eJVU=
|
||||
golang.org/x/mod v0.31.0 h1:HaW9xtz0+kOcWKwli0ZXy79Ix+UW/vOfmWI5QVd2tgI=
|
||||
golang.org/x/mod v0.31.0/go.mod h1:43JraMp9cGx1Rx3AqioxrbrhNsLl2l/iNAvuBkrezpg=
|
||||
golang.org/x/image v0.37.0 h1:ZiRjArKI8GwxZOoEtUfhrBtaCN+4b/7709dlT6SSnQA=
|
||||
golang.org/x/image v0.37.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
|
||||
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
|
||||
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
|
||||
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.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
|
||||
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
|
||||
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
|
||||
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
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.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
|
||||
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.40.0 h1:yLkxfA+Qnul4cs9QA3KnlFu0lVmd8JJfoq+E41uSutA=
|
||||
golang.org/x/tools v0.40.0/go.mod h1:Ik/tzLRlbscWpqqMRjyWYDisX8bG13FrdXp3o4Sr9lc=
|
||||
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
|
||||
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
|
||||
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=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
modernc.org/cc/v4 v4.26.5 h1:xM3bX7Mve6G8K8b+T11ReenJOT+BmVqQj0FY5T4+5Y4=
|
||||
modernc.org/cc/v4 v4.26.5/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||
modernc.org/ccgo/v4 v4.28.1 h1:wPKYn5EC/mYTqBO373jKjvX2n+3+aK7+sICCv4Fjy1A=
|
||||
modernc.org/ccgo/v4 v4.28.1/go.mod h1:uD+4RnfrVgE6ec9NGguUNdhqzNIeeomeXf6CL0GTE5Q=
|
||||
modernc.org/fileutil v1.3.40 h1:ZGMswMNc9JOCrcrakF1HrvmergNLAmxOPjizirpfqBA=
|
||||
modernc.org/fileutil v1.3.40/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.77 h1:iQtQTjFUOcTT19fI8sTCzYXsjeVs56et3D8AbKS2Uks=
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.77/go.mod h1:oV+IO8kGh0B7TxErbydDe2+BRmi9g/W0CkpVV+QBTJU=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.77 h1:Z06sMOzc0GNCwp6efaVrIrz4ywGJ1v+DP0pjVkOfDuA=
|
||||
kernel.org/pub/linux/libs/security/libcap/psx v1.2.77/go.mod h1:+l6Ee2F59XiJ2I6WR5ObpC1utCQJZ/VLsEbQCD8RG24=
|
||||
modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis=
|
||||
modernc.org/cc/v4 v4.27.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||
modernc.org/ccgo/v4 v4.32.0 h1:hjG66bI/kqIPX1b2yT6fr/jt+QedtP2fqojG2VrFuVw=
|
||||
modernc.org/ccgo/v4 v4.32.0/go.mod h1:6F08EBCx5uQc38kMGl+0Nm0oWczoo1c7cgpzEry7Uc0=
|
||||
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.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo=
|
||||
modernc.org/gc/v3 v3.1.2/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.66.10 h1:yZkb3YeLx4oynyR+iUsXsybsX4Ubx7MQlSYEw4yj59A=
|
||||
modernc.org/libc v1.66.10/go.mod h1:8vGSEwvoUoltr4dlywvHqjtAqHBaw0j1jI7iFBTAr2I=
|
||||
modernc.org/libc v1.70.0 h1:U58NawXqXbgpZ/dcdS9kMshu08aiA6b7gusEusqzNkw=
|
||||
modernc.org/libc v1.70.0/go.mod h1:OVmxFGP1CI/Z4L3E0Q3Mf1PDE0BucwMkcXjjLntvHJo=
|
||||
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.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
@@ -152,8 +158,8 @@ modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
|
||||
modernc.org/opt v0.1.4/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.41.0 h1:bJXddp4ZpsqMsNN1vS0jWo4IJTZzb8nWpcgvyCFG9Ck=
|
||||
modernc.org/sqlite v1.41.0/go.mod h1:9fjQZ0mB1LLP0GYrp39oOJXx/I2sxEnZtzCmEQIKvGE=
|
||||
modernc.org/sqlite v1.46.2 h1:gkXQ6R0+AjxFC/fTDaeIVLbNLNrRoOK7YYVz5BKhTcE=
|
||||
modernc.org/sqlite v1.46.2/go.mod h1:hWjRO6Tj/5Ik8ieqxQybiEOUXy0NJFNp2tpvVpKlvig=
|
||||
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=
|
||||
|
||||
@@ -4,14 +4,8 @@ import (
|
||||
"errors"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
probing "github.com/prometheus-community/pro-bing"
|
||||
)
|
||||
|
||||
func isNoRouteOrDownError(err error) bool {
|
||||
@@ -26,53 +20,6 @@ func isNoRouteOrDownError(err error) bool {
|
||||
return syscallErr.Err == syscall.EHOSTUNREACH || syscallErr.Err == syscall.EHOSTDOWN
|
||||
}
|
||||
|
||||
func PingDevice(device *core.Record) (bool, error) {
|
||||
ping_cmd := device.GetString("ping_cmd")
|
||||
if ping_cmd == "" {
|
||||
pinger, err := probing.NewPinger(device.GetString("ip"))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
pinger.Count = 1
|
||||
pinger.Timeout = 500 * time.Millisecond
|
||||
|
||||
privileged := isRoot()
|
||||
privilegedEnv := os.Getenv("UPSNAP_PING_PRIVILEGED")
|
||||
if privilegedEnv != "" {
|
||||
privileged, err = strconv.ParseBool(privilegedEnv)
|
||||
if err != nil {
|
||||
privileged = false
|
||||
}
|
||||
}
|
||||
pinger.SetPrivileged(privileged)
|
||||
|
||||
err = pinger.Run()
|
||||
if err != nil {
|
||||
if isNoRouteOrDownError(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
stats := pinger.Statistics()
|
||||
return stats.PacketLoss == 0, nil
|
||||
} else {
|
||||
var shell string
|
||||
var shell_arg string
|
||||
if runtime.GOOS == "windows" {
|
||||
shell = "cmd"
|
||||
shell_arg = "/C"
|
||||
} else {
|
||||
shell = "/bin/sh"
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
cmd := exec.Command(shell, shell_arg, ping_cmd)
|
||||
err := cmd.Run()
|
||||
|
||||
return err == nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func CheckPort(host string, port string) (bool, error) {
|
||||
timeout := 500 * time.Millisecond
|
||||
conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, port), timeout)
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
//go:build linux
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
probing "github.com/prometheus-community/pro-bing"
|
||||
"kernel.org/pub/linux/libs/security/libcap/cap"
|
||||
)
|
||||
|
||||
func PingDevice(device *core.Record) (bool, error) {
|
||||
ping_cmd := device.GetString("ping_cmd")
|
||||
if ping_cmd == "" {
|
||||
pinger, err := probing.NewPinger(device.GetString("ip"))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
pinger.Count = 1
|
||||
pinger.Timeout = 500 * time.Millisecond
|
||||
|
||||
privileged := true
|
||||
privilegedEnv := os.Getenv("UPSNAP_PING_PRIVILEGED")
|
||||
if privilegedEnv != "" {
|
||||
privileged, err = strconv.ParseBool(privilegedEnv)
|
||||
if err != nil {
|
||||
privileged = false
|
||||
}
|
||||
}
|
||||
if privileged {
|
||||
orig := cap.GetProc()
|
||||
defer orig.SetProc() // restore original caps on exit.
|
||||
|
||||
c, err := orig.Dup()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("Failed to dup existing capabilities: %v", err)
|
||||
}
|
||||
|
||||
if on, _ := c.GetFlag(cap.Permitted, cap.NET_RAW); !on {
|
||||
return false, fmt.Errorf("Privileged ping selected but NET_RAW capability not permitted")
|
||||
}
|
||||
|
||||
if err := c.SetFlag(cap.Effective, true, cap.NET_RAW); err != nil {
|
||||
return false, fmt.Errorf("unable to set NET_RAW capability")
|
||||
}
|
||||
|
||||
if err := c.SetProc(); err != nil {
|
||||
return false, fmt.Errorf("unable to raise NET_RAW capability")
|
||||
}
|
||||
}
|
||||
pinger.SetPrivileged(privileged)
|
||||
|
||||
err = pinger.Run()
|
||||
if err != nil {
|
||||
if isNoRouteOrDownError(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
stats := pinger.Statistics()
|
||||
return stats.PacketLoss == 0, nil
|
||||
} else {
|
||||
var shell string
|
||||
var shell_arg string
|
||||
|
||||
shell = "/bin/sh"
|
||||
shell_arg = "-c"
|
||||
|
||||
cmd := exec.Command(shell, shell_arg, ping_cmd)
|
||||
err := cmd.Run()
|
||||
|
||||
return err == nil, err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
//go:build !linux
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.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"))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
pinger.Count = 1
|
||||
pinger.Timeout = 500 * time.Millisecond
|
||||
|
||||
privileged := true // default to privileged ping, required by Windows
|
||||
if runtime.GOOS == "darwin" {
|
||||
// macOS pings will fail when using privileged ping as non root, but works with non-privileged.
|
||||
privileged = false
|
||||
}
|
||||
privilegedEnv := os.Getenv("UPSNAP_PING_PRIVILEGED")
|
||||
if privilegedEnv != "" {
|
||||
privileged, err = strconv.ParseBool(privilegedEnv)
|
||||
if err != nil {
|
||||
privileged = false
|
||||
}
|
||||
}
|
||||
pinger.SetPrivileged(privileged)
|
||||
|
||||
err = pinger.Run()
|
||||
if err != nil {
|
||||
if isNoRouteOrDownError(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
stats := pinger.Statistics()
|
||||
return stats.PacketLoss == 0, nil
|
||||
} else {
|
||||
var shell string
|
||||
var shell_arg string
|
||||
if runtime.GOOS == "windows" {
|
||||
shell = "cmd"
|
||||
shell_arg = "/C"
|
||||
} else {
|
||||
shell = "/bin/sh"
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
cmd := exec.Command(shell, shell_arg, ping_cmd)
|
||||
err := cmd.Run()
|
||||
|
||||
return err == nil, err
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//go:build !windows
|
||||
|
||||
package networking
|
||||
|
||||
import "os"
|
||||
|
||||
func isRoot() bool {
|
||||
return os.Geteuid() == 0
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//go:build windows
|
||||
|
||||
package networking
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
func isRoot() bool {
|
||||
var sid *windows.SID
|
||||
sid, err := windows.CreateWellKnownSid(windows.WinBuiltinAdministratorsSid)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
token := windows.GetCurrentProcessToken()
|
||||
isAdmin, err := token.IsMember(sid)
|
||||
return err == nil && isAdmin
|
||||
}
|
||||
@@ -44,7 +44,7 @@ func ShutdownDevice(device *core.Record) error {
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
done := make(chan error, 1)
|
||||
@@ -61,31 +61,46 @@ func ShutdownDevice(device *core.Record) error {
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(1 * time.Second):
|
||||
case err := <-done:
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s", stderr.String())
|
||||
} else {
|
||||
for {
|
||||
isOnline, err := PingDevice(device)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
if isOnline {
|
||||
if time.Since(start) >= time.Duration(shutdownTimeout)*time.Second {
|
||||
return fmt.Errorf("%s not offline after %d seconds", device.GetString("name"), shutdownTimeout)
|
||||
}
|
||||
}
|
||||
if !isOnline {
|
||||
return nil
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
default:
|
||||
isOnline, err := PingDevice(device)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
if time.Since(start) >= time.Duration(shutdownTimeout)*time.Second {
|
||||
if err := KillProcess(cmd.Process); err != nil {
|
||||
logger.Error.Println(err)
|
||||
}
|
||||
return fmt.Errorf("%s not offline after %d seconds", device.GetString("name"), shutdownTimeout)
|
||||
}
|
||||
isOnline, err := PingDevice(device)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
if !isOnline {
|
||||
if err := KillProcess(cmd.Process); err != nil {
|
||||
logger.Error.Println(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
case err := <-done:
|
||||
if err != nil {
|
||||
if err := KillProcess(cmd.Process); err != nil {
|
||||
logger.Error.Println(err)
|
||||
}
|
||||
return fmt.Errorf("%s", stderr.String())
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package networking
|
||||
|
||||
@@ -29,7 +28,5 @@ func KillProcess(process *os.Process) error {
|
||||
return unix.Kill(-pgid, unix.SIGKILL)
|
||||
}
|
||||
|
||||
_, err = process.Wait()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package networking
|
||||
|
||||
|
||||
+1
-96
@@ -2,12 +2,8 @@ package pb
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -151,7 +147,7 @@ func HandlerShutdown(e *core.RequestEvent) error {
|
||||
|
||||
if err := asyncCall(e, func() *router.ApiError {
|
||||
if err := networking.ShutdownDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
logger.Error.Println(strings.ReplaceAll(err.Error(), "\n", ""))
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
@@ -216,97 +212,6 @@ type Nmaprun struct {
|
||||
} `xml:"host"`
|
||||
}
|
||||
|
||||
func HandlerScan(e *core.RequestEvent) error {
|
||||
// check if nmap installed
|
||||
nmap, err := exec.LookPath("nmap")
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// check if scan range is valid
|
||||
allPrivateSettings, err := e.App.FindAllRecords("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPrivate := allPrivateSettings[0]
|
||||
scanRange := settingsPrivate.GetString("scan_range")
|
||||
_, ipNet, err := net.ParseCIDR(scanRange)
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// run nmap
|
||||
timeout := os.Getenv("UPSNAP_SCAN_TIMEOUT")
|
||||
if timeout == "" {
|
||||
timeout = "500ms"
|
||||
}
|
||||
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", timeout)
|
||||
cmdOutput, err := cmd.Output()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// unmarshal xml
|
||||
nmapOutput := Nmaprun{}
|
||||
if err := xml.Unmarshal(cmdOutput, &nmapOutput); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
Name string `json:"name"`
|
||||
IP string `json:"ip"`
|
||||
MAC string `json:"mac"`
|
||||
MACVendor string `json:"mac_vendor"`
|
||||
}
|
||||
|
||||
// extract info from struct into data
|
||||
type Response struct {
|
||||
Netmask string `json:"netmask"`
|
||||
Devices []Device `json:"devices"`
|
||||
}
|
||||
res := Response{}
|
||||
var nm []string
|
||||
for _, octet := range ipNet.Mask {
|
||||
nm = append(nm, strconv.Itoa(int(octet)))
|
||||
}
|
||||
res.Netmask = strings.Join(nm, ".")
|
||||
|
||||
for _, host := range nmapOutput.Host {
|
||||
dev := Device{}
|
||||
for _, addr := range host.Address {
|
||||
if addr.Addrtype == "ipv4" {
|
||||
dev.IP = addr.Addr
|
||||
} else if addr.Addrtype == "mac" {
|
||||
dev.MAC = addr.Addr
|
||||
}
|
||||
if addr.Vendor != "" {
|
||||
dev.MACVendor = addr.Vendor
|
||||
} else {
|
||||
dev.MACVendor = "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
if dev.IP == "" || dev.MAC == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
names, err := net.LookupAddr(dev.IP)
|
||||
if err != nil || len(names) == 0 {
|
||||
dev.Name = dev.MACVendor
|
||||
} else {
|
||||
dev.Name = strings.TrimSuffix(names[0], ".")
|
||||
}
|
||||
|
||||
if dev.Name == "" && dev.MACVendor == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
res.Devices = append(res.Devices, dev)
|
||||
}
|
||||
|
||||
return e.JSON(http.StatusOK, res)
|
||||
}
|
||||
|
||||
func HandlerInitSuperuser(e *core.RequestEvent) error {
|
||||
superusersCollection, err := e.App.FindCollectionByNameOrId(core.CollectionNameSuperusers)
|
||||
if err != nil {
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//go:build linux
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"kernel.org/pub/linux/libs/security/libcap/cap"
|
||||
)
|
||||
|
||||
func HandlerScan(e *core.RequestEvent) error {
|
||||
// check if nmap installed
|
||||
nmap, err := exec.LookPath("nmap")
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// check if scan range is valid
|
||||
allPrivateSettings, err := e.App.FindAllRecords("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPrivate := allPrivateSettings[0]
|
||||
scanRange := settingsPrivate.GetString("scan_range")
|
||||
_, ipNet, err := net.ParseCIDR(scanRange)
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// run nmap
|
||||
timeout := os.Getenv("UPSNAP_SCAN_TIMEOUT")
|
||||
if timeout == "" {
|
||||
timeout = "500ms"
|
||||
}
|
||||
orig := cap.GetProc()
|
||||
defer orig.SetProc() // restore original caps on exit.
|
||||
|
||||
c, err := orig.Dup()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to dup existing capabilities: %v", err)
|
||||
}
|
||||
|
||||
if on, _ := c.GetFlag(cap.Permitted, cap.NET_RAW); !on {
|
||||
return fmt.Errorf("unable to get NET_RAW permissions")
|
||||
}
|
||||
|
||||
if err := c.SetFlag(cap.Effective, true, cap.NET_RAW); err != nil {
|
||||
return fmt.Errorf("unable to set NET_RAW capability effective")
|
||||
}
|
||||
|
||||
if err := c.SetFlag(cap.Inheritable, true, cap.NET_RAW); err != nil {
|
||||
return fmt.Errorf("unable to set NET_RAW capability inheritable")
|
||||
}
|
||||
|
||||
if err := c.SetProc(); err != nil {
|
||||
return fmt.Errorf("unable to raise NET_RAW capability")
|
||||
}
|
||||
|
||||
if err := cap.SetAmbient(true, cap.NET_RAW); err != nil {
|
||||
return fmt.Errorf("unable to set NET_RAW capability ambient")
|
||||
}
|
||||
|
||||
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", timeout, "--privileged")
|
||||
cmdOutput, err := cmd.Output()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// unmarshal xml
|
||||
nmapOutput := Nmaprun{}
|
||||
if err := xml.Unmarshal(cmdOutput, &nmapOutput); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
Name string `json:"name"`
|
||||
IP string `json:"ip"`
|
||||
MAC string `json:"mac"`
|
||||
MACVendor string `json:"mac_vendor"`
|
||||
}
|
||||
|
||||
// extract info from struct into data
|
||||
type Response struct {
|
||||
Netmask string `json:"netmask"`
|
||||
Devices []Device `json:"devices"`
|
||||
}
|
||||
res := Response{}
|
||||
var nm []string
|
||||
for _, octet := range ipNet.Mask {
|
||||
nm = append(nm, strconv.Itoa(int(octet)))
|
||||
}
|
||||
res.Netmask = strings.Join(nm, ".")
|
||||
|
||||
for _, host := range nmapOutput.Host {
|
||||
dev := Device{}
|
||||
for _, addr := range host.Address {
|
||||
if addr.Addrtype == "ipv4" {
|
||||
dev.IP = addr.Addr
|
||||
} else if addr.Addrtype == "mac" {
|
||||
dev.MAC = addr.Addr
|
||||
}
|
||||
if addr.Vendor != "" {
|
||||
dev.MACVendor = addr.Vendor
|
||||
} else {
|
||||
dev.MACVendor = "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
if dev.IP == "" || dev.MAC == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
names, err := net.LookupAddr(dev.IP)
|
||||
if err != nil || len(names) == 0 {
|
||||
dev.Name = dev.MACVendor
|
||||
} else {
|
||||
dev.Name = strings.TrimSuffix(names[0], ".")
|
||||
}
|
||||
|
||||
if dev.Name == "" && dev.MACVendor == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
res.Devices = append(res.Devices, dev)
|
||||
}
|
||||
|
||||
return e.JSON(http.StatusOK, res)
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
//go:build !linux
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
func HandlerScan(e *core.RequestEvent) error {
|
||||
// check if nmap installed
|
||||
nmap, err := exec.LookPath("nmap")
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// check if scan range is valid
|
||||
allPrivateSettings, err := e.App.FindAllRecords("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPrivate := allPrivateSettings[0]
|
||||
scanRange := settingsPrivate.GetString("scan_range")
|
||||
_, ipNet, err := net.ParseCIDR(scanRange)
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
// run nmap
|
||||
timeout := os.Getenv("UPSNAP_SCAN_TIMEOUT")
|
||||
if timeout == "" {
|
||||
timeout = "500ms"
|
||||
}
|
||||
cmd := exec.Command(nmap, "-sn", "-oX", "-", scanRange, "--host-timeout", timeout, "--privileged")
|
||||
cmdOutput, err := cmd.Output()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// unmarshal xml
|
||||
nmapOutput := Nmaprun{}
|
||||
if err := xml.Unmarshal(cmdOutput, &nmapOutput); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
type Device struct {
|
||||
Name string `json:"name"`
|
||||
IP string `json:"ip"`
|
||||
MAC string `json:"mac"`
|
||||
MACVendor string `json:"mac_vendor"`
|
||||
}
|
||||
|
||||
// extract info from struct into data
|
||||
type Response struct {
|
||||
Netmask string `json:"netmask"`
|
||||
Devices []Device `json:"devices"`
|
||||
}
|
||||
res := Response{}
|
||||
var nm []string
|
||||
for _, octet := range ipNet.Mask {
|
||||
nm = append(nm, strconv.Itoa(int(octet)))
|
||||
}
|
||||
res.Netmask = strings.Join(nm, ".")
|
||||
|
||||
for _, host := range nmapOutput.Host {
|
||||
dev := Device{}
|
||||
for _, addr := range host.Address {
|
||||
if addr.Addrtype == "ipv4" {
|
||||
dev.IP = addr.Addr
|
||||
} else if addr.Addrtype == "mac" {
|
||||
dev.MAC = addr.Addr
|
||||
}
|
||||
if addr.Vendor != "" {
|
||||
dev.MACVendor = addr.Vendor
|
||||
} else {
|
||||
dev.MACVendor = "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
if dev.IP == "" || dev.MAC == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
names, err := net.LookupAddr(dev.IP)
|
||||
if err != nil || len(names) == 0 {
|
||||
dev.Name = dev.MACVendor
|
||||
} else {
|
||||
dev.Name = strings.TrimSuffix(names[0], ".")
|
||||
}
|
||||
|
||||
if dev.Name == "" && dev.MACVendor == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
res.Devices = append(res.Devices, dev)
|
||||
}
|
||||
|
||||
return e.JSON(http.StatusOK, res)
|
||||
}
|
||||
@@ -7,6 +7,32 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tools/hook"
|
||||
)
|
||||
|
||||
func RequireScanDevicesPermission() *hook.Handler[*core.RequestEvent] {
|
||||
return &hook.Handler[*core.RequestEvent]{
|
||||
Func: func(e *core.RequestEvent) error {
|
||||
if e.HasSuperuserAuth() {
|
||||
return e.Next()
|
||||
}
|
||||
|
||||
user := e.Auth
|
||||
if user == nil {
|
||||
return apis.NewUnauthorizedError("The request requires superuser or record authorization token to be set.", nil)
|
||||
}
|
||||
|
||||
res, err := e.App.FindFirstRecordByFilter(
|
||||
"permissions",
|
||||
"user.id = {:userId} && create = true",
|
||||
dbx.Params{"userId": user.Id},
|
||||
)
|
||||
if res == nil || err != nil {
|
||||
return apis.NewForbiddenError("You are not allowed to perform this request.", nil)
|
||||
}
|
||||
|
||||
return e.Next()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func RequireUpSnapPermission() *hook.Handler[*core.RequestEvent] {
|
||||
return &hook.Handler[*core.RequestEvent]{
|
||||
Func: func(e *core.RequestEvent) error {
|
||||
|
||||
+1
-2
@@ -69,13 +69,12 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
// event hooks
|
||||
app.OnServe().BindFunc(func(se *core.ServeEvent) error {
|
||||
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())
|
||||
se.Router.GET("/api/upsnap/sleep/{id}", HandlerSleep).Bind(RequireUpSnapPermission())
|
||||
se.Router.GET("/api/upsnap/reboot/{id}", HandlerReboot).Bind(RequireUpSnapPermission())
|
||||
se.Router.GET("/api/upsnap/shutdown/{id}", HandlerShutdown).Bind(RequireUpSnapPermission())
|
||||
se.Router.GET("/api/upsnap/scan", HandlerScan).Bind(apis.RequireSuperuserAuth())
|
||||
se.Router.GET("/api/upsnap/scan", HandlerScan).Bind(RequireScanDevicesPermission())
|
||||
se.Router.POST("/api/upsnap/init-superuser", HandlerInitSuperuser) // https://github.com/pocketbase/pocketbase/discussions/6198
|
||||
se.Router.POST("/api/upsnap/validate-cron", HandlerValidateCron)
|
||||
se.Router.GET("/api/upsnap/manifest.webmanifest", HandlerWebsiteManifest)
|
||||
|
||||
+10
-2
@@ -1,8 +1,12 @@
|
||||
services:
|
||||
upsnap:
|
||||
cap_add:
|
||||
- NET_RAW # NET_RAW is required for privileged ping
|
||||
cap_drop:
|
||||
- ALL
|
||||
container_name: upsnap
|
||||
image: ghcr.io/seriousm4x/upsnap:5 # images are also available on docker hub: seriousm4x/upsnap:5
|
||||
network_mode: host
|
||||
network_mode: host # host is required for WOL magic packets
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/app/pb_data
|
||||
@@ -14,8 +18,12 @@ services:
|
||||
# - UPSNAP_INTERVAL=*/10 * * * * * # Sets the interval in which the devices are pinged
|
||||
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
|
||||
# - UPSNAP_SCAN_TIMEOUT=500ms # Scan timeout is nmap's --host-timeout value to wait for devices (https://nmap.org/book/man-performance.html)
|
||||
# - UPSNAP_PING_PRIVILEGED=true # Set to false if you don't have root user permissions
|
||||
# - UPSNAP_PING_PRIVILEGED=true # Default is true. Set to false for unprivileged ping
|
||||
# For Linux hosts, unprivileged pings REQUIRES the host to set 'sysctl net.ipv4.ping_group_range="0 2147483647"'
|
||||
# or another suitable value to grant the group access to send ping and WOL magic packets.
|
||||
# - UPSNAP_WEBSITE_TITLE=Custom name # Custom website title
|
||||
# security_opt:
|
||||
# - no-new-privileges=true
|
||||
# # dns is used for name resolution during network scan
|
||||
# dns:
|
||||
# - 192.18.0.1
|
||||
|
||||
+21
-22
@@ -15,29 +15,29 @@
|
||||
"machine-translate": "inlang machine translate --project project.inlang"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.4.1",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@inlang/cli": "^3.0.12",
|
||||
"@inlang/paraglide-js": "2.7.2",
|
||||
"@eslint/compat": "^2.0.3",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@inlang/cli": "^3.1.7",
|
||||
"@inlang/paraglide-js": "2.15.0",
|
||||
"@sveltejs/adapter-static": "^3.0.10",
|
||||
"@sveltejs/kit": "^2.49.3",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.1.1",
|
||||
"daisyui": "^5.5.14",
|
||||
"eslint": "^9.39.2",
|
||||
"@sveltejs/kit": "^2.55.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
||||
"daisyui": "^5.5.19",
|
||||
"eslint": "^10.0.3",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.13.1",
|
||||
"globals": "^16.5.0",
|
||||
"eslint-plugin-svelte": "^3.15.2",
|
||||
"globals": "^17.4.0",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.7.4",
|
||||
"prettier-plugin-svelte": "^3.4.1",
|
||||
"prettier": "^3.8.1",
|
||||
"prettier-plugin-svelte": "^3.5.1",
|
||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||
"svelte": "^5.46.1",
|
||||
"svelte-check": "^4.3.5",
|
||||
"tailwindcss": "^4.1.18",
|
||||
"svelte": "^5.54.0",
|
||||
"svelte-check": "^4.4.5",
|
||||
"tailwindcss": "^4.2.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.52.0",
|
||||
"vite": "^6.4.1"
|
||||
"typescript-eslint": "^8.57.1",
|
||||
"vite": "^7.3.1"
|
||||
},
|
||||
"type": "module",
|
||||
"lint-staged": {
|
||||
@@ -45,12 +45,11 @@
|
||||
"*.{js,css,md,svelte,scss}": "prettier --write --cache --cache-strategy content --ignore-path ../.gitignore ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
||||
"@tailwindcss/postcss": "^4.1.18",
|
||||
"cron-parser": "^5.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"cron-parser": "^5.5.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"pocketbase": "^0.26.5",
|
||||
"postcss": "^8.5.6",
|
||||
"pocketbase": "^0.26.8",
|
||||
"svelte-fa": "^4.0.4",
|
||||
"svelte-french-toast": "github:seriousm4x/svelte-french-toast#fix-72-build",
|
||||
"theme-change": "^2.5.0"
|
||||
|
||||
Generated
+826
-960
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {}
|
||||
}
|
||||
};
|
||||
@@ -1 +1,19 @@
|
||||
cache
|
||||
# IF GIT SHOWED THAT THIS FILE CHANGED
|
||||
#
|
||||
# 1. RUN THE FOLLOWING COMMAND
|
||||
#
|
||||
# ---
|
||||
# git rm --cached '**/*.inlang/.gitignore'
|
||||
# ---
|
||||
#
|
||||
# 2. COMMIT THE CHANGE
|
||||
#
|
||||
# ---
|
||||
# git commit -m "fix: remove tracked .gitignore from inlang project"
|
||||
# ---
|
||||
#
|
||||
# Inlang handles the gitignore itself starting with version ^2.5.
|
||||
#
|
||||
# everything is ignored except settings.json
|
||||
*
|
||||
!settings.json
|
||||
@@ -2,6 +2,7 @@
|
||||
"$schema": "https://inlang.com/schema/project-settings",
|
||||
"baseLocale": "en-US",
|
||||
"locales": [
|
||||
"ar-SA",
|
||||
"bg-BG",
|
||||
"cs-CZ",
|
||||
"de-DE",
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
<ul
|
||||
id="mobile-menu"
|
||||
tabindex="-1"
|
||||
class="menu dropdown-content rounded-box bg-base-200 z-[1] mt-3 w-max gap-1 p-2 shadow-sm"
|
||||
class="menu dropdown-content rounded-box bg-base-200 z-1 mt-3 w-max gap-1 p-2 shadow-sm"
|
||||
>
|
||||
{#if $settingsPub?.website_title}
|
||||
<div class="menu-title">
|
||||
@@ -259,7 +259,7 @@
|
||||
</label>
|
||||
<ul
|
||||
tabindex="-1"
|
||||
class="menu dropdown-content rounded-box bg-base-200 z-[1] mt-3 w-52 p-2 shadow"
|
||||
class="menu dropdown-content rounded-box bg-base-200 z-1 mt-3 w-52 p-2 shadow"
|
||||
>
|
||||
<li class="menu-title">
|
||||
{$pocketbase.authStore.isSuperuser
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
let replaceNetmaskCheckbox = false;
|
||||
let replaceNetmask = '';
|
||||
|
||||
let loading = true;
|
||||
|
||||
onMount(() => {
|
||||
if (!$settingsPriv) {
|
||||
$pocketbase
|
||||
@@ -40,6 +42,7 @@
|
||||
} else {
|
||||
scanRange = $settingsPriv.scan_range;
|
||||
}
|
||||
loading = false;
|
||||
});
|
||||
|
||||
function saveSettings() {
|
||||
@@ -118,7 +121,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $settingsPriv}
|
||||
{#if !loading}
|
||||
<div class="card bg-base-200 mt-6 w-full shadow-sm">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{m['device_tabs.1']()}</h2>
|
||||
@@ -126,36 +129,39 @@
|
||||
{m.device_network_scan_desc()}
|
||||
</p>
|
||||
<div class="flex flex-row flex-wrap items-end gap-4">
|
||||
<form
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault();
|
||||
saveSettings();
|
||||
}}
|
||||
>
|
||||
<fieldset class="fieldset p-0">
|
||||
<label class="floating-label mt-2">
|
||||
<span>{m.device_network_scan_ip_range()}</span>
|
||||
<div class="join max-w-xs">
|
||||
<input
|
||||
id="scan-range"
|
||||
class="input join-item w-full"
|
||||
type="text"
|
||||
placeholder="192.168.1.0/24"
|
||||
bind:value={scanRange}
|
||||
/>
|
||||
<button class="btn btn-neutral join-item" type="submit">{m.buttons_save()}</button>
|
||||
</div>
|
||||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
{#if $settingsPriv}
|
||||
<form
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault();
|
||||
saveSettings();
|
||||
}}
|
||||
>
|
||||
<fieldset class="fieldset p-0">
|
||||
<label class="floating-label mt-2">
|
||||
<span>{m.device_network_scan_ip_range()}</span>
|
||||
<div class="join max-w-xs">
|
||||
<input
|
||||
id="scan-range"
|
||||
class="input join-item w-full"
|
||||
type="text"
|
||||
placeholder="192.168.1.0/24"
|
||||
bind:value={scanRange}
|
||||
/>
|
||||
<button class="btn btn-neutral join-item" type="submit">{m.buttons_save()}</button
|
||||
>
|
||||
</div>
|
||||
</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
{/if}
|
||||
<div>
|
||||
<div>
|
||||
{#if !$settingsPriv.scan_range}
|
||||
{#if $settingsPriv && !$settingsPriv.scan_range}
|
||||
<button class="btn btn-error" disabled>
|
||||
<Fa icon={faX} />
|
||||
{m.device_network_scan_no_range()}
|
||||
</button>
|
||||
{:else if scanRange !== $settingsPriv.scan_range}
|
||||
{:else if $settingsPriv && scanRange !== $settingsPriv.scan_range}
|
||||
<button class="btn btn-error" disabled>
|
||||
<Fa icon={faX} />
|
||||
{m.device_network_scan_unsaved_changes()}
|
||||
@@ -175,7 +181,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{#if scanResponse.devices?.length > 0}
|
||||
{#each scanResponse.devices.sort( (a, b) => a.ip.localeCompare( b.ip, $localeStore, { numeric: true } ) ) as device, index (device.mac)}
|
||||
{#each scanResponse.devices.sort( (a, b) => a.ip.localeCompare( b.ip, $localeStore, { numeric: true } ) ) as device, index (device)}
|
||||
<div class="collapse-arrow bg-base-100 collapse">
|
||||
<input type="radio" name="scanned-devices" checked={index === 0} />
|
||||
<div class="collapse-title font-bold">
|
||||
@@ -214,15 +220,14 @@
|
||||
</div>
|
||||
{/each}
|
||||
<h2 class="card-title mt-4">{m.device_network_scan_add_all()}</h2>
|
||||
<div class="max-w-fit">
|
||||
<div class="flex max-w-fit flex-col gap-2">
|
||||
<label class="label cursor-pointer">
|
||||
<input type="checkbox" class="checkbox" bind:checked={replaceNetmaskCheckbox} />
|
||||
<span class="ms-2 text-wrap break-words">{m.device_network_scan_replace_netmask()}</span
|
||||
<span class="ms-2 text-wrap wrap-break-word"
|
||||
>{m.device_network_scan_replace_netmask()}</span
|
||||
>
|
||||
</label>
|
||||
</div>
|
||||
{#if replaceNetmaskCheckbox}
|
||||
<div class="max-w-fit">
|
||||
{#if replaceNetmaskCheckbox}
|
||||
<label class="label cursor-pointer" for="replaceNetmaskInput">
|
||||
<span class="ms-2">{m.device_network_scan_new_netmask()}</span>
|
||||
</label>
|
||||
@@ -233,13 +238,11 @@
|
||||
placeholder="255.255.255.0"
|
||||
bind:value={replaceNetmask}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if scanResponse.devices.find((dev) => dev.name === 'Unknown')}
|
||||
<div class="max-w-fit">
|
||||
{/if}
|
||||
{#if scanResponse.devices.find((dev) => dev.name === 'Unknown')}
|
||||
<label class="label cursor-pointer">
|
||||
<input type="checkbox" class="checkbox" bind:checked={addAllCheckbox} />
|
||||
<span class="ms-2 text-wrap break-words"
|
||||
<span class="ms-2 text-wrap wrap-break-word"
|
||||
>{m.device_network_scan_include_unknown()}</span
|
||||
>
|
||||
</label>
|
||||
@@ -264,9 +267,7 @@
|
||||
).length})
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="max-w-fit">
|
||||
{:else}
|
||||
<button
|
||||
class="btn btn-success"
|
||||
onclick={() => addAll()}
|
||||
@@ -275,8 +276,8 @@
|
||||
<Fa icon={faPlus} />
|
||||
{m.device_network_scan_add_all()} ({scanResponse.devices.length})
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { fly } from 'svelte/transition';
|
||||
export let url: URL;
|
||||
let { url, children } = $props();
|
||||
</script>
|
||||
|
||||
{#key url}
|
||||
<div in:fly={{ y: 50, duration: 300 }}>
|
||||
<slot />
|
||||
{@render children()}
|
||||
</div>
|
||||
{/key}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getLocale } from '$lib/paraglide/runtime';
|
||||
import type { Locale } from 'date-fns';
|
||||
import { arSA } from 'date-fns/locale/ar-SA';
|
||||
import { bg } from 'date-fns/locale/bg';
|
||||
import { cs } from 'date-fns/locale/cs';
|
||||
import { de } from 'date-fns/locale/de';
|
||||
@@ -20,7 +21,6 @@ import { uk } from 'date-fns/locale/uk';
|
||||
import { vi } from 'date-fns/locale/vi';
|
||||
import { zhCN } from 'date-fns/locale/zh-CN';
|
||||
import { zhTW } from 'date-fns/locale/zh-TW';
|
||||
|
||||
import { writable, type Writable } from 'svelte/store';
|
||||
|
||||
export const localeStore = writable(getLocale());
|
||||
@@ -28,6 +28,9 @@ export const dateFnsLocale: Writable<Locale> = writable(enUS);
|
||||
|
||||
localeStore.subscribe((l: string) => {
|
||||
switch (l) {
|
||||
case 'ar-SA':
|
||||
dateFnsLocale.set(arSA);
|
||||
break;
|
||||
case 'bg-BG':
|
||||
dateFnsLocale.set(bg);
|
||||
break;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import Navbar from '$lib/components/Navbar.svelte';
|
||||
import Transition from '$lib/components/Transition.svelte';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import { localeStore } from '$lib/stores/locale';
|
||||
import { backendUrl, permission, pocketbase } from '$lib/stores/pocketbase';
|
||||
import { settingsPub } from '$lib/stores/settings';
|
||||
import type { Permission } from '$lib/types/permission';
|
||||
@@ -12,11 +13,28 @@
|
||||
import { onMount } from 'svelte';
|
||||
import toast, { Toaster, type ToastOptions } from 'svelte-french-toast';
|
||||
import '../app.css';
|
||||
|
||||
let { children } = $props();
|
||||
let authIsValid = $state(false);
|
||||
|
||||
const toastOptions: ToastOptions = {
|
||||
duration: 5000
|
||||
};
|
||||
|
||||
let authIsValid = false;
|
||||
// list of RTL languages, more can be added if needed
|
||||
const RTL_LANGS = ['ar-SA'];
|
||||
|
||||
function setHTMLdir(lang: string) {
|
||||
if (RTL_LANGS.includes(lang)) {
|
||||
document.documentElement.setAttribute('dir', 'rtl');
|
||||
} else {
|
||||
document.documentElement.setAttribute('dir', 'ltr');
|
||||
}
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
setHTMLdir($localeStore);
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
$pocketbase.authStore.onChange(() => {
|
||||
@@ -48,7 +66,7 @@
|
||||
}
|
||||
|
||||
// redirect to welcome page if setup is not completed
|
||||
if ($settingsPub.setup_completed === false && page.url.pathname !== '/welcome') {
|
||||
if ($settingsPub.setup_completed === false && page.url.pathname !== '/welcome/') {
|
||||
$pocketbase.authStore.clear();
|
||||
goto(resolve('/welcome'));
|
||||
return;
|
||||
@@ -112,6 +130,6 @@
|
||||
|
||||
<Transition url={page.url}>
|
||||
<div class="container mx-auto mb-4 p-2">
|
||||
<slot />
|
||||
{@render children()}
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
devices: Device[];
|
||||
}[] = $derived([]);
|
||||
|
||||
const isMac = /Mac|iPhone|iPad/.test(navigator.userAgent);
|
||||
const isMac = browser && /Mac|iPhone|iPad/.test(navigator.userAgent);
|
||||
const gridClass = 'grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-4';
|
||||
|
||||
if (browser) {
|
||||
@@ -150,12 +150,12 @@
|
||||
</label>
|
||||
<div class="join ms-auto">
|
||||
{#if orderExpanded}
|
||||
<button class="btn join-item !outline-0" onclick={() => (orderByGroups = !orderByGroups)}>
|
||||
<button class="btn join-item outline-0!" onclick={() => (orderByGroups = !orderByGroups)}>
|
||||
{m.home_order_groups()}
|
||||
<input type="checkbox" class="checkbox" checked={orderByGroups} />
|
||||
</button>
|
||||
<input
|
||||
class="btn join-item !outline-0"
|
||||
class="btn join-item outline-0!"
|
||||
type="radio"
|
||||
name="order"
|
||||
aria-label={m.home_order_name()}
|
||||
@@ -163,7 +163,7 @@
|
||||
value="name"
|
||||
/>
|
||||
<input
|
||||
class="btn join-item !outline-0"
|
||||
class="btn join-item outline-0!"
|
||||
type="radio"
|
||||
name="order"
|
||||
aria-label={m.home_order_ip()}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
// locales
|
||||
const languageEmojis = {
|
||||
'ar-SA': '🇸🇦',
|
||||
'bg-BG': '🇧🇬',
|
||||
'cs-CZ': '🇨🇿',
|
||||
'de-DE': '🇩🇪',
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
name: 'scan',
|
||||
ll_name: m['device_tabs.1'](),
|
||||
icon: faBinoculars,
|
||||
show: $pocketbase.authStore.isSuperuser
|
||||
show: true
|
||||
}
|
||||
];
|
||||
</script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { asset, resolve } from '$app/paths';
|
||||
import { toggleVisibility } from '$lib/helpers/forms';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { backendUrl, pocketbase } from '$lib/stores/pocketbase';
|
||||
@@ -68,7 +68,7 @@
|
||||
<img
|
||||
src={$settingsPub?.id && $settingsPub?.favicon
|
||||
? `${backendUrl}api/files/settings_public/${$settingsPub?.id}/${$settingsPub?.favicon}`
|
||||
: '/gopher.svg'}
|
||||
: asset('/gopher.svg')}
|
||||
alt={$settingsPub?.website_title ? $settingsPub?.website_title : 'Gopher'}
|
||||
/>
|
||||
</figure>
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
<div class="font-bold">{m.users_delete()}</div>
|
||||
<div class="font-bold">{m.users_power()}</div>
|
||||
{#each devices as device (device.id)}
|
||||
<hr class="border-neutral col-span-full w-full border-b-1 opacity-30" />
|
||||
<hr class="border-neutral col-span-full w-full border-b opacity-30" />
|
||||
{#each permissions.filter((perm) => perm.user === user.id) as permission (permission.id)}
|
||||
<div
|
||||
class="col-span-full flex flex-row flex-wrap gap-2 place-self-start break-all md:col-span-1"
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"account_account_type_admin": "مسؤول",
|
||||
"account_account_type_user": "مستخدم",
|
||||
"account_avatar_title": "صورة",
|
||||
"account_change_password_body": "بعد تعديل كلمة المرور، يجب عليك تسجيل الدخول مرة أخرى",
|
||||
"account_change_password_confirm": "تأكيد كلمة المرور",
|
||||
"account_change_password_label": "كلمة المرور القديمة",
|
||||
"account_change_password_new": "كلمة المرور الجديدة",
|
||||
"account_change_password_title": "تغيير كلمة المرور",
|
||||
"account_language_title": "اللغة",
|
||||
"account_page_title": "الحساب",
|
||||
"buttons_add": "إضافة",
|
||||
"buttons_cancel": "إلغاء",
|
||||
"buttons_change": "تغيير",
|
||||
"buttons_confirm": "تأكيد",
|
||||
"buttons_delete": "حذف",
|
||||
"buttons_reset": "إعادة تعيين",
|
||||
"buttons_save": "حفظ",
|
||||
"device_card_btn_more_edit": "تعديل",
|
||||
"device_card_btn_more_reboot": "إعادة تشغيل",
|
||||
"device_card_btn_more_sleep": "سكون",
|
||||
"device_card_btn_more": "المزيد",
|
||||
"device_card_nic_tooltip_pending": "قيد الانتظار",
|
||||
"device_card_nic_tooltip_power_no_permission": "لا توجد صلاحية لتشغيل هذا الجهاز",
|
||||
"device_card_nic_tooltip_power": "تشغيل",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "لم يتم تعيين أمر الإيقاف",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "لا توجد صلاحية لإيقاف هذا الجهاز",
|
||||
"device_card_nic_tooltip_shutdown": "إيقاف التشغيل",
|
||||
"device_card_password": "كلمة المرور",
|
||||
"device_card_tooltip_last_status_change": "آخر تغيير في الحالة",
|
||||
"device_card_tooltip_shutdown_cron": "جدولة الإيقاف",
|
||||
"device_card_tooltip_wake_cron": "جدولة التشغيل",
|
||||
"device_card_tooltip_wake_password": "كلمة مرور التشغيل",
|
||||
"device_general_description_placeholder": "وصف للجهاز",
|
||||
"device_general_description": "الوصف",
|
||||
"device_general_ip": "عنوان IP",
|
||||
"device_general_mac": "عنوان Mac",
|
||||
"device_general_name": "الاسم",
|
||||
"device_general_netmask": "قناع الشبكة",
|
||||
"device_general_required_field": "حقل مطلوب",
|
||||
"device_general": "عام",
|
||||
"device_groups_desc": "يمكنك إضافة الأجهزة إلى مجموعة لفرزها حسب المجموعة في لوحة التحكم.",
|
||||
"device_groups_placeholder": "مثلاً 'القبو' أو 'المكتب'",
|
||||
"device_groups": "المجموعات",
|
||||
"device_link_desc": "يجعل اسم جهازك رابطاً قابلاً للنقر، مثالي للربط بلوحة تحكم على سبيل المثال.",
|
||||
"device_link_open_new_tab": "تبويب جديد",
|
||||
"device_link_open_no": "لا",
|
||||
"device_link_open_same_tab": "نفس التبويب",
|
||||
"device_link_open": "فتح الرابط تلقائياً",
|
||||
"device_link": "الرابط",
|
||||
"device_modal_confirm_shutdown_desc": "يرجى التأكيد لإيقاف {device}.",
|
||||
"device_modal_confirm_shutdown_title": "إيقاف {device}؟",
|
||||
"device_modal_confirm_wake_desc": "يرجى التأكيد لتشغيل {device}.",
|
||||
"device_modal_confirm_wake_title": "تشغيل {device}؟",
|
||||
"device_network_scan_add_all": "إضافة جميع الأجهزة",
|
||||
"device_network_scan_desc": "فحص شبكتك تلقائياً للعثور على الأجهزة. لكي يعمل هذا، تحتاج إلى تشغيل UpSnap كمسؤول وتثبيت nmap وإتاحته في $PATH (بالنسبة لمستخدمي Docker، هذا متوفر بالفعل ولا تحتاج لفعل أي شيء). قد يستغرق الفحص بضع ثوانٍ.",
|
||||
"device_network_scan_include_unknown": "تضمين الأجهزة التي اسمها \"Unknown\"",
|
||||
"device_network_scan_ip_range": "نطاق IP",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_mac_vendor": "جهة تصنيع الـ Mac:",
|
||||
"device_network_scan_mac": "Mac:",
|
||||
"device_network_scan_netmask": "قناع الشبكة:",
|
||||
"device_network_scan_new_netmask": "قناع شبكة جديد",
|
||||
"device_network_scan_no_range": "لا يوجد نطاق فحص",
|
||||
"device_network_scan_range_saved": "تم حفظ نطاق الفحص",
|
||||
"device_network_scan_replace_netmask": "استبدال قناع الشبكة لجميع الأجهزة؟",
|
||||
"device_network_scan_running": "الفحص قيد التشغيل",
|
||||
"device_network_scan_unsaved_changes": "تغييرات غير محفوظة",
|
||||
"device_network_scan": "فحص",
|
||||
"device_page_title": "جهاز جديد",
|
||||
"device_password_desc": "بعض بطاقات الشبكة لديها خيار تعيين كلمة مرور لـ Magic Packets، تسمى أيضاً <span class=\"badge\">SecureON</span>. يمكن أن تكون كلمة المرور 0 أو 4 أو 6 أحرف فقط.",
|
||||
"device_password": "كلمة المرور",
|
||||
"device_ping_cmd": "أمر ping مخصص",
|
||||
"device_ping_desc": "يمكنك استخدام أمر shell مخصص لمعرفة ما إذا كان الجهاز قيد التشغيل. يجب أن يُرجع الأمر رمز خروج <span class=\"badge\">0</span> للإشارة إلى أن الجهاز قيد التشغيل، أي رمز خروج آخر سيحدد الجهاز على أنه متوقف.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports_add_new": "إضافة منفذ جديد",
|
||||
"device_ports_desc": "يمكن لـ UpSnap أيضاً التحقق مما إذا كانت المنافذ المحددة مفتوحة.",
|
||||
"device_ports_name": "الاسم",
|
||||
"device_ports_number": "الرقم",
|
||||
"device_ports": "المنافذ",
|
||||
"device_require_confirmation": "يتطلب تأكيد",
|
||||
"device_shutdown_cmd": "أمر الإيقاف",
|
||||
"device_shutdown_cron_desc": "تماماً مثل تعيين جدولة لتشغيل الجهاز، يمكنك أيضاً جدولة مهمة لإيقاف هذا الجهاز.",
|
||||
"device_shutdown_cron_enable": "تفعيل جدولة الإيقاف",
|
||||
"device_shutdown_cron": "جدولة الإيقاف",
|
||||
"device_shutdown_desc": "سيتم تشغيل <strong>أمر shell</strong> هذا داخل الحاوية الخاصة بك (إذا كنت تستخدم Docker) أو على المضيف الخاص بك (إذا كنت تستخدم الملف الثنائي). للتحقق من أنه يعمل، يمكنك تشغيل الأمر داخل الحاوية أو على shell المضيف أولاً. الأوامر الشائعة هي <span class=\"badge\">net rpc</span> لـ Windows، <span class=\"badge\">sshpass</span> لـ Linux أو <span class=\"badge\">curl</span> بشكل عام لإجراء طلبات الويب.",
|
||||
"device_shutdown_examples_linux": "إيقاف جهاز Linux عن بُعد:",
|
||||
"device_shutdown_examples_windows": "إيقاف جهاز Windows عن بُعد:",
|
||||
"device_shutdown_examples": "أمثلة:",
|
||||
"device_shutdown_timeout": "مهلة الإيقاف (بالثواني)",
|
||||
"device_shutdown": "الإيقاف",
|
||||
"device_sol_authorization": "التفويض",
|
||||
"device_sol_desc1": "يمكنك وضع الأجهزة في وضع السكون باستخدام أداة <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a>. وهي أداة خارجية تعمل على الأجهزة التي تريد التحكم بها وتوفر نقطة نهاية REST. للمزيد، راجع قسم <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">الاستخدام</a>.",
|
||||
"device_sol_desc2": "تم تكوين SOL لإرسال الطلبات عبر HTTP بدلاً من UDP لتمكين التفويض وجعل الطلبات أكثر موثوقية.",
|
||||
"device_sol_desc3": "لذلك، يرجى التأكد من تضمين <span class=\"badge\">HTTP:<YOURPORT></span> في قسم <span class=\"badge\">Listeners</span> من <a href=\"https://github.com/SR-G/sleep-on-lan#configuration\" class=\"link\" target=\"_blank\">تكوين SOL</a>.",
|
||||
"device_sol_enable": "تفعيل Sleep-On-LAN",
|
||||
"device_sol_password": "كلمة مرور SOL",
|
||||
"device_sol_port": "منفذ SOL",
|
||||
"device_sol_user": "مستخدم SOL",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_tabs.0": "يدوي",
|
||||
"device_tabs.1": "فحص الشبكة",
|
||||
"device_wake_cmd": "أمر تشغيل مخصص",
|
||||
"device_wake_cron_enable": "تفعيل جدولة التشغيل",
|
||||
"device_wake_cron": "جدولة التشغيل",
|
||||
"device_wake_desc": "يمكنك تشغيل هذا الجهاز باستخدام مهمة مجدولة.",
|
||||
"device_wake_timeout": "مهلة التشغيل (بالثواني)",
|
||||
"device_wake": "التشغيل",
|
||||
"home_add_first_device": "أضف جهازك الأول",
|
||||
"home_grant_permissions": "يرجى الطلب من المسؤول منحك صلاحيات للأجهزة الموجودة أو لإنشاء أجهزة جديدة.",
|
||||
"home_no_devices": "لا توجد أجهزة هنا.",
|
||||
"home_order_groups": "المجموعات",
|
||||
"home_order_ip": "IP",
|
||||
"home_order_name": "الاسم",
|
||||
"home_order_tooltip": "الترتيب",
|
||||
"home_page_title": "الرئيسية",
|
||||
"home_search_placeholder": "البحث عن الأجهزة",
|
||||
"home_wake_group": "تشغيل المجموعة",
|
||||
"login_btn_login": "تسجيل الدخول",
|
||||
"login_btn_more": "المزيد",
|
||||
"login_email_label": "البريد الإلكتروني أو اسم المستخدم:",
|
||||
"login_menu_title_auth_providers": "موفرو مصادقة آخرون",
|
||||
"login_password_label": "كلمة المرور:",
|
||||
"login_welcome": "مرحباً",
|
||||
"navbar_edit_account": "تعديل الحساب",
|
||||
"navbar_logout": "تسجيل الخروج",
|
||||
"navbar_new": "جديد",
|
||||
"navbar_theme": "المظهر",
|
||||
"settings_icon_desc": "تعيين أيقونة مفضلة مخصصة. أنواع الملفات المدعومة هي:",
|
||||
"settings_icon_title": "الأيقونة",
|
||||
"settings_invalid_cron": "❌ صيغة cron غير صالحة",
|
||||
"settings_lazy_ping_desc": "عندما يتم تشغيل الـ ping خامل سيقوم UpSnap بفحص الأجهزة فقط إذا كان هناك مستخدم نشط يزور الموقع. إذا تم إيقاف تشغيله، سيقوم UpSnap دائماً بفحص الأجهزة.",
|
||||
"settings_lazy_ping_enable": "تفعيل",
|
||||
"settings_lazy_ping_title": "Ping خامل",
|
||||
"settings_page_title": "الإعدادات",
|
||||
"settings_ping_interval_desc1": "يعين الفاصل الزمني الذي يتم فيه فحص الأجهزة. اتركه فارغاً لاستخدام القيمة الافتراضية <span class=\"badge\">*/3 * * * * *</span>.",
|
||||
"settings_ping_interval_desc2": "تعرف على المزيد حول الصيغة الصحيحة لـ cron على <a class=\"link\" href=\"https://en.wikipedia.org/wiki/Cron\" target=\"_blank\">ويكيبيديا</a> أو راجع <a class=\"link\" href=\"https://github.com/harrisiirak/cron-parser\" target=\"_blank\">توثيق الحزمة</a>.",
|
||||
"settings_ping_interval_title": "فاصل زمني للـ Ping",
|
||||
"settings_upsnap_version": "إصدار UpSnap",
|
||||
"settings_website_title_desc": "يعين عنوان الموقع وفي تبويب المتصفح.",
|
||||
"settings_website_title_title": "عنوان الموقع",
|
||||
"toasts_admin_saved": "تم حفظ المسؤول",
|
||||
"toasts_device_created": "تم إنشاء {device}",
|
||||
"toasts_device_deleted": "تم حذف {device}",
|
||||
"toasts_device_updated": "تم تحديث {device}",
|
||||
"toasts_devices_created_multiple": "تم إنشاء {count} جهاز",
|
||||
"toasts_group_created": "تم إنشاء المجموعة {group}",
|
||||
"toasts_group_deleted": "تم حذف المجموعة {group}",
|
||||
"toasts_no_permission": "ليس لديك صلاحية لزيارة {url}",
|
||||
"toasts_password_changed": "تم تغيير كلمة المرور. يرجى تسجيل الدخول مرة أخرى.",
|
||||
"toasts_passwords_missmatch": "كلمات المرور غير متطابقة",
|
||||
"toasts_permissions_created": "تم إنشاء صلاحيات لـ {username}",
|
||||
"toasts_permissions_deleted": "تم حذف صلاحيات {username}",
|
||||
"toasts_permissions_updated_personal": "تم تحديث صلاحياتك",
|
||||
"toasts_permissions_updated": "تم تحديث صلاحيات {username}",
|
||||
"toasts_settings_saved": "تم حفظ الإعدادات",
|
||||
"toasts_user_created": "تم إنشاء المستخدم {username}",
|
||||
"toasts_user_deleted": "تم حذف المستخدم {username}",
|
||||
"toasts_user_saved": "تم حفظ المستخدم",
|
||||
"users_allow_create_devices": "السماح لـ {username} بإنشاء أجهزة جديدة وتعديل مجموعات الأجهزة",
|
||||
"users_confirm_delete_desc": "هل أنت متأكد من حذف {username}؟",
|
||||
"users_confirm_delete_title": "تأكيد الحذف",
|
||||
"users_create_new_device": "إنشاء جهاز جديد",
|
||||
"users_create_new_user": "إنشاء مستخدم جديد",
|
||||
"users_delete": "حذف",
|
||||
"users_device_permissions": "صلاحيات الأجهزة",
|
||||
"users_page_title": "المستخدمون",
|
||||
"users_password_confirm": "تأكيد كلمة المرور",
|
||||
"users_password": "كلمة المرور",
|
||||
"users_power": "التشغيل",
|
||||
"users_read": "قراءة",
|
||||
"users_required_field": "حقل مطلوب",
|
||||
"users_toggle": "تبديل",
|
||||
"users_update": "تحديث",
|
||||
"users_username": "اسم المستخدم",
|
||||
"welcome_not_expected_back": "العودة",
|
||||
"welcome_not_expected_desc": "لقد انتهيت بالفعل من الإعداد! لا يوجد شيء للقيام به.",
|
||||
"welcome_not_expected_title": "لم أتوقع رؤيتك هنا! 🧐",
|
||||
"welcome_progress_step1": "مرحباً",
|
||||
"welcome_progress_step2": "إنشاء حساب",
|
||||
"welcome_progress_step3": "تم",
|
||||
"welcome_step1_page_title": "مرحباً بك في UpSnap 🥳",
|
||||
"welcome_step1_setup_btn_next": "التالي",
|
||||
"welcome_step1_setup_desc": "يرجى إكمال الخطوات التالية لإنهاء الإعداد.",
|
||||
"welcome_step2_btn_create": "إنشاء",
|
||||
"welcome_step2_label_email": "البريد الإلكتروني:",
|
||||
"welcome_step2_label_min_chars": "10 أحرف كحد أدنى",
|
||||
"welcome_step2_label_password_confirm": "تأكيد كلمة المرور:",
|
||||
"welcome_step2_label_password": "كلمة المرور:",
|
||||
"welcome_step2_page_title": "إنشاء حساب مسؤول",
|
||||
"welcome_step3_btn_done": "لنبدأ!",
|
||||
"welcome_step3_page_desc": "تابع وأضف بعض الأجهزة إلى لوحة التحكم الخاصة بك.",
|
||||
"welcome_step3_page_title": "كل شيء جاهز! 🎉"
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
import { paraglideVitePlugin } from '@inlang/paraglide-js';
|
||||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
tailwindcss(),
|
||||
paraglideVitePlugin({ project: './project.inlang', outdir: './src/lib/paraglide' }),
|
||||
sveltekit()
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user