mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-11-27 12:21:56 +00:00
Compare commits
387 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14b9e031d5 | |||
| 523b7f9846 | |||
| 5018b01542 | |||
| 40c97359ae | |||
| 6a8bbb4525 | |||
| 66ce01cb40 | |||
| 5435d914b3 | |||
| fc4e34da61 | |||
| 730873a347 | |||
| 9f05b1c134 | |||
| 2c244beaaa | |||
| c5d33fdae8 | |||
| b17b09109f | |||
| 0a798d6e94 | |||
| aee5c8c3c7 | |||
| 7045f74d77 | |||
| b3c4b376a0 | |||
| 7bbe114407 | |||
| 710329e8ab | |||
| df7a577db2 | |||
| d8eafbc123 | |||
| 11bdb8ad36 | |||
| 9057fa710b | |||
| b5fd864320 | |||
| 297518f008 | |||
| e3c7342932 | |||
| 89977debc5 | |||
| 391b218fe5 | |||
| 3614f3654b | |||
| c4cf006832 | |||
| 0834d0089b | |||
| b2c39ddbb1 | |||
| 66fe9109bb | |||
| f2f7655a44 | |||
| 8f52541fe7 | |||
| a4c0378acb | |||
| f8c9cd8934 | |||
| b9ff66a0aa | |||
| 242cfb4baf | |||
| 24bdf6776d | |||
| 66ba9d94f4 | |||
| 92f9e295d5 | |||
| 74633e7f24 | |||
| 43f3f65d65 | |||
| dfaf0eec59 | |||
| 8b08585ced | |||
| 7b8bcfa296 | |||
| 19daaf803f | |||
| 1a60020a1a | |||
| 9494c34598 | |||
| 6aa2345344 | |||
| 91fe0740ea | |||
| 6df1205aff | |||
| cc605acc83 | |||
| 24e218b334 | |||
| aabd8c165c | |||
| b297f3a887 | |||
| af655d3621 | |||
| 65d6e9fa86 | |||
| 6d53e9e197 | |||
| 6caddf25d0 | |||
| f7dc0b2113 | |||
| 314d338d08 | |||
| d8bdab2d2e | |||
| 95d722ba56 | |||
| 59b1723b1c | |||
| 49d4109f1b | |||
| 8d461e0cc7 | |||
| b00f3a1c72 | |||
| 4c03494807 | |||
| 4610b54c93 | |||
| 105ae4f6bc | |||
| 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 | |||
| 7277f39f12 | |||
| 4bfc0576ee | |||
| d18b54e7b6 | |||
| 212e1b6da6 | |||
| a85a7def6b | |||
| 61da5f5bf6 | |||
| c75679f238 | |||
| 8714f937d9 | |||
| d1c6ee5b11 | |||
| 341d6b712c | |||
| dbcdd2b56f | |||
| 3d68442ad6 | |||
| dd9a00987c | |||
| c7f15d3dcd | |||
| 326cc1507c | |||
| 1cbbe9b3d7 | |||
| c2c7b3cbcc | |||
| 258d4d6aa3 | |||
| d3c0247abe | |||
| d3a4b7c6c3 | |||
| 76cf5fb028 | |||
| aba6615adc | |||
| 9f75e42a02 | |||
| 3484bddb92 | |||
| 3c9e3e129a | |||
| 6465130d6b | |||
| 609b5e2671 | |||
| 2a738cda87 | |||
| 4f6a9020a4 | |||
| 0f290f8572 | |||
| d1715b5d18 | |||
| 98081bde9e | |||
| 51498f7ea0 | |||
| af28d0b0f9 | |||
| d6e47b1264 | |||
| 3d3a536752 | |||
| 17736369d3 | |||
| c670ff9099 | |||
| 5b6dfffc22 | |||
| 28d2db9b5e | |||
| 1a8ee6bb07 | |||
| 451dc1d566 | |||
| 178f34bfdc | |||
| 636da1998a | |||
| 3c48888964 | |||
| ed6062e8db | |||
| 12b294a900 | |||
| cc4bae80ae | |||
| c6983d8ca3 | |||
| 846a530212 | |||
| bc27081b94 | |||
| c72d63e01c | |||
| c775ca2949 | |||
| 7d6d60a227 | |||
| 9300d66b78 | |||
| e94c1012ae | |||
| b29ad9ba1b | |||
| 4583e8ae3b | |||
| 6ce4dbe76f | |||
| 8a0c2ea29a | |||
| 747859d05b | |||
| a5a22c4020 | |||
| 5cbda84c37 | |||
| 26e573a0f5 | |||
| 6357ada980 | |||
| 309813bdff | |||
| fcb5e037ac | |||
| 88db4cf158 | |||
| fc4807b7f3 | |||
| 83ae5141bc | |||
| 153fe53ac6 | |||
| 4ded3eb8ab | |||
| 1b030fb2a0 | |||
| 731266a72a | |||
| 0813faa233 | |||
| 1b684936d5 | |||
| 057f5e4770 | |||
| 583f031748 | |||
| 5157ff4f48 | |||
| ddd52f2ac0 | |||
| 284c6a83b6 | |||
| 385ca62eb3 | |||
| c273370819 | |||
| 78cad054e6 | |||
| aa3574281b | |||
| 387ff4c4c2 | |||
| 9e6ecf1ed3 | |||
| 633b08f096 | |||
| 4d20cc8ab3 | |||
| 0cf7ee5b81 | |||
| fe67763712 | |||
| 5f1f7c528e | |||
| 30c7daddf1 | |||
| 84678ed835 | |||
| 489a309bd3 | |||
| 453a352bc2 | |||
| 2c4a67413d | |||
| 934d9556d0 | |||
| 61f4616157 | |||
| f20093aaae | |||
| 97fdaa3fbb | |||
| 5bd66ff6f2 | |||
| 5f51ba02e9 | |||
| 12ff07d022 | |||
| 63417cbf01 | |||
| 354915eff2 | |||
| 85b37bf623 | |||
| b98ce71293 | |||
| 0ef1f5144d | |||
| b82614a759 | |||
| 1accda28f7 | |||
| a2e1c810a1 | |||
| d223200ac4 | |||
| 702d03bfcd | |||
| 9c6213acdc | |||
| c736561fab | |||
| 9e8983d961 | |||
| 99a13af022 | |||
| 345a8c56e7 | |||
| f0edf53a68 | |||
| ff36399ce4 | |||
| bbbaadac62 | |||
| 862741787d | |||
| 78060b72dd | |||
| 08879bb179 | |||
| 9fcede20c1 | |||
| 3acac952c1 | |||
| f85f1e181d | |||
| 43fad60b15 | |||
| 50a4da0516 | |||
| d951c9a4d6 | |||
| 6ae38f578f | |||
| ddab4a7db0 | |||
| 29c5850327 | |||
| 23e9206080 | |||
| 281aff7760 | |||
| 9a3c7d1611 | |||
| ebe8aa67f2 | |||
| 8b34ef8828 | |||
| c0d655f1c4 | |||
| 264356a298 | |||
| 57c5591e85 | |||
| 090b153381 | |||
| 413c667d2a | |||
| 51e375f2a0 | |||
| 6fd6231ad4 | |||
| a3969176bd | |||
| a4904e78d0 | |||
| 7c98f8116e | |||
| dd0bfbf46f | |||
| f873772351 | |||
| f079f01a46 | |||
| 5e9387a259 | |||
| 30913ebecd | |||
| 74830115fb | |||
| 64e672315a | |||
| 3fc0780b0d | |||
| 423c8afc24 | |||
| 2fee69ea2f | |||
| 206e9e0959 | |||
| ee7cf4e59e | |||
| c92ea013a9 | |||
| 8a28d138d9 | |||
| e5d91d7cc9 | |||
| 718be00850 | |||
| c432008deb | |||
| 935e2fbf61 | |||
| 8a009ce225 | |||
| 735b79e9a2 | |||
| d9e802cf73 | |||
| 97438e945e | |||
| 3b135e0982 | |||
| 1380281bfe | |||
| fad4d75ce2 | |||
| 6afa5f28ce | |||
| e87a930ccc | |||
| 45b6097a2f | |||
| abd8a63dc7 | |||
| 8f5d004647 | |||
| 071d964e3f | |||
| e98c384520 | |||
| 16e33793ef | |||
| 285c745ca4 | |||
| eb5e3e9149 |
@@ -1,30 +0,0 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: gomod
|
||||
directory: "/backend"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
commit-message:
|
||||
prefix: go-dep
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types: ["version-update:semver-major"]
|
||||
- package-ecosystem: npm
|
||||
directory: "/frontend"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
commit-message:
|
||||
prefix: npm-dep
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types: ["version-update:semver-major"]
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
commit-message:
|
||||
prefix: gh-action
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
codeberg:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: pixta-dev/repository-mirroring-action@v1
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
name: dependabot automerge
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
dependabot:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||
steps:
|
||||
- name: Dependabot metadata
|
||||
id: metadata
|
||||
uses: dependabot/fetch-metadata@v2
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: Enable auto-merge for Dependabot PRs
|
||||
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} || ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
|
||||
run: gh pr merge --auto --rebase "$PR_URL"
|
||||
env:
|
||||
PR_URL: ${{github.event.pull_request.html_url}}
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
needs: check-runner
|
||||
runs-on: ${{ needs.check-runner.outputs.runner-label }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
|
||||
@@ -29,23 +29,23 @@ jobs:
|
||||
needs: check-runner
|
||||
runs-on: ${{ needs.check-runner.outputs.runner-label }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
- uses: pnpm/action-setup@v6
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v5
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: latest
|
||||
cache: pnpm
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
|
||||
- name: Cache frontend build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
frontend/node_modules
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
tar -czf frontend-dist.tar.gz -C frontend/build .
|
||||
|
||||
- name: Upload frontend artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend-dist.tar.gz
|
||||
@@ -72,12 +72,12 @@ jobs:
|
||||
- frontend
|
||||
runs-on: ${{ needs.check-runner.outputs.runner-label }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download frontend artifact
|
||||
uses: actions/download-artifact@v5
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: frontend-dist
|
||||
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
cache-dependency-path: backend/go.sum
|
||||
|
||||
- name: Cache Go build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
@@ -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@v4
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: backend-dist
|
||||
path: backend/dist
|
||||
@@ -128,19 +128,19 @@ jobs:
|
||||
- goreleaser
|
||||
runs-on: ${{ needs.check-runner.outputs.runner-label }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download backend artifact
|
||||
uses: actions/download-artifact@v5
|
||||
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
|
||||
|
||||
@@ -60,6 +60,7 @@ Temporary Items
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
!frontend/src/routes/logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
||||
+11
-3
@@ -11,14 +11,22 @@ 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
|
||||
ENV UPSNAP_HTTP_LISTEN=${UPSNAP_HTTP_LISTEN}
|
||||
RUN apk update &&\
|
||||
apk add --no-cache tzdata ca-certificates nmap samba samba-common-tools openssh sshpass curl &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
RUN addgroup -g 1000 upsnap &&\
|
||||
adduser -G upsnap -D -H -u 1000 upsnap -s /sbin/nologin
|
||||
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"
|
||||
HEALTHCHECK --interval=10s \
|
||||
CMD curl -fs "http://localhost:8090/api/health" || exit 1
|
||||
ENTRYPOINT ["./upsnap", "serve", "--http=0.0.0.0:8090"]
|
||||
CMD curl -fs "http://${UPSNAP_HTTP_LISTEN}/api/health" || exit 1
|
||||
CMD ["serve","--http","${UPSNAP_HTTP_LISTEN}"]
|
||||
ENTRYPOINT ["/app/upsnap"]
|
||||
|
||||
+5
-3
@@ -1,4 +1,4 @@
|
||||
FROM node:alpine AS node
|
||||
FROM node:bookworm AS node
|
||||
WORKDIR /app
|
||||
COPY frontend/ .
|
||||
RUN npm i -g pnpm &&\
|
||||
@@ -17,11 +17,13 @@ RUN go build -o upsnap main.go &&\
|
||||
setcap 'cap_net_raw=+ep' ./upsnap
|
||||
|
||||
FROM alpine:3
|
||||
ARG UPSNAP_HTTP_LISTEN=0.0.0.0:8090
|
||||
ENV UPSNAP_HTTP_LISTEN=${UPSNAP_HTTP_LISTEN}
|
||||
RUN apk update &&\
|
||||
apk add --no-cache tzdata ca-certificates nmap samba samba-common-tools openssh sshpass curl &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
WORKDIR /app
|
||||
COPY --from=go /app/upsnap upsnap
|
||||
HEALTHCHECK --interval=10s \
|
||||
CMD curl -fs "http://localhost:8090/api/health" || exit 1
|
||||
ENTRYPOINT ["./upsnap", "serve", "--http=0.0.0.0:8090"]
|
||||
CMD curl -fs "http://${UPSNAP_HTTP_LISTEN}/api/health" || exit 1
|
||||
ENTRYPOINT ["sh", "-c", "./upsnap serve --http ${UPSNAP_HTTP_LISTEN}"]
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<p>A simple wake on lan web app written with SvelteKit, Go and PocketBase.</p>
|
||||
<div>
|
||||
<a target="_blank" href="https://github.com/seriousm4x/upsnap"><img src="https://img.shields.io/github/stars/seriousm4x/UpSnap?style=flat&label=Stars" /></a>
|
||||
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/pkgs/container/upsnap"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fipitio%2Fbackage%2Findex%2Fseriousm4x%2FUpSnap%2Fupsnap.json&query=downloads&label=ghcr.io%20pulls" /></a>
|
||||
<a target="_blank" href="https://hub.docker.com/r/seriousm4x/upsnap"><img src="https://img.shields.io/docker/pulls/seriousm4x/upsnap?label=docker%20hub%20pulls" /></a>
|
||||
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/releases"><img src="https://img.shields.io/github/downloads/seriousm4x/upsnap/total?label=binary%20downloads" /></a>
|
||||
</div>
|
||||
@@ -19,22 +18,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
> [!NOTE]
|
||||
>
|
||||
> #### UpSnap is, and always will be, free and open source software.
|
||||
>
|
||||
> If someone is asking you to pay money for access to UpSnap binaries, source code, or licenses, you are being scammed.
|
||||
>
|
||||
> The official and only trusted source for UpSnap is this repository (and its linked releases).
|
||||
> Do not pay third parties for something that is provided here for free.
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- 🚀 One-Click Device Wake-Up Dashboard
|
||||
- ⏰ Timed Events via Cron for Automation
|
||||
- 🔌 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
|
||||
- 🌐 i18n support for [these](/frontend/translations) languages
|
||||
- 🎨 35 Themes
|
||||
- 🐳 [Docker images](https://github.com/seriousm4x/UpSnap/pkgs/container/upsnap) for amd64, arm64, arm/v7, arm/v6
|
||||
@@ -55,58 +49,36 @@
|
||||
|
||||
Just download the latest binary from the [release page](https://github.com/seriousm4x/UpSnap/releases) and run it.
|
||||
|
||||
### Root:
|
||||
|
||||
```bash
|
||||
sudo ./upsnap serve --http=0.0.0.0:8090
|
||||
```
|
||||
|
||||
### Non-root:
|
||||
|
||||
```bash
|
||||
sudo setcap cap_net_raw=+ep ./upsnap # only once after downloading
|
||||
./upsnap serve --http=0.0.0.0:8090
|
||||
```
|
||||
To run as non-root (Linux only), refer to the Wiki: [Use non-root user](https://github.com/seriousm4x/UpSnap/wiki/Use-non%E2%80%90root-user)
|
||||
|
||||
For more options check `./upsnap --help` or visit [PocketBase documentation](https://pocketbase.io/docs).
|
||||
|
||||
If you want to use network discovery, make sure to have `nmap` installed and run UpSnap as root/admin.
|
||||
## 🐳 Run in Docker
|
||||
|
||||
## 🐳 Run in docker
|
||||
Just pull and run the image: `docker run --network=host seriousm4x/upsnap:latest` or you can use the [docker-compose](docker-compose.yml) example. See the comments in the file for customization.
|
||||
|
||||
You can use the [docker-compose](docker-compose.yml) example. See the comments in the file for customization.
|
||||
To run as non-root, refer to the Wiki: [Use non-root user](https://github.com/seriousm4x/UpSnap/wiki/Use-non%E2%80%90root-user)
|
||||
|
||||
### Non-root docker user:
|
||||
Set `UPSNAP_LOG_LEVEL` to `DEBUG`, `INFO`, `WARN`, `ERROR`, or `OFF` to control UpSnap console logs. Default is `INFO`. PocketBase log persistence and retention remain configurable in PocketBase settings. PocketBase's `--dev` mode prints all logs regardless of this setting.
|
||||
|
||||
You will lose the ability to add network devices via the scan page.
|
||||
|
||||
Create the mount point first:
|
||||
|
||||
```bash
|
||||
mkdir data
|
||||
```
|
||||
|
||||
Then add `user: 1000:1000` to the docker-compose file (or whatever your $UID:$GID is).
|
||||
|
||||
### Change port
|
||||
### Change port (Docker)
|
||||
|
||||
If you want to change the port from 8090 to something else, change the following (5000 in this case):
|
||||
|
||||
```yml
|
||||
entrypoint: /bin/sh -c "./upsnap serve --http 0.0.0.0:5000"
|
||||
healthcheck:
|
||||
test: curl -fs "http://localhost:5000/api/health" || exit 1
|
||||
environment:
|
||||
- UPSNAP_HTTP_LISTEN=0.0.0.0:5000
|
||||
```
|
||||
|
||||
### Install additional packages for shutdown cmd
|
||||
## ❎️ Shutting Down Devices
|
||||
|
||||
```yml
|
||||
entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
|
||||
```
|
||||
To shutdown devices, refer to the Wiki: [How to use shutdowns](https://github.com/seriousm4x/UpSnap/wiki/How-to-use-shutdowns)
|
||||
|
||||
You can search for your needed package [here](https://pkgs.alpinelinux.org/packages).
|
||||
|
||||
### Reverse Proxy
|
||||
## Reverse Proxy
|
||||
|
||||
**Caddy example**
|
||||
|
||||
@@ -116,7 +88,7 @@ upsnap.example.com {
|
||||
}
|
||||
```
|
||||
|
||||
### Run in sub path
|
||||
## Run in sub path
|
||||
|
||||
You can run UpSnap on a different path than `/`, e.g. `/upsnap-sub-path/`. To do this in caddy, set the following:
|
||||
|
||||
@@ -164,16 +136,19 @@ UpSnap offers unique access for each user, per device. While admins have all per
|
||||
|
||||
Although UpSnap has user authorisation, it is **not recommended to expose it to the open web** and make it accessible by everyone!
|
||||
|
||||
**Reason**: The shutdown device command is basically a command piped to #sh (root if you run docker). If anyone gains unauthorized access and can abuse this api route in any way, the attacker has access to a (root) shell on your local network.
|
||||
**Reason**: The shutdown device command is basically a command piped to #sh (possibly as root user). If anyone gains unauthorized access and can abuse this API route in any way, the attacker has access to a (root) shell on your local network.
|
||||
|
||||
**Recommended**: If you need access from outside your network, please use a vpn. Wireguard or OpenVPN is your way to go.
|
||||
**Recommended**: If you need access from outside your network, please use a VPN. Wireguard or OpenVPN is your way to go.
|
||||
|
||||
## 🌐 Help translating
|
||||
|
||||
UpSnap is available in the following languages so far:
|
||||
|
||||
- 🇸🇦 **Arabic (Saudi Arabia)** (ar-SA)
|
||||
- 🇧🇬 **Bulgarian (Bulgaria)** (bg-BG)
|
||||
- 🇨🇿 **Czech (Czech republic)** (cs-CZ)
|
||||
- 🇩🇪 **German (Germany)** (de-DE)
|
||||
- 🇬🇷 **Greek (Greece)** (el-GR)
|
||||
- 🇺🇸 **English (United States)** (en-US)
|
||||
- 🇪🇸 **Spanish (Spain)** (es-ES)
|
||||
- 🇫🇷 **French (France)** (fr-FR)
|
||||
@@ -181,14 +156,17 @@ UpSnap is available in the following languages so far:
|
||||
- 🇮🇩 **Bahasa (Indonesia)** (id-ID)
|
||||
- 🇮🇹 **Italian (Italy)** (it-IT)
|
||||
- 🇯🇵 **Japanese (Japan)** (ja-JP)
|
||||
- 🇳🇱 **Dutch (Netherlands)** (nl-NL)
|
||||
- 🇰🇷 **Korean (Republic of Korea)** (ko-KR)
|
||||
- 🇳🇴 **Norwegian (Norway)** (nb-NO)
|
||||
- 🇳🇱 **Dutch (Netherlands)** (nl-NL)
|
||||
- 🇵🇱 **Polish (Poland)** (pl-PL)
|
||||
- 🇧🇷 **Portuguese (Brazil)** (pt-BR)
|
||||
- 🇵🇹 **Portuguese (Portugal)** (pt-PT)
|
||||
- 🇷🇺 **Russian (Russia)** (ru-RU)
|
||||
- 🇺🇦 **Ukrainian (Ukrain)** (uk-UA)
|
||||
- 🇻🇳 **Vietnamese (Vietnam)** (vi-VN)
|
||||
- 🇹🇼 **Chinese (Taiwan)** (zh-TW)
|
||||
- 🇨🇳 **Chinese (China)** (zh-CN)
|
||||
- 🇹🇼 **Chinese (Taiwan)** (zh-TW)
|
||||
|
||||
**If you want to contribute and help translating, check the wiki: [How to add languages](https://github.com/seriousm4x/UpSnap/wiki/How-to-add-languages)**
|
||||
|
||||
@@ -198,7 +176,7 @@ Fork this branch and clone it.
|
||||
|
||||
1. Start backend
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cd backend
|
||||
go mod tidy
|
||||
go run main.go serve
|
||||
@@ -206,14 +184,10 @@ go run main.go serve
|
||||
|
||||
2. Start frontend
|
||||
|
||||
```sh
|
||||
```bash
|
||||
cd frontend
|
||||
pnpm i
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
Open up [http://localhost:5173/](http://localhost:5173/), create an admin user and add some devices.
|
||||
|
||||
## 🌟 Star History
|
||||
|
||||
[](https://star-history.com/#seriousm4x/UpSnap&Date)
|
||||
|
||||
+19
-27
@@ -2,15 +2,6 @@ version: 2
|
||||
release:
|
||||
draft: false
|
||||
prerelease: auto
|
||||
header: |
|
||||
> [!NOTE]
|
||||
>
|
||||
> #### UpSnap is, and always will be, free and open source software.
|
||||
>
|
||||
> If someone is asking you to pay money for access to UpSnap binaries, source code, or licenses, you are being scammed.
|
||||
>
|
||||
> The official and only trusted source for UpSnap is this repository (and its linked releases).
|
||||
> Do not pay third parties for something that is provided here for free.
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
@@ -29,6 +20,7 @@ builds:
|
||||
- amd64
|
||||
- arm64
|
||||
- arm
|
||||
- riscv64
|
||||
goarm:
|
||||
- "6"
|
||||
- "7"
|
||||
@@ -40,7 +32,7 @@ builds:
|
||||
- goos: freebsd
|
||||
goarch: arm
|
||||
archives:
|
||||
- formats: [ 'zip' ]
|
||||
- formats: ["zip"]
|
||||
checksum:
|
||||
name_template: "checksums.txt"
|
||||
snapshot:
|
||||
@@ -69,20 +61,20 @@ changelog:
|
||||
git:
|
||||
ignore_tags:
|
||||
- "{{ if not .Prerelease}}*beta*{{ end }}"
|
||||
aurs:
|
||||
- name: upsnap-bin
|
||||
homepage: https://github.com/seriousm4x/UpSnap
|
||||
description: "A simple wake on lan web app written with SvelteKit, Go and PocketBase."
|
||||
maintainers:
|
||||
- "SeriousM4x <maxi at quoss dot org>"
|
||||
license: "MIT"
|
||||
private_key: "{{ .Env.AUR_KEY }}"
|
||||
git_url: "ssh://aur@aur.archlinux.org/upsnap-bin.git"
|
||||
package: |-
|
||||
install -Dm755 "./upsnap" "${pkgdir}/usr/bin/upsnap"
|
||||
skip_upload: auto
|
||||
optdepends:
|
||||
- "nmap: to scan for network devices"
|
||||
commit_author:
|
||||
name: goreleaserbot
|
||||
email: bot@goreleaser.com
|
||||
# aurs:
|
||||
# - name: upsnap-bin
|
||||
# homepage: https://github.com/seriousm4x/UpSnap
|
||||
# description: "A simple wake on lan web app written with SvelteKit, Go and PocketBase."
|
||||
# maintainers:
|
||||
# - "SeriousM4x <maxi at quoss dot org>"
|
||||
# license: "MIT"
|
||||
# private_key: "{{ .Env.AUR_KEY }}"
|
||||
# git_url: "ssh://aur@aur.archlinux.org/upsnap-bin.git"
|
||||
# package: |-
|
||||
# install -Dm755 "./upsnap" "${pkgdir}/usr/bin/upsnap"
|
||||
# skip_upload: auto
|
||||
# optdepends:
|
||||
# - "nmap: to scan for network devices"
|
||||
# commit_author:
|
||||
# name: goreleaserbot
|
||||
# email: bot@goreleaser.com
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package cronjobs
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/pocketbase"
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/seriousm4x/upsnap/logger"
|
||||
"github.com/seriousm4x/upsnap/iptracking"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,8 @@ var (
|
||||
)))
|
||||
)
|
||||
|
||||
func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
func SetPingJobs(app core.App) {
|
||||
log := logging.Logger(app)
|
||||
// remove existing jobs
|
||||
for _, job := range CronPing.Entries() {
|
||||
CronPing.Remove(job.ID)
|
||||
@@ -27,7 +28,8 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
|
||||
settingsPrivateRecords, err := app.FindAllRecords("settings_private")
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to load private settings", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
CronPing.AddFunc(settingsPrivateRecords[0].GetString("interval"), func() {
|
||||
@@ -39,7 +41,7 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
|
||||
devices, err := app.FindAllRecords("devices")
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to load devices for ping job", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -49,6 +51,7 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
}
|
||||
merr := app.ExpandRecords(devices, []string{"ports"}, expandFetchFunc)
|
||||
if len(merr) > 0 {
|
||||
log.Error("Failed to expand device ports", "errors", merr)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
}
|
||||
isUp, err := networking.PingDevice(d)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to ping device", "device", d.GetString("name"), "error", err)
|
||||
}
|
||||
if isUp {
|
||||
if status == "online" {
|
||||
@@ -69,7 +72,9 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
}
|
||||
d.Set("status", "online")
|
||||
if err := app.Save(d); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save device status", "device", d.GetString("name"), "error", err)
|
||||
} else {
|
||||
log.Info("Device turned on", "device", d.GetString("name"))
|
||||
}
|
||||
} else {
|
||||
if status == "offline" {
|
||||
@@ -77,7 +82,9 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
}
|
||||
d.Set("status", "offline")
|
||||
if err := app.Save(d); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save device status", "device", d.GetString("name"), "error", err)
|
||||
} else {
|
||||
log.Info("Device turned off", "device", d.GetString("name"))
|
||||
}
|
||||
}
|
||||
}(device)
|
||||
@@ -86,26 +93,50 @@ func SetPingJobs(app *pocketbase.PocketBase) {
|
||||
go func(d *core.Record) {
|
||||
ports, err := app.FindRecordsByIds("ports", d.GetStringSlice("ports"))
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
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 {
|
||||
logger.Error.Println("Failed to check port:", 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)
|
||||
if err := app.Save(port); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save port status", "device", d.GetString("name"), "port", port.GetString("number"), "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}(device)
|
||||
}
|
||||
})
|
||||
|
||||
// update ip addresses of opted-in devices from a periodic arp scan
|
||||
trackIpInterval := settingsPrivateRecords[0].GetString("track_ip_interval")
|
||||
if trackIpInterval != "" {
|
||||
if _, err := CronPing.AddFunc(trackIpInterval, func() {
|
||||
// pause scans if no realtime clients connected and lazy_ping is
|
||||
// turned on; a catch-up sweep runs when the next client connects
|
||||
realtimeClients := len(app.SubscriptionsBroker().Clients())
|
||||
iptracking.PeriodicSweep(app, realtimeClients == 0 && settingsPrivateRecords[0].GetBool("lazy_ping"))
|
||||
}); err != nil {
|
||||
log.Error("Failed to add IP tracking cron job", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func SetWakeShutdownJobs(app *pocketbase.PocketBase) {
|
||||
func SetWakeShutdownJobs(app core.App) {
|
||||
log := logging.Logger(app)
|
||||
// remove existing jobs
|
||||
for _, job := range CronWakeShutdown.Entries() {
|
||||
CronWakeShutdown.Remove(job.ID)
|
||||
@@ -113,7 +144,7 @@ func SetWakeShutdownJobs(app *pocketbase.PocketBase) {
|
||||
|
||||
devices, err := app.FindAllRecords("devices")
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to load devices for wake and shutdown jobs", "error", err)
|
||||
return
|
||||
}
|
||||
for _, dev := range devices {
|
||||
@@ -126,15 +157,15 @@ func SetWakeShutdownJobs(app *pocketbase.PocketBase) {
|
||||
_, err := CronWakeShutdown.AddFunc(wake_cron, func() {
|
||||
d, err := app.FindRecordById("devices", dev.Id)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to load device for wake job", "device", dev.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
if d.GetString("status") == "pending" {
|
||||
return
|
||||
}
|
||||
isOnline, err := networking.PingDevice(dev)
|
||||
isOnline, err := networking.PingDevice(d)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to ping device before wake", "device", d.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
if isOnline {
|
||||
@@ -142,21 +173,21 @@ func SetWakeShutdownJobs(app *pocketbase.PocketBase) {
|
||||
}
|
||||
d.Set("status", "pending")
|
||||
if err := app.Save(d); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save pending device status", "device", d.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
if err := networking.WakeDevice(d); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.WakeDevice(app, d, "cron"); err != nil {
|
||||
log.Error("Wake job failed", "device", d.GetString("name"), "error", err)
|
||||
d.Set("status", "offline")
|
||||
} else {
|
||||
d.Set("status", "online")
|
||||
}
|
||||
if err := app.Save(d); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save device status after wake", "device", d.GetString("name"), "error", err)
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error.Printf("device %s: %+v", dev.GetString("name"), err)
|
||||
log.Error("Failed to add wake cron job", "device", dev.GetString("name"), "error", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,40 +195,39 @@ func SetWakeShutdownJobs(app *pocketbase.PocketBase) {
|
||||
_, err := CronWakeShutdown.AddFunc(shutdown_cron, func() {
|
||||
d, err := app.FindRecordById("devices", dev.Id)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to load device for shutdown job", "device", dev.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
if d.GetString("status") == "pending" {
|
||||
return
|
||||
}
|
||||
isOnline, err := networking.PingDevice(dev)
|
||||
isOnline, err := networking.PingDevice(d)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to ping device before shutdown", "device", d.GetString("name"), "error", err)
|
||||
return
|
||||
}
|
||||
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 {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save pending device status", "device", d.GetString("name"), "error", err)
|
||||
}
|
||||
if err := networking.ShutdownDevice(d); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.ShutdownDevice(app, d, "cron"); err != nil {
|
||||
log.Error("Shutdown job failed", "device", d.GetString("name"), "error", err)
|
||||
d.Set("status", "online")
|
||||
} else {
|
||||
d.Set("status", "offline")
|
||||
}
|
||||
if err := app.Save(d); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
log.Error("Failed to save device status after shutdown", "device", d.GetString("name"), "error", err)
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error.Printf("device %s: %+v", dev.GetString("name"), err)
|
||||
log.Error("Failed to add shutdown cron job", "device", dev.GetString("name"), "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,9 +239,9 @@ func StartWakeShutdown() {
|
||||
|
||||
}
|
||||
|
||||
func StopWakeShutdown() {
|
||||
func StopWakeShutdown(app core.App) {
|
||||
if WakeShutdownRunning {
|
||||
logger.Info.Println("Stopping wake/shutdown cronjob")
|
||||
logging.Logger(app).Info("Stopping wake and shutdown cron jobs")
|
||||
CronWakeShutdown.Stop()
|
||||
}
|
||||
WakeShutdownRunning = false
|
||||
@@ -222,15 +252,15 @@ func StartPing() {
|
||||
go CronPing.Run()
|
||||
}
|
||||
|
||||
func StopPing() {
|
||||
func StopPing(app core.App) {
|
||||
if PingRunning {
|
||||
logger.Info.Println("Stopping wake/shutdown cronjob")
|
||||
logging.Logger(app).Info("Stopping ping cron jobs")
|
||||
CronPing.Stop()
|
||||
}
|
||||
PingRunning = false
|
||||
}
|
||||
|
||||
func StopAll() {
|
||||
StopPing()
|
||||
StopWakeShutdown()
|
||||
func StopAll(app core.App) {
|
||||
StopPing(app)
|
||||
StopWakeShutdown(app)
|
||||
}
|
||||
|
||||
+31
-29
@@ -1,51 +1,53 @@
|
||||
module github.com/seriousm4x/upsnap
|
||||
|
||||
go 1.24.1
|
||||
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.11.0
|
||||
github.com/pocketbase/pocketbase v0.30.0
|
||||
github.com/prometheus-community/pro-bing v0.7.0
|
||||
github.com/prometheus-community/pro-bing v0.9.1
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
golang.org/x/sys v0.36.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/fatih/color v1.18.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||
github.com/ganigeorgiev/fexpr v0.5.0 // indirect
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // 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/go-sql-driver/mysql v1.9.3 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // 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.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // 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/socket v0.5.1 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/mdlayher/packet v1.2.0 // indirect
|
||||
github.com/mdlayher/socket v0.7.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.1 // 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.42.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect
|
||||
golang.org/x/image v0.31.0 // indirect
|
||||
golang.org/x/net v0.44.0 // indirect
|
||||
golang.org/x/oauth2 v0.31.0 // indirect
|
||||
golang.org/x/sync v0.17.0 // indirect
|
||||
golang.org/x/text v0.29.0 // indirect
|
||||
modernc.org/libc v1.66.3 // 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.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.77.1 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
modernc.org/sqlite v1.38.2 // indirect
|
||||
modernc.org/memory v1.12.1 // indirect
|
||||
modernc.org/sqlite v1.60.1 // indirect
|
||||
)
|
||||
|
||||
+80
-69
@@ -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,68 +19,67 @@ 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/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
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=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.10/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=
|
||||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew=
|
||||
github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
|
||||
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/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/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=
|
||||
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-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
|
||||
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
|
||||
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.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
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.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
|
||||
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
|
||||
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 v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||
github.com/ncruces/go-strftime v0.1.9/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.11.0 h1:LpZezioMfT3K4tLrqA55wWFw1EtH1pM4tzSVa7kgszU=
|
||||
github.com/pocketbase/dbx v1.11.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/pocketbase v0.30.0 h1:7v9O3hBYyHyptnnFjdP8tEJIuyHEfjhG6PC4gjf5eoE=
|
||||
github.com/pocketbase/pocketbase v0.30.0/go.mod h1:gZIwampw4VqMcEdGHwBZgSa54xWIDgVJb4uINUMXLmA=
|
||||
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/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=
|
||||
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=
|
||||
@@ -82,8 +89,8 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
|
||||
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
|
||||
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
|
||||
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
@@ -91,68 +98,72 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
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.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
|
||||
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.31.0 h1:mLChjE2MV6g1S7oqbXC0/UcKijjm5fnJLUYKIYrLESA=
|
||||
golang.org/x/image v0.31.0/go.mod h1:R9ec5Lcp96v9FTF+ajwaH3uGxPH4fKfHHAVbUILxghA=
|
||||
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
|
||||
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
|
||||
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.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||
golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
|
||||
golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
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.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
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.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||
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.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
||||
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||
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=
|
||||
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.2 h1:991HMkLjJzYBIfha6ECZdjrIYz2/1ayr+FL8GN+CNzM=
|
||||
modernc.org/cc/v4 v4.26.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
|
||||
modernc.org/ccgo/v4 v4.28.0 h1:rjznn6WWehKq7dG4JtLRKxb52Ecv8OUGah8+Z/SfpNU=
|
||||
modernc.org/ccgo/v4 v4.28.0/go.mod h1:JygV3+9AV6SmPhDasu4JgquwU81XAKLd3OKTUDNOiKE=
|
||||
modernc.org/fileutil v1.3.8 h1:qtzNm7ED75pd1C7WgAGcK4edm4fvhtBsEiI/0NQ54YM=
|
||||
modernc.org/fileutil v1.3.8/go.mod h1:HxmghZSZVAz/LXcMNwZPA/DRrQZEVP9VX0V4LQGQFOc=
|
||||
kernel.org/pub/linux/libs/security/libcap/cap v1.2.78 h1:jgqg4gyu2BaYW9L6uzEtGLf8GNREwk/z4UFdwt5F3pE=
|
||||
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.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.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.66.3 h1:cfCbjTUcdsKyyZZfEUKfoHcP3S0Wkvz3jgSzByEWVCQ=
|
||||
modernc.org/libc v1.66.3/go.mod h1:XD9zO8kt59cANKvHPXpx7yS2ELPheAey0vjIuZOhOU8=
|
||||
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.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
|
||||
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
|
||||
modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||
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.38.2 h1:Aclu7+tgjgcQVShZqim41Bbw9Cho0y/7WzYptXqkEek=
|
||||
modernc.org/sqlite v1.38.2/go.mod h1:cPTJYSlgg3Sfg046yBShXENNtPrWrDX8bsbAQBzgQ5E=
|
||||
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=
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
// Package iptracking updates the stored ip addresses of opted-in devices by
|
||||
// scanning their local subnets for their mac addresses.
|
||||
package iptracking
|
||||
|
||||
import (
|
||||
"net"
|
||||
"sync/atomic"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
var sweepRunning atomic.Bool
|
||||
|
||||
// sweepOwed marks that a periodic sweep was skipped while no realtime
|
||||
// clients were connected, so the next client to connect gets a catch-up
|
||||
// sweep. Starts true so the first client after boot gets fresh ips.
|
||||
var sweepOwed atomic.Bool
|
||||
|
||||
func init() {
|
||||
sweepOwed.Store(true)
|
||||
}
|
||||
|
||||
// nmapScan is a seam for tests to stub out the privileged nmap invocation
|
||||
var nmapScan = networking.NmapScan
|
||||
|
||||
// TrackAllSubnets scans the local subnets of devices with ip tracking enabled
|
||||
// and updates their ip address if their mac address is found at a different
|
||||
// one. Non-scannable subnets are silently skipped, but their devices can
|
||||
// still be updated by another subnet's scan that finds their mac address,
|
||||
// as long as the new ip stays within the device's own subnet.
|
||||
func TrackAllSubnets(app core.App) {
|
||||
log := logging.Logger(app)
|
||||
// skip if the previous sweep is still running
|
||||
if !sweepRunning.CompareAndSwap(false, true) {
|
||||
return
|
||||
}
|
||||
defer sweepRunning.Store(false)
|
||||
|
||||
devices, err := app.FindRecordsByFilter("devices", "track_ip = true", "", 0, 0)
|
||||
if err != nil {
|
||||
log.Error("Failed to load devices for IP tracking", "error", err)
|
||||
return
|
||||
}
|
||||
|
||||
// collect the unique scannable subnets of the tracked devices
|
||||
subnets := make(map[string]*net.IPNet)
|
||||
for _, device := range devices {
|
||||
subnet, err := networking.DeviceSubnet(device.GetString("ip"), device.GetString("netmask"))
|
||||
if err != nil {
|
||||
log.Error("Failed to determine device subnet for IP tracking", "device", device.GetString("name"), "error", err)
|
||||
continue
|
||||
}
|
||||
if networking.ValidateScannableSubnet(subnet) != nil {
|
||||
continue
|
||||
}
|
||||
subnets[subnet.String()] = subnet
|
||||
}
|
||||
|
||||
for cidr, subnet := range subnets {
|
||||
if err := TrackOneSubnet(app, subnet); err != nil {
|
||||
log.Error("IP tracking scan failed", "subnet", cidr, "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PeriodicSweep runs the scheduled sweep, or skips it when paused — no
|
||||
// realtime clients connected while lazy_ping is on — owing a catch-up
|
||||
// sweep to the next client that connects.
|
||||
func PeriodicSweep(app core.App, pause bool) {
|
||||
if pause {
|
||||
sweepOwed.Store(true)
|
||||
return
|
||||
}
|
||||
TrackAllSubnets(app)
|
||||
}
|
||||
|
||||
// CatchUpSweep runs a sweep if one is owed, i.e. the periodic sweep was
|
||||
// skipped while nobody was connected or hasn't run since boot. Clients
|
||||
// connecting while sweeps run on schedule trigger nothing.
|
||||
func CatchUpSweep(app core.App) {
|
||||
if !sweepOwed.CompareAndSwap(true, false) {
|
||||
return
|
||||
}
|
||||
TrackAllSubnets(app)
|
||||
}
|
||||
|
||||
// TrackOneSubnet runs an nmap scan of the given subnet and updates the ip
|
||||
// address of any ip-tracked device whose mac address is found at a new
|
||||
// address within its own subnet. Returns an error for a non-scannable subnet.
|
||||
func TrackOneSubnet(app core.App, subnet *net.IPNet) error {
|
||||
log := logging.Logger(app)
|
||||
if err := networking.ValidateScannableSubnet(subnet); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
scan, err := nmapScan(subnet.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
macToIp := scan.MacToIP()
|
||||
|
||||
devices, err := app.FindRecordsByFilter("devices", "track_ip = true", "", 0, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, device := range devices {
|
||||
parsedMac, err := net.ParseMAC(device.GetString("mac"))
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
newIp, ok := macToIp[parsedMac.String()]
|
||||
if !ok || newIp == device.GetString("ip") {
|
||||
continue
|
||||
}
|
||||
// only move a device within its own subnet, so that a scan can't
|
||||
// relocate devices tracked on other subnets that see the same mac
|
||||
deviceSubnet, err := networking.DeviceSubnet(device.GetString("ip"), device.GetString("netmask"))
|
||||
if err != nil || !deviceSubnet.Contains(net.ParseIP(newIp)) {
|
||||
continue
|
||||
}
|
||||
oldIP := device.GetString("ip")
|
||||
device.Set("ip", newIp)
|
||||
// only write the changed ip field to avoid clobbering concurrent
|
||||
// status updates from the ping and wake/shutdown cronjobs
|
||||
device.IgnoreUnchangedFields(true)
|
||||
if err := app.Save(device); err != nil {
|
||||
log.Error("Failed to save tracked device IP", "device", device.GetString("name"), "error", err)
|
||||
} else {
|
||||
log.Info("Device IP changed", "device", device.GetString("name"), "from", oldIP, "to", newIp)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
package iptracking
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"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
|
||||
_ "github.com/seriousm4x/upsnap/migrations"
|
||||
)
|
||||
|
||||
// newTestApp returns a throwaway app with all migrations applied.
|
||||
func newTestApp(t *testing.T) *tests.TestApp {
|
||||
t.Helper()
|
||||
app, err := tests.NewTestApp(t.TempDir())
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
t.Cleanup(app.Cleanup)
|
||||
return app
|
||||
}
|
||||
|
||||
func buildDevice(t *testing.T, app core.App, name, ip, netmask, mac string, trackIp bool) *core.Record {
|
||||
t.Helper()
|
||||
collection, err := app.FindCollectionByNameOrId("devices")
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
device := core.NewRecord(collection)
|
||||
device.Set("name", name)
|
||||
device.Set("ip", ip)
|
||||
device.Set("netmask", netmask)
|
||||
device.Set("mac", mac)
|
||||
device.Set("track_ip", trackIp)
|
||||
return device
|
||||
}
|
||||
|
||||
func newDevice(t *testing.T, app core.App, name, ip, netmask, mac string, trackIp bool) *core.Record {
|
||||
t.Helper()
|
||||
device := buildDevice(t, app, name, ip, netmask, mac, trackIp)
|
||||
if err := app.Save(device); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
return device
|
||||
}
|
||||
|
||||
// newLegacyDevice saves a device bypassing field validation, like rows
|
||||
// created before the ip and mac format rules existed.
|
||||
func newLegacyDevice(t *testing.T, app core.App, name, ip, netmask, mac string, trackIp bool) *core.Record {
|
||||
t.Helper()
|
||||
device := buildDevice(t, app, name, ip, netmask, mac, trackIp)
|
||||
if err := app.SaveNoValidate(device); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
return device
|
||||
}
|
||||
|
||||
// stubScan replaces the nmap seam with a canned scan reporting the given
|
||||
// mac addresses at the given ips, and returns the list of scanned ranges.
|
||||
func stubScan(t *testing.T, macToHostIp map[string]string) *[]string {
|
||||
t.Helper()
|
||||
var sample strings.Builder
|
||||
sample.WriteString("<nmaprun>")
|
||||
for mac, ip := range macToHostIp {
|
||||
fmt.Fprintf(&sample, `<host><address addr=%q addrtype="ipv4"/><address addr=%q addrtype="mac"/></host>`, ip, mac)
|
||||
}
|
||||
sample.WriteString("</nmaprun>")
|
||||
scan := networking.Nmaprun{}
|
||||
if err := xml.Unmarshal([]byte(sample.String()), &scan); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
var scanned []string
|
||||
orig := nmapScan
|
||||
nmapScan = func(scanRange string) (networking.Nmaprun, error) {
|
||||
scanned = append(scanned, scanRange)
|
||||
return scan, nil
|
||||
}
|
||||
t.Cleanup(func() { nmapScan = orig })
|
||||
return &scanned
|
||||
}
|
||||
|
||||
func mustSubnet(t *testing.T, cidr string) *net.IPNet {
|
||||
t.Helper()
|
||||
_, subnet, err := net.ParseCIDR(cidr)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
return subnet
|
||||
}
|
||||
|
||||
// The loopback /16 passes the scannable checks on any host, making it the
|
||||
// only subnet a test can scan without depending on the environment.
|
||||
const (
|
||||
testSubnet = "127.0.0.0/16"
|
||||
testNetmask = "255.255.0.0"
|
||||
)
|
||||
|
||||
func TestTrackOneSubnetSkipsUntrackedDevices(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
device := newDevice(t, app, "untracked", "127.0.0.50", testNetmask, "AA:BB:CC:DD:EE:01", false)
|
||||
stubScan(t, map[string]string{"AA:BB:CC:DD:EE:01": "127.0.0.99"})
|
||||
|
||||
if err := TrackOneSubnet(app, mustSubnet(t, testSubnet)); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
fresh, err := app.FindRecordById("devices", device.Id)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
if ip := fresh.GetString("ip"); ip != "127.0.0.50" {
|
||||
t.Errorf("Ip of device without track_ip changed to %s", ip)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackOneSubnetSkipPaths(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
saves := 0
|
||||
app.OnRecordUpdate("devices").BindFunc(func(e *core.RecordEvent) error {
|
||||
saves++
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
ip string
|
||||
mac string
|
||||
legacy bool
|
||||
}{
|
||||
// A device mac that can't be parsed never matches
|
||||
{
|
||||
name: "Invalid Mac",
|
||||
ip: "127.0.0.50",
|
||||
mac: "not-a-mac",
|
||||
legacy: true,
|
||||
},
|
||||
// A device mac missing from the scan results is left alone
|
||||
{
|
||||
name: "Mac Not In Scan",
|
||||
ip: "127.0.0.50",
|
||||
mac: "AA:BB:CC:DD:EE:02",
|
||||
},
|
||||
// A device ip without a computable subnet is never moved
|
||||
{
|
||||
name: "Invalid Device Ip",
|
||||
ip: "999.999.999.999",
|
||||
mac: "AA:BB:CC:DD:EE:01",
|
||||
legacy: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
create := newDevice
|
||||
if tc.legacy {
|
||||
create = newLegacyDevice
|
||||
}
|
||||
device := create(t, app, tc.name, tc.ip, testNetmask, tc.mac, true)
|
||||
stubScan(t, map[string]string{"AA:BB:CC:DD:EE:01": "127.0.0.99"})
|
||||
|
||||
if err := TrackOneSubnet(app, mustSubnet(t, testSubnet)); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
fresh, err := app.FindRecordById("devices", device.Id)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
if ip := fresh.GetString("ip"); ip != tc.ip {
|
||||
t.Errorf("Ip mismatch: expected %s, got %s", tc.ip, ip)
|
||||
}
|
||||
if saves != 0 {
|
||||
t.Errorf("Expected no record updates, got %d", saves)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackOneSubnetUnscannable(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
// TEST-NET-1 (RFC 5737) is never assigned to an interface
|
||||
scanned := stubScan(t, nil)
|
||||
|
||||
if err := TrackOneSubnet(app, mustSubnet(t, "192.0.2.0/24")); err == nil {
|
||||
t.Error("Expected error but got none")
|
||||
}
|
||||
if len(*scanned) != 0 {
|
||||
t.Errorf("Expected no scans of an unscannable subnet, got %v", *scanned)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTrackOneSubnetSameSubnetGuard(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
ip string
|
||||
netmask string
|
||||
mac string
|
||||
scanMac string
|
||||
foundIp string
|
||||
wantIp string
|
||||
}{
|
||||
// A move within the device's own subnet is applied, with the
|
||||
// stored dashed lower case mac matching the scanned
|
||||
// colon-separated upper case one
|
||||
{
|
||||
name: "Within Own Subnet",
|
||||
ip: "127.0.0.50",
|
||||
netmask: testNetmask,
|
||||
mac: "aa-bb-cc-dd-01-01",
|
||||
scanMac: "AA:BB:CC:DD:01:01",
|
||||
foundIp: "127.0.0.99",
|
||||
wantIp: "127.0.0.99",
|
||||
},
|
||||
// The device's own subnet bounds the move, not the scanned one
|
||||
{
|
||||
name: "Narrower Subnet Within Scan",
|
||||
ip: "127.0.5.5",
|
||||
netmask: "255.255.255.0",
|
||||
mac: "AA:BB:CC:DD:01:02",
|
||||
foundIp: "127.0.5.9",
|
||||
wantIp: "127.0.5.9",
|
||||
},
|
||||
// A found ip outside the device's narrower subnet is not applied,
|
||||
// even though it is inside the scanned subnet
|
||||
{
|
||||
name: "Outside Own Subnet",
|
||||
ip: "127.0.5.5",
|
||||
netmask: "255.255.255.0",
|
||||
mac: "AA:BB:CC:DD:01:03",
|
||||
foundIp: "127.0.6.9",
|
||||
wantIp: "127.0.5.5",
|
||||
},
|
||||
// A device from a disjoint subnet is never moved into the scanned one
|
||||
{
|
||||
name: "Disjoint Subnet",
|
||||
ip: "10.9.9.9",
|
||||
netmask: "255.255.255.0",
|
||||
mac: "AA:BB:CC:DD:01:04",
|
||||
foundIp: "127.0.0.99",
|
||||
wantIp: "10.9.9.9",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
device := newDevice(t, app, tc.name, tc.ip, tc.netmask, tc.mac, true)
|
||||
scanMac := tc.scanMac
|
||||
if scanMac == "" {
|
||||
scanMac = tc.mac
|
||||
}
|
||||
stubScan(t, map[string]string{scanMac: tc.foundIp})
|
||||
|
||||
if err := TrackOneSubnet(app, mustSubnet(t, testSubnet)); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
fresh, err := app.FindRecordById("devices", device.Id)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
if ip := fresh.GetString("ip"); ip != tc.wantIp {
|
||||
t.Errorf("Ip mismatch: expected %s, got %s", tc.wantIp, ip)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// A paused periodic sweep scans nothing and owes a catch-up sweep, which
|
||||
// runs at most once until the next pause; an unpaused sweep scans directly.
|
||||
func TestPeriodicSweepAndCatchUp(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
newDevice(t, app, "tracked", "127.0.0.50", testNetmask, "AA:BB:CC:DD:09:01", true)
|
||||
scanned := stubScan(t, map[string]string{"AA:BB:CC:DD:09:01": "127.0.0.99"})
|
||||
|
||||
PeriodicSweep(app, true)
|
||||
if len(*scanned) != 0 {
|
||||
t.Fatalf("Expected no scans while paused, got %v", *scanned)
|
||||
}
|
||||
|
||||
CatchUpSweep(app)
|
||||
if len(*scanned) != 1 {
|
||||
t.Fatalf("Expected one scan after a paused sweep, got %v", *scanned)
|
||||
}
|
||||
|
||||
CatchUpSweep(app)
|
||||
if len(*scanned) != 1 {
|
||||
t.Errorf("Expected no scan when none is owed, got %v", *scanned)
|
||||
}
|
||||
|
||||
PeriodicSweep(app, false)
|
||||
if len(*scanned) != 2 {
|
||||
t.Errorf("Expected an unpaused sweep to scan, got %v", *scanned)
|
||||
}
|
||||
|
||||
CatchUpSweep(app)
|
||||
if len(*scanned) != 2 {
|
||||
t.Errorf("Expected an unpaused sweep to owe nothing, got %v", *scanned)
|
||||
}
|
||||
}
|
||||
|
||||
// TrackAllSubnets scans each unique scannable subnet once, silently skips the
|
||||
// rest, and updates any tracked device found at a new ip within its own
|
||||
// subnet — even one whose own subnet couldn't be scanned.
|
||||
func TestTrackAllSubnets(t *testing.T) {
|
||||
app := newTestApp(t)
|
||||
first := newDevice(t, app, "first", "127.0.0.10", testNetmask, "AA:BB:CC:DD:02:01", true)
|
||||
second := newDevice(t, app, "second", "127.0.0.20", testNetmask, "AA:BB:CC:DD:02:02", true)
|
||||
// TEST-NET-1 (RFC 5737) is never assigned to an interface
|
||||
unscannable := newDevice(t, app, "unscannable", "192.0.2.5", "255.255.255.0", "AA:BB:CC:DD:02:03", true)
|
||||
// a /8 subnet is too large to scan but contains the found ip
|
||||
wide := newDevice(t, app, "wide", "127.0.0.60", "255.0.0.0", "AA:BB:CC:DD:02:04", true)
|
||||
scanned := stubScan(t, map[string]string{
|
||||
"AA:BB:CC:DD:02:01": "127.0.0.11",
|
||||
"AA:BB:CC:DD:02:02": "127.0.0.21",
|
||||
"AA:BB:CC:DD:02:04": "127.0.0.61",
|
||||
})
|
||||
|
||||
TrackAllSubnets(app)
|
||||
|
||||
if len(*scanned) != 1 || (*scanned)[0] != testSubnet {
|
||||
t.Errorf("Expected a single scan of %s, got %v", testSubnet, *scanned)
|
||||
}
|
||||
wantIps := map[string]string{
|
||||
first.Id: "127.0.0.11",
|
||||
second.Id: "127.0.0.21",
|
||||
unscannable.Id: "192.0.2.5",
|
||||
wide.Id: "127.0.0.61",
|
||||
}
|
||||
for id, wantIp := range wantIps {
|
||||
fresh, err := app.FindRecordById("devices", id)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
if ip := fresh.GetString("ip"); ip != wantIp {
|
||||
t.Errorf("Ip mismatch for %s: expected %s, got %s", fresh.GetString("name"), wantIp, ip)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
const (
|
||||
flags = log.Ldate | log.Ltime | log.Lshortfile
|
||||
)
|
||||
|
||||
var (
|
||||
Info = log.New(os.Stdout, "[INFO] ", flags)
|
||||
Debug = log.New(os.Stdout, "[DEBUG] ", flags)
|
||||
Warning = log.New(os.Stdout, "[WARNING] ", flags)
|
||||
Error = log.New(os.Stderr, "[ERROR] ", flags)
|
||||
)
|
||||
|
||||
func init() {
|
||||
// TODO: decide if you want to log to a file to max
|
||||
// output := io.MultiWriter(os.Stdout, logFile)
|
||||
output := os.Stdout
|
||||
Info.SetOutput(output)
|
||||
Error.SetOutput(output)
|
||||
Debug.SetOutput(output)
|
||||
|
||||
log.SetOutput(Debug.Writer())
|
||||
log.SetPrefix("[DEBUG]")
|
||||
log.SetFlags(flags)
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
var consoleHandler slog.Handler
|
||||
|
||||
// ConfigureConsole sets console output for UpSnap logs. PocketBase persistence
|
||||
// remains controlled by PocketBase's built-in log settings.
|
||||
func ConfigureConsole(level string) error {
|
||||
level = strings.TrimSpace(level)
|
||||
if level == "" {
|
||||
level = "INFO"
|
||||
}
|
||||
|
||||
if strings.EqualFold(level, "OFF") {
|
||||
consoleHandler = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
var parsed slog.Level
|
||||
if err := parsed.UnmarshalText([]byte(strings.ToUpper(level))); err != nil {
|
||||
return fmt.Errorf("invalid UPSNAP_LOG_LEVEL %q (expected DEBUG, INFO, WARN, ERROR, or OFF)", level)
|
||||
}
|
||||
|
||||
consoleHandler = slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{
|
||||
Level: parsed,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func relativeSource(file string) string {
|
||||
file = strings.ReplaceAll(file, "\\", "/")
|
||||
if index := strings.LastIndex(file, "/backend/"); index >= 0 {
|
||||
return file[index+1:]
|
||||
}
|
||||
return file
|
||||
}
|
||||
|
||||
// Logger writes through PocketBase's logger and mirrors UpSnap logs to stdout.
|
||||
func Logger(app core.App) *slog.Logger {
|
||||
handlers := []slog.Handler{app.Logger().Handler()}
|
||||
if consoleHandler != nil && !app.IsDev() {
|
||||
handlers = append(handlers, consoleHandler)
|
||||
}
|
||||
return slog.New(multiHandler(handlers)).With("upsnap", true)
|
||||
}
|
||||
|
||||
type multiHandler []slog.Handler
|
||||
|
||||
func (h multiHandler) Enabled(ctx context.Context, level slog.Level) bool {
|
||||
for _, handler := range h {
|
||||
if handler.Enabled(ctx, level) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (h multiHandler) Handle(ctx context.Context, record slog.Record) error {
|
||||
if record.PC != 0 {
|
||||
frames := runtime.CallersFrames([]uintptr{record.PC})
|
||||
frame, _ := frames.Next()
|
||||
record.AddAttrs(slog.String(slog.SourceKey, relativeSource(frame.File)+":"+strconv.Itoa(frame.Line)))
|
||||
}
|
||||
|
||||
var errs []error
|
||||
for _, handler := range h {
|
||||
if handler.Enabled(ctx, record.Level) {
|
||||
if err := handler.Handle(ctx, record.Clone()); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
return errors.Join(errs...)
|
||||
}
|
||||
|
||||
func (h multiHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
|
||||
handlers := make(multiHandler, len(h))
|
||||
for i, handler := range h {
|
||||
handlers[i] = handler.WithAttrs(attrs)
|
||||
}
|
||||
return handlers
|
||||
}
|
||||
|
||||
func (h multiHandler) WithGroup(name string) slog.Handler {
|
||||
handlers := make(multiHandler, len(h))
|
||||
for i, handler := range h {
|
||||
handlers[i] = handler.WithGroup(name)
|
||||
}
|
||||
return handlers
|
||||
}
|
||||
+5
-2
@@ -2,8 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"log"
|
||||
|
||||
"github.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"github.com/seriousm4x/upsnap/pb"
|
||||
)
|
||||
|
||||
@@ -12,5 +13,7 @@ var distDir embed.FS
|
||||
var distDirFS = apis.MustSubFS(distDir, "pb_public")
|
||||
|
||||
func main() {
|
||||
pb.StartPocketBase(distDirFS)
|
||||
if err := pb.StartPocketBase(distDirFS); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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": "^((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(3, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "fyqmpon6",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "mac",
|
||||
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
|
||||
"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": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// update field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(3, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"help": "",
|
||||
"hidden": false,
|
||||
"id": "fyqmpon6",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "mac",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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": "^(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)
|
||||
}, 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]|1\\d|[1-9]|)\\d)\\.?\\b){4}$",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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(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)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if 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": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": true,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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
|
||||
}
|
||||
|
||||
// add field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(6, []byte(`{
|
||||
"hidden": false,
|
||||
"id": "bool2618032555",
|
||||
"name": "track_ip",
|
||||
"presentable": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "bool"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove field
|
||||
collection.Fields.RemoveById("bool2618032555")
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// add field
|
||||
if err := collection.Fields.AddMarshaledJSONAt(4, []byte(`{
|
||||
"autogeneratePattern": "",
|
||||
"hidden": false,
|
||||
"id": "text3846109882",
|
||||
"max": 0,
|
||||
"min": 0,
|
||||
"name": "track_ip_interval",
|
||||
"pattern": "",
|
||||
"presentable": false,
|
||||
"primaryKey": false,
|
||||
"required": false,
|
||||
"system": false,
|
||||
"type": "text"
|
||||
}`)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return app.Save(collection)
|
||||
}, func(app core.App) error {
|
||||
collection, err := app.FindCollectionByNameOrId("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove field
|
||||
collection.Fields.RemoveById("text3846109882")
|
||||
|
||||
return app.Save(collection)
|
||||
})
|
||||
}
|
||||
@@ -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,74 +23,100 @@ 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 {
|
||||
// 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
|
||||
if err := wakeUDP(broadcastIp, ip, parsedMac, bytePassword); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// send wake via udp port 9
|
||||
if err := wakeUDP(broadcastIp, parsedMac, bytePassword); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func wakeUDP(broadcastIp string, target net.HardwareAddr, password []byte) error {
|
||||
func wakeUDP(broadcastIp string, deviceIp string, target net.HardwareAddr, password []byte) error {
|
||||
c, err := wol.NewClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer c.Close()
|
||||
|
||||
// send 4 magic packets to different addresses to enhance change 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",
|
||||
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)
|
||||
mask := net.ParseIP(maskStr).To4()
|
||||
if mask == nil {
|
||||
return "", errors.New("subnet mask not a valid ipv4 address")
|
||||
}
|
||||
mask = mask.To4()
|
||||
ip = ip.To4()
|
||||
if ip == nil {
|
||||
return "", errors.New("subnet mask not a valid ipv4 address")
|
||||
}
|
||||
|
||||
broadcast := make(net.IP, 4)
|
||||
for i := range ip {
|
||||
@@ -96,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 {
|
||||
@@ -107,6 +107,7 @@ func TestSendMagicPacket(t *testing.T) {
|
||||
func TestWakeUDP(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
ip string
|
||||
broadcastIp string
|
||||
targetMac string
|
||||
password string
|
||||
@@ -115,6 +116,7 @@ func TestWakeUDP(t *testing.T) {
|
||||
// Valid case: all inputs correct
|
||||
{
|
||||
name: "Valid Case",
|
||||
ip: "192.168.1.10",
|
||||
broadcastIp: "192.168.1.255",
|
||||
targetMac: "00:11:22:33:44:55",
|
||||
password: "secret",
|
||||
@@ -123,6 +125,7 @@ func TestWakeUDP(t *testing.T) {
|
||||
// Invalid MAC address
|
||||
{
|
||||
name: "Invalid MAC",
|
||||
ip: "192.168.1.10",
|
||||
broadcastIp: "192.168.1.255",
|
||||
targetMac: "invalid",
|
||||
password: "secret",
|
||||
@@ -131,6 +134,7 @@ func TestWakeUDP(t *testing.T) {
|
||||
// Password too short
|
||||
{
|
||||
name: "Password Too Short",
|
||||
ip: "192.168.1.10",
|
||||
broadcastIp: "192.168.1.255",
|
||||
targetMac: "00:11:22:33:44:55",
|
||||
password: "s", // length 1
|
||||
@@ -139,6 +143,7 @@ func TestWakeUDP(t *testing.T) {
|
||||
// Password too long
|
||||
{
|
||||
name: "Password Too Long",
|
||||
ip: "192.168.1.10",
|
||||
broadcastIp: "192.168.1.255",
|
||||
targetMac: "00:11:22:33:44:55",
|
||||
password: "password", // length 9
|
||||
@@ -156,7 +161,7 @@ func TestWakeUDP(t *testing.T) {
|
||||
}
|
||||
|
||||
// Now test the wakeUDP function
|
||||
err = wakeUDP(tc.broadcastIp, mac, []byte(tc.password))
|
||||
err = wakeUDP(tc.broadcastIp, tc.ip, mac, []byte(tc.password))
|
||||
if tc.wantError {
|
||||
if err == nil {
|
||||
t.Errorf("Expected error but got none")
|
||||
|
||||
@@ -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,60 +20,12 @@ 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)
|
||||
if err != nil {
|
||||
// treat "host unreachable", "connection refused" and "timeout" as no error
|
||||
var netErr *net.OpError
|
||||
if errors.As(err, &netErr) {
|
||||
if netErr, ok := errors.AsType[*net.OpError](err); ok {
|
||||
if errors.Is(netErr.Err, syscall.EHOSTUNREACH) ||
|
||||
errors.Is(netErr.Err, syscall.ECONNREFUSED) ||
|
||||
netErr.Timeout() {
|
||||
|
||||
@@ -3,7 +3,7 @@ package networking
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
)
|
||||
|
||||
func TestPingDevice(t *testing.T) {
|
||||
@@ -25,7 +25,7 @@ func TestPingDevice(t *testing.T) {
|
||||
name: "Invalid Ping Command",
|
||||
ip: "8.8.8.8",
|
||||
ping_cmd: "exit 1",
|
||||
wantError: true,
|
||||
wantError: false,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func TestCheckPort(t *testing.T) {
|
||||
// Valid case: all inputs correct
|
||||
{
|
||||
name: "Valid Case",
|
||||
host: "8.8.8.8",
|
||||
host: "0.0.0.0",
|
||||
port: "443",
|
||||
wantError: false,
|
||||
},
|
||||
@@ -71,17 +71,10 @@ func TestCheckPort(t *testing.T) {
|
||||
// Invalid port number
|
||||
{
|
||||
name: "Invalid Port",
|
||||
host: "8.8.8.8",
|
||||
host: "0.0.0.0",
|
||||
port: "70000", // invalid
|
||||
wantError: true,
|
||||
},
|
||||
// Port zero
|
||||
{
|
||||
name: "Port Zero",
|
||||
host: "8.8.8.8",
|
||||
port: "0",
|
||||
wantError: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//go:build linux
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"ganigeorgiev.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 == "" {
|
||||
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
|
||||
}
|
||||
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()
|
||||
|
||||
if err != nil {
|
||||
if _, ok := err.(*exec.ExitError); ok {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
//go:build !linux
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"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 == "" {
|
||||
ip, err := ResolveToIPAddr(device.GetString("ip"))
|
||||
if err != nil || ip == "" {
|
||||
return false, err
|
||||
}
|
||||
pinger, err := probing.NewPinger(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()
|
||||
|
||||
if err != nil {
|
||||
if _, ok := err.(*exec.ExitError); ok {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type Nmaprun struct {
|
||||
Host []struct {
|
||||
Address []struct {
|
||||
Addr string `xml:"addr,attr" binding:"required"`
|
||||
Addrtype string `xml:"addrtype,attr" binding:"required"`
|
||||
Vendor string `xml:"vendor,attr"`
|
||||
} `xml:"address"`
|
||||
} `xml:"host"`
|
||||
}
|
||||
|
||||
// MacToIP maps each scanned host's normalized mac address to its ipv4
|
||||
// address, skipping hosts that lack either.
|
||||
func (n Nmaprun) MacToIP() map[string]string {
|
||||
macToIp := make(map[string]string)
|
||||
for _, host := range n.Host {
|
||||
var hostIp, hostMac string
|
||||
for _, addr := range host.Address {
|
||||
switch addr.Addrtype {
|
||||
case "ipv4":
|
||||
hostIp = addr.Addr
|
||||
case "mac":
|
||||
hostMac = addr.Addr
|
||||
}
|
||||
}
|
||||
if parsedMac, err := net.ParseMAC(hostMac); hostIp != "" && err == nil {
|
||||
macToIp[parsedMac.String()] = hostIp
|
||||
}
|
||||
}
|
||||
return macToIp
|
||||
}
|
||||
|
||||
func runNmap(scanRange string) (Nmaprun, error) {
|
||||
nmapOutput := Nmaprun{}
|
||||
|
||||
nmap, err := exec.LookPath("nmap")
|
||||
if err != nil {
|
||||
return nmapOutput, err
|
||||
}
|
||||
|
||||
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 nmapOutput, err
|
||||
}
|
||||
|
||||
if err := xml.Unmarshal(cmdOutput, &nmapOutput); err != nil {
|
||||
return nmapOutput, err
|
||||
}
|
||||
|
||||
return nmapOutput, nil
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//go:build linux
|
||||
|
||||
package networking
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"kernel.org/pub/linux/libs/security/libcap/cap"
|
||||
)
|
||||
|
||||
func NmapScan(scanRange string) (Nmaprun, error) {
|
||||
orig := cap.GetProc()
|
||||
defer orig.SetProc() // restore original caps on exit.
|
||||
|
||||
c, err := orig.Dup()
|
||||
if err != nil {
|
||||
return Nmaprun{}, fmt.Errorf("Failed to dup existing capabilities: %v", err)
|
||||
}
|
||||
|
||||
if on, _ := c.GetFlag(cap.Permitted, cap.NET_RAW); !on {
|
||||
return Nmaprun{}, fmt.Errorf("unable to get NET_RAW permissions")
|
||||
}
|
||||
|
||||
if err := c.SetFlag(cap.Effective, true, cap.NET_RAW); err != nil {
|
||||
return Nmaprun{}, fmt.Errorf("unable to set NET_RAW capability effective")
|
||||
}
|
||||
|
||||
if err := c.SetFlag(cap.Inheritable, true, cap.NET_RAW); err != nil {
|
||||
return Nmaprun{}, fmt.Errorf("unable to set NET_RAW capability inheritable")
|
||||
}
|
||||
|
||||
if err := c.SetProc(); err != nil {
|
||||
return Nmaprun{}, fmt.Errorf("unable to raise NET_RAW capability")
|
||||
}
|
||||
|
||||
if err := cap.SetAmbient(true, cap.NET_RAW); err != nil {
|
||||
return Nmaprun{}, fmt.Errorf("unable to set NET_RAW capability ambient")
|
||||
}
|
||||
|
||||
return runNmap(scanRange)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !linux
|
||||
|
||||
package networking
|
||||
|
||||
func NmapScan(scanRange string) (Nmaprun, error) {
|
||||
return runNmap(scanRange)
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// Trimmed from real `nmap -sn -oX -` output: one host with a mac (scanned
|
||||
// with raw socket privileges), one without (the scanning host itself).
|
||||
const nmapSample = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<nmaprun scanner="nmap" args="nmap -sn -oX - 10.1.10.0/24" version="7.94">
|
||||
<host><status state="up" reason="arp-response"/>
|
||||
<address addr="10.1.10.1" addrtype="ipv4"/>
|
||||
<address addr="AA:BB:CC:DD:EE:FF" addrtype="mac" vendor="Ubiquiti Networks"/>
|
||||
<hostnames></hostnames>
|
||||
</host>
|
||||
<host><status state="up" reason="localhost-response"/>
|
||||
<address addr="10.1.10.9" addrtype="ipv4"/>
|
||||
<hostnames></hostnames>
|
||||
</host>
|
||||
<runstats><finished time="1754000000" exit="success"/></runstats>
|
||||
</nmaprun>`
|
||||
|
||||
func TestNmaprunUnmarshal(t *testing.T) {
|
||||
nmapOutput := Nmaprun{}
|
||||
if err := xml.Unmarshal([]byte(nmapSample), &nmapOutput); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
if len(nmapOutput.Host) != 2 {
|
||||
t.Fatalf("Host count mismatch: expected 2, got %d", len(nmapOutput.Host))
|
||||
}
|
||||
|
||||
first := nmapOutput.Host[0].Address
|
||||
if len(first) != 2 {
|
||||
t.Fatalf("Address count mismatch: expected 2, got %d", len(first))
|
||||
}
|
||||
if first[0].Addrtype != "ipv4" || first[0].Addr != "10.1.10.1" {
|
||||
t.Errorf("Unexpected ipv4 address: %+v", first[0])
|
||||
}
|
||||
if first[1].Addrtype != "mac" || first[1].Addr != "AA:BB:CC:DD:EE:FF" || first[1].Vendor != "Ubiquiti Networks" {
|
||||
t.Errorf("Unexpected mac address: %+v", first[1])
|
||||
}
|
||||
|
||||
second := nmapOutput.Host[1].Address
|
||||
if len(second) != 1 || second[0].Addrtype != "ipv4" {
|
||||
t.Errorf("Unexpected addresses for mac-less host: %+v", second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNmaprunMacToIP(t *testing.T) {
|
||||
nmapOutput := Nmaprun{}
|
||||
if err := xml.Unmarshal([]byte(nmapSample), &nmapOutput); err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
|
||||
macToIp := nmapOutput.MacToIP()
|
||||
if len(macToIp) != 1 {
|
||||
t.Fatalf("Entry count mismatch: expected 1, got %d", len(macToIp))
|
||||
}
|
||||
// the mac address is normalized to lower case, the mac-less host is skipped
|
||||
if ip := macToIp["aa:bb:cc:dd:ee:ff"]; ip != "10.1.10.1" {
|
||||
t.Errorf("Unexpected ip for aa:bb:cc:dd:ee:ff: %q", ip)
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,22 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logger"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
func ShutdownDevice(device *core.Record) error {
|
||||
logger.Info.Println("Shutdown triggered for", device.GetString("name"))
|
||||
func ShutdownDevice(app core.App, device *core.Record, trigger string) error {
|
||||
log := logging.Logger(app)
|
||||
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
|
||||
@@ -29,6 +32,20 @@ func ShutdownDevice(device *core.Record) error {
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
// 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 }}", deviceIP)
|
||||
shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_MAC }}", deviceMAC)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
@@ -40,7 +57,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)
|
||||
@@ -57,31 +74,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 {
|
||||
log.Error("Failed to ping device during shutdown", "error", 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 {
|
||||
log.Error("Failed to ping device during shutdown", "error", err)
|
||||
return err
|
||||
}
|
||||
if time.Since(start) >= time.Duration(shutdownTimeout)*time.Second {
|
||||
if err := KillProcess(cmd.Process); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := KillProcess(app, cmd.Process); err != nil {
|
||||
log.Error("Failed to kill shutdown command", "error", 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)
|
||||
if err := KillProcess(app, cmd.Process); err != nil {
|
||||
log.Error("Failed to kill shutdown command", "error", 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
|
||||
|
||||
@@ -7,7 +6,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/seriousm4x/upsnap/logger"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@@ -17,8 +17,8 @@ func SetProcessAttributes(cmd *exec.Cmd) {
|
||||
}
|
||||
|
||||
// Kills child processes on Linux. Windows doesn't provide a direct way to kill child processes, so we kill just the main process.
|
||||
func KillProcess(process *os.Process) error {
|
||||
logger.Warning.Println("Your command didn't finish in time. It will be killed.")
|
||||
func KillProcess(app core.App, process *os.Process) error {
|
||||
logging.Logger(app).Warn("Command did not finish in time and will be killed")
|
||||
pgid, err := unix.Getpgid(process.Pid)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -29,7 +29,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
|
||||
|
||||
@@ -7,6 +6,8 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
@@ -14,6 +15,6 @@ import (
|
||||
func SetProcessAttributes(cmd *exec.Cmd) {}
|
||||
|
||||
// Kills child processes on Linux. Windows doesn't provide a direct way to kill child processes, so we kill just the main process.
|
||||
func KillProcess(process *os.Process) error {
|
||||
func KillProcess(_ core.App, process *os.Process) error {
|
||||
return windows.GenerateConsoleCtrlEvent(windows.CTRL_BREAK_EVENT, uint32(process.Pid))
|
||||
}
|
||||
|
||||
@@ -7,25 +7,29 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logger"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
type SolResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func SleepDevice(device *core.Record) (SolResponse, error) {
|
||||
logger.Info.Println("Sleep triggered for", device.GetString("name"))
|
||||
func SleepDevice(app core.App, device *core.Record) (SolResponse, error) {
|
||||
logging.Logger(app).Info("Sleep triggered", "device", device.GetString("name"))
|
||||
|
||||
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,59 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net"
|
||||
)
|
||||
|
||||
// DeviceSubnet returns the device's IPv4 subnet computed from its ip and netmask.
|
||||
func DeviceSubnet(ipStr, maskStr string) (*net.IPNet, error) {
|
||||
ip := net.ParseIP(ipStr)
|
||||
if ip == nil || ip.To4() == nil {
|
||||
return nil, errors.New("ip not a valid ipv4 address")
|
||||
}
|
||||
ip = ip.To4()
|
||||
|
||||
mask := net.ParseIP(maskStr)
|
||||
if mask == nil || mask.To4() == nil {
|
||||
return nil, errors.New("subnet mask not a valid ipv4 address")
|
||||
}
|
||||
ipMask := net.IPMask(mask.To4())
|
||||
|
||||
return &net.IPNet{IP: ip.Mask(ipMask), Mask: ipMask}, nil
|
||||
}
|
||||
|
||||
// ValidateScannableSubnet returns nil if the subnet is suitable for an nmap
|
||||
// scan, or an error explaining why it isn't.
|
||||
func ValidateScannableSubnet(subnet *net.IPNet) error {
|
||||
ones, bits := subnet.Mask.Size()
|
||||
if ones == 0 && bits == 0 {
|
||||
// Size() returns 0,0 for a non-contiguous mask, which has no cidr
|
||||
// notation to hand to nmap
|
||||
return errors.New("netmask is not contiguous")
|
||||
}
|
||||
if ones == bits {
|
||||
return errors.New("a single address has nothing to scan")
|
||||
}
|
||||
if ones < 16 {
|
||||
return errors.New("subnets larger than a /16 take too long to scan")
|
||||
}
|
||||
|
||||
// arp only answers on-link, so the subnet must overlap one of the
|
||||
// host's attached ipv4 networks for a scan to find mac addresses
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, addr := range addrs {
|
||||
attached, ok := addr.(*net.IPNet)
|
||||
if !ok || attached.IP.To4() == nil {
|
||||
continue
|
||||
}
|
||||
// subnets are either disjoint or nested, so checking containment
|
||||
// in both directions covers overlap
|
||||
if attached.Contains(subnet.IP) || subnet.Contains(attached.IP) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return errors.New("subnet does not overlap a directly attached network")
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package networking
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDeviceSubnet(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
ip string
|
||||
netmask string
|
||||
wantCidr string
|
||||
wantError bool
|
||||
}{
|
||||
// Valid case: address is masked down to the network
|
||||
{
|
||||
name: "Valid Case",
|
||||
ip: "192.168.1.100",
|
||||
netmask: "255.255.255.0",
|
||||
wantCidr: "192.168.1.0/24",
|
||||
wantError: false,
|
||||
},
|
||||
// Valid case: wider mask
|
||||
{
|
||||
name: "Valid /16",
|
||||
ip: "10.1.10.142",
|
||||
netmask: "255.255.0.0",
|
||||
wantCidr: "10.1.0.0/16",
|
||||
wantError: false,
|
||||
},
|
||||
// Valid case: host mask
|
||||
{
|
||||
name: "Valid /32",
|
||||
ip: "192.168.1.5",
|
||||
netmask: "255.255.255.255",
|
||||
wantCidr: "192.168.1.5/32",
|
||||
wantError: false,
|
||||
},
|
||||
// Invalid IP address
|
||||
{
|
||||
name: "Invalid IP",
|
||||
ip: "256.1.1.1", // invalid
|
||||
netmask: "255.255.255.0",
|
||||
wantCidr: "",
|
||||
wantError: true,
|
||||
},
|
||||
// Invalid netmask
|
||||
{
|
||||
name: "Invalid Netmask",
|
||||
ip: "192.168.1.100",
|
||||
netmask: "300.255.255.0", // invalid
|
||||
wantCidr: "",
|
||||
wantError: true,
|
||||
},
|
||||
// IPv6 address is not a valid device ip
|
||||
{
|
||||
name: "IPv6 IP",
|
||||
ip: "fe80::1",
|
||||
netmask: "255.255.255.0",
|
||||
wantCidr: "",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
subnet, err := DeviceSubnet(tc.ip, tc.netmask)
|
||||
if tc.wantError {
|
||||
if err == nil {
|
||||
t.Errorf("Expected error but got none")
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
t.Errorf("Got unexpected error: %v", err)
|
||||
} else if subnet.String() != tc.wantCidr {
|
||||
t.Errorf("Subnet mismatch: expected %s, got %s", tc.wantCidr, subnet.String())
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateScannableSubnet(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
ip string
|
||||
netmask string
|
||||
wantError bool
|
||||
}{
|
||||
// A /32 has nothing to scan
|
||||
{
|
||||
name: "Host Mask",
|
||||
ip: "192.168.1.5",
|
||||
netmask: "255.255.255.255",
|
||||
wantError: true,
|
||||
},
|
||||
// A non-contiguous mask has no cidr notation to scan
|
||||
{
|
||||
name: "Non-contiguous Mask",
|
||||
ip: "10.0.1.5",
|
||||
netmask: "255.0.255.0",
|
||||
wantError: true,
|
||||
},
|
||||
// Anything larger than a /16 takes too long to scan
|
||||
{
|
||||
name: "Too Large",
|
||||
ip: "10.0.0.1",
|
||||
netmask: "255.0.0.0",
|
||||
wantError: true,
|
||||
},
|
||||
// The loopback address as a /16 is within limits and always attached
|
||||
{
|
||||
name: "Local /16",
|
||||
ip: "127.0.0.1",
|
||||
netmask: "255.255.0.0",
|
||||
wantError: false,
|
||||
},
|
||||
// A sub-block of the attached loopback /8 is on-link even though
|
||||
// it doesn't contain the host's own 127.0.0.1
|
||||
{
|
||||
name: "Nested In Attached",
|
||||
ip: "127.0.1.5",
|
||||
netmask: "255.255.255.0",
|
||||
wantError: false,
|
||||
},
|
||||
// TEST-NET-1 (RFC 5737) is never assigned to an interface
|
||||
{
|
||||
name: "No Overlap",
|
||||
ip: "192.0.2.1",
|
||||
netmask: "255.255.255.0",
|
||||
wantError: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
subnet, err := DeviceSubnet(tc.ip, tc.netmask)
|
||||
if err != nil {
|
||||
t.Fatalf("Got unexpected error: %v", err)
|
||||
}
|
||||
if err := ValidateScannableSubnet(subnet); (err != nil) != tc.wantError {
|
||||
t.Errorf("ValidateScannableSubnet(%s): expected error=%v, got %v", subnet.String(), tc.wantError, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
+43
-14
@@ -4,16 +4,19 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logger"
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/core"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
)
|
||||
|
||||
func WakeDevice(device *core.Record) error {
|
||||
logger.Info.Println("Wake triggered for", device.GetString("name"))
|
||||
func WakeDevice(app core.App, device *core.Record, trigger string) error {
|
||||
log := logging.Logger(app)
|
||||
log.Info("Wake triggered", "device", device.GetString("name"), "trigger", trigger)
|
||||
|
||||
wakeTimeout := device.GetInt("wake_timeout")
|
||||
if wakeTimeout <= 0 {
|
||||
@@ -32,6 +35,21 @@ func WakeDevice(device *core.Record) error {
|
||||
shell_arg = "-c"
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_IP }}", deviceIP)
|
||||
wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_MAC }}", deviceMAC)
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
@@ -43,7 +61,8 @@ func WakeDevice(device *core.Record) error {
|
||||
cmd.Stderr = &stderr
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to start wake command", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
done := make(chan error, 1)
|
||||
@@ -52,34 +71,44 @@ func WakeDevice(device *core.Record) error {
|
||||
}()
|
||||
|
||||
start := time.Now()
|
||||
commandFinished := false
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-time.After(1 * time.Second):
|
||||
if time.Since(start) >= time.Duration(wakeTimeout)*time.Second {
|
||||
if err := KillProcess(cmd.Process); err != nil {
|
||||
logger.Error.Println(err)
|
||||
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 {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to ping device after wake", "error", 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)
|
||||
if cmd.Process != nil {
|
||||
if err := KillProcess(app, cmd.Process); err != nil {
|
||||
log.Error("Failed to kill wake command", "error", err)
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%s", stderr.String())
|
||||
}
|
||||
commandFinished = true
|
||||
done = nil
|
||||
// Command finished successfully, but we continue the loop until device is online or timeout
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -93,7 +122,7 @@ func WakeDevice(device *core.Record) error {
|
||||
time.Sleep(1 * time.Second)
|
||||
isOnline, err := PingDevice(device)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
log.Error("Failed to ping device after wake", "error", err)
|
||||
return err
|
||||
}
|
||||
if isOnline {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
+70
-131
@@ -2,22 +2,18 @@ package pb
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"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/logger"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
@@ -29,22 +25,22 @@ func HandlerWake(e *core.RequestEvent) error {
|
||||
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := asyncCall(e, func() *router.ApiError {
|
||||
if err := networking.WakeDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.WakeDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to wake device", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -63,23 +59,23 @@ func HandlerSleep(e *core.RequestEvent) error {
|
||||
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := asyncCall(e, func() *router.ApiError {
|
||||
resp, err := networking.SleepDevice(record)
|
||||
resp, err := networking.SleepDevice(e.App, record)
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(e.App).Error("Failed to sleep device", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return apis.NewBadRequestError(resp.Message, nil)
|
||||
}
|
||||
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -98,15 +94,15 @@ func HandlerReboot(e *core.RequestEvent) error {
|
||||
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := asyncCall(e, func() *router.ApiError {
|
||||
if err := networking.ShutdownDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.ShutdownDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to shut down device for reboot", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
@@ -116,18 +112,18 @@ func HandlerReboot(e *core.RequestEvent) error {
|
||||
// so we wait a little to make sure the device has shut down completely and is ready to receive wake requests.
|
||||
time.Sleep(15 * time.Second)
|
||||
|
||||
if err := networking.WakeDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.WakeDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to wake device after reboot", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -146,22 +142,22 @@ func HandlerShutdown(e *core.RequestEvent) error {
|
||||
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := asyncCall(e, func() *router.ApiError {
|
||||
if err := networking.ShutdownDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.ShutdownDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to shut down device", "device", record.GetString("name"), "error", 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)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
}
|
||||
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -173,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 {
|
||||
@@ -184,21 +180,55 @@ func HandlerWakeGroup(e *core.RequestEvent) error {
|
||||
go func() {
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := networking.WakeDevice(record); err != nil {
|
||||
logger.Error.Println(err)
|
||||
if err := networking.WakeDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to wake device", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logger.Error.Println("Failed to save record:", err)
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return e.JSON(http.StatusOK, records)
|
||||
}
|
||||
|
||||
func HandlerShutdownGroup(e *core.RequestEvent) error {
|
||||
records, err := e.App.FindRecordsByFilter("devices", "groups.id ?= {:grpId} && status = 'online'", "", 0, 0,
|
||||
dbx.Params{"grpId": e.Request.PathValue("id")},
|
||||
)
|
||||
if err != nil {
|
||||
return apis.NewNotFoundError("No devices in group", err)
|
||||
}
|
||||
|
||||
for _, record := range records {
|
||||
go func() {
|
||||
record.Set("status", "pending")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to save pending device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
|
||||
if err := networking.ShutdownDevice(e.App, record, "manual"); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to shut down device", "device", record.GetString("name"), "error", err)
|
||||
record.Set("status", "online")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
record.Set("status", "offline")
|
||||
if err := e.App.Save(record); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to save device status", "device", record.GetString("name"), "error", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
@@ -216,97 +246,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 {
|
||||
@@ -355,7 +294,7 @@ func HandlerValidateCron(e *core.RequestEvent) error {
|
||||
var body ValidateCronRequest
|
||||
|
||||
if err := e.BindBody(&body); err != nil {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(e.App).Error("Failed to bind cron validation request", "error", err)
|
||||
return e.BadRequestError("invalid request", err)
|
||||
}
|
||||
|
||||
@@ -386,7 +325,7 @@ func asyncCall(e *core.RequestEvent, fn func() *router.ApiError) *router.ApiErro
|
||||
|
||||
func HandlerWebsiteManifest(e *core.RequestEvent) error {
|
||||
scheme := "http"
|
||||
if e.Request.TLS != nil {
|
||||
if e.Request.TLS != nil || e.Request.Header.Get("X-Forwarded-Proto") == "https" {
|
||||
scheme = "https"
|
||||
}
|
||||
baseUrl := fmt.Sprintf("%s://%s", scheme, e.Request.Host)
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//go:build linux
|
||||
|
||||
package pb
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.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"
|
||||
|
||||
"ganigeorgiev.com/pocketbase/pocketbase/apis"
|
||||
"ganigeorgiev.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)
|
||||
}
|
||||
@@ -1,12 +1,48 @@
|
||||
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 {
|
||||
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 {
|
||||
|
||||
+149
-42
@@ -1,33 +1,40 @@
|
||||
package pb
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"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/logger"
|
||||
"github.com/seriousm4x/upsnap/iptracking"
|
||||
"github.com/seriousm4x/upsnap/logging"
|
||||
_ "github.com/seriousm4x/upsnap/migrations"
|
||||
"github.com/seriousm4x/upsnap/networking"
|
||||
)
|
||||
|
||||
var Version = "(untracked)"
|
||||
|
||||
func StartPocketBase(distDirFS fs.FS) {
|
||||
func StartPocketBase(distDirFS fs.FS) error {
|
||||
if err := logging.ConfigureConsole(os.Getenv("UPSNAP_LOG_LEVEL")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// set data dir
|
||||
// use "./pb_data" if it's in the same dir as upsnap binary
|
||||
// else use os.UserConfigDir() / upsnap
|
||||
var dataDir string
|
||||
baseDir, err := os.Getwd()
|
||||
if err != nil {
|
||||
logger.Error.Fatalln(err)
|
||||
return err
|
||||
}
|
||||
pb_data := path.Join(baseDir, "pb_data")
|
||||
if _, err = os.Stat(pb_data); err == nil {
|
||||
@@ -35,14 +42,14 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
} else if os.IsNotExist(err) {
|
||||
userConfigDir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
logger.Error.Fatalln(err)
|
||||
return err
|
||||
}
|
||||
upsnap_data := path.Join(userConfigDir, "upsnap")
|
||||
if _, err = os.Stat(upsnap_data); err == nil {
|
||||
dataDir = upsnap_data
|
||||
} else if os.IsNotExist(err) {
|
||||
if err := os.MkdirAll(upsnap_data, 0700); err != nil {
|
||||
logger.Error.Fatalln(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,15 +75,15 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
|
||||
// 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())
|
||||
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.POST("/api/upsnap/init-superuser", HandlerInitSuperuser) // https://github.com/pocketbase/pocketbase/discussions/6198
|
||||
se.Router.GET("/api/upsnap/shutdowngroup/{id}", HandlerShutdownGroup).Bind(RequireUpSnapPermission())
|
||||
se.Router.GET("/api/upsnap/scan", HandlerScan).Bind(RequireScanDevicesPermission())
|
||||
se.Router.POST("/api/upsnap/validate-cron", HandlerValidateCron)
|
||||
se.Router.GET("/api/upsnap/manifest.webmanifest", HandlerWebsiteManifest)
|
||||
|
||||
@@ -119,12 +126,19 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
oldShutdownCmd := oldRecord.GetString("shutdown_cmd")
|
||||
oldShutdownCronEnabled := oldRecord.GetBool("shutdown_cron_enabled")
|
||||
|
||||
newIp := newRecord.GetString("ip")
|
||||
oldIp := oldRecord.GetString("ip")
|
||||
newPingCmd := newRecord.GetString("ping_cmd")
|
||||
oldPingCmd := oldRecord.GetString("ping_cmd")
|
||||
|
||||
if newWakeCron != oldWakeCron ||
|
||||
newWakeCmd != oldWakeCmd ||
|
||||
newWakeCronEnabled != oldWakeCronEnabled ||
|
||||
newShutdownCron != oldShutdownCron ||
|
||||
newShutdownCronEnabled != oldShutdownCronEnabled ||
|
||||
newShutdownCmd != oldShutdownCmd {
|
||||
newShutdownCmd != oldShutdownCmd ||
|
||||
newIp != oldIp ||
|
||||
newPingCmd != oldPingCmd {
|
||||
cronjobs.SetWakeShutdownJobs(app)
|
||||
}
|
||||
}
|
||||
@@ -133,10 +147,14 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
return se.Next()
|
||||
})
|
||||
|
||||
app.OnModelAfterCreateSuccess().BindFunc(func(e *core.ModelEvent) error {
|
||||
app.OnModelAfterCreateSuccess("_superusers", "devices").BindFunc(func(e *core.ModelEvent) error {
|
||||
if e.Model.TableName() == "_superusers" {
|
||||
// when pocketbase creates it's default superuser, do not trigger setSetupCompleted()
|
||||
if e.Model.(*core.Record).Email() == core.DefaultInstallerEmail {
|
||||
return e.Next()
|
||||
}
|
||||
if err := setSetupCompleted(e.App); err != nil {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(e.App).Error("Failed to update setup state", "error", err)
|
||||
return err
|
||||
}
|
||||
return e.Next()
|
||||
@@ -149,7 +167,7 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
permissionRec, err := app.FindFirstRecordByFilter("permissions",
|
||||
fmt.Sprintf("user.id = '%s'", userId))
|
||||
if err != nil && err.Error() != "sql: no rows in result set" {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(e.App).Error("Failed to load permissions for new device", "error", err)
|
||||
return err
|
||||
} else if permissionRec != nil {
|
||||
permissionRec.Set("read", append(permissionRec.GetStringSlice("read"), deviceRec.Id))
|
||||
@@ -157,7 +175,7 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
permissionRec.Set("delete", append(permissionRec.GetStringSlice("delete"), deviceRec.Id))
|
||||
permissionRec.Set("power", append(permissionRec.GetStringSlice("power"), deviceRec.Id))
|
||||
if err := app.Save(permissionRec); err != nil {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(e.App).Error("Failed to grant permissions for new device", "error", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -165,35 +183,120 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
app.OnModelAfterDeleteSuccess().BindFunc(func(e *core.ModelEvent) error {
|
||||
if e.Model.TableName() == "_superusers" {
|
||||
if err := setSetupCompleted(e.App); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
app.OnModelAfterDeleteSuccess("_superusers").BindFunc(func(e *core.ModelEvent) error {
|
||||
if err := setSetupCompleted(e.App); err != nil {
|
||||
logging.Logger(e.App).Error("Failed to update setup state", "error", err)
|
||||
return err
|
||||
}
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
app.OnRecordValidate("devices").BindFunc(func(e *core.RecordEvent) error {
|
||||
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)
|
||||
if saveErr != nil {
|
||||
return saveErr
|
||||
}
|
||||
}
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
// prevent new superuser bahavior introduced in pocketbase 0.23
|
||||
app.OnRecordCreate(core.CollectionNameSuperusers).BindFunc(func(e *core.RecordEvent) error {
|
||||
if e.Record.Email() == core.DefaultInstallerEmail {
|
||||
return errors.New("skip default PocketBase installer")
|
||||
app.OnRealtimeConnectRequest().BindFunc(func(e *core.RealtimeConnectRequestEvent) error {
|
||||
// a client just became active: catch up on any tracking sweep that
|
||||
// was skipped while nobody was connected
|
||||
settings, err := e.App.FindFirstRecordByFilter("settings_private", "")
|
||||
if err != nil {
|
||||
logging.Logger(e.App).Error("Failed to load private settings on realtime connection", "error", err)
|
||||
} else if settings.GetBool("lazy_ping") && settings.GetString("track_ip_interval") != "" {
|
||||
go iptracking.CatchUpSweep(e.App)
|
||||
}
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
app.OnTerminate().BindFunc(func(e *core.TerminateEvent) error {
|
||||
cronjobs.StopAll()
|
||||
app.OnRealtimeConnectRequest().BindFunc(func(e *core.RealtimeConnectRequestEvent) error {
|
||||
// PocketBase has no realtime disconnect hook. When a browser refreshes,
|
||||
// the old client may disappear before the new connection is registered.
|
||||
// Delay the offline transition and use the connecting client's id to
|
||||
// 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
|
||||
}
|
||||
time.AfterFunc(2*time.Second, func() {
|
||||
if _, err := e.App.SubscriptionsBroker().ClientById(clientID); err == nil {
|
||||
return
|
||||
}
|
||||
if len(e.App.SubscriptionsBroker().Clients()) != 0 {
|
||||
return
|
||||
}
|
||||
allDevices, err := app.FindAllRecords("devices", dbx.NewExp("shutdown_cmd != ''"))
|
||||
if err != nil {
|
||||
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)
|
||||
}
|
||||
})
|
||||
}()
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
if err := app.Start(); err != nil {
|
||||
logger.Error.Fatalln(err)
|
||||
app.OnTerminate().BindFunc(func(e *core.TerminateEvent) error {
|
||||
cronjobs.StopAll(e.App)
|
||||
return e.Next()
|
||||
})
|
||||
|
||||
// check for custom http listen address in env var, else use default
|
||||
httpListen := os.Getenv("UPSNAP_HTTP_LISTEN")
|
||||
if httpListen != "" {
|
||||
if err := app.Bootstrap(); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := apis.Serve(app, apis.ServeConfig{
|
||||
HttpAddr: httpListen,
|
||||
ShowStartBanner: true,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := app.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func importSettings(app *pocketbase.PocketBase) error {
|
||||
func importSettings(app core.App) error {
|
||||
settingsPrivateRecords, err := app.FindAllRecords("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -239,12 +342,10 @@ func importSettings(app *pocketbase.PocketBase) error {
|
||||
if interval == "*/3 * * * *" || interval == "@every 3s" {
|
||||
settingsPrivate.Set("interval", defaultInterval)
|
||||
if e := app.Save(settingsPrivate); e != nil {
|
||||
logger.Error.Println(e)
|
||||
logging.Logger(app).Error("Failed to save default ping interval", "error", e)
|
||||
}
|
||||
} else {
|
||||
logger.Error.Printf("'%s' ping interval is not valid.\n", interval)
|
||||
logger.Error.Println("Please go to '/settings/' and change your ping interval.")
|
||||
logger.Error.Println("Falling back to default interval: " + defaultInterval)
|
||||
logging.Logger(app).Error("Invalid ping interval; using default", "interval", interval, "default", defaultInterval)
|
||||
}
|
||||
interval = defaultInterval
|
||||
}
|
||||
@@ -265,15 +366,14 @@ func importSettings(app *pocketbase.PocketBase) error {
|
||||
return err
|
||||
}
|
||||
if err := setSetupCompleted(app); err != nil {
|
||||
logger.Error.Println(err)
|
||||
logging.Logger(app).Error("Failed to update setup state", "error", err)
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info.Println("Ping interval set to", interval)
|
||||
return nil
|
||||
}
|
||||
|
||||
func resetDeviceStates(app *pocketbase.PocketBase) error {
|
||||
func resetDeviceStates(app core.App) error {
|
||||
devices, err := app.FindAllRecords("devices")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -288,15 +388,22 @@ func resetDeviceStates(app *pocketbase.PocketBase) error {
|
||||
}
|
||||
|
||||
func setSetupCompleted(app core.App) error {
|
||||
totalAdmins, err := app.CountRecords(core.CollectionNameSuperusers)
|
||||
allSuperusers, err := app.FindAllRecords(core.CollectionNameSuperusers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
realSuperusers := 0
|
||||
for _, r := range allSuperusers {
|
||||
// exclude the temporary PocketBase installer account from the count
|
||||
if r.Email() != core.DefaultInstallerEmail {
|
||||
realSuperusers++
|
||||
}
|
||||
}
|
||||
settingsPublicRecords, err := app.FindAllRecords("settings_public")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if totalAdmins > 0 {
|
||||
if realSuperusers > 0 {
|
||||
settingsPublicRecords[0].Set("setup_completed", true)
|
||||
} else {
|
||||
settingsPublicRecords[0].Set("setup_completed", false)
|
||||
|
||||
+11
-1
@@ -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,12 +11,18 @@ 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
|
||||
# environment:
|
||||
# - TZ=Europe/Berlin # Set container timezone for cron schedules
|
||||
# - UPSNAP_HTTP_LISTEN=127.0.0.1:8090
|
||||
# - UPSNAP_INTERVAL=*/10 * * * * * # Sets the interval in which the devices are pinged
|
||||
# - UPSNAP_LOG_LEVEL=INFO # Console level for UpSnap logs: DEBUG, INFO, WARN, ERROR, or OFF
|
||||
# - UPSNAP_SCAN_RANGE=192.168.1.0/24 # Scan range is used for device discovery on local network
|
||||
# - UPSNAP_WEBSITE_TITLE=Custom name # Custom website title
|
||||
# # dns is used for name resolution during network scan
|
||||
@@ -25,4 +35,4 @@ services:
|
||||
# test: curl -fs "http://localhost:5000/api/health" || exit 1
|
||||
# interval: 10s
|
||||
# # or install custom packages for shutdown
|
||||
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
|
||||
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve"
|
||||
|
||||
+17
-9
@@ -1,28 +1,36 @@
|
||||
services:
|
||||
upsnap:
|
||||
cap_add:
|
||||
- NET_RAW # NET_RAW is required for privileged ping, network device scan and ip address tracking (nmap)
|
||||
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
|
||||
# # 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:
|
||||
# - TZ=Europe/Berlin # Set container timezone for cron schedules
|
||||
# - UPSNAP_HTTP_LISTEN=127.0.0.1:8090
|
||||
# - UPSNAP_INTERVAL=*/10 * * * * * # Sets the interval in which the devices are pinged
|
||||
# - UPSNAP_LOG_LEVEL=INFO # Console level for UpSnap logs: DEBUG, INFO, WARN, ERROR, or OFF
|
||||
# - 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
|
||||
# - 192.18.0.2
|
||||
# # you can change the listen ip:port inside the container like this:
|
||||
# entrypoint: /bin/sh -c "./upsnap serve --http 0.0.0.0:5000"
|
||||
# healthcheck:
|
||||
# test: curl -fs "http://localhost:5000/api/health" || exit 1
|
||||
# interval: 10s
|
||||
# # or install custom packages for shutdown
|
||||
# entrypoint: /bin/sh -c "apk update && apk add --no-cache <YOUR_PACKAGE> && rm -rf /var/cache/apk/* && ./upsnap serve --http 0.0.0.0:8090"
|
||||
|
||||
+27
-34
@@ -15,29 +15,29 @@
|
||||
"machine-translate": "inlang machine translate --project project.inlang"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.3.2",
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@inlang/cli": "^3.0.12",
|
||||
"@inlang/paraglide-js": "2.3.2",
|
||||
"@sveltejs/adapter-static": "^3.0.9",
|
||||
"@sveltejs/kit": "^2.39.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.1.1",
|
||||
"daisyui": "^5.1.12",
|
||||
"eslint": "^9.35.0",
|
||||
"@eslint/compat": "^2.1.1",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@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.12.3",
|
||||
"globals": "^16.4.0",
|
||||
"eslint-plugin-svelte": "^3.24.0",
|
||||
"globals": "^17.14.0",
|
||||
"husky": "^9.1.7",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-plugin-svelte": "^3.4.0",
|
||||
"prettier-plugin-tailwindcss": "^0.6.14",
|
||||
"svelte": "^5.38.10",
|
||||
"svelte-check": "^4.3.1",
|
||||
"tailwindcss": "^4.1.13",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.44.0",
|
||||
"vite": "^6.3.6"
|
||||
"prettier": "^3.9.10",
|
||||
"prettier-plugin-svelte": "^4.1.1",
|
||||
"prettier-plugin-tailwindcss": "^0.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.72.1",
|
||||
"vite": "^8.3.6"
|
||||
},
|
||||
"type": "module",
|
||||
"lint-staged": {
|
||||
@@ -45,20 +45,13 @@
|
||||
"*.{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.13",
|
||||
"cron-parser": "^5.4.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"pocketbase": "^0.26.2",
|
||||
"postcss": "^8.5.6",
|
||||
"@fortawesome/free-solid-svg-icons": "^7.3.1",
|
||||
"@tailwindcss/vite": "^4.3.4",
|
||||
"cron-parser": "^5.10.3",
|
||||
"date-fns": "^4.4.0",
|
||||
"pocketbase": "^0.28.2",
|
||||
"svelte-fa": "^4.0.4",
|
||||
"svelte-french-toast": "github:seriousm4x/svelte-french-toast#fix-72-build",
|
||||
"theme-change": "^2.5.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"@tailwindcss/oxide",
|
||||
"esbuild"
|
||||
]
|
||||
"theme-change": "^2.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+1569
-2617
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
allowBuilds:
|
||||
esbuild: true
|
||||
svelte-french-toast: true
|
||||
svelte-french-toast@https://codeload.github.com/seriousm4x/svelte-french-toast/tar.gz/fbf89b9952cf11e15174b1841a6eb1ad23770349: true
|
||||
@@ -1,5 +0,0 @@
|
||||
export default {
|
||||
plugins: {
|
||||
'@tailwindcss/postcss': {}
|
||||
}
|
||||
};
|
||||
@@ -1 +1,24 @@
|
||||
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 and Paraglide configuration
|
||||
*
|
||||
!settings.json
|
||||
!descriptions.json
|
||||
!paraglide.config.js
|
||||
!paraglide.config.mjs
|
||||
!paraglide.config.ts
|
||||
!paraglide.config.cjs
|
||||
@@ -2,8 +2,11 @@
|
||||
"$schema": "https://inlang.com/schema/project-settings",
|
||||
"baseLocale": "en-US",
|
||||
"locales": [
|
||||
"ar-SA",
|
||||
"bg-BG",
|
||||
"cs-CZ",
|
||||
"de-DE",
|
||||
"el-GR",
|
||||
"en-US",
|
||||
"es-ES",
|
||||
"fr-FR",
|
||||
@@ -15,7 +18,9 @@
|
||||
"nl-NL",
|
||||
"nb-NO",
|
||||
"pl-PL",
|
||||
"pt-BR",
|
||||
"pt-PT",
|
||||
"ru-RU",
|
||||
"uk-UA",
|
||||
"vi-VN",
|
||||
"zh-TW",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@import 'tailwindcss';
|
||||
|
||||
@plugin "daisyui" {
|
||||
@plugin 'daisyui' {
|
||||
themes: all;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
{
|
||||
text: m.device_card_btn_more_edit(),
|
||||
icon: faPen,
|
||||
onClick: () => goto(resolve(`/device/${device.id}`)),
|
||||
onClick: () => goto(resolve(`/device?id=${device.id}`)),
|
||||
requires: $pocketbase.authStore.isSuperuser || $permission.update?.includes(device.id)
|
||||
}
|
||||
]);
|
||||
|
||||
@@ -163,9 +163,9 @@
|
||||
>
|
||||
{:else if device.status === 'pending'}
|
||||
<button class="btn btn-warning">
|
||||
<span class="countdown font-mono">
|
||||
<span style="--value:{minutes};"></span>:
|
||||
<span style="--value:{seconds};"></span>
|
||||
<span class="countdown font-mono tabular-nums">
|
||||
<span style="--value:{minutes};--digits: 2"></span>:
|
||||
<span style="--value:{seconds};--digits: 2"></span>
|
||||
</span>
|
||||
</button>
|
||||
{:else}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { nextCronDate, parseCron as validateCron } from '$lib/helpers/cron';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { permission, pocketbase } from '$lib/stores/pocketbase';
|
||||
import { settingsPriv } from '$lib/stores/settings';
|
||||
import type { Device, Group, Port } from '$lib/types/device';
|
||||
import { faSave, faTrash, faX } from '@fortawesome/free-solid-svg-icons';
|
||||
import { onMount } from 'svelte';
|
||||
@@ -21,7 +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})$';
|
||||
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());
|
||||
@@ -225,6 +244,7 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_ip()}
|
||||
class="input"
|
||||
maxlength="255"
|
||||
bind:value={device.ip}
|
||||
required
|
||||
/>
|
||||
@@ -237,6 +257,8 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_mac()}
|
||||
class="input"
|
||||
maxlength="18"
|
||||
pattern={macPattern}
|
||||
bind:value={device.mac}
|
||||
required
|
||||
/>
|
||||
@@ -249,6 +271,8 @@
|
||||
type="text"
|
||||
placeholder={m.device_general_netmask()}
|
||||
class="input"
|
||||
maxlength="16"
|
||||
pattern={netmaskPattern}
|
||||
bind:value={device.netmask}
|
||||
required
|
||||
/>
|
||||
@@ -267,6 +291,19 @@
|
||||
</fieldset>
|
||||
<span class="badge text-error self-center">* {m.device_general_required_field()}</span>
|
||||
</div>
|
||||
<fieldset class="fieldset bg-base-100 border-base-300 rounded-box mt-2 w-fit border p-4">
|
||||
<legend class="fieldset-legend">{m.device_general_track_ip()}</legend>
|
||||
<label class="fieldset-label">
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={device.track_ip}
|
||||
class="toggle toggle-success"
|
||||
disabled={$settingsPriv?.track_ip_interval === '' || !ipPattern.test(device.ip)}
|
||||
/>
|
||||
{m.device_general_track_ip()}
|
||||
</label>
|
||||
<p class="fieldset-label max-w-md">{m.device_general_track_ip_desc()}</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card bg-base-200 mt-6 w-full shadow-sm">
|
||||
@@ -327,7 +364,7 @@
|
||||
{@html m.device_ping_desc()}
|
||||
</p>
|
||||
<fieldset class="fieldset">
|
||||
<label class="input mt-2">
|
||||
<label class="input mt-2 w-full">
|
||||
<span>$:</span>
|
||||
<input
|
||||
type="text"
|
||||
@@ -343,7 +380,7 @@
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{m.device_wake()}</h2>
|
||||
<p>
|
||||
{m.device_wake_desc()}
|
||||
{@html m.device_wake_desc()}
|
||||
<!-- eslint-disable svelte/no-at-html-tags -->
|
||||
{@html m.settings_ping_interval_desc2()}
|
||||
</p>
|
||||
@@ -360,8 +397,8 @@
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<label class="input mt-2">
|
||||
<fieldset class="fieldset grow">
|
||||
<label class="input mt-2 w-full">
|
||||
<span>$:</span>
|
||||
<input
|
||||
type="text"
|
||||
@@ -457,8 +494,8 @@ second (0–59, optional)
|
||||
/>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<label class="input mt-2">
|
||||
<fieldset class="fieldset grow">
|
||||
<label class="input mt-2 w-full">
|
||||
<span>$:</span>
|
||||
<input
|
||||
type="text"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
faCog,
|
||||
faDoorOpen,
|
||||
faHome,
|
||||
faListUl,
|
||||
faPlus,
|
||||
faSwatchbook,
|
||||
faUserGear,
|
||||
@@ -103,7 +104,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">
|
||||
@@ -132,6 +133,14 @@
|
||||
><Fa icon={faCog} />{m.settings_page_title()}</a
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href={resolve('/logs/')}
|
||||
class="px-4 py-2"
|
||||
class:active={page.url.pathname.startsWith(resolve('/logs'))}
|
||||
><Fa icon={faListUl} />{m.logs_page_title()}</a
|
||||
>
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<details>
|
||||
@@ -207,6 +216,14 @@
|
||||
><Fa icon={faCog} />{m.settings_page_title()}</a
|
||||
>
|
||||
</li>
|
||||
<li class="h-full">
|
||||
<a
|
||||
href={resolve('/logs/')}
|
||||
class="p-2"
|
||||
class:menu-active={page.url.pathname.startsWith(resolve('/logs'))}
|
||||
><Fa icon={faListUl} />{m.logs_page_title()}</a
|
||||
>
|
||||
</li>
|
||||
{/if}
|
||||
<div class="dropdown dropdown-end">
|
||||
<button class="btn btn-ghost hover:bg-base-content/10 h-full border-0 p-2" tabindex="0">
|
||||
@@ -259,7 +276,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,44 +121,47 @@
|
||||
}
|
||||
</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>
|
||||
<h2 class="card-title">{m['device_tabs_0']()}</h2>
|
||||
<p class="my-2">
|
||||
{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,13 +1,13 @@
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { dateFnsLocale } from '$lib/stores/locale';
|
||||
import { backendUrl } from '$lib/stores/pocketbase';
|
||||
import cronParser from 'cron-parser';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import { formatDate, type Locale } from 'date-fns';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
export function nextCronDate(expression: string) {
|
||||
try {
|
||||
const cron = cronParser.parse(expression);
|
||||
const cron = CronExpressionParser.parse(expression);
|
||||
const cronStr = cron.next().toISOString();
|
||||
if (!cronStr) {
|
||||
throw new Error(m.settings_invalid_cron());
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
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';
|
||||
import { el } from 'date-fns/locale/el';
|
||||
import { enUS } from 'date-fns/locale/en-US';
|
||||
import { es } from 'date-fns/locale/es';
|
||||
import { fr } from 'date-fns/locale/fr';
|
||||
@@ -14,11 +17,12 @@ import { nb } from 'date-fns/locale/nb';
|
||||
import { nl } from 'date-fns/locale/nl';
|
||||
import { pl } from 'date-fns/locale/pl';
|
||||
import { pt } from 'date-fns/locale/pt';
|
||||
import { ptBR } from 'date-fns/locale/pt-BR';
|
||||
import { ru } from 'date-fns/locale/ru';
|
||||
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());
|
||||
@@ -26,12 +30,21 @@ 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;
|
||||
case 'cs-CZ':
|
||||
dateFnsLocale.set(cs);
|
||||
break;
|
||||
case 'de-DE':
|
||||
dateFnsLocale.set(de);
|
||||
break;
|
||||
case 'el-GR':
|
||||
dateFnsLocale.set(el);
|
||||
break;
|
||||
case 'en-US':
|
||||
dateFnsLocale.set(enUS);
|
||||
break;
|
||||
@@ -65,9 +78,15 @@ localeStore.subscribe((l: string) => {
|
||||
case 'pl-PL':
|
||||
dateFnsLocale.set(pl);
|
||||
break;
|
||||
case 'pt-BR':
|
||||
dateFnsLocale.set(ptBR);
|
||||
break;
|
||||
case 'pt':
|
||||
dateFnsLocale.set(pt);
|
||||
break;
|
||||
case 'ru-RU':
|
||||
dateFnsLocale.set(ru);
|
||||
break;
|
||||
case 'uk-UA':
|
||||
dateFnsLocale.set(uk);
|
||||
break;
|
||||
|
||||
@@ -5,6 +5,7 @@ export type Device = RecordModel & {
|
||||
ip: string;
|
||||
mac: string;
|
||||
netmask: string;
|
||||
track_ip: boolean;
|
||||
description: string;
|
||||
status: 'pending' | 'online' | 'offline' | '';
|
||||
ports: string[];
|
||||
|
||||
@@ -11,4 +11,5 @@ export type SettingsPrivate = RecordModel & {
|
||||
interval: string;
|
||||
lazy_ping: boolean;
|
||||
scan_range: string;
|
||||
track_ip_interval: string;
|
||||
};
|
||||
|
||||
@@ -5,18 +5,36 @@
|
||||
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 { settingsPriv, settingsPub } from '$lib/stores/settings';
|
||||
import type { Permission } from '$lib/types/permission';
|
||||
import type { SettingsPublic } from '$lib/types/settings';
|
||||
import type { SettingsPrivate, SettingsPublic } from '$lib/types/settings';
|
||||
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,9 +66,11 @@
|
||||
}
|
||||
|
||||
// redirect to welcome page if setup is not completed
|
||||
if ($settingsPub.setup_completed === false && page.url.pathname !== '/welcome') {
|
||||
if ($settingsPub.setup_completed === false) {
|
||||
$pocketbase.authStore.clear();
|
||||
goto(resolve('/welcome'));
|
||||
if (page.url.pathname !== '/welcome/') {
|
||||
goto(resolve('/welcome'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,6 +79,13 @@
|
||||
await $pocketbase
|
||||
.collection('_superusers')
|
||||
.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;
|
||||
@@ -86,7 +113,11 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="manifest" href={backendUrl + 'api/upsnap/manifest.webmanifest'} />
|
||||
<link
|
||||
rel="manifest"
|
||||
href={backendUrl + 'api/upsnap/manifest.webmanifest'}
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link
|
||||
rel="shortcut icon"
|
||||
href={$settingsPub?.id && $settingsPub?.favicon
|
||||
@@ -108,6 +139,6 @@
|
||||
|
||||
<Transition url={page.url}>
|
||||
<div class="container mx-auto mb-4 p-2">
|
||||
<slot />
|
||||
{@render children()}
|
||||
</div>
|
||||
</Transition>
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
let orderByGroups = $state(true);
|
||||
let searchQuery = $state('');
|
||||
let searchInput: HTMLInputElement | undefined = $state();
|
||||
let modalShutdownGroup: HTMLDialogElement | undefined = $state();
|
||||
let pendingShutdownGroup: Group | null = $state(null);
|
||||
let filteredDevices: Device[] = $derived([]);
|
||||
let devicesWithoutGroups: Device[] = $derived([]);
|
||||
let devicesWithGroup: {
|
||||
@@ -32,7 +34,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) {
|
||||
@@ -111,6 +113,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
function askShutdownGroupConfirmation(group: Group) {
|
||||
pendingShutdownGroup = group;
|
||||
modalShutdownGroup?.showModal();
|
||||
}
|
||||
|
||||
function executeShutdownGroup() {
|
||||
if (pendingShutdownGroup) {
|
||||
fetch(`${backendUrl}api/upsnap/shutdowngroup/${pendingShutdownGroup.id}`, {
|
||||
headers: {
|
||||
Authorization: $pocketbase.authStore.token
|
||||
}
|
||||
}).catch((err) => {
|
||||
toast.error(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
orderBy = (localStorage.getItem('orderBy') as 'name' | 'ip') || 'name';
|
||||
orderByGroups = localStorage.getItem('orderByGroups') !== 'false';
|
||||
@@ -150,12 +169,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 +182,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()}
|
||||
@@ -189,19 +208,24 @@
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{#each devicesWithGroup.sort( (a, b) => (a.group?.name ?? '').localeCompare( b.group?.name ?? '', $localeStore, { numeric: true } ) ) as { group, devices } (group?.id)}
|
||||
{#each devicesWithGroup.sort( (a, b) => (a.group?.name ?? '').localeCompare( b.group?.name ?? '', $localeStore, { numeric: true } ) ) as { group, devices: groupDevices } (group?.id)}
|
||||
<div>
|
||||
<h1 class="mb-3 text-2xl font-bold">
|
||||
{group?.name ?? 'Unknown group name'}
|
||||
<h1 class="mb-3 flex flex-wrap items-center gap-3 text-2xl font-bold">
|
||||
<span>{group?.name ?? 'Unknown group name'}</span>
|
||||
<button
|
||||
class="btn btn-sm btn-success btn-soft"
|
||||
onclick={() => wakeGroup(group?.id ?? '')}
|
||||
><Fa icon={faPowerOff} /> {m.home_wake_group()}</button
|
||||
>
|
||||
<button
|
||||
class="btn btn-sm btn-error btn-soft"
|
||||
onclick={() => group && askShutdownGroupConfirmation(group)}
|
||||
><Fa icon={faPowerOff} /> {m.home_shutdown_group()}</button
|
||||
>
|
||||
</h1>
|
||||
<div class={gridClass}>
|
||||
{#each devices as device, i (device.id)}
|
||||
<DeviceCard bind:device={devices[i]} />
|
||||
{#each groupDevices as device (device.id)}
|
||||
<DeviceCard bind:device={devices[devices.findIndex((d) => d.id === device.id)]} />
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
@@ -212,8 +236,8 @@
|
||||
.snapshot(filteredDevices)
|
||||
.sort((a, b) => a[orderBy].localeCompare(b[orderBy], $localeStore, { numeric: true }))}
|
||||
<div class={gridClass}>
|
||||
{#each sorted as device, i (device.id)}
|
||||
<DeviceCard bind:device={sorted[i]} />
|
||||
{#each sorted as device (device.id)}
|
||||
<DeviceCard bind:device={devices[devices.findIndex((d) => d.id === device.id)]} />
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -237,3 +261,20 @@
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<dialog class="modal" bind:this={modalShutdownGroup}>
|
||||
<div class="modal-box">
|
||||
<h3 class="text-lg font-bold">
|
||||
{m.home_modal_confirm_shutdown_group_title({ group: pendingShutdownGroup?.name ?? '' })}
|
||||
</h3>
|
||||
<p class="py-4">
|
||||
{m.home_modal_confirm_shutdown_group_desc({ group: pendingShutdownGroup?.name ?? '' })}
|
||||
</p>
|
||||
<div class="modal-action">
|
||||
<form method="dialog">
|
||||
<button class="btn">{m.buttons_cancel()}</button>
|
||||
<button class="btn btn-error" onclick={executeShutdownGroup}>{m.buttons_confirm()}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
// locales
|
||||
const languageEmojis = {
|
||||
'ar-SA': '🇸🇦',
|
||||
'bg-BG': '🇧🇬',
|
||||
'cs-CZ': '🇨🇿',
|
||||
'de-DE': '🇩🇪',
|
||||
'el-GR': '🇬🇷',
|
||||
'en-US': '🇺🇸',
|
||||
'es-ES': '🇪🇸',
|
||||
'fr-FR': '🇫🇷',
|
||||
@@ -29,7 +32,9 @@
|
||||
'nb-NO': '🇳🇴',
|
||||
'nl-NL': '🇳🇱',
|
||||
'pl-PL': '🇵🇱',
|
||||
'pt-BR': '🇧🇷',
|
||||
'pt-PT': '🇵🇹',
|
||||
'ru-RU': '🇷🇺',
|
||||
'uk-UA': '🇺🇦',
|
||||
'vi-VN': '🇻🇳',
|
||||
'zh-CN': '🇨🇳',
|
||||
|
||||
+30
-26
@@ -7,11 +7,15 @@
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { permission, pocketbase } from '$lib/stores/pocketbase';
|
||||
import type { Device, Group, Port } from '$lib/types/device';
|
||||
import { onMount } from 'svelte';
|
||||
import toast from 'svelte-french-toast';
|
||||
|
||||
let device: Device | null = $state(null);
|
||||
let error: string | null = $state(null);
|
||||
|
||||
$effect(() => {
|
||||
if (Object.hasOwn($permission, 'update')) {
|
||||
const id = page.params.id;
|
||||
const id = page.url.searchParams.get('id');
|
||||
if (!$pocketbase.authStore.isSuperuser && !$permission.update.includes(id || '')) {
|
||||
toast(m.toasts_no_permission({ url: page.url.pathname }), {
|
||||
icon: '⛔'
|
||||
@@ -21,35 +25,35 @@
|
||||
}
|
||||
});
|
||||
|
||||
async function getDevice(): Promise<Device> {
|
||||
const id = page.params.id;
|
||||
if (!id) throw new Error('No device ID provided');
|
||||
onMount(async () => {
|
||||
try {
|
||||
const id = page.url.searchParams.get('id');
|
||||
if (!id) throw new Error('No device ID provided');
|
||||
|
||||
const resp = await $pocketbase.collection('devices').getOne(id, { expand: 'ports,groups' });
|
||||
let device = resp as Device;
|
||||
const resp = await $pocketbase.collection('devices').getOne(id, { expand: 'ports,groups' });
|
||||
const dev = resp as Device;
|
||||
|
||||
if (!device.expand) {
|
||||
device.expand = {} as {
|
||||
ports: Port[];
|
||||
groups: Group[];
|
||||
};
|
||||
if (!dev.expand) {
|
||||
dev.expand = {} as { ports: Port[]; groups: Group[] };
|
||||
}
|
||||
if (!dev.expand.ports) {
|
||||
dev.expand.ports = [] as Port[];
|
||||
}
|
||||
|
||||
device = dev;
|
||||
} catch (err) {
|
||||
error = String(err);
|
||||
}
|
||||
|
||||
if (!device.expand.ports) {
|
||||
device.expand.ports = [] as Port[];
|
||||
}
|
||||
|
||||
return resp as Device;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
{#await getDevice()}
|
||||
<PageLoading />
|
||||
{:then device}
|
||||
{#if error}
|
||||
<div class="container mx-auto max-w-lg">
|
||||
{error}
|
||||
</div>
|
||||
{:else if device}
|
||||
<h1 class="mb-8 text-3xl font-bold sm:break-all">{device.name}</h1>
|
||||
<DeviceForm {device} />
|
||||
{:catch err}
|
||||
<div class="container mx-auto max-w-lg">
|
||||
{err}
|
||||
</div>
|
||||
{/await}
|
||||
{:else}
|
||||
<PageLoading />
|
||||
{/if}
|
||||
@@ -60,15 +60,15 @@
|
||||
let tabs = [
|
||||
{
|
||||
name: 'manual',
|
||||
ll_name: m['device_tabs.0'](),
|
||||
ll_name: m['device_tabs_0'](),
|
||||
icon: faWrench,
|
||||
show: true
|
||||
},
|
||||
{
|
||||
name: 'scan',
|
||||
ll_name: m['device_tabs.1'](),
|
||||
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>
|
||||
|
||||
@@ -0,0 +1,492 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import { page } from '$app/state';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { pocketbase } from '$lib/stores/pocketbase';
|
||||
import {
|
||||
faArrowDown,
|
||||
faArrowUp,
|
||||
faArrowsRotate,
|
||||
faChevronDown,
|
||||
faChevronLeft,
|
||||
faChevronRight,
|
||||
faChevronUp,
|
||||
faFilter
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import type { LogModel } from 'pocketbase';
|
||||
import { onMount } from 'svelte';
|
||||
import Fa from 'svelte-fa';
|
||||
import toast from 'svelte-french-toast';
|
||||
|
||||
let logs = $state.raw<LogModel[]>([]);
|
||||
let currentPage = $state(1);
|
||||
let perPage = $state(20);
|
||||
let totalItems = $state(0);
|
||||
let totalPages = $state(0);
|
||||
let selectedLevel = $state('');
|
||||
let textSearch = $state('');
|
||||
let onlyUpSnapLogs = $state(true);
|
||||
let sort = $state('-created');
|
||||
let intervalSeconds = $state(5);
|
||||
let loading = $state(true);
|
||||
let refreshing = $state(false);
|
||||
let reloadPending = false;
|
||||
let error = $state('');
|
||||
let lastUpdated = $state<Date>();
|
||||
let pollTimer: ReturnType<typeof setInterval> | undefined;
|
||||
let searchTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
let detailsDialog: HTMLDialogElement;
|
||||
let selectedLog = $state<LogModel>();
|
||||
let mobileFiltersOpen = $state(false);
|
||||
|
||||
const levels = [
|
||||
{ value: '', label: () => m.logs_level_all() },
|
||||
{ value: '8', label: () => 'ERROR' },
|
||||
{ value: '4', label: () => 'WARN' },
|
||||
{ value: '0', label: () => 'INFO' },
|
||||
{ value: '-4', label: () => 'DEBUG' }
|
||||
];
|
||||
|
||||
function levelMeta(level: string) {
|
||||
switch (Number(level)) {
|
||||
case 8:
|
||||
return { label: 'ERROR', dotClass: 'bg-error' };
|
||||
case 4:
|
||||
return { label: 'WARN', dotClass: 'bg-warning' };
|
||||
case 0:
|
||||
return { label: 'INFO', dotClass: 'bg-success' };
|
||||
case -4:
|
||||
return { label: 'DEBUG', dotClass: 'bg-info' };
|
||||
default:
|
||||
return { label: 'UNKNOWN', dotClass: 'bg-base-content/60' };
|
||||
}
|
||||
}
|
||||
|
||||
function hasData(entry: LogModel) {
|
||||
return entry.data && Object.keys(entry.data).length > 0;
|
||||
}
|
||||
|
||||
function showDetails(entry: LogModel) {
|
||||
selectedLog = entry;
|
||||
detailsDialog.showModal();
|
||||
}
|
||||
|
||||
function dataEntries(entry: LogModel) {
|
||||
return Object.entries(entry.data ?? {});
|
||||
}
|
||||
|
||||
function dataValue(value: unknown) {
|
||||
if (value === '') return 'N/A';
|
||||
if (typeof value === 'object') return JSON.stringify(value);
|
||||
return String(value);
|
||||
}
|
||||
|
||||
function updateSearch() {
|
||||
if (searchTimer) clearTimeout(searchTimer);
|
||||
searchTimer = setTimeout(() => updateQuery(), 250);
|
||||
}
|
||||
|
||||
function toggleSort(field: 'created' | 'message') {
|
||||
sort = sort === field ? `-${field}` : field;
|
||||
void loadLogs();
|
||||
}
|
||||
|
||||
async function loadLogs(initial = false, notifyError = false) {
|
||||
if (refreshing) {
|
||||
reloadPending = true;
|
||||
return;
|
||||
}
|
||||
|
||||
refreshing = true;
|
||||
if (initial) loading = true;
|
||||
error = '';
|
||||
|
||||
try {
|
||||
const filters = [];
|
||||
if (selectedLevel) filters.push(`level = ${selectedLevel}`);
|
||||
if (onlyUpSnapLogs) filters.push('data.upsnap = true');
|
||||
if (textSearch.trim()) {
|
||||
filters.push(
|
||||
$pocketbase.filter('(level ?~ {:search} || message ?~ {:search} || data ?~ {:search})', {
|
||||
search: textSearch.trim()
|
||||
})
|
||||
);
|
||||
}
|
||||
const result = await $pocketbase.logs.getList(currentPage, perPage, {
|
||||
sort,
|
||||
filter: filters.join(' && ')
|
||||
});
|
||||
if (result.totalPages > 0 && currentPage > result.totalPages) {
|
||||
currentPage = result.totalPages;
|
||||
reloadPending = true;
|
||||
return;
|
||||
}
|
||||
if (result.totalPages === 0) currentPage = 1;
|
||||
logs = result.items;
|
||||
totalItems = result.totalItems;
|
||||
totalPages = result.totalPages;
|
||||
lastUpdated = new Date();
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
error = m.logs_refresh_failed({ message });
|
||||
if (notifyError) toast.error(error);
|
||||
} finally {
|
||||
loading = false;
|
||||
refreshing = false;
|
||||
if (reloadPending) {
|
||||
reloadPending = false;
|
||||
void loadLogs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restartPolling() {
|
||||
if (pollTimer) clearInterval(pollTimer);
|
||||
pollTimer = undefined;
|
||||
|
||||
if (intervalSeconds > 0) {
|
||||
pollTimer = setInterval(() => void loadLogs(), intervalSeconds * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function updateQuery() {
|
||||
currentPage = 1;
|
||||
void loadLogs();
|
||||
}
|
||||
|
||||
function changePage(nextPage: number) {
|
||||
currentPage = nextPage;
|
||||
void loadLogs();
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (!$pocketbase.authStore.isSuperuser) {
|
||||
toast(m.toasts_no_permission({ url: page.url.pathname }), { icon: '⛔' });
|
||||
goto(resolve('/'));
|
||||
return;
|
||||
}
|
||||
|
||||
void loadLogs(true);
|
||||
restartPolling();
|
||||
|
||||
return () => {
|
||||
if (pollTimer) clearInterval(pollTimer);
|
||||
if (searchTimer) clearTimeout(searchTimer);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<main class="container mx-auto flex flex-col gap-4 p-4">
|
||||
<header class="flex flex-col justify-between gap-3 md:flex-row md:items-end">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold">{m.logs_page_title()}</h1>
|
||||
{#if lastUpdated}
|
||||
<p class="text-base-content/60 text-sm">
|
||||
{m.logs_refreshed_at({ time: lastUpdated.toLocaleTimeString() })}
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="join w-full md:w-auto">
|
||||
<button
|
||||
class="btn btn-sm join-item flex-1 md:flex-none"
|
||||
onclick={() => loadLogs(false, true)}
|
||||
disabled={refreshing}
|
||||
>
|
||||
<Fa icon={faArrowsRotate} class={refreshing ? 'animate-spin' : ''} />
|
||||
{m.logs_refresh()}
|
||||
</button>
|
||||
<select
|
||||
class="select select-sm join-item"
|
||||
aria-label={m.logs_refresh()}
|
||||
bind:value={intervalSeconds}
|
||||
onchange={restartPolling}
|
||||
>
|
||||
<option value={0}>{m.logs_off()}</option>
|
||||
{#each [2, 5, 10, 30, 60] as seconds (seconds)}
|
||||
<option value={seconds}>{m.logs_seconds({ seconds })}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="xl:hidden">
|
||||
<button
|
||||
class="btn w-full justify-start gap-3"
|
||||
aria-expanded={mobileFiltersOpen}
|
||||
onclick={() => (mobileFiltersOpen = !mobileFiltersOpen)}
|
||||
>
|
||||
<Fa icon={faFilter} />
|
||||
<span class="text-base-content/60 flex-1 truncate text-left font-normal">
|
||||
{m.logs_filters()}
|
||||
</span>
|
||||
<Fa icon={mobileFiltersOpen ? faChevronUp : faChevronDown} />
|
||||
</button>
|
||||
|
||||
{#if mobileFiltersOpen}
|
||||
<div class="card card-border bg-base-100 mt-2">
|
||||
<div class="card-body grid grid-cols-2 gap-3 p-3">
|
||||
<fieldset class="fieldset gap-1">
|
||||
<legend class="fieldset-legend">{m.logs_column_level()}</legend>
|
||||
<select
|
||||
class="select select-sm w-full"
|
||||
bind:value={selectedLevel}
|
||||
onchange={updateQuery}
|
||||
>
|
||||
{#each levels as level (level.value)}
|
||||
<option value={level.value}>{level.label()}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fieldset gap-1">
|
||||
<legend class="fieldset-legend">{m.logs_upsnap_logs()}</legend>
|
||||
<label class="label gap-2 py-1">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="toggle toggle-sm"
|
||||
bind:checked={onlyUpSnapLogs}
|
||||
onchange={updateQuery}
|
||||
/>
|
||||
<span class="text-sm">{m.logs_only()}</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fieldset gap-1">
|
||||
<legend class="fieldset-legend">{m.logs_page_size()}</legend>
|
||||
<select class="select select-sm w-full" bind:value={perPage} onchange={updateQuery}>
|
||||
<option value={10}>10</option>
|
||||
<option value={20}>20</option>
|
||||
<option value={40}>40</option>
|
||||
<option value={80}>80</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<input
|
||||
class="input mt-3 w-full"
|
||||
placeholder={m.logs_search_placeholder()}
|
||||
aria-label={m.logs_column_message()}
|
||||
bind:value={textSearch}
|
||||
oninput={updateSearch}
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="card card-border bg-base-100 hidden xl:block">
|
||||
<div class="flex items-end gap-3 p-4">
|
||||
<fieldset class="fieldset shrink-0">
|
||||
<legend class="fieldset-legend">{m.logs_column_level()}</legend>
|
||||
<select class="select w-auto" bind:value={selectedLevel} onchange={updateQuery}>
|
||||
{#each levels as level (level.value)}
|
||||
<option value={level.value}>{level.label()}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fieldset flex-1">
|
||||
<legend class="fieldset-legend">{m.logs_column_message()}</legend>
|
||||
<input
|
||||
class="input w-full"
|
||||
placeholder={m.logs_search_placeholder()}
|
||||
bind:value={textSearch}
|
||||
oninput={updateSearch}
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fieldset flex! shrink-0 flex-col self-stretch">
|
||||
<legend class="fieldset-legend">{m.logs_upsnap_logs()}</legend>
|
||||
<label class="label flex-1 gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="toggle"
|
||||
bind:checked={onlyUpSnapLogs}
|
||||
onchange={updateQuery}
|
||||
/>
|
||||
<span>{m.logs_only()}</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="fieldset shrink-0">
|
||||
<legend class="fieldset-legend">{m.logs_page_size()}</legend>
|
||||
<select class="select w-auto" bind:value={perPage} onchange={updateQuery}>
|
||||
<option value={10}>10</option>
|
||||
<option value={20}>20</option>
|
||||
<option value={40}>40</option>
|
||||
<option value={80}>80</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{#if error}
|
||||
<div role="alert" class="alert alert-error">
|
||||
<span>{error}</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<section class="card card-border bg-base-100 overflow-hidden">
|
||||
{#if loading}
|
||||
<div class="flex min-h-64 items-center justify-center">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
</div>
|
||||
{:else if logs.length === 0}
|
||||
<div class="flex min-h-64 items-center justify-center p-6 text-center">
|
||||
<p class="text-base-content/60">{m.logs_empty()}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="hidden md:block">
|
||||
<div class="border-base-300 flex border-b text-sm font-bold">
|
||||
<div class="w-32 shrink-0 p-3">{m.logs_column_level()}</div>
|
||||
<button
|
||||
class="hover:bg-base-300 flex flex-1 items-center gap-1 p-3 text-left"
|
||||
onclick={() => toggleSort('message')}
|
||||
>
|
||||
{m.logs_column_message()}
|
||||
{#if sort === 'message'}<Fa icon={faArrowUp} />{:else if sort === '-message'}<Fa
|
||||
icon={faArrowDown}
|
||||
/>{/if}
|
||||
</button>
|
||||
<button
|
||||
class="hover:bg-base-300 flex w-40 shrink-0 items-center gap-1 p-3 text-left"
|
||||
onclick={() => toggleSort('created')}
|
||||
>
|
||||
{m.logs_column_time()}
|
||||
{#if sort === 'created'}<Fa icon={faArrowUp} />{:else if sort === '-created'}<Fa
|
||||
icon={faArrowDown}
|
||||
/>{/if}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="divide-base-300 divide-y">
|
||||
{#each logs as entry (entry.id)}
|
||||
{@const meta = levelMeta(entry.level)}
|
||||
<button
|
||||
class="hover:bg-base-200 flex w-full cursor-pointer items-start text-left"
|
||||
onclick={() => showDetails(entry)}
|
||||
>
|
||||
<div class="w-32 shrink-0 p-3">
|
||||
<span class="badge bg-base-300 badge-sm gap-1.5 border-0 font-semibold"
|
||||
><span class={`size-2 rounded-full ${meta.dotClass}`}></span>{meta.label}</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex-1 p-3">
|
||||
<p class="text-xs wrap-break-word whitespace-pre-wrap">{entry.message}</p>
|
||||
{#if hasData(entry)}
|
||||
<div class="mt-1 flex flex-wrap gap-1">
|
||||
{#each dataEntries(entry) as [key, value] (key)}
|
||||
<span
|
||||
class="badge bg-base-300 badge-ghost badge-xs h-auto min-h-4 gap-1 py-0.5 font-normal whitespace-normal"
|
||||
>
|
||||
<span class="shrink-0">{key}:</span>
|
||||
<span>{dataValue(value)}</span>
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<time class="w-40 shrink-0 p-3 text-xs whitespace-nowrap"
|
||||
>{new Date(entry.created).toLocaleString()}</time
|
||||
>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="divide-base-300 divide-y md:hidden">
|
||||
{#each logs as entry (entry.id)}
|
||||
{@const meta = levelMeta(entry.level)}
|
||||
<li>
|
||||
<button
|
||||
class="hover:bg-base-200 flex w-full cursor-pointer flex-col gap-2 p-4 text-left"
|
||||
onclick={() => showDetails(entry)}
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<span class="badge bg-base-300 badge-sm gap-1.5 border-0 font-semibold"
|
||||
><span class={`size-2 rounded-full ${meta.dotClass}`}></span>{meta.label}</span
|
||||
>
|
||||
<time class="text-base-content/60 text-xs"
|
||||
>{new Date(entry.created).toLocaleString()}</time
|
||||
>
|
||||
</div>
|
||||
<p class="text-xs wrap-break-word whitespace-pre-wrap">{entry.message}</p>
|
||||
{#if hasData(entry)}
|
||||
<div class="flex flex-wrap gap-1">
|
||||
{#each dataEntries(entry) as [key, value] (key)}
|
||||
<span
|
||||
class="badge bg-base-300 badge-ghost badge-xs h-auto min-h-4 gap-1 py-0.5 font-normal whitespace-normal"
|
||||
>
|
||||
<span class="shrink-0">{key}:</span>
|
||||
<span>{dataValue(value)}</span>
|
||||
</span>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{#if totalPages > 1}
|
||||
<footer class="border-base-300 flex items-center justify-between border-t p-3">
|
||||
<span class="text-base-content/60 text-sm">{currentPage} / {totalPages} ({totalItems})</span
|
||||
>
|
||||
<div class="join">
|
||||
<button
|
||||
class="btn btn-sm join-item"
|
||||
onclick={() => changePage(currentPage - 1)}
|
||||
disabled={currentPage <= 1 || refreshing}
|
||||
aria-label={m.logs_previous()}
|
||||
>
|
||||
<Fa icon={faChevronLeft} />
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-sm join-item"
|
||||
onclick={() => changePage(currentPage + 1)}
|
||||
disabled={currentPage >= totalPages || refreshing}
|
||||
aria-label={m.logs_next()}
|
||||
>
|
||||
<Fa icon={faChevronRight} />
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
{/if}
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<dialog class="modal" bind:this={detailsDialog}>
|
||||
<div class="modal-box max-w-3xl">
|
||||
{#if selectedLog}
|
||||
{@const meta = levelMeta(selectedLog.level)}
|
||||
<h2 class="text-lg font-bold">{m.logs_column_data()}</h2>
|
||||
<dl class="mt-4 grid items-center gap-x-6 gap-y-2 text-xs sm:grid-cols-[auto_1fr]">
|
||||
<dt class="text-base-content/60">ID</dt>
|
||||
<dd class="break-all">{selectedLog.id}</dd>
|
||||
<dt class="text-base-content/60">{m.logs_column_level()}</dt>
|
||||
<dd>
|
||||
<span class="badge bg-base-300 badge-sm gap-1.5 border-0 font-semibold"
|
||||
><span class={`size-2 rounded-full ${meta.dotClass}`}></span>{meta.label}</span
|
||||
>
|
||||
</dd>
|
||||
<dt class="text-base-content/60">{m.logs_column_message()}</dt>
|
||||
<dd class="wrap-break-word whitespace-pre-wrap">{selectedLog.message}</dd>
|
||||
<dt class="text-base-content/60">{m.logs_column_time()}</dt>
|
||||
<dd>{new Date(selectedLog.created).toLocaleString()}</dd>
|
||||
</dl>
|
||||
<pre class="bg-base-200 rounded-box mt-4 max-h-96 overflow-auto p-4 text-xs">{JSON.stringify(
|
||||
selectedLog,
|
||||
null,
|
||||
2
|
||||
)}</pre>
|
||||
{/if}
|
||||
<div class="modal-action">
|
||||
<form method="dialog">
|
||||
<button class="btn">{m.buttons_cancel()}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop"><button>close</button></form>
|
||||
</dialog>
|
||||
@@ -10,7 +10,7 @@
|
||||
import { settingsPriv, settingsPub } from '$lib/stores/settings';
|
||||
import type { SettingsPrivate, SettingsPublic } from '$lib/types/settings';
|
||||
import { faSave } from '@fortawesome/free-solid-svg-icons';
|
||||
import cronParser from 'cron-parser';
|
||||
import { CronExpressionParser } from 'cron-parser';
|
||||
import { onMount } from 'svelte';
|
||||
import Fa from 'svelte-fa';
|
||||
import toast from 'svelte-french-toast';
|
||||
@@ -61,7 +61,7 @@
|
||||
return;
|
||||
|
||||
try {
|
||||
cronParser.parse(settingsPrivClone.interval);
|
||||
CronExpressionParser.parse(settingsPrivClone.interval);
|
||||
} catch {
|
||||
toast.error(m.settings_invalid_cron());
|
||||
throw new Error(`failed to parse cron: ` + settingsPrivClone.interval);
|
||||
@@ -72,6 +72,14 @@
|
||||
throw new Error('ping_interval not valid');
|
||||
}
|
||||
|
||||
if (
|
||||
settingsPrivClone.track_ip_interval !== '' &&
|
||||
!(await parseCron(settingsPrivClone.track_ip_interval))
|
||||
) {
|
||||
toast.error(m.settings_invalid_cron());
|
||||
throw new Error('track_ip_interval not valid');
|
||||
}
|
||||
|
||||
await $pocketbase
|
||||
.collection('settings_public')
|
||||
.update(settingsPubClone.id, settingsPubClone)
|
||||
@@ -153,6 +161,29 @@
|
||||
| minute (0–59)
|
||||
second (0–59, optional)
|
||||
</code></pre>
|
||||
<h2 class="card-title mt-2">{m.settings_track_ip_title()}</h2>
|
||||
<p class="mt-2">
|
||||
{m.settings_track_ip_desc()}
|
||||
</p>
|
||||
<div class="mt-2 w-full">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="e.g. '0 */30 * * * *'"
|
||||
class="input"
|
||||
bind:value={settingsPrivClone.track_ip_interval}
|
||||
/>
|
||||
</div>
|
||||
{#if settingsPrivClone.track_ip_interval}
|
||||
<p class="fieldset-label">
|
||||
{#await parseCron(settingsPrivClone.track_ip_interval)}
|
||||
<span class="loading loading-spinner loading-xs"></span>
|
||||
{:then valid}
|
||||
{valid
|
||||
? '✅ ' + nextCronDate(settingsPrivClone.track_ip_interval)
|
||||
: m.settings_invalid_cron()}
|
||||
{/await}
|
||||
</p>
|
||||
{/if}
|
||||
<h2 class="card-title mt-2">{m.settings_lazy_ping_title()}</h2>
|
||||
<p class="mt-2">
|
||||
{m.settings_lazy_ping_desc()}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,188 +1,42 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { asset, resolve } from '$app/paths';
|
||||
import { toggleVisibility } from '$lib/helpers/forms';
|
||||
import { m } from '$lib/paraglide/messages.js';
|
||||
import { m } from '$lib/paraglide/messages';
|
||||
import { pocketbase } from '$lib/stores/pocketbase';
|
||||
import { settingsPub } from '$lib/stores/settings';
|
||||
import type { SettingsPublic } from '$lib/types/settings';
|
||||
import { faArrowRight, faEye } from '@fortawesome/free-solid-svg-icons';
|
||||
import { onMount } from 'svelte';
|
||||
import Fa from 'svelte-fa';
|
||||
import toast from 'svelte-french-toast';
|
||||
|
||||
let stepsCompleted = 0;
|
||||
let inputPassword: HTMLInputElement;
|
||||
let inputConfirm: HTMLInputElement;
|
||||
let form = {
|
||||
email: '',
|
||||
password: '',
|
||||
confirm: ''
|
||||
};
|
||||
let notReady = $state(false);
|
||||
|
||||
onMount(() => {
|
||||
if ($settingsPub && !$settingsPub.setup_completed && $pocketbase.authStore.isValid) {
|
||||
$pocketbase.authStore.clear();
|
||||
async function checkAndContinue() {
|
||||
const data = await $pocketbase.collection('settings_public').getFirstListItem('');
|
||||
settingsPub.set(data as SettingsPublic);
|
||||
if (data.setup_completed) {
|
||||
goto(resolve('/login'));
|
||||
} else {
|
||||
notReady = true;
|
||||
}
|
||||
});
|
||||
|
||||
async function register() {
|
||||
$pocketbase
|
||||
.send('/api/upsnap/init-superuser', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
email: form.email,
|
||||
password: form.password,
|
||||
password_confirm: form.confirm
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
$pocketbase
|
||||
.collection('settings_public')
|
||||
.getFirstListItem('')
|
||||
.then((data) => {
|
||||
settingsPub.set(data as SettingsPublic);
|
||||
});
|
||||
$pocketbase
|
||||
.collection('_superusers')
|
||||
.authWithPassword(form.email, form.password)
|
||||
.then(() => {
|
||||
stepsCompleted = 2;
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.data?.data?.identity?.message) {
|
||||
toast.error(err.data.data.identity.message);
|
||||
return;
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.data?.data?.passwordConfirm?.message) {
|
||||
toast.error(m.toasts_passwords_missmatch());
|
||||
} else if (err.data?.data?.email?.message) {
|
||||
toast.error(err.data.data.email.message);
|
||||
} else {
|
||||
toast.error(err.message || err);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mt-10 flex items-center justify-center">
|
||||
<div class="my-4 flex w-screen max-w-lg flex-col gap-16">
|
||||
<div class="card bg-base-200 shadow-sm">
|
||||
{#if stepsCompleted === 0 && $settingsPub?.setup_completed}
|
||||
<figure class="mx-auto w-72 pt-6"><img src={asset('/gopher.svg')} alt="Gopher" /></figure>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{m.welcome_not_expected_title()}</h2>
|
||||
<p>{m.welcome_not_expected_desc()}</p>
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-success" onclick={() => goto(resolve('/'))}
|
||||
>{m.welcome_not_expected_back()}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{:else if stepsCompleted === 0}
|
||||
{#if !$settingsPub?.setup_completed}
|
||||
<figure class="mx-auto w-44 pt-6"><img src={asset('/gopher.svg')} alt="Gopher" /></figure>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{m.welcome_step1_page_title()}</h2>
|
||||
<p>{m.welcome_step1_setup_desc()}</p>
|
||||
<h2 class="card-title">{m.welcome_title()}</h2>
|
||||
<p>{m.welcome_desc()}</p>
|
||||
{#if notReady}
|
||||
<p class="text-error text-sm">{m.welcome_not_ready()}</p>
|
||||
{/if}
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-success" onclick={() => (stepsCompleted = 1)}
|
||||
>{m.welcome_step1_setup_btn_next()} <Fa icon={faArrowRight} /></button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{:else if stepsCompleted === 1}
|
||||
<div class="card-body">
|
||||
<div class="flex flex-row gap-4">
|
||||
<figure class="w-16"><img src={asset('/gopher.svg')} alt="Gopher" /></figure>
|
||||
<h2 class="card-title">{m.welcome_step2_page_title()}</h2>
|
||||
</div>
|
||||
<form
|
||||
class="w-full"
|
||||
onsubmit={(e) => {
|
||||
e.preventDefault();
|
||||
register();
|
||||
}}
|
||||
>
|
||||
<label class="label" for="email">
|
||||
<span>{m.welcome_step2_label_email()}</span>
|
||||
</label>
|
||||
<input id="email" type="email" class="input w-full" required bind:value={form.email} />
|
||||
<label class="label" for="password">
|
||||
<span>{m.welcome_step2_label_password()}</span>
|
||||
<span>{m.welcome_step2_label_min_chars()}</span>
|
||||
</label>
|
||||
<label class="relative block">
|
||||
<div
|
||||
class="absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer"
|
||||
role="none"
|
||||
onclick={() => toggleVisibility(inputPassword)}
|
||||
onkeydown={() => toggleVisibility(inputPassword)}
|
||||
>
|
||||
<Fa icon={faEye} />
|
||||
</div>
|
||||
<input
|
||||
id="password"
|
||||
type="password"
|
||||
class="input w-full"
|
||||
minlength="10"
|
||||
maxlength="72"
|
||||
required
|
||||
bind:value={form.password}
|
||||
bind:this={inputPassword}
|
||||
/>
|
||||
</label>
|
||||
<label class="label" for="passwordConfirm">
|
||||
<span>{m.welcome_step2_label_password_confirm()}</span>
|
||||
</label>
|
||||
<label class="relative block">
|
||||
<div
|
||||
class="absolute top-1/2 right-4 -translate-y-1/2 cursor-pointer"
|
||||
role="none"
|
||||
onclick={() => toggleVisibility(inputConfirm)}
|
||||
onkeydown={() => toggleVisibility(inputConfirm)}
|
||||
>
|
||||
<Fa icon={faEye} />
|
||||
</div>
|
||||
<input
|
||||
id="confirm"
|
||||
type="password"
|
||||
class="input w-full"
|
||||
minlength="10"
|
||||
maxlength="72"
|
||||
required
|
||||
bind:value={form.confirm}
|
||||
bind:this={inputConfirm}
|
||||
/>
|
||||
</label>
|
||||
<div class="card-actions mt-4 justify-end">
|
||||
<button class="btn btn-success" type="submit"
|
||||
>{m.welcome_step2_btn_create()} <Fa icon={faArrowRight} /></button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{:else if stepsCompleted === 2}
|
||||
<figure class="mx-auto w-72 pt-6"><img src={asset('/gopher.svg')} alt="Gopher" /></figure>
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">{m.welcome_step3_page_title()}</h2>
|
||||
<p>{m.welcome_step3_page_desc()}</p>
|
||||
<div class="card-actions justify-end">
|
||||
<button class="btn btn-success" onclick={() => goto(resolve('/'))}
|
||||
>{m.welcome_step3_btn_done()}</button
|
||||
<button class="btn btn-success" onclick={checkAndContinue}
|
||||
>{m.welcome_btn_done()}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $settingsPub && !$settingsPub.setup_completed}
|
||||
<ul class="steps steps-horizontal">
|
||||
<li class="step step-success">{m.welcome_progress_step1()}</li>
|
||||
<li class="step" class:step-success={stepsCompleted > 0}>{m.welcome_progress_step2()}</li>
|
||||
<li class="step" class:step-success={stepsCompleted > 1}>{m.welcome_progress_step3()}</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,10 +18,11 @@ const config = {
|
||||
'/login',
|
||||
'/account',
|
||||
'/welcome',
|
||||
'/device/[id]',
|
||||
'/device',
|
||||
'/device/new',
|
||||
'/users',
|
||||
'/settings'
|
||||
'/settings',
|
||||
'/logs'
|
||||
],
|
||||
handleHttpError: ({ path, message }) => {
|
||||
if (path === '/api/upsnap/manifest.webmanifest') {
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "عوامل التصفية",
|
||||
"logs_column_data": "التفاصيل",
|
||||
"logs_column_level": "المستوى",
|
||||
"logs_column_message": "الرسالة",
|
||||
"logs_column_time": "الوقت",
|
||||
"logs_empty": "لا توجد سجلات تطابق هذا الفلتر.",
|
||||
"logs_upsnap_logs": "سجلات UpSnap",
|
||||
"logs_only": "فقط",
|
||||
"logs_level_all": "كل المستويات",
|
||||
"logs_next": "التالي",
|
||||
"logs_off": "إيقاف",
|
||||
"logs_page_size": "صفوف لكل صفحة",
|
||||
"logs_page_title": "السجلات",
|
||||
"logs_previous": "السابق",
|
||||
"logs_refresh": "تحديث",
|
||||
"logs_refresh_failed": "تعذر تحميل السجلات: {message}",
|
||||
"logs_refreshed_at": "تم التحديث {time}",
|
||||
"logs_search_placeholder": "البحث في السجلات",
|
||||
"logs_seconds": "{seconds} ثوانٍ",
|
||||
"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": "المزيد",
|
||||
"device_card_btn_more_edit": "تعديل",
|
||||
"device_card_btn_more_reboot": "إعادة تشغيل",
|
||||
"device_card_btn_more_sleep": "سكون",
|
||||
"device_card_nic_tooltip_pending": "قيد الانتظار",
|
||||
"device_card_nic_tooltip_power": "تشغيل",
|
||||
"device_card_nic_tooltip_power_no_permission": "لا توجد صلاحية لتشغيل هذا الجهاز",
|
||||
"device_card_nic_tooltip_shutdown": "إيقاف التشغيل",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "لم يتم تعيين أمر الإيقاف",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "لا توجد صلاحية لإيقاف هذا الجهاز",
|
||||
"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": "عام",
|
||||
"device_general_description": "الوصف",
|
||||
"device_general_description_placeholder": "وصف للجهاز",
|
||||
"device_general_ip": "عنوان IP/FQDN",
|
||||
"device_general_mac": "عنوان Mac",
|
||||
"device_general_name": "الاسم",
|
||||
"device_general_netmask": "قناع الشبكة",
|
||||
"device_general_required_field": "حقل مطلوب",
|
||||
"device_groups": "المجموعات",
|
||||
"device_groups_desc": "يمكنك إضافة الأجهزة إلى مجموعة لفرزها حسب المجموعة في لوحة التحكم.",
|
||||
"device_groups_placeholder": "مثلاً 'القبو' أو 'المكتب'",
|
||||
"device_link": "الرابط",
|
||||
"device_link_desc": "يجعل اسم جهازك رابطاً قابلاً للنقر، مثالي للربط بلوحة تحكم على سبيل المثال.",
|
||||
"device_link_open": "فتح الرابط تلقائياً",
|
||||
"device_link_open_new_tab": "تبويب جديد",
|
||||
"device_link_open_no": "لا",
|
||||
"device_link_open_same_tab": "نفس التبويب",
|
||||
"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": "فحص",
|
||||
"device_network_scan_add_all": "إضافة جميع الأجهزة",
|
||||
"device_network_scan_desc": "فحص شبكتك تلقائياً للعثور على الأجهزة. لكي يعمل هذا، تحتاج إلى تشغيل UpSnap كمسؤول وتثبيت nmap وإتاحته في $PATH (بالنسبة لمستخدمي Docker، هذا متوفر بالفعل ولا تحتاج لفعل أي شيء). قد يستغرق الفحص بضع ثوانٍ.",
|
||||
"device_network_scan_include_unknown": "تضمين الأجهزة التي اسمها \"Unknown\"",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_ip_range": "نطاق IP",
|
||||
"device_network_scan_mac": "Mac:",
|
||||
"device_network_scan_mac_vendor": "جهة تصنيع الـ 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_page_title": "جهاز جديد",
|
||||
"device_password": "كلمة المرور",
|
||||
"device_password_desc": "بعض بطاقات الشبكة لديها خيار تعيين كلمة مرور لـ Magic Packets، تسمى أيضاً <span class=\"badge\">SecureON</span>. يمكن أن تكون كلمة المرور 0 أو 4 أو 6 أحرف فقط.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "أمر ping مخصص",
|
||||
"device_ping_desc": "يمكنك استخدام أمر shell مخصص لمعرفة ما إذا كان الجهاز قيد التشغيل. يجب أن يُرجع الأمر رمز خروج <span class=\"badge\">0</span> للإشارة إلى أن الجهاز قيد التشغيل، أي رمز خروج آخر سيحدد الجهاز على أنه متوقف.",
|
||||
"device_ports": "المنافذ",
|
||||
"device_ports_add_new": "إضافة منفذ جديد",
|
||||
"device_ports_desc": "يمكن لـ UpSnap أيضاً التحقق مما إذا كانت المنافذ المحددة مفتوحة.",
|
||||
"device_ports_name": "الاسم",
|
||||
"device_ports_number": "الرقم",
|
||||
"device_require_confirmation": "يتطلب تأكيد",
|
||||
"device_shutdown": "الإيقاف",
|
||||
"device_shutdown_cmd": "أمر الإيقاف",
|
||||
"device_shutdown_cron": "جدولة الإيقاف",
|
||||
"device_shutdown_cron_desc": "تماماً مثل تعيين جدولة لتشغيل الجهاز، يمكنك أيضاً جدولة مهمة لإيقاف هذا الجهاز.",
|
||||
"device_shutdown_cron_enable": "تفعيل جدولة الإيقاف",
|
||||
"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> بشكل عام لإجراء طلبات الويب. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> و <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> للاستبدال التلقائي لعناوين IP وMAC الفعلية.",
|
||||
"device_shutdown_examples": "أمثلة:",
|
||||
"device_shutdown_examples_linux": "إيقاف جهاز Linux عن بُعد:",
|
||||
"device_shutdown_examples_windows": "إيقاف جهاز Windows عن بُعد:",
|
||||
"device_shutdown_timeout": "مهلة الإيقاف (بالثواني)",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"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_tabs_0": "يدوي",
|
||||
"device_tabs_1": "فحص الشبكة",
|
||||
"device_wake": "التشغيل",
|
||||
"device_wake_cmd": "أمر تشغيل مخصص",
|
||||
"device_wake_cron": "جدولة التشغيل",
|
||||
"device_wake_cron_enable": "تفعيل جدولة التشغيل",
|
||||
"device_wake_desc": "يمكنك تشغيل هذا الجهاز باستخدام مهمة مجدولة. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> و <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> للاستبدال التلقائي لعناوين IP و MAC الفعلية.",
|
||||
"device_wake_timeout": "مهلة التشغيل (بالثواني)",
|
||||
"home_add_first_device": "أضف جهازك الأول",
|
||||
"home_grant_permissions": "يرجى الطلب من المسؤول منحك صلاحيات للأجهزة الموجودة أو لإنشاء أجهزة جديدة.",
|
||||
"home_modal_confirm_shutdown_group_desc": "يرجى التأكيد لإيقاف جميع الأجهزة في {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "إيقاف {group}؟",
|
||||
"home_no_devices": "لا توجد أجهزة هنا.",
|
||||
"home_order_groups": "المجموعات",
|
||||
"home_order_ip": "IP",
|
||||
"home_order_name": "الاسم",
|
||||
"home_order_tooltip": "الترتيب",
|
||||
"home_page_title": "الرئيسية",
|
||||
"home_search_placeholder": "البحث عن الأجهزة",
|
||||
"home_shutdown_group": "إيقاف المجموعة",
|
||||
"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_invalid_fqdnip": "❌ عنوان FQDN/IPv4 غير صالح",
|
||||
"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": "تم تحديث صلاحيات {username}",
|
||||
"toasts_permissions_updated_personal": "تم تحديث صلاحياتك",
|
||||
"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": "كلمة المرور",
|
||||
"users_password_confirm": "تأكيد كلمة المرور",
|
||||
"users_power": "التشغيل",
|
||||
"users_read": "قراءة",
|
||||
"users_required_field": "حقل مطلوب",
|
||||
"users_toggle": "تبديل",
|
||||
"users_update": "تحديث",
|
||||
"users_username": "اسم المستخدم",
|
||||
"welcome_btn_done": "تم",
|
||||
"welcome_desc": "تحقق من سجلات وحدة تحكم الخادم للحصول على رابط لإنشاء حساب المستخدم الخارق الأولي. بمجرد إنشاء المستخدم الخارق، عد إلى هنا.",
|
||||
"welcome_not_ready": "لم يتم العثور على مستخدم خارق بعد. يرجى إكمال الإعداد أولاً.",
|
||||
"welcome_title": "الإعداد الأولي مطلوب"
|
||||
}
|
||||
@@ -1,5 +1,24 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Филтри",
|
||||
"logs_column_data": "Подробности",
|
||||
"logs_column_level": "Ниво",
|
||||
"logs_column_message": "Съобщение",
|
||||
"logs_column_time": "Време",
|
||||
"logs_empty": "Няма логове, съответстващи на този филтър.",
|
||||
"logs_upsnap_logs": "Дневници на UpSnap",
|
||||
"logs_only": "Само",
|
||||
"logs_level_all": "Всички нива",
|
||||
"logs_next": "Напред",
|
||||
"logs_off": "Изключено",
|
||||
"logs_page_size": "Редове на страница",
|
||||
"logs_page_title": "Логове",
|
||||
"logs_previous": "Назад",
|
||||
"logs_refresh": "Опресни",
|
||||
"logs_refresh_failed": "Неуспешно зареждане на логовете: {message}",
|
||||
"logs_refreshed_at": "Обновено {time}",
|
||||
"logs_search_placeholder": "Търсене в логовете",
|
||||
"logs_seconds": "{seconds} секунди",
|
||||
"account_account_type_admin": "Администратор",
|
||||
"account_account_type_user": "Потребител",
|
||||
"account_avatar_title": "Аватар",
|
||||
@@ -17,49 +36,50 @@
|
||||
"buttons_delete": "Изтриване",
|
||||
"buttons_reset": "Нулиране",
|
||||
"buttons_save": "Запазване",
|
||||
"device_card_btn_more": "...",
|
||||
"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_power_no_permission": "Нямате права за включване на това устройство",
|
||||
"device_card_nic_tooltip_shutdown": "Изключване",
|
||||
"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": "Cron за изключване",
|
||||
"device_card_tooltip_wake_cron": "Cron за събуждане",
|
||||
"device_card_tooltip_wake_password": "Парола за събуждане",
|
||||
"device_general_description_placeholder": "Описание на устройството",
|
||||
"device_general": "Общи",
|
||||
"device_general_description": "Описание",
|
||||
"device_general_ip": "IP адрес",
|
||||
"device_general_description_placeholder": "Описание на устройството",
|
||||
"device_general_ip": "IP адрес/FQDN",
|
||||
"device_general_mac": "MAC адрес",
|
||||
"device_general_name": "Име",
|
||||
"device_general_netmask": "Мрежова маска",
|
||||
"device_general_required_field": "задължително поле",
|
||||
"device_general": "Общи",
|
||||
"device_groups": "Групи",
|
||||
"device_groups_desc": "Можете да добавяте устройства към група, за да ги групирате заедно на началния екран.",
|
||||
"device_groups_placeholder": "напр. „Мазе“ или „Офис“",
|
||||
"device_groups": "Групи",
|
||||
"device_link": "Връзка",
|
||||
"device_link_desc": "Превръща името на устройството във връзка, идеална за свързване към уебсайт, например.",
|
||||
"device_link_open": "Автоматично отваряне на връзка",
|
||||
"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": "Сканиране",
|
||||
"device_network_scan_add_all": "Добавяне на всички устройства",
|
||||
"device_network_scan_desc": "Автоматично сканиране на мрежата за устройства. За да работи, трябва да стартирате UpSnap като root/admin и да имате nmap инсталиран и наличен в $PATH променливата (за потребители на Docker това вече е така и не е необходимо да променяте нищо). Сканирането може да отнеме няколко секунди.",
|
||||
"device_network_scan_include_unknown": "Включване на устройства с име „Неизвестно“",
|
||||
"device_network_scan_ip_range": "IP диапазон",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_mac_vendor": "Доставчик на MAC адрес:",
|
||||
"device_network_scan_ip_range": "IP диапазон",
|
||||
"device_network_scan_mac": "MAC адрес:",
|
||||
"device_network_scan_mac_vendor": "Доставчик на MAC адрес:",
|
||||
"device_network_scan_netmask": "Мрежова маска:",
|
||||
"device_network_scan_new_netmask": "Нова мрежова маска",
|
||||
"device_network_scan_no_range": "Няма диапазон на сканиране",
|
||||
@@ -67,29 +87,29 @@
|
||||
"device_network_scan_replace_netmask": "Замяна на мрежовата маска за всички устройства?",
|
||||
"device_network_scan_running": "Сканирането стартира...",
|
||||
"device_network_scan_unsaved_changes": "Незапазени промени",
|
||||
"device_network_scan": "Сканиране",
|
||||
"device_page_title": "Ново устройство",
|
||||
"device_password_desc": "Някои мрежови карти имат възможност да задават парола за Magic пакети, наричана още <span class=\"badge\">SecureON</span>. Паролата може да бъде дълга само 0, 4 или 6 знака.",
|
||||
"device_password": "Парола",
|
||||
"device_password_desc": "Някои мрежови карти имат възможност да задават парола за Magic пакети, наричана още <span class=\"badge\">SecureON</span>. Паролата може да бъде дълга само 0, 4 или 6 знака.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Персонализирана ping команда",
|
||||
"device_ping_desc": "Можете да използвате персонализирана shell команда, за да проверите дали устройството е включено. Командата трябва да върне exit код <span class=\"badge\">0</span>, за да потвърди, че устройството е включено, докато всеки друг код показва, че устройството е изключено.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports": "Портове",
|
||||
"device_ports_add_new": "Добавяне на нов порт",
|
||||
"device_ports_desc": "UpSnap може също да провери дали дадените портове са отворени.",
|
||||
"device_ports_name": "Име",
|
||||
"device_ports_number": "Номер",
|
||||
"device_ports": "Портове",
|
||||
"device_require_confirmation": "Изискване на потвърждение",
|
||||
"device_shutdown": "Изключване",
|
||||
"device_shutdown_cmd": "Команда за изключване",
|
||||
"device_shutdown_cron": "Параметри за изключване за cron",
|
||||
"device_shutdown_cron_desc": "Подобно на настройването на cron за събуждане на устройство, можете също да планирате cron задача за изключване на това устройство.",
|
||||
"device_shutdown_cron_enable": "Активиране на изключване чрез cron",
|
||||
"device_shutdown_cron": "Параметри за изключване за 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_desc": "Тази <strong>shell команда</strong> ще се изпълни във вашия контейнер (ако използвате Docker) или на вашия хост (ако използвате двоичен файл). За да се уверите, че работи, първо можете да изпълните командата вътре в контейнера или в shell на хоста. Типични команди са <span class=\"badge\">net rpc</span> за Windows, <span class=\"badge\">sshpass</span> за Linux или <span class=\"badge\">curl</span> за отправяне на уеб заявки. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> и <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> могат да се използват за автоматично заместване на действителни IP и MAC адреси.",
|
||||
"device_shutdown_examples": "Примери:",
|
||||
"device_shutdown_examples_linux": "Изключване на отдалечена машина с Linux:",
|
||||
"device_shutdown_examples_windows": "Изключване на отдалечена машина с Windows:",
|
||||
"device_shutdown_examples": "Примери:",
|
||||
"device_shutdown_timeout": "Време за изключване (секунди)",
|
||||
"device_shutdown": "Изключване",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Оторизация",
|
||||
"device_sol_desc1": "Можете да изключите устройството си с помощта на инструмента <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a>. Sleep-On-LAN (SOL) е външен инструмент, който се изпълнява на устройството, което искате да изключите, предоставяйки REST крайна точка. За инструкции относно конфигурирането на Sleep-On-LAN, вижте раздела <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Използване</a>.",
|
||||
"device_sol_desc2": "SOL е конфигуриран да изпраща заявки през HTTP вместо UDP, за да се даде възможност за оторизация и да се направят заявките по-надеждни.",
|
||||
@@ -98,17 +118,18 @@
|
||||
"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": "Активиране на cron за събуждане",
|
||||
"device_wake_cron": "Cron за събуждане",
|
||||
"device_wake_desc": "Можете да събудите това устройство чрез планирана cron задача.",
|
||||
"device_wake_timeout": "Време за събуждане (секунди)",
|
||||
"device_tabs_0": "Ръчно",
|
||||
"device_tabs_1": "Сканиране на мрежа",
|
||||
"device_wake": "Събуждане",
|
||||
"device_wake_cmd": "Персонализирана команда за събуждане",
|
||||
"device_wake_cron": "Cron за събуждане",
|
||||
"device_wake_cron_enable": "Активиране на cron за събуждане",
|
||||
"device_wake_desc": "Можете да събудите това устройство чрез планирана cron задача. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> и <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> могат да се използват за автоматично заместване на действителни IP и MAC адреси.",
|
||||
"device_wake_timeout": "Време за събуждане (секунди)",
|
||||
"home_add_first_device": "Добавете първото си устройство",
|
||||
"home_grant_permissions": "Моля, помолете вашия администратор да ви предостави необходимите права за добавяне и работа с устройства.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Моля, потвърдете изключването на всички устройства в {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Изключване на {group}?",
|
||||
"home_no_devices": "Тук няма устройства.",
|
||||
"home_order_groups": "Групи",
|
||||
"home_order_ip": "IP",
|
||||
@@ -116,6 +137,7 @@
|
||||
"home_order_tooltip": "Подредба",
|
||||
"home_page_title": "Начало",
|
||||
"home_search_placeholder": "Търсене на устройства",
|
||||
"home_shutdown_group": "Изключване на група",
|
||||
"home_wake_group": "Събуждане на група",
|
||||
"login_btn_login": "Влизане",
|
||||
"login_btn_more": "...",
|
||||
@@ -130,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",
|
||||
@@ -152,8 +175,8 @@
|
||||
"toasts_passwords_missmatch": "Паролите не съвпадат",
|
||||
"toasts_permissions_created": "Правата за потребител {username} са създадени",
|
||||
"toasts_permissions_deleted": "Правата за потребител {username} са изтрити",
|
||||
"toasts_permissions_updated_personal": "Вашите права са обновени",
|
||||
"toasts_permissions_updated": "Правата за потребител {username} са обновени",
|
||||
"toasts_permissions_updated_personal": "Вашите права са обновени",
|
||||
"toasts_settings_saved": "Настройките са запазени",
|
||||
"toasts_user_created": "Потребител {username} е създаден",
|
||||
"toasts_user_deleted": "Потребител {username} е изтрит",
|
||||
@@ -166,30 +189,16 @@
|
||||
"users_delete": "Изтриване",
|
||||
"users_device_permissions": "Права за устройства",
|
||||
"users_page_title": "Потребители",
|
||||
"users_password_confirm": "Потвърждение на парола",
|
||||
"users_password": "Парола",
|
||||
"users_password_confirm": "Потвърждение на парола",
|
||||
"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": "Свършихме! 🎉"
|
||||
"welcome_btn_done": "Готово",
|
||||
"welcome_desc": "Проверете журналите на конзолата на сървъра за връзка за създаване на началния акаунт на суперпотребител. След като създадете суперпотребителя, върнете се тук.",
|
||||
"welcome_not_ready": "Все още не е намерен суперпотребител. Моля, завършете първо настройката.",
|
||||
"welcome_title": "Необходима е начална настройка"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Filtry",
|
||||
"logs_column_data": "Podrobnosti",
|
||||
"logs_column_level": "Úroveň",
|
||||
"logs_column_message": "Zpráva",
|
||||
"logs_column_time": "Čas",
|
||||
"logs_empty": "Žádné záznamy neodpovídají tomuto filtru.",
|
||||
"logs_upsnap_logs": "Záznamy UpSnap",
|
||||
"logs_only": "Pouze",
|
||||
"logs_level_all": "Všechny úrovně",
|
||||
"logs_next": "Další",
|
||||
"logs_off": "Vypnuto",
|
||||
"logs_page_size": "Řádků na stránku",
|
||||
"logs_page_title": "Záznamy",
|
||||
"logs_previous": "Předchozí",
|
||||
"logs_refresh": "Obnovit",
|
||||
"logs_refresh_failed": "Nelze načíst záznamy: {message}",
|
||||
"logs_refreshed_at": "Aktualizováno {time}",
|
||||
"logs_search_placeholder": "Hledat v záznamech",
|
||||
"logs_seconds": "{seconds} sekund",
|
||||
"account_account_type_admin": "Administrátor",
|
||||
"account_account_type_user": "Uživatel",
|
||||
"account_avatar_title": "Avatar",
|
||||
"account_change_password_body": "Po změně hesla se budete muset znovu přihlásit.",
|
||||
"account_change_password_confirm": "Potvrzení hesla",
|
||||
"account_change_password_label": "Staré heslo",
|
||||
"account_change_password_new": "Nové heslo",
|
||||
"account_change_password_title": "Změna hesla",
|
||||
"account_language_title": "Jazyk",
|
||||
"account_page_title": "Účet",
|
||||
"buttons_add": "Přidat",
|
||||
"buttons_cancel": "Zrušit",
|
||||
"buttons_change": "Změnit",
|
||||
"buttons_confirm": "Potvrdit",
|
||||
"buttons_delete": "Smazat",
|
||||
"buttons_reset": "Reset",
|
||||
"buttons_save": "Uložit",
|
||||
"device_card_btn_more": "Více",
|
||||
"device_card_btn_more_edit": "Změnit",
|
||||
"device_card_btn_more_reboot": "Restartovat",
|
||||
"device_card_btn_more_sleep": "Uspat",
|
||||
"device_card_nic_tooltip_pending": "Čeká na vyřízení",
|
||||
"device_card_nic_tooltip_power": "Zapnout",
|
||||
"device_card_nic_tooltip_power_no_permission": "Nemáte oprávnění k zapnutí tohoto zařízení",
|
||||
"device_card_nic_tooltip_shutdown": "Vypnout",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "Není nastaven žádný příkaz k vypnutí",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "Nemáte opránění pro vypnutí tohoto zařízení",
|
||||
"device_card_password": "Heslo",
|
||||
"device_card_tooltip_last_status_change": "Poslední změna stavu",
|
||||
"device_card_tooltip_shutdown_cron": "Cron pro vypnutí",
|
||||
"device_card_tooltip_wake_cron": "Cron pro probuzení",
|
||||
"device_card_tooltip_wake_password": "Heslo pro probuzení",
|
||||
"device_general": "Obecné",
|
||||
"device_general_description": "Popisek",
|
||||
"device_general_description_placeholder": "Stručný popis zařízení",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "MAC",
|
||||
"device_general_name": "Jméno",
|
||||
"device_general_netmask": "Síťová maska",
|
||||
"device_general_required_field": "povinné pole",
|
||||
"device_groups": "Skupiny",
|
||||
"device_groups_desc": "Zařízení můžete přidat do skupiny, aby byla na ovládacím panelu seřazena podle skupin.",
|
||||
"device_groups_placeholder": "např. 'Přízemí' nebo 'Kancelář'",
|
||||
"device_link": "Odkaz",
|
||||
"device_link_desc": "Umožňuje vytvořit z názvu zařízení klikatelný odkaz, což je ideální například pro propojení s ovládacím panelem.",
|
||||
"device_link_open": "Automaticky otevřít odkaz",
|
||||
"device_link_open_new_tab": "Nová záložka",
|
||||
"device_link_open_no": "Ne",
|
||||
"device_link_open_same_tab": "Stejná záložka",
|
||||
"device_modal_confirm_shutdown_desc": "Prosím potvrďte vypnutí zařízení {device}.",
|
||||
"device_modal_confirm_shutdown_title": "Vypnout {device}?",
|
||||
"device_modal_confirm_wake_desc": "Prosím potvrďte probuzení zařízení {device}.",
|
||||
"device_modal_confirm_wake_title": "Probudit {device}?",
|
||||
"device_network_scan": "Skenovat",
|
||||
"device_network_scan_add_all": "Přidat všechna zařízení",
|
||||
"device_network_scan_desc": "Automaticky prohledávejte síť pro zařízení. Aby to fungovalo, musíte spustit UpSnap jako root/admin a mít nmap nainstalovaný a dostupný ve vašem $PATH (pro uživatele Dockeru je to již splněno a nemusíte nic dělat). Prohledávání může trvat několik sekund.",
|
||||
"device_network_scan_include_unknown": "Zahrnout zařízení, jejichž název je \"Neznámé\"",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_ip_range": "IP rozsah",
|
||||
"device_network_scan_mac": "MAC:",
|
||||
"device_network_scan_mac_vendor": "Výrobce dle MAC:",
|
||||
"device_network_scan_netmask": "Síťová maska:",
|
||||
"device_network_scan_new_netmask": "Nová síťová maska",
|
||||
"device_network_scan_no_range": "Žádný rozsah skenování",
|
||||
"device_network_scan_range_saved": "Rozsah skenování uložen",
|
||||
"device_network_scan_replace_netmask": "Nahradit síťovou masku pro všechna zařízení?",
|
||||
"device_network_scan_running": "Sken běží",
|
||||
"device_network_scan_unsaved_changes": "Neuložené změny",
|
||||
"device_page_title": "Nové zařízení",
|
||||
"device_password": "Heslo",
|
||||
"device_password_desc": "Některé síťové karty mají možnost nastavit heslo pro magické pakety, také nazývané <span class=\"badge\">SecureON</span>. Heslo může mít pouze 0, 4 nebo 6 znaků.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Vlastní příkaz pro ping",
|
||||
"device_ping_desc": "Pomocí vlastního příkazu shellu můžete zjistit, zda je zařízení zapnuté. Příkaz by měl vrátit výstupní kód <span class=\"badge\">0</span>, který označuje, že zařízení je zapnuté. Jakýkoli jiný výstupní kód označí zařízení jako vypnuté.",
|
||||
"device_ports": "Porty",
|
||||
"device_ports_add_new": "Přidat nový port",
|
||||
"device_ports_desc": "UpSnap může také zkontrolovat, zda jsou dané porty otevřené.",
|
||||
"device_ports_name": "Jméno",
|
||||
"device_ports_number": "Číslo",
|
||||
"device_require_confirmation": "Vyžaduje potvrzení",
|
||||
"device_shutdown": "Vypnout",
|
||||
"device_shutdown_cmd": "Příkaz pro vypnutí",
|
||||
"device_shutdown_cron": "Cron pro vypnutí",
|
||||
"device_shutdown_cron_desc": "Stejně jako nastavení cronu pro probuzení zařízení můžete také naplánovat cron úlohu pro vypnutí tohoto zařízení.",
|
||||
"device_shutdown_cron_enable": "Povolit cron pro vypnutí",
|
||||
"device_shutdown_desc": "Tento <strong>příkaz shellu</strong> se spustí uvnitř vašeho kontejneru (pokud používáte Docker) nebo na vašem hostiteli (pokud používáte binární soubor). Chcete-li ověřit, že funguje, můžete nejprve spustit příkaz uvnitř kontejneru nebo na shellu hostitele. Běžné příkazy jsou <span class=\"badge\">net rpc</span> pro Windows, <span class=\"badge\">sshpass</span> pro Linux nebo obecně <span class=\"badge\">curl</span> pro vytváření webových požadavků. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> a <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> lze použít pro automatické nahrazení skutečných IP a MAC adres.",
|
||||
"device_shutdown_examples": "Příklady:",
|
||||
"device_shutdown_examples_linux": "Vypnout vzdálený stroj s Linuxem:",
|
||||
"device_shutdown_examples_windows": "Vypnout vzdálený stroj s Windows:",
|
||||
"device_shutdown_timeout": "Časový limit pro vypnutí (v sekundách)",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Autorizace",
|
||||
"device_sol_desc1": "Počítače můžete uvést do režimu spánku pomocí nástroje <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a>. Sleep-On-LAN (SOL) je externí nástroj/daemon, který funguje na počítačích, které chcete uvést do režimu spánku, a poskytuje koncový bod REST. Pokyny k nastavení Sleep-On-LAN naleznete v části <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Použití</a>.",
|
||||
"device_sol_desc2": "SOL je nakonfigurován tak, aby odesílal požadavky přes HTTP namísto UDP, aby umožnil autorizaci a zvýšil spolehlivost požadavků.",
|
||||
"device_sol_desc3": "Proto se ujistěte, že jste do sekce <span class=\"badge\">Listeners</span> v <a href=\"https://github.com/SR-G/sleep-on-lan#configuration\" class=\"link\" target=\"_blank\">konfiguraci SOL</a> zahrnuli <span class=\"badge\">HTTP:<YOURPORT></span>.",
|
||||
"device_sol_enable": "Povolit Sleep-On-LAN",
|
||||
"device_sol_password": "SOL Heslo",
|
||||
"device_sol_port": "SOL Port",
|
||||
"device_sol_user": "SOL Uživatel",
|
||||
"device_tabs_0": "Ruční",
|
||||
"device_tabs_1": "Síťový sken",
|
||||
"device_wake": "Probudit",
|
||||
"device_wake_cmd": "Vlastní příkaz pro probuzení",
|
||||
"device_wake_cron": "Cron pro probuzení",
|
||||
"device_wake_cron_enable": "Povolit cron pro probuzení",
|
||||
"device_wake_desc": "Toto zařízení můžete zapnout pomocí naplánované cron úlohy. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> a <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> lze použít pro automatické nahrazení skutečných IP a MAC adres.",
|
||||
"device_wake_timeout": "Časový limit pto probuzení (v sekundách)",
|
||||
"home_add_first_device": "Přidat vaše první zařízení",
|
||||
"home_grant_permissions": "Požádejte správce, aby vám udělil oprávnění k existujícím zařízením nebo vytvořil nová.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Potvrďte vypnutí všech zařízení ve skupině {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Vypnout {group}?",
|
||||
"home_no_devices": "Nejsou zde žádná zařízení",
|
||||
"home_order_groups": "Skupiny",
|
||||
"home_order_ip": "IP",
|
||||
"home_order_name": "Jméno",
|
||||
"home_order_tooltip": "Pořadí",
|
||||
"home_page_title": "Domů",
|
||||
"home_search_placeholder": "Vyhledat zařízení",
|
||||
"home_shutdown_group": "Skupiny vypnutí",
|
||||
"home_wake_group": "Skupiny pro probuzení",
|
||||
"login_btn_login": "Přihlásit se",
|
||||
"login_btn_more": "Více",
|
||||
"login_email_label": "E-mailová adresa nebo uživatelské jméno:",
|
||||
"login_menu_title_auth_providers": "Ostatní poskytovatelé ověřování",
|
||||
"login_password_label": "Heslo:",
|
||||
"login_welcome": "Vítejte",
|
||||
"navbar_edit_account": "Upravit účet",
|
||||
"navbar_logout": "Odhlásit se",
|
||||
"navbar_new": "Nové",
|
||||
"navbar_theme": "Téma",
|
||||
"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",
|
||||
"settings_page_title": "Nastavení",
|
||||
"settings_ping_interval_desc1": "Nastavuje interval, ve kterém jsou zařízení pingována. Nechte pole prázdné, pokud chcete použít výchozí hodnotu <span class=\"badge\">*/3 * * * * *</span>.",
|
||||
"settings_ping_interval_desc2": "Více informací o správné syntaxi pro cron najdete na <a class=\"link\" href=\"https://en.wikipedia.org/wiki/Cron\" target=\"_blank\">Wikipedii</a> nebo v <a class=\"link\" href=\"https://github.com/harrisiirak/cron-parser\" target=\"_blank\">dokumentaci k balíčku</a>.",
|
||||
"settings_ping_interval_title": "Ping interval",
|
||||
"settings_upsnap_version": "UpSnap verze",
|
||||
"settings_website_title_desc": "Nastaví jméno webové stránky a záložky prohlížeče.",
|
||||
"settings_website_title_title": "Jméno webové stránky",
|
||||
"toasts_admin_saved": "Admin uložen",
|
||||
"toasts_device_created": "Vytvořeno {device}",
|
||||
"toasts_device_deleted": "Smazáno {device}",
|
||||
"toasts_device_updated": "Změněno {device}",
|
||||
"toasts_devices_created_multiple": "Vytvořeno {count} zařízení",
|
||||
"toasts_group_created": "Vytvořit skupimu {group}",
|
||||
"toasts_group_deleted": "Smazat skupinu {group}",
|
||||
"toasts_no_permission": "Nemáte oprávnění pro navštívění {url}",
|
||||
"toasts_password_changed": "Heslo změněno. Znovu se prosím přihlašte.",
|
||||
"toasts_passwords_missmatch": "Hesla se neshodují",
|
||||
"toasts_permissions_created": "Oprávnění pro {username} byla vytvořena",
|
||||
"toasts_permissions_deleted": "Oprávnění pro {username} byla smazána",
|
||||
"toasts_permissions_updated": "Oprávnění pro {username} byla změněna",
|
||||
"toasts_permissions_updated_personal": "Vaše oprávnění byla změměna",
|
||||
"toasts_settings_saved": "Uložit nastavení",
|
||||
"toasts_user_created": "Uživatel {username} vytvořen",
|
||||
"toasts_user_deleted": "Uživatel {username} smazán",
|
||||
"toasts_user_saved": "Uživatel uložen",
|
||||
"users_allow_create_devices": "Povolit {username} vytváření nových zařízení a upravovat skupiny zařízení",
|
||||
"users_confirm_delete_desc": "Jste si jistí, že chcete smazat {username}?",
|
||||
"users_confirm_delete_title": "Potvrdit smazání",
|
||||
"users_create_new_device": "Vytvořit nové zařízení",
|
||||
"users_create_new_user": "Vytvořit nového uživatele",
|
||||
"users_delete": "Smazat",
|
||||
"users_device_permissions": "Oprávnění zařízení",
|
||||
"users_page_title": "Uživatelé",
|
||||
"users_password": "Heslo",
|
||||
"users_password_confirm": "Potvrzení hesla",
|
||||
"users_power": "Napájení",
|
||||
"users_read": "Čtení",
|
||||
"users_required_field": "povinné pole",
|
||||
"users_toggle": "Přepnout",
|
||||
"users_update": "Změna",
|
||||
"users_username": "Uživatelské jméno",
|
||||
"welcome_btn_done": "Hotovo",
|
||||
"welcome_desc": "Zkontrolujte protokoly konzole serveru pro odkaz k vytvoření počátečního účtu superuživatele. Jakmile vytvoříte superuživatele, vraťte se sem.",
|
||||
"welcome_not_ready": "Zatím nebyl nalezen žádný superuživatel. Nejprve dokončete nastavení.",
|
||||
"welcome_title": "Vyžaduje se počáteční nastavení"
|
||||
}
|
||||
@@ -1,5 +1,24 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Filter",
|
||||
"logs_column_data": "Details",
|
||||
"logs_column_level": "Stufe",
|
||||
"logs_column_message": "Nachricht",
|
||||
"logs_column_time": "Zeit",
|
||||
"logs_empty": "Keine Protokolle entsprechen diesem Filter.",
|
||||
"logs_upsnap_logs": "UpSnap-Protokolle",
|
||||
"logs_only": "Nur",
|
||||
"logs_level_all": "Alle Stufen",
|
||||
"logs_next": "Weiter",
|
||||
"logs_off": "Aus",
|
||||
"logs_page_size": "Zeilen pro Seite",
|
||||
"logs_page_title": "Protokolle",
|
||||
"logs_previous": "Zurück",
|
||||
"logs_refresh": "Aktualisieren",
|
||||
"logs_refresh_failed": "Protokolle konnten nicht geladen werden: {message}",
|
||||
"logs_refreshed_at": "Aktualisiert {time}",
|
||||
"logs_search_placeholder": "Protokolle durchsuchen",
|
||||
"logs_seconds": "{seconds} Sekunden",
|
||||
"account_account_type_admin": "Admin",
|
||||
"account_account_type_user": "Benutzer",
|
||||
"account_avatar_title": "Avatar",
|
||||
@@ -17,49 +36,50 @@
|
||||
"buttons_delete": "Löschen",
|
||||
"buttons_reset": "Zurücksetzen",
|
||||
"buttons_save": "Speichern",
|
||||
"device_card_btn_more": "Mehr",
|
||||
"device_card_btn_more_edit": "Bearbeiten",
|
||||
"device_card_btn_more_reboot": "Neustart",
|
||||
"device_card_btn_more_sleep": "Ruhezustand",
|
||||
"device_card_btn_more": "Mehr",
|
||||
"device_card_nic_tooltip_pending": "Warten",
|
||||
"device_card_nic_tooltip_power_no_permission": "Keine Berechtigung zum einschalten",
|
||||
"device_card_nic_tooltip_power": "Einschalten",
|
||||
"device_card_nic_tooltip_power_no_permission": "Keine Berechtigung zum einschalten",
|
||||
"device_card_nic_tooltip_shutdown": "Ausschalten",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "Kein Ausschaltbefehl gesetzt",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "Keine Berechtigung zum ausschalten",
|
||||
"device_card_nic_tooltip_shutdown": "Ausschalten",
|
||||
"device_card_password": "Passwort",
|
||||
"device_card_tooltip_last_status_change": "Letzte Statusänderung",
|
||||
"device_card_tooltip_shutdown_cron": "Ausschalten Cron",
|
||||
"device_card_tooltip_wake_cron": "Einschalten Cron",
|
||||
"device_card_tooltip_wake_password": "Einschalten Passwort",
|
||||
"device_general_description_placeholder": "Eine Beschreibung des Geräts",
|
||||
"device_general": "Allgemein",
|
||||
"device_general_description": "Beschreibung",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_description_placeholder": "Eine Beschreibung des Geräts",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Name",
|
||||
"device_general_netmask": "Netmask",
|
||||
"device_general_required_field": "Pflichtfeld",
|
||||
"device_general": "Allgemein",
|
||||
"device_groups": "Gruppen",
|
||||
"device_groups_desc": "Du kannst Geräte einer Gruppe hinzufügen, um sie auf dem Dashboard nach Gruppen sortiert anzuzeigen.",
|
||||
"device_groups_placeholder": "z.B. 'Keller' or 'Büro'",
|
||||
"device_groups": "Gruppen",
|
||||
"device_link": "Link",
|
||||
"device_link_desc": "Macht Ihren Gerätenamen zu einem anklickbaren Link, ideal zum Beispiel für die Verknüpfung eines Dashboards.",
|
||||
"device_link_open": "Automatisch Link öffnen",
|
||||
"device_link_open_new_tab": "Neuer Tab",
|
||||
"device_link_open_no": "Nein",
|
||||
"device_link_open_same_tab": "Selber Tab",
|
||||
"device_link_open": "Automatisch Link öffnen",
|
||||
"device_link": "Link",
|
||||
"device_modal_confirm_shutdown_desc": "Bitte bestätigen, um {device} herunterzufahren.",
|
||||
"device_modal_confirm_shutdown_title": "{device} herunterfahren?",
|
||||
"device_modal_confirm_wake_desc": "Bitte bestätigen, um {device} einzuschalten.",
|
||||
"device_modal_confirm_wake_title": "{device} einschalten?",
|
||||
"device_network_scan": "Scan",
|
||||
"device_network_scan_add_all": "Alle Geräte hinzufügen",
|
||||
"device_network_scan_desc": "Automatisches Scannen deines Netzwerks nach Geräten. Damit dies funktioniert, musst du UpSnap als Administrator/root ausführen und nmap installiert und im $PATH verfügbar haben (Für Docker-Benutzer ist das bereits der Fall, und du musst nichts weiter tun). Das Scannen kann einige Sekunden dauern.",
|
||||
"device_network_scan_include_unknown": "Schließe Geräte ein, bei denen der Name 'Unknown' ist.",
|
||||
"device_network_scan_ip_range": "IP-Bereich",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_mac_vendor": "Mac Hersteller:",
|
||||
"device_network_scan_ip_range": "IP-Bereich",
|
||||
"device_network_scan_mac": "Mac:",
|
||||
"device_network_scan_mac_vendor": "Mac Hersteller:",
|
||||
"device_network_scan_netmask": "Netmask:",
|
||||
"device_network_scan_new_netmask": "Neue Netmask",
|
||||
"device_network_scan_no_range": "Kein Scan-Bereich",
|
||||
@@ -67,29 +87,29 @@
|
||||
"device_network_scan_replace_netmask": "Netmask für alle Geräte ändern?",
|
||||
"device_network_scan_running": "Scan läuft",
|
||||
"device_network_scan_unsaved_changes": "Ungespeicherte Änderungen",
|
||||
"device_network_scan": "Scan",
|
||||
"device_page_title": "Neues Gerät",
|
||||
"device_password_desc": "Einige Netzwerkkarten bieten die Möglichkeit, ein Passwort für Magic Packets zu setzen, auch <span class=\"badge\">SecureON</span> genannt. Das Passwort kann nur 0, 4 oder 6 Zeichen lang sein.",
|
||||
"device_password": "Password",
|
||||
"device_password_desc": "Einige Netzwerkkarten bieten die Möglichkeit, ein Passwort für Magic Packets zu setzen, auch <span class=\"badge\">SecureON</span> genannt. Das Passwort kann nur 0, 4 oder 6 Zeichen lang sein.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Eigener Ping-Befehl",
|
||||
"device_ping_desc": "Du kannst einen benutzerdefinierten Shell-Befehl verwenden, um festzustellen, ob das Gerät eingeschaltet ist. Der Befehl sollte einen Exit-Code von <span class=\"badge\">0</span> zurückgeben, um anzuzeigen, dass das Gerät eingeschaltet ist. Jeder andere Exit-Code setzt den Status auf offline.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports": "Ports",
|
||||
"device_ports_add_new": "Port hinzufügen",
|
||||
"device_ports_desc": "UpSnap kann auch prüfen, ob bestimmte Ports offen sind.",
|
||||
"device_ports_name": "Name",
|
||||
"device_ports_number": "Nummer",
|
||||
"device_ports": "Ports",
|
||||
"device_require_confirmation": "Bestätigung erforderlich",
|
||||
"device_shutdown": "Ausschalten",
|
||||
"device_shutdown_cmd": "Befehl zum ausschalten",
|
||||
"device_shutdown_cron": "Cron",
|
||||
"device_shutdown_cron_desc": "Genau wie das Einrichten eines Cron-Jobs, um das Gerät aufzuwecken, kannst du auch einen Cron-Job planen, um dieses Gerät herunterzufahren.",
|
||||
"device_shutdown_cron_enable": "Aktivieren",
|
||||
"device_shutdown_cron": "Cron",
|
||||
"device_shutdown_desc": "Dieser <strong>Shell-Befehl</strong> wird in deinem Container ausgeführt (wenn du Docker verwendest) oder auf deinem Host (wenn du die Binärdatei verwendest). Um zu überprüfen, ob das funktioniert, kannst du den Befehl zuerst im Container oder auf deiner Host-Shell ausführen. Übliche Befehle sind <span class=\"badge\">net rpc</span> für Windows, <span class=\"badge\">sshpass</span> für Linux oder <span class=\"badge\">curl</span> im Allgemeinen, um Webanfragen durchzuführen.",
|
||||
"device_shutdown_desc": "Dieser <strong>Shell-Befehl</strong> wird in deinem Container ausgeführt (wenn du Docker verwendest) oder auf deinem Host (wenn du die Binärdatei verwendest). Um zu überprüfen, ob das funktioniert, kannst du den Befehl zuerst im Container oder auf deiner Host-Shell ausführen. Übliche Befehle sind <span class=\"badge\">net rpc</span> für Windows, <span class=\"badge\">sshpass</span> für Linux oder <span class=\"badge\">curl</span> im Allgemeinen, um Webanfragen durchzuführen. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> und <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> können zur automatischen Ersetzung der tatsächlichen IP- und MAC-Adressen verwendet werden.",
|
||||
"device_shutdown_examples": "Beispiele:",
|
||||
"device_shutdown_examples_linux": "Entfernten Linux PC ausschalten:",
|
||||
"device_shutdown_examples_windows": "Entfernten Windows PC ausschalten:",
|
||||
"device_shutdown_examples": "Beispiele:",
|
||||
"device_shutdown_timeout": "Ausschalt-Timeout (Sekunden)",
|
||||
"device_shutdown": "Ausschalten",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Authorisierung",
|
||||
"device_sol_desc1": "Du kannst Computer mithilfe des Tools <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a> in den Ruhezustand versetzen. Sleep-On-LAN (SOL) ist ein externes Tool/Daemon, das auf den PCs arbeitet, die du in den Ruhezustand versetzen möchtest, und stellt einen REST-Endpunkt bereit. Für Anweisungen zur Einrichtung von Sleep-On-LAN verweise bitte auf den Abschnitt <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Usage</a>.",
|
||||
"device_sol_desc2": "SOL ist so konfiguriert, dass es Anfragen über HTTP statt über UDP sendet, um eine Autorisierung zu ermöglichen und die Zuverlässigkeit der Anfragen zu erhöhen.",
|
||||
@@ -98,17 +118,18 @@
|
||||
"device_sol_password": "SOL Passwort",
|
||||
"device_sol_port": "SOL Port",
|
||||
"device_sol_user": "SOL Benutzer",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_tabs.0": "Manuell",
|
||||
"device_tabs.1": "Netzwerkscan",
|
||||
"device_wake_cmd": "Eigener Einschalt-Befehl",
|
||||
"device_wake_cron_enable": "Aktivieren",
|
||||
"device_wake_cron": "Cron",
|
||||
"device_wake_desc": "Du kannst das Gerät mit einem Cron-Job einschalten.",
|
||||
"device_wake_timeout": "Einschalt-Timeout (Sekunden)",
|
||||
"device_tabs_0": "Manuell",
|
||||
"device_tabs_1": "Netzwerkscan",
|
||||
"device_wake": "Einschalten",
|
||||
"device_wake_cmd": "Eigener Einschalt-Befehl",
|
||||
"device_wake_cron": "Cron",
|
||||
"device_wake_cron_enable": "Aktivieren",
|
||||
"device_wake_desc": "Du kannst das Gerät mit einem Cron-Job einschalten. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> und <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> können zur automatischen Ersetzung der tatsächlichen IP- und MAC-Adressen verwendet werden.",
|
||||
"device_wake_timeout": "Einschalt-Timeout (Sekunden)",
|
||||
"home_add_first_device": "Füge dein erstes Gerät hinzu",
|
||||
"home_grant_permissions": "Bitte frag den Administrator, dir Berechtigungen für bestehende Geräte zu erteilen oder neue Geräte zu erstellen.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Bitte bestätigen, um alle Geräte in {group} herunterzufahren.",
|
||||
"home_modal_confirm_shutdown_group_title": "{group} herunterfahren?",
|
||||
"home_no_devices": "Keine Geräte.",
|
||||
"home_order_groups": "Gruppen",
|
||||
"home_order_ip": "IP",
|
||||
@@ -116,6 +137,7 @@
|
||||
"home_order_tooltip": "Sortieren",
|
||||
"home_page_title": "Home",
|
||||
"home_search_placeholder": "Suche nach Geräten",
|
||||
"home_shutdown_group": "Gruppe herunterfahren",
|
||||
"home_wake_group": "Gruppe wecken",
|
||||
"login_btn_login": "Login",
|
||||
"login_btn_more": "Mehr",
|
||||
@@ -130,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",
|
||||
@@ -152,8 +175,8 @@
|
||||
"toasts_passwords_missmatch": "Passwörter stimmen nicht überein",
|
||||
"toasts_permissions_created": "Berechtigungen für {username} erstellt",
|
||||
"toasts_permissions_deleted": "Berechtigungen für {username} gelöscht",
|
||||
"toasts_permissions_updated_personal": "Deine Berechtigungen wurden aktualisiert",
|
||||
"toasts_permissions_updated": "Berechtigungen für {username} geändert",
|
||||
"toasts_permissions_updated_personal": "Deine Berechtigungen wurden aktualisiert",
|
||||
"toasts_settings_saved": "Einstellungen gespeichert",
|
||||
"toasts_user_created": "Benutzer {username} erstellt",
|
||||
"toasts_user_deleted": "Benutzer {username} gelöscht",
|
||||
@@ -166,30 +189,16 @@
|
||||
"users_delete": "Löschen",
|
||||
"users_device_permissions": "Geräteberechtigungen",
|
||||
"users_page_title": "Benutzer",
|
||||
"users_password_confirm": "Passwort bestätigen",
|
||||
"users_password": "Passwort",
|
||||
"users_password_confirm": "Passwort bestätigen",
|
||||
"users_power": "Power",
|
||||
"users_read": "Lesen",
|
||||
"users_required_field": "Pflichtfeld",
|
||||
"users_toggle": "Toggle",
|
||||
"users_update": "Ändern",
|
||||
"users_username": "Benutzername",
|
||||
"welcome_not_expected_back": "Bring mich zurück",
|
||||
"welcome_not_expected_desc": "Du hast die Einrichtung bereits abgeschlossen! Hier gibt es nichts zu tun.",
|
||||
"welcome_not_expected_title": "Ich hab dich hier nicht erwartet! 🧐",
|
||||
"welcome_progress_step1": "Willkommen",
|
||||
"welcome_progress_step2": "Account erstellen",
|
||||
"welcome_progress_step3": "Fertig",
|
||||
"welcome_step1_page_title": "Willkommen bei UpSnap 🥳",
|
||||
"welcome_step1_setup_btn_next": "Weiter",
|
||||
"welcome_step1_setup_desc": "Bitte schließe die nachfolgenden Schritte ab, um die Einrichtung abzuschließen.",
|
||||
"welcome_step2_btn_create": "Erstellen",
|
||||
"welcome_step2_label_email": "Email:",
|
||||
"welcome_step2_label_min_chars": "min. 10 Zeichen",
|
||||
"welcome_step2_label_password_confirm": "Passwort bestätigen:",
|
||||
"welcome_step2_label_password": "Passwort:",
|
||||
"welcome_step2_page_title": "Erstelle einen Admin Account",
|
||||
"welcome_step3_btn_done": "Los geht's!",
|
||||
"welcome_step3_page_desc": "Füge Geräte zu deinem Dashboard hinzu.",
|
||||
"welcome_step3_page_title": "Du bist fertig! 🎉"
|
||||
"welcome_btn_done": "Fertig",
|
||||
"welcome_desc": "Überprüfe die Server-Konsolenprotokolle für einen Link zum Erstellen des ersten Superuser-Kontos. Sobald du den Superuser erstellt hast, komm hierher zurück.",
|
||||
"welcome_not_ready": "Noch kein Superuser gefunden. Bitte schließe zuerst die Einrichtung ab.",
|
||||
"welcome_title": "Ersteinrichtung erforderlich"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Φίλτρα",
|
||||
"logs_column_data": "Λεπτομέρειες",
|
||||
"logs_column_level": "Επίπεδο",
|
||||
"logs_column_message": "Μήνυμα",
|
||||
"logs_column_time": "Ώρα",
|
||||
"logs_empty": "Κανένα αρχείο καταγραφής δεν ταιριάζει με αυτό το φίλτρο.",
|
||||
"logs_upsnap_logs": "Αρχεία καταγραφής UpSnap",
|
||||
"logs_only": "Μόνο",
|
||||
"logs_level_all": "Όλα τα επίπεδα",
|
||||
"logs_next": "Επόμενο",
|
||||
"logs_off": "Απενεργοποίηση",
|
||||
"logs_page_size": "Γραμμές ανά σελίδα",
|
||||
"logs_page_title": "Αρχεία καταγραφής",
|
||||
"logs_previous": "Προηγούμενο",
|
||||
"logs_refresh": "Ανανέωση",
|
||||
"logs_refresh_failed": "Δεν ήταν δυνατή η φόρτωση αρχείων καταγραφής: {message}",
|
||||
"logs_refreshed_at": "Ενημερώθηκε {time}",
|
||||
"logs_search_placeholder": "Αναζήτηση αρχείων καταγραφής",
|
||||
"logs_seconds": "{seconds} δευτερόλεπτα",
|
||||
"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": "Περισσότερα",
|
||||
"device_card_btn_more_edit": "Επεξεργασία",
|
||||
"device_card_btn_more_reboot": "Επανεκκίνηση",
|
||||
"device_card_btn_more_sleep": "Αδράνεια",
|
||||
"device_card_nic_tooltip_pending": "Εκρεμμεί",
|
||||
"device_card_nic_tooltip_power": "Ενεργοποίηση",
|
||||
"device_card_nic_tooltip_power_no_permission": "Ανεπαρκές δικαιώμα ενεργοποίησης στη συσκευή αυτή",
|
||||
"device_card_nic_tooltip_shutdown": "Απενεργοποίηση",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "Μη ορισμένη εντολή απενεργοποίησης",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "Ανεπαρκές δικαιώμα απενεργοποίησης στη συσκευή αυτή",
|
||||
"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": "Γενικά",
|
||||
"device_general_description": "Περιγραφή",
|
||||
"device_general_description_placeholder": "Περιγραφή συσκευής",
|
||||
"device_general_ip": "IP Διεύθυνση/FQDN",
|
||||
"device_general_mac": "Mac Φυσική Διεύθυνση",
|
||||
"device_general_name": "Όνομα",
|
||||
"device_general_netmask": "Μάσκα δικτύου",
|
||||
"device_general_required_field": "απαιτούμενο πεδίο",
|
||||
"device_groups": "Ομάδες",
|
||||
"device_groups_desc": "Μπορείτε να προσθέσετε συσκευές σε μια ομάδα για να υπάρχει ταξινόμηση ανα ομάδα στην αρχική σελίδα.",
|
||||
"device_groups_placeholder": "π.χ. 'Υπόγειο' ή 'Γραφείο'",
|
||||
"device_link": "Σύνδεσμος",
|
||||
"device_link_desc": "Καθιστά το όνομα της συσκευής σύνδεσμο, ιδανικό για σύνδεσεις στην αρχική σελίδα.",
|
||||
"device_link_open": "Αυτόματο άνοιγμα συνδέσμου",
|
||||
"device_link_open_new_tab": "Νέα καρτέλα",
|
||||
"device_link_open_no": "Όχι",
|
||||
"device_link_open_same_tab": "Κάποια καρτέλα",
|
||||
"device_modal_confirm_shutdown_desc": "Παρακαλώ επιβεβαιώστε την απενεργοποίηση της συσκευής {device}.",
|
||||
"device_modal_confirm_shutdown_title": "Απενεργοποίηση της συσκευής {device}?",
|
||||
"device_modal_confirm_wake_desc": "PΠαρακαλώ επιβεβαιώστε την ενεργοποίηση της συσκευής {device}.",
|
||||
"device_modal_confirm_wake_title": "Ενεργοποίηση της συσκευής {device};",
|
||||
"device_network_scan": "Σάρωση",
|
||||
"device_network_scan_add_all": "Add all devices",
|
||||
"device_network_scan_desc": "Αυτόματη σάρωση συσκευών στο δίκτυο. Για να λειτουργήσει θα πρέπει να γίνει εκτέλεση του UpSnap ώς as root/admin χρήστης και να υπάρχει εγκατεστησμένο και να βρίσκεται στο $PATH το nmap. (Για χρήστες docker, δεν απαιτείται κάτι απο αυτά). Η σάρωση μπορεί να πάρει κάποια δευτερόλεπτα.",
|
||||
"device_network_scan_include_unknown": "Συμπερίληψη συσκευών με όνομα \"Unknown\"",
|
||||
"device_network_scan_ip": "IP Διεύθυνση:",
|
||||
"device_network_scan_ip_range": "Εύρος IP",
|
||||
"device_network_scan_mac": "Mac Φυσική Διεύθυνση:",
|
||||
"device_network_scan_mac_vendor": "Κατασκευαστής 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_page_title": "Νέα συσκευή",
|
||||
"device_password": "Κωδικός",
|
||||
"device_password_desc": "Κάποιες δικτυακές κάρτες έχουν την δυνατότητα επιλογής κωδικού για μαγικά πακέτα, επίσης γνωστό ως <span class=\"badge\">SecureON</span>. Ο κωδικός μπορεί να έχει μήκος 0, 4 or 6 χαρακτήρες.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Προσμοσμένη εντολή ping",
|
||||
"device_ping_desc": "Μπορεί να χρησιμοποιηθεί προσαρμοσμένη εντολή για να ελενχθεί αν η συσκευή είναι ήδη ενεργή. Η εντολή θα πρέπει να επιστρέφει ένα κώδικα εξόδου <span class=\"badge\">0</span> που θα υποδεικνύει ότι η συσκευή είναι ενεργή, οποιαδήποτε άλλη τιμή θα σημαίνει ότι η συσκευή είναι ανενεργή.",
|
||||
"device_ports": "Πόρτες",
|
||||
"device_ports_add_new": "Πρόσθεση νέας πόρτας",
|
||||
"device_ports_desc": "UpSnap μπορεί επίσης να ελέγχει αν οι παρεχόμενες πόρτες είναι ανοιχτές.",
|
||||
"device_ports_name": "Όνομα",
|
||||
"device_ports_number": "Αριθμός",
|
||||
"device_require_confirmation": "Απαίτησης επιβεβαίωσης",
|
||||
"device_shutdown": "Απενεργοποίηση",
|
||||
"device_shutdown_cmd": "Εντολή απενεργοποίησης",
|
||||
"device_shutdown_cron": "Προγραμματισμός απενεργοποίησης",
|
||||
"device_shutdown_cron_desc": "Ακριβώς όπως με την επιλογή προγραμματισμού ενεργοποίησης συσκευής, είναι δυνατό να προγραμματιστεί η απενεργοποίηση της συσκευής.",
|
||||
"device_shutdown_cron_enable": "Ενεργοποίησης προγραμματισμού απενεργοποίησης",
|
||||
"device_shutdown_desc": "Αυτή η <strong>εντολή</strong> θα εκτελεστεί εντός του container (σε περίπτωση χρήσης docker) ή από τον host (στην περίπτωση χρήσης binary). Για επιβεβαιώση λειτουργίας, μπορεί να εκτελεστεί η εντολή εντός του container ή στον host πρώτα. Οι συνήθεις εντολές είναι <span class=\"badge\">net rpc</span> για windows, <span class=\"badge\">sshpass</span> για linux ή <span class=\"badge\">curl</span> για γενικά web requests. <span class=\"badge\">{{ DEVICE_IP }}</span> και <span class=\"badge\">{{ DEVICE_MAC }}</span> μπορούν να χρησιμοποιηθούν για αυτόματη αντικατάσταση των πραγματικών IP και MAC διεθύνσεων.",
|
||||
"device_shutdown_examples": "Παραδείγματα:",
|
||||
"device_shutdown_examples_linux": "Απομακρυσμένη απενεργοποίηση της συσκευής linux:",
|
||||
"device_shutdown_examples_windows": "Απομακρυσμένη απενεργοποίηση της συσκευής windows:",
|
||||
"device_shutdown_timeout": "Αντίστοφη μέτρηση απενεργοποίησης (seconds)",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Εξουσιοδότηση",
|
||||
"device_sol_desc1": "Μπορεί να αδρανοποιηθούν οι συσκευές χρησιμοποιώντας το εργαλείπ <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a>. Sleep-On-LAN (SOL) είναι ένα εξωτερικό εργαλείο που λειτουργεί στους υπολογιστές που είναι προς αδρανοποίηση, με χρηση REST endpoint. Για οδηγίες για τη λειτουργία του Sleep-On-LAN, παρακαλώ δείτε το <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Usage</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 configuration</a>.",
|
||||
"device_sol_enable": "Ενεργοποίηση Sleep-On-LAN",
|
||||
"device_sol_password": "SOL Κωδικός",
|
||||
"device_sol_port": "SOL Πόρτα",
|
||||
"device_sol_user": "SOL Χρήστης",
|
||||
"device_tabs_0": "Χειροκίνητα",
|
||||
"device_tabs_1": "Δικτυακή σάρωση",
|
||||
"device_wake": "Ενεργοποίηση",
|
||||
"device_wake_cmd": "Προσαρμοσμένη εντολή ενεργοποίησης",
|
||||
"device_wake_cron": "Προγραμματισμός εντολής ενεργοποίησης",
|
||||
"device_wake_cron_enable": "Ενεργοποίηση εντολής ενεργοποίησης",
|
||||
"device_wake_desc": "Μπορεί να γίνει ενεργοποίηση της συσκευής με προγραμμένη εντολή ενεργοποίησης. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> και <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> μπορούν να χρησιμοποιηθούν για αυτόματη αντικατάσταση των πραγματικών IP και MAC διευθύνσεις.",
|
||||
"device_wake_timeout": "Αντίστοφη μέτρηση ενεργοποίησης (seconds)",
|
||||
"home_add_first_device": "Προσθέστε την πρώτη σας συσκευή",
|
||||
"home_grant_permissions": "Παρακαλώ ρωτήστει τον διαχειριστή για εξουσιοδότηση διαχείρισης υπάρχουσων συσκευών ή για δημιουργία νέων.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Παρακαλώ επιβεβαιώστε την απενεργοποίηση όλων των συσκευών στην όμαδα {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Απενεργοποίηση ομάδας {group}?",
|
||||
"home_no_devices": "Καθόλου συσκευές εδώ.",
|
||||
"home_order_groups": "Ομάδες",
|
||||
"home_order_ip": "IP διευθύνσεις",
|
||||
"home_order_name": "Όνομα",
|
||||
"home_order_tooltip": "Ταξινόμηση",
|
||||
"home_page_title": "Αρχική Σελίδα",
|
||||
"home_search_placeholder": "Αναζήτηση συσκευών",
|
||||
"home_shutdown_group": "Απενεργοποίηση ομάδας",
|
||||
"home_wake_group": "Ενεργοποίηση ομάδας",
|
||||
"login_btn_login": "Είσοδος",
|
||||
"login_btn_more": "Περισσότερα",
|
||||
"login_email_label": "Email ή όνομα χρήστη:",
|
||||
"login_menu_title_auth_providers": "Λοιποί πάροχη αυθεντικοποίησης",
|
||||
"login_password_label": "Κωδικός:",
|
||||
"login_welcome": "Καλώς ήλθατε",
|
||||
"navbar_edit_account": "Επεξεργασία λογαριασμού",
|
||||
"navbar_logout": "Αποσύνδεση",
|
||||
"navbar_new": "Δημιουργία",
|
||||
"navbar_theme": "Θέμα",
|
||||
"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",
|
||||
"settings_page_title": "Επιλογές",
|
||||
"settings_ping_interval_desc1": "Προσδιορίζει τη συχνότητα που στέλνεται ping στις συσκευές. Αφήστε κενό για την προεπιλεγμένη τιμή <span class=\"badge\">*/3 * * * * *</span>.",
|
||||
"settings_ping_interval_desc2": "Για περισσότερα σε σχέση με το συντακτικό προγραμματισμού στο <a class=\"link\" href=\"https://en.wikipedia.org/wiki/Cron\" target=\"_blank\">Wikipedia</a> ή επισκευθείτε το <a class=\"link\" href=\"https://github.com/harrisiirak/cron-parser\" target=\"_blank\">package documentation</a>.",
|
||||
"settings_ping_interval_title": "Συχνότητα Ping",
|
||||
"settings_upsnap_version": "UpSnap version",
|
||||
"settings_website_title_desc": "Προσδιορίζει το τίτλο του ιστότοπου και στην καρτέλα του browser.",
|
||||
"settings_website_title_title": "Τίτλος Ιστότοπου",
|
||||
"toasts_admin_saved": "Διαχειριστής αποθηκεύτηκε",
|
||||
"toasts_device_created": "Δημιουργήθηκε {device}",
|
||||
"toasts_device_deleted": "Διεγράφη {device}",
|
||||
"toasts_device_updated": "Ανανεωμένη {device}",
|
||||
"toasts_devices_created_multiple": "Δημιουργήθηκαν {count} devices",
|
||||
"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": "Τα δικαιώματα για τον {username} ανανεώθηκαν",
|
||||
"toasts_permissions_updated_personal": "Τα δικαιώματα ανανεώθηκαν",
|
||||
"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": "Device permissions",
|
||||
"users_page_title": "Χρήστες",
|
||||
"users_password": "Κωδικός",
|
||||
"users_password_confirm": "Επιβεβαίωση κωδικού",
|
||||
"users_power": "Ενεργός",
|
||||
"users_read": "Ανάγνωση",
|
||||
"users_required_field": "απαιτούμενο πεδίο",
|
||||
"users_toggle": "Ενεργοποίηση/Απενεργοποίηση",
|
||||
"users_update": "Ανανέωση",
|
||||
"users_username": "Όνομα χρήστα",
|
||||
"welcome_btn_done": "Τέλος",
|
||||
"welcome_desc": "Ελέγξτε τα αρχεία καταγραφής κονσόλας του διακομιστή για έναν σύνδεσμο δημιουργίας του αρχικού λογαριασμού υπερχρήστη. Αφού δημιουργήσετε τον υπερχρήστη, επιστρέψτε εδώ.",
|
||||
"welcome_not_ready": "Δεν βρέθηκε ακόμα υπερχρήστης. Παρακαλώ ολοκληρώστε πρώτα τη ρύθμιση.",
|
||||
"welcome_title": "Απαιτείται αρχική ρύθμιση"
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Filters",
|
||||
"account_account_type_admin": "Admin",
|
||||
"account_account_type_user": "User",
|
||||
"account_avatar_title": "Avatar",
|
||||
@@ -17,49 +18,52 @@
|
||||
"buttons_delete": "Delete",
|
||||
"buttons_reset": "Reset",
|
||||
"buttons_save": "Save",
|
||||
"device_card_btn_more": "More",
|
||||
"device_card_btn_more_edit": "Edit",
|
||||
"device_card_btn_more_reboot": "Reboot",
|
||||
"device_card_btn_more_sleep": "Sleep",
|
||||
"device_card_btn_more": "More",
|
||||
"device_card_nic_tooltip_pending": "Pending",
|
||||
"device_card_nic_tooltip_power_no_permission": "No permission to power on this device",
|
||||
"device_card_nic_tooltip_power": "Power on",
|
||||
"device_card_nic_tooltip_power_no_permission": "No permission to power on this device",
|
||||
"device_card_nic_tooltip_shutdown": "Shut down",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "No shutdown command set",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "No permission to shut down this device",
|
||||
"device_card_nic_tooltip_shutdown": "Shut down",
|
||||
"device_card_password": "Password",
|
||||
"device_card_tooltip_last_status_change": "Last status change",
|
||||
"device_card_tooltip_shutdown_cron": "Shutdown cron",
|
||||
"device_card_tooltip_wake_cron": "Wake cron",
|
||||
"device_card_tooltip_wake_password": "Wake password",
|
||||
"device_general_description_placeholder": "Some description of the device",
|
||||
"device_general": "General",
|
||||
"device_general_description": "Description",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_description_placeholder": "Some description of the device",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Name",
|
||||
"device_general_netmask": "Netmask",
|
||||
"device_general_required_field": "required field",
|
||||
"device_general": "General",
|
||||
"device_general_track_ip": "Track IP address",
|
||||
"device_general_track_ip_desc": "Updates this device's IP address automatically whenever the periodic network scan finds its MAC address at a different IP. Requires the 'IP address tracking' interval to be set in the settings and only works on subnets UpSnap is directly attached to.",
|
||||
"device_groups": "Groups",
|
||||
"device_groups_desc": "You can add devices to a group to have them sorted by group on the dashboard.",
|
||||
"device_groups_placeholder": "e.g. 'Basement' or 'Office'",
|
||||
"device_groups": "Groups",
|
||||
"device_link": "Link",
|
||||
"device_link_desc": "Makes your device name a clickable link, perfect for linking a dashboard for example.",
|
||||
"device_link_open": "Automatically open link",
|
||||
"device_link_open_new_tab": "New tab",
|
||||
"device_link_open_no": "No",
|
||||
"device_link_open_same_tab": "Same tab",
|
||||
"device_link_open": "Automatically open link",
|
||||
"device_link": "Link",
|
||||
"device_modal_confirm_shutdown_desc": "Please confirm to shutdown {device}.",
|
||||
"device_modal_confirm_shutdown_title": "Shutdown {device}?",
|
||||
"device_modal_confirm_wake_desc": "Please confirm to wake {device}.",
|
||||
"device_modal_confirm_wake_title": "Wake {device}?",
|
||||
"device_network_scan": "Scan",
|
||||
"device_network_scan_add_all": "Add all devices",
|
||||
"device_network_scan_desc": "Automatically scan your network for devices. For this to work, you need to run UpSnap as root/admin and have nmap installed and available in your $PATH (For docker users, thats already the case and you don't need to do anything). Scanning might take some seconds.",
|
||||
"device_network_scan_include_unknown": "Include devices where name is \"Unknown\"",
|
||||
"device_network_scan_ip_range": "IP range",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_mac_vendor": "Mac vendor:",
|
||||
"device_network_scan_ip_range": "IP range",
|
||||
"device_network_scan_mac": "Mac:",
|
||||
"device_network_scan_mac_vendor": "Mac vendor:",
|
||||
"device_network_scan_netmask": "Netmask:",
|
||||
"device_network_scan_new_netmask": "New netmask",
|
||||
"device_network_scan_no_range": "No scan range",
|
||||
@@ -67,29 +71,29 @@
|
||||
"device_network_scan_replace_netmask": "Replace netmask for all devices?",
|
||||
"device_network_scan_running": "Scan running",
|
||||
"device_network_scan_unsaved_changes": "Unsaved changes",
|
||||
"device_network_scan": "Scan",
|
||||
"device_page_title": "New device",
|
||||
"device_password_desc": "Some network cards have the option to set a password for magic packets, also called <span class=\"badge\">SecureON</span>. Password can only be 0, 4 or 6 characters in length.",
|
||||
"device_password": "Password",
|
||||
"device_password_desc": "Some network cards have the option to set a password for magic packets, also called <span class=\"badge\">SecureON</span>. Password can only be 0, 4 or 6 characters in length.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Custom ping command",
|
||||
"device_ping_desc": "You can use a custom shell command to see if the device is powered on. The command should return an exit code of <span class=\"badge\">0</span> to indicate that the device is powered on, any other exit code will mark the device as powered off.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports": "Ports",
|
||||
"device_ports_add_new": "Add new port",
|
||||
"device_ports_desc": "UpSnap can also check if given ports are open.",
|
||||
"device_ports_name": "Name",
|
||||
"device_ports_number": "Number",
|
||||
"device_ports": "Ports",
|
||||
"device_require_confirmation": "Require Confirmation",
|
||||
"device_shutdown": "Shutdown",
|
||||
"device_shutdown_cmd": "Shutdown command",
|
||||
"device_shutdown_cron": "Shutdown cron",
|
||||
"device_shutdown_cron_desc": "Just like setting a cron to wake the device, you can also schedule a cron job to shut down this device.",
|
||||
"device_shutdown_cron_enable": "Enable shutdown cron",
|
||||
"device_shutdown_cron": "Shutdown cron",
|
||||
"device_shutdown_desc": "This <strong>shell command</strong> will run inside your container (if you use docker) or on your host (if you use the binary). To verify that it works, you can run the command inside the container or on your host shell first. Common commands are <span class=\"badge\">net rpc</span> for windows, <span class=\"badge\">sshpass</span> for linux or <span class=\"badge\">curl</span> in general to make web requests.",
|
||||
"device_shutdown_desc": "This <strong>shell command</strong> will run inside your container (if you use docker) or on your host (if you use the binary). To verify that it works, you can run the command inside the container or on your host shell first. Common commands are <span class=\"badge\">net rpc</span> for windows, <span class=\"badge\">sshpass</span> for linux or <span class=\"badge\">curl</span> in general to make web requests. <span class=\"badge\">{{ DEVICE_IP }}</span> and <span class=\"badge\">{{ DEVICE_MAC }}</span> can be used for automatic substitution for actual IP and MAC addresses.",
|
||||
"device_shutdown_examples": "Examples:",
|
||||
"device_shutdown_examples_linux": "Shutdown remote linux machine:",
|
||||
"device_shutdown_examples_windows": "Shutdown remote windows machine:",
|
||||
"device_shutdown_examples": "Examples:",
|
||||
"device_shutdown_timeout": "Shutdown Timeout (seconds)",
|
||||
"device_shutdown": "Shutdown",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Authorization",
|
||||
"device_sol_desc1": "You can put computers to sleep using the <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a> tool. Sleep-On-LAN (SOL) is an external tool/daemon that operates on the PCs you want to put to sleep, providing a REST endpoint. For instructions on setting up Sleep-On-LAN, please refer to the <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Usage</a> section.",
|
||||
"device_sol_desc2": "SOL is configured to send requests over HTTP instead of UDP to enable authorization and make requests more reliable.",
|
||||
@@ -98,17 +102,18 @@
|
||||
"device_sol_password": "SOL Password",
|
||||
"device_sol_port": "SOL Port",
|
||||
"device_sol_user": "SOL User",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_tabs.0": "Manual",
|
||||
"device_tabs.1": "Network Scan",
|
||||
"device_wake_cmd": "Custom wake command",
|
||||
"device_wake_cron_enable": "Enable wake cron",
|
||||
"device_wake_cron": "Wake cron",
|
||||
"device_wake_desc": "You can power this device using a scheduled cron job.",
|
||||
"device_wake_timeout": "Wake Timeout (seconds)",
|
||||
"device_tabs_0": "Manual",
|
||||
"device_tabs_1": "Network Scan",
|
||||
"device_wake": "Wake",
|
||||
"device_wake_cmd": "Custom wake command",
|
||||
"device_wake_cron": "Wake cron",
|
||||
"device_wake_cron_enable": "Enable wake cron",
|
||||
"device_wake_desc": "You can power this device using a scheduled cron job. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> and <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> can be used for automatic substitution for actual IP and MAC addresses.",
|
||||
"device_wake_timeout": "Wake Timeout (seconds)",
|
||||
"home_add_first_device": "Add your first device",
|
||||
"home_grant_permissions": "Please ask the admin to grant you permissions to existing devices or to create new ones.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Please confirm to shutdown all devices in {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Shutdown {group}?",
|
||||
"home_no_devices": "No devices here.",
|
||||
"home_order_groups": "Groups",
|
||||
"home_order_ip": "IP",
|
||||
@@ -116,6 +121,7 @@
|
||||
"home_order_tooltip": "Order",
|
||||
"home_page_title": "Home",
|
||||
"home_search_placeholder": "Search for devices",
|
||||
"home_shutdown_group": "Shutdown group",
|
||||
"home_wake_group": "Wake group",
|
||||
"login_btn_login": "Login",
|
||||
"login_btn_more": "More",
|
||||
@@ -123,6 +129,24 @@
|
||||
"login_menu_title_auth_providers": "Other Auth Providers",
|
||||
"login_password_label": "Password:",
|
||||
"login_welcome": "Welcome",
|
||||
"logs_column_data": "Details",
|
||||
"logs_column_level": "Level",
|
||||
"logs_column_message": "Message",
|
||||
"logs_column_time": "Time",
|
||||
"logs_empty": "No logs match this filter.",
|
||||
"logs_upsnap_logs": "UpSnap logs",
|
||||
"logs_only": "Only",
|
||||
"logs_level_all": "All levels",
|
||||
"logs_next": "Next",
|
||||
"logs_off": "Off",
|
||||
"logs_page_size": "Rows per page",
|
||||
"logs_page_title": "Logs",
|
||||
"logs_previous": "Previous",
|
||||
"logs_refresh": "Refresh",
|
||||
"logs_refresh_failed": "Could not load logs: {message}",
|
||||
"logs_refreshed_at": "Updated {time}",
|
||||
"logs_search_placeholder": "Search logs",
|
||||
"logs_seconds": "{seconds} seconds",
|
||||
"navbar_edit_account": "Edit account",
|
||||
"navbar_logout": "Logout",
|
||||
"navbar_new": "New",
|
||||
@@ -130,13 +154,16 @@
|
||||
"settings_icon_desc": "Set a custom favicon. Supported file types are:",
|
||||
"settings_icon_title": "Icon",
|
||||
"settings_invalid_cron": "❌ Invalid cron syntax",
|
||||
"settings_lazy_ping_desc": "When lazy ping is turned on, UpSnap will only ping devices if there is an active user visiting the website. If it's turned off, UpSnap will always ping devices.",
|
||||
"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",
|
||||
"settings_page_title": "Settings",
|
||||
"settings_ping_interval_desc1": "Sets the interval in which the devices are pinged. Leave blank to use default value of <span class=\"badge\">*/3 * * * * *</span>.",
|
||||
"settings_ping_interval_desc2": "Learn more about the correct syntax for cron on <a class=\"link\" href=\"https://en.wikipedia.org/wiki/Cron\" target=\"_blank\">Wikipedia</a> or refer to the <a class=\"link\" href=\"https://github.com/harrisiirak/cron-parser\" target=\"_blank\">package documentation</a>.",
|
||||
"settings_ping_interval_title": "Ping interval",
|
||||
"settings_track_ip_desc": "Cron interval at which UpSnap scans the local subnets of devices with 'Track IP address' enabled and updates their IP address if their MAC address is found at a different one. Every 15-60 minutes is plenty; short intervals broadcast-scan your network aggressively, which can be especially bad on wider subnets. Leave empty to disable. Requires nmap, same as the network scan.",
|
||||
"settings_track_ip_title": "IP address tracking",
|
||||
"settings_upsnap_version": "UpSnap version",
|
||||
"settings_website_title_desc": "Sets the title of the website and in the browser tab.",
|
||||
"settings_website_title_title": "Website title",
|
||||
@@ -152,8 +179,8 @@
|
||||
"toasts_passwords_missmatch": "Passwords don't match",
|
||||
"toasts_permissions_created": "Permissions for {username} created",
|
||||
"toasts_permissions_deleted": "Permissions for {username} deleted",
|
||||
"toasts_permissions_updated_personal": "Your permissions have been updated",
|
||||
"toasts_permissions_updated": "Permissions for {username} updated",
|
||||
"toasts_permissions_updated_personal": "Your permissions have been updated",
|
||||
"toasts_settings_saved": "Saved settings",
|
||||
"toasts_user_created": "User {username} created",
|
||||
"toasts_user_deleted": "User {username} deleted",
|
||||
@@ -166,30 +193,16 @@
|
||||
"users_delete": "Delete",
|
||||
"users_device_permissions": "Device permissions",
|
||||
"users_page_title": "Users",
|
||||
"users_password_confirm": "Password confirm",
|
||||
"users_password": "Password",
|
||||
"users_password_confirm": "Password confirm",
|
||||
"users_power": "Power",
|
||||
"users_read": "Read",
|
||||
"users_required_field": "required field",
|
||||
"users_toggle": "Toggle",
|
||||
"users_update": "Update",
|
||||
"users_username": "Username",
|
||||
"welcome_not_expected_back": "Take me back",
|
||||
"welcome_not_expected_desc": "You are already done with the setup! Nothing to do.",
|
||||
"welcome_not_expected_title": "I didn't expect you here! 🧐",
|
||||
"welcome_progress_step1": "Welcome",
|
||||
"welcome_progress_step2": "Create account",
|
||||
"welcome_progress_step3": "Done",
|
||||
"welcome_step1_page_title": "Welcome to UpSnap 🥳",
|
||||
"welcome_step1_setup_btn_next": "Next",
|
||||
"welcome_step1_setup_desc": "Please complete the following steps to finish the setup.",
|
||||
"welcome_step2_btn_create": "Create",
|
||||
"welcome_step2_label_email": "Email:",
|
||||
"welcome_step2_label_min_chars": "min. 10 characters",
|
||||
"welcome_step2_label_password_confirm": "Password confirm:",
|
||||
"welcome_step2_label_password": "Password:",
|
||||
"welcome_step2_page_title": "Create an admin account",
|
||||
"welcome_step3_btn_done": "Lets go!",
|
||||
"welcome_step3_page_desc": "Go ahead and add some devices to your dashboard.",
|
||||
"welcome_step3_page_title": "You are all set! 🎉"
|
||||
"welcome_btn_done": "Done",
|
||||
"welcome_desc": "Check the server console logs for a link to create the initial superuser account. Once you have created the superuser, come back here.",
|
||||
"welcome_not_ready": "No superuser found yet. Please complete the setup first.",
|
||||
"welcome_title": "Initial setup required"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Filtros",
|
||||
"logs_column_data": "Detalles",
|
||||
"logs_column_level": "Nivel",
|
||||
"logs_column_message": "Mensaje",
|
||||
"logs_column_time": "Hora",
|
||||
"logs_empty": "Ningún registro coincide con este filtro.",
|
||||
"logs_upsnap_logs": "Registros de UpSnap",
|
||||
"logs_only": "Solo",
|
||||
"logs_level_all": "Todos los niveles",
|
||||
"logs_next": "Siguiente",
|
||||
"logs_off": "Desactivado",
|
||||
"logs_page_size": "Filas por página",
|
||||
"logs_page_title": "Registros",
|
||||
"logs_previous": "Anterior",
|
||||
"logs_refresh": "Actualizar",
|
||||
"logs_refresh_failed": "No se pudieron cargar los registros: {message}",
|
||||
"logs_refreshed_at": "Actualizado {time}",
|
||||
"logs_search_placeholder": "Buscar registros",
|
||||
"logs_seconds": "{seconds} segundos",
|
||||
"account_account_type_admin": "Admin",
|
||||
"account_account_type_user": "Usuario",
|
||||
"account_avatar_title": "Avatar",
|
||||
@@ -17,49 +36,50 @@
|
||||
"buttons_delete": "Eliminar",
|
||||
"buttons_reset": "Reiniciar",
|
||||
"buttons_save": "Guardar",
|
||||
"device_card_btn_more": "Más",
|
||||
"device_card_btn_more_edit": "Editar",
|
||||
"device_card_btn_more_reboot": "Reiniciar",
|
||||
"device_card_btn_more_sleep": "Suspender",
|
||||
"device_card_btn_more": "Más",
|
||||
"device_card_nic_tooltip_pending": "Pendiente",
|
||||
"device_card_nic_tooltip_power_no_permission": "No tienes permiso para encender este dispositivo",
|
||||
"device_card_nic_tooltip_power": "Encender",
|
||||
"device_card_nic_tooltip_power_no_permission": "No tienes permiso para encender este dispositivo",
|
||||
"device_card_nic_tooltip_shutdown": "Apagar",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "El comando de apagado no está definido",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "No tienes permiso para apagar este dispositivo",
|
||||
"device_card_nic_tooltip_shutdown": "Apagar",
|
||||
"device_card_password": "Contraseña",
|
||||
"device_card_tooltip_last_status_change": "Último cambio de estado",
|
||||
"device_card_tooltip_shutdown_cron": "Shutdown cron",
|
||||
"device_card_tooltip_wake_cron": "Wake cron",
|
||||
"device_card_tooltip_wake_password": "Wake password",
|
||||
"device_general_description_placeholder": "Descripción del dispositivo",
|
||||
"device_general": "General",
|
||||
"device_general_description": "Descripción",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_description_placeholder": "Descripción del dispositivo",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nombre",
|
||||
"device_general_netmask": "Máscara de red",
|
||||
"device_general_required_field": "Campo obligatorio",
|
||||
"device_general": "General",
|
||||
"device_groups": "Grupos",
|
||||
"device_groups_desc": "Puede agregar dispositivos a un grupo para ordenarlos por grupo en el dashboard.",
|
||||
"device_groups_placeholder": "e.g. 'Basement' o 'Office'",
|
||||
"device_groups": "Grupos",
|
||||
"device_link": "Link",
|
||||
"device_link_desc": "Permite que el nombre de su dispositivo sea un enlace. Perfecto para dashboard, por ejemplo.",
|
||||
"device_link_open": "Abrir enlace automáticamente",
|
||||
"device_link_open_new_tab": "Nueva pestaña",
|
||||
"device_link_open_no": "No",
|
||||
"device_link_open_same_tab": "Misma pestaña",
|
||||
"device_link_open": "Abrir enlace automáticamente",
|
||||
"device_link": "Link",
|
||||
"device_modal_confirm_shutdown_desc": "Por favor confirme para apagar {device}.",
|
||||
"device_modal_confirm_shutdown_title": "{device} apagar?",
|
||||
"device_modal_confirm_wake_desc": "Confirme para activar {device}.",
|
||||
"device_modal_confirm_wake_title": "{device} activar?",
|
||||
"device_network_scan": "Escaneo",
|
||||
"device_network_scan_add_all": "Añadir todos los dispositivos",
|
||||
"device_network_scan_desc": "Escanee automáticamente su red en busca de dispositivos. Para que esto funcione, necesita ejecutar UpSnap como root/admin y tener nmap instalado y disponible en su $PATH (para los usuarios de Docker, ese ya es el caso y no necesitan hacer nada). El escaneo puede tardar algunos segundos.",
|
||||
"device_network_scan_include_unknown": "Incluir dispositivos donde este el nombre 'Unknown'",
|
||||
"device_network_scan_ip_range": "Rango IP",
|
||||
"device_network_scan_ip": "IP:",
|
||||
"device_network_scan_mac_vendor": "Proveedor Mac:",
|
||||
"device_network_scan_ip_range": "Rango IP",
|
||||
"device_network_scan_mac": "Mac:",
|
||||
"device_network_scan_mac_vendor": "Proveedor Mac:",
|
||||
"device_network_scan_netmask": "Máscara de red:",
|
||||
"device_network_scan_new_netmask": "Nueva máscara de red",
|
||||
"device_network_scan_no_range": "Sin rango de escaneo",
|
||||
@@ -67,29 +87,29 @@
|
||||
"device_network_scan_replace_netmask": "Reemplazar máscara de red para todos los dispositivos?",
|
||||
"device_network_scan_running": "Escaneo en curso",
|
||||
"device_network_scan_unsaved_changes": "Cambios sin guardar",
|
||||
"device_network_scan": "Escaneo",
|
||||
"device_page_title": "Nuevo dispositivo",
|
||||
"device_password_desc": "Algunos adaptadores de red tienen la opción de definir una contraseña para magic pockets, también conocidos como <span class=\"badge\">SecureON</span>. la contraseña sólo podrá contener 0, 4 o 6 caracteres.",
|
||||
"device_password": "Contraseña",
|
||||
"device_password_desc": "Algunos adaptadores de red tienen la opción de definir una contraseña para magic pockets, también conocidos como <span class=\"badge\">SecureON</span>. la contraseña sólo podrá contener 0, 4 o 6 caracteres.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Comando ping personalizado",
|
||||
"device_ping_desc": "Puede utilizar un comando de shell personalizado para ver si el dispositivo está conectado. El comando debe devolver un código de salida de <span class=\"badge\">0</span> para indicar que el dispositivo está encendido; cualquier otro código de salida marcará el dispositivo como apagado.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports": "Puertos",
|
||||
"device_ports_add_new": "Añadir nuevo puerto",
|
||||
"device_ports_desc": "UpSnap puede comprobar si ciertos puertos están abiertos.",
|
||||
"device_ports_name": "Nombre",
|
||||
"device_ports_number": "Número",
|
||||
"device_ports": "Puertos",
|
||||
"device_require_confirmation": "Requiere confirmación",
|
||||
"device_shutdown": "Apagar",
|
||||
"device_shutdown_cmd": "Comando para Apagar",
|
||||
"device_shutdown_cron": "Apagar cron",
|
||||
"device_shutdown_cron_desc": "Al igual que configurar un cron para encender el dispositivo, también puede programar un cron job para apagar este dispositivo.",
|
||||
"device_shutdown_cron_enable": "Activar apagado de cron",
|
||||
"device_shutdown_cron": "Apagar cron",
|
||||
"device_shutdown_desc": "Este <strong>comando de shell</strong> se ejecutará dentro de su contenedor (si usa Docker) o en su host (si usa el binario). Para verificar que funciona, primero puede ejecutar el comando dentro del contenedor o en el shell de su host. Los comandos comunes son <span class=\"badge\">net rpc</span> para Windows, <span class=\"badge\">sshpass</span> para Linux o <span class=\"badge\">curl</span> en general para realizar solicitudes web.",
|
||||
"device_shutdown_desc": "Este <strong>comando de shell</strong> se ejecutará dentro de su contenedor (si usa Docker) o en su host (si usa el binario). Para verificar que funciona, primero puede ejecutar el comando dentro del contenedor o en el shell de su host. Los comandos comunes son <span class=\"badge\">net rpc</span> para Windows, <span class=\"badge\">sshpass</span> para Linux o <span class=\"badge\">curl</span> en general para realizar solicitudes web. Puedes usar <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> y <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> para sustituir automáticamente las direcciones IP y MAC reales.",
|
||||
"device_shutdown_examples": "Ejemplos:",
|
||||
"device_shutdown_examples_linux": "Apagar el dispositivo Linux remoto:",
|
||||
"device_shutdown_examples_windows": "Apagar el dispositivo Windows remoto:",
|
||||
"device_shutdown_examples": "Ejemplos:",
|
||||
"device_shutdown_timeout": "Tiempo de espera de apagado (segundos)",
|
||||
"device_shutdown": "Apagar",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Autorización",
|
||||
"device_sol_desc1": "Puedes poner las computadoras en modo de suspensión usando <a class=\"link\" href=\"https://github.com/SR-G/sleep-on-lan\" target=\"_blank\">Sleep-On-LAN</a> herramienta. Sleep-On-LAN (SOL) es una herramienta/daemon externo que opera en las PC que desea poner en suspensión y proporciona un punto final REST. Para obtener instrucciones sobre cómo configurar Sleep-On-LAN, consulte <a href=\"https://github.com/SR-G/sleep-on-lan#usage\" class=\"link\" target=\"_blank\">Uso</a> sección.",
|
||||
"device_sol_desc2": "SOL está configurado para enviar solicitudes a través de HTTP en lugar de UDP para permitir la autorización y hacer que las solicitudes sean más confiables.",
|
||||
@@ -98,17 +118,18 @@
|
||||
"device_sol_password": "Contraseña SOL",
|
||||
"device_sol_port": "Puerto SOL",
|
||||
"device_sol_user": "Usuario SOL",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_tabs.0": "Manual",
|
||||
"device_tabs.1": "búsqueda de red",
|
||||
"device_wake_cmd": "Comando de encendido personalizado",
|
||||
"device_wake_cron_enable": "Activar wake cron",
|
||||
"device_wake_cron": "Encender cron",
|
||||
"device_wake_desc": "Podrá encender este dispositivo utilizando un scheduled cron job.",
|
||||
"device_wake_timeout": "Tiempo de espera de encendido (segundos)",
|
||||
"device_tabs_0": "Manual",
|
||||
"device_tabs_1": "búsqueda de red",
|
||||
"device_wake": "Encender",
|
||||
"device_wake_cmd": "Comando de encendido personalizado",
|
||||
"device_wake_cron": "Encender cron",
|
||||
"device_wake_cron_enable": "Activar wake cron",
|
||||
"device_wake_desc": "Podrá encender este dispositivo utilizando un scheduled cron job. Puedes usar <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> y <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> para sustituir automáticamente las direcciones IP y MAC reales.",
|
||||
"device_wake_timeout": "Tiempo de espera de encendido (segundos)",
|
||||
"home_add_first_device": "Añade tu primer dispositivo",
|
||||
"home_grant_permissions": "Pídale al administrador que le otorgue permisos para los dispositivos existentes o que cree otros nuevos.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Por favor confirme para apagar todos los dispositivos en {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Apagar {group}?",
|
||||
"home_no_devices": "Sin dispositivos.",
|
||||
"home_order_groups": "Grupos",
|
||||
"home_order_ip": "IP",
|
||||
@@ -116,6 +137,7 @@
|
||||
"home_order_tooltip": "Orden",
|
||||
"home_page_title": "Inicio",
|
||||
"home_search_placeholder": "Buscar dispositivos",
|
||||
"home_shutdown_group": "Grupo apagar",
|
||||
"home_wake_group": "Grupo Wake",
|
||||
"login_btn_login": "Entrar",
|
||||
"login_btn_more": "Más",
|
||||
@@ -130,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",
|
||||
@@ -152,8 +175,8 @@
|
||||
"toasts_passwords_missmatch": "Las contraseñas no coinciden",
|
||||
"toasts_permissions_created": "Permisos creados para {username}",
|
||||
"toasts_permissions_deleted": "Permisos para {username} eliminados",
|
||||
"toasts_permissions_updated_personal": "Tus permisos han sido actualizados",
|
||||
"toasts_permissions_updated": "Permisos para {username} actualizados",
|
||||
"toasts_permissions_updated_personal": "Tus permisos han sido actualizados",
|
||||
"toasts_settings_saved": "Configuraciones guardadas",
|
||||
"toasts_user_created": "Usuario {username} creado",
|
||||
"toasts_user_deleted": "Usuario {username} eliminado",
|
||||
@@ -166,30 +189,16 @@
|
||||
"users_delete": "Eliminar",
|
||||
"users_device_permissions": "Permisos del dispositivo",
|
||||
"users_page_title": "Usuarios",
|
||||
"users_password_confirm": "Confirmar contraseña",
|
||||
"users_password": "Contraseña",
|
||||
"users_password_confirm": "Confirmar contraseña",
|
||||
"users_power": "Energía",
|
||||
"users_read": "Leer",
|
||||
"users_required_field": "Campo obligatorio",
|
||||
"users_toggle": "Alternar",
|
||||
"users_update": "Editar",
|
||||
"users_username": "Usuario",
|
||||
"welcome_not_expected_back": "Llévame de vuelta",
|
||||
"welcome_not_expected_desc": "Ya has terminado con la configuración! Nada que hacer!",
|
||||
"welcome_not_expected_title": "No te esperaba por aquí! 🧐",
|
||||
"welcome_progress_step1": "Bienvenido",
|
||||
"welcome_progress_step2": "Crear cuenta",
|
||||
"welcome_progress_step3": "Terminado",
|
||||
"welcome_step1_page_title": "Bienvenido a UpSnap 🥳",
|
||||
"welcome_step1_setup_btn_next": "Siguiente",
|
||||
"welcome_step1_setup_desc": "Por favor complete los siguientes pasos para terminar la configuración.",
|
||||
"welcome_step2_btn_create": "Crear",
|
||||
"welcome_step2_label_email": "Email:",
|
||||
"welcome_step2_label_min_chars": "min. 10 caracteres",
|
||||
"welcome_step2_label_password_confirm": "Confirmar contraseña:",
|
||||
"welcome_step2_label_password": "Contraseña:",
|
||||
"welcome_step2_page_title": "Crear cuenta de administrador",
|
||||
"welcome_step3_btn_done": "Vamos!",
|
||||
"welcome_step3_page_desc": "Añada algún dispositivo a su dashboard.",
|
||||
"welcome_step3_page_title": "Ya está hecho! 🎉"
|
||||
"welcome_btn_done": "Listo",
|
||||
"welcome_desc": "Revisa los registros de la consola del servidor para encontrar un enlace para crear la cuenta de superusuario inicial. Una vez que hayas creado el superusuario, vuelve aquí.",
|
||||
"welcome_not_ready": "No se encontró ningún superusuario aún. Completa la configuración primero.",
|
||||
"welcome_title": "Configuración inicial requerida"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
{
|
||||
"$schema": "https://inlang.com/schema/inlang-message-format",
|
||||
"logs_filters": "Filtres",
|
||||
"logs_column_data": "Détails",
|
||||
"logs_column_level": "Niveau",
|
||||
"logs_column_message": "Message",
|
||||
"logs_column_time": "Heure",
|
||||
"logs_empty": "Aucun journal ne correspond à ce filtre.",
|
||||
"logs_upsnap_logs": "Journaux UpSnap",
|
||||
"logs_only": "Seulement",
|
||||
"logs_level_all": "Tous les niveaux",
|
||||
"logs_next": "Suivant",
|
||||
"logs_off": "Désactivé",
|
||||
"logs_page_size": "Lignes par page",
|
||||
"logs_page_title": "Journaux",
|
||||
"logs_previous": "Précédent",
|
||||
"logs_refresh": "Actualiser",
|
||||
"logs_refresh_failed": "Impossible de charger les journaux : {message}",
|
||||
"logs_refreshed_at": "Mis à jour {time}",
|
||||
"logs_search_placeholder": "Rechercher dans les journaux",
|
||||
"logs_seconds": "{seconds} secondes",
|
||||
"account_account_type_admin": "Administrateur",
|
||||
"account_account_type_user": "Utilisateur",
|
||||
"account_avatar_title": "Avatar",
|
||||
@@ -17,49 +36,50 @@
|
||||
"buttons_delete": "Supprimer",
|
||||
"buttons_reset": "Réinitialiser",
|
||||
"buttons_save": "Sauvegarder",
|
||||
"device_card_btn_more": "Plus",
|
||||
"device_card_btn_more_edit": "Modifier",
|
||||
"device_card_btn_more_reboot": "Redémarrer",
|
||||
"device_card_btn_more_sleep": "Veille",
|
||||
"device_card_btn_more": "Plus",
|
||||
"device_card_nic_tooltip_pending": "En attente",
|
||||
"device_card_nic_tooltip_power_no_permission": "Vous n'avez pas la permission pour allumer cet appareil",
|
||||
"device_card_nic_tooltip_power": "Allumer",
|
||||
"device_card_nic_tooltip_power_no_permission": "Vous n'avez pas la permission pour allumer cet appareil",
|
||||
"device_card_nic_tooltip_shutdown": "Éteindre",
|
||||
"device_card_nic_tooltip_shutdown_no_cmd": "Aucune commande d'arrêt n'est définie",
|
||||
"device_card_nic_tooltip_shutdown_no_permission": "Vous n'avez pas la permission pour éteindre cet appareil",
|
||||
"device_card_nic_tooltip_shutdown": "Éteindre",
|
||||
"device_card_password": "Mot de passe",
|
||||
"device_card_tooltip_last_status_change": "Dernier changement de statut",
|
||||
"device_card_tooltip_shutdown_cron": "Arrêt avec cron",
|
||||
"device_card_tooltip_wake_cron": "Réveil avec cron",
|
||||
"device_card_tooltip_wake_password": "Mot de passe de réveil",
|
||||
"device_general_description_placeholder": "Description de l'appareil",
|
||||
"device_general": "Général",
|
||||
"device_general_description": "Description",
|
||||
"device_general_ip": "IP",
|
||||
"device_general_description_placeholder": "Description de l'appareil",
|
||||
"device_general_ip": "IP/FQDN",
|
||||
"device_general_mac": "Mac",
|
||||
"device_general_name": "Nom",
|
||||
"device_general_netmask": "Masque réseau",
|
||||
"device_general_required_field": "champ requis",
|
||||
"device_general": "Général",
|
||||
"device_groups": "Groupes",
|
||||
"device_groups_desc": "Vous pouvez ajouter des appareils à un groupe pour pouvoir les trier sur le tableau de bord.",
|
||||
"device_groups_placeholder": "par ex. « Bureau »",
|
||||
"device_groups": "Groupes",
|
||||
"device_link": "Lien",
|
||||
"device_link_desc": "Rend le nom de votre appareil cliquable, parfait pour y lier un tableau de bord par exemple.",
|
||||
"device_link_open": "Ouvrir automatiquement un lien",
|
||||
"device_link_open_new_tab": "Nouvel onglet",
|
||||
"device_link_open_no": "Non",
|
||||
"device_link_open_same_tab": "Même onglet",
|
||||
"device_link_open": "Ouvrir automatiquement un lien",
|
||||
"device_link": "Lien",
|
||||
"device_modal_confirm_shutdown_desc": "Veuillez confirmer l'arrêt de {device}.",
|
||||
"device_modal_confirm_shutdown_title": "Arrêter {device} ?",
|
||||
"device_modal_confirm_wake_desc": "Veuillez confirmer le réveil de {device}.",
|
||||
"device_modal_confirm_wake_title": "Réveiller {device} ?",
|
||||
"device_network_scan": "Analyser",
|
||||
"device_network_scan_add_all": "Ajouter tous les appareils",
|
||||
"device_network_scan_desc": "Analyser automatiquement votre réseau pour trouver des appareils. Pour que cela fonctionne, vous devez exécuter UpSnap en tant que root/administrateur et avoir nmap installé et disponible dans votre $PATH (pour les utilisateurs Docker, cela est déjà le cas et vous n'avez besoin de rien faire). L'analyse peut prendre quelques secondes.",
|
||||
"device_network_scan_include_unknown": "Inclure les appareils dont le nom est « Inconnu »",
|
||||
"device_network_scan_ip_range": "Plage IP",
|
||||
"device_network_scan_ip": "IP :",
|
||||
"device_network_scan_mac_vendor": "Fabricant ayant l'adresse Mac :",
|
||||
"device_network_scan_ip_range": "Plage IP",
|
||||
"device_network_scan_mac": "Mac :",
|
||||
"device_network_scan_mac_vendor": "Fabricant ayant l'adresse Mac :",
|
||||
"device_network_scan_netmask": "Masque réseau :",
|
||||
"device_network_scan_new_netmask": "Nouveau masque réseau",
|
||||
"device_network_scan_no_range": "Aucune plage d'analyse",
|
||||
@@ -67,29 +87,29 @@
|
||||
"device_network_scan_replace_netmask": "Remplacer le masque réseau pour tous les appareils ?",
|
||||
"device_network_scan_running": "Analyse en cours",
|
||||
"device_network_scan_unsaved_changes": "Modifications non sauvegardées",
|
||||
"device_network_scan": "Analyser",
|
||||
"device_page_title": "Nouvel appareil",
|
||||
"device_password_desc": "Certaines cartes réseau ont l'option pour définir un mot de passe pour les paquets magiques, aussi appelée <span class='badge'>SecureON</span>. Le mot de passe ne peut être que de 0, 4 ou 6 caractères.",
|
||||
"device_password": "Mot de passe",
|
||||
"device_password_desc": "Certaines cartes réseau ont l'option pour définir un mot de passe pour les paquets magiques, aussi appelée <span class='badge'>SecureON</span>. Le mot de passe ne peut être que de 0, 4 ou 6 caractères.",
|
||||
"device_ping": "Ping",
|
||||
"device_ping_cmd": "Commande ping personnalisée",
|
||||
"device_ping_desc": "Vous pouvez utiliser une commande shell personnalisée pour vérifier si l'appareil est sous tension. La commande doit renvoyer un code de sortie de <span class='badge'>0</span> pour indiquer que l'appareil est sous tension, tout autre code de sortie indiquera que l'appareil est hors tension.",
|
||||
"device_ping": "Ping",
|
||||
"device_ports": "Ports",
|
||||
"device_ports_add_new": "Ajouter un nouveau port",
|
||||
"device_ports_desc": "UpSnap peut aussi vérifier si certains ports sont ouverts.",
|
||||
"device_ports_name": "Nom",
|
||||
"device_ports_number": "Numéro",
|
||||
"device_ports": "Ports",
|
||||
"device_require_confirmation": "Demande de confirmation",
|
||||
"device_shutdown": "Arrêt",
|
||||
"device_shutdown_cmd": "Commande d'arrêt",
|
||||
"device_shutdown_cron": "Arrêt avec cron",
|
||||
"device_shutdown_cron_desc": "Exactement comme configurer cron pour réveiller l'appareil, vous pouvez aussi planifier un job cron pour arrêter cet appareil.",
|
||||
"device_shutdown_cron_enable": "Activer l'arrêt avec cron",
|
||||
"device_shutdown_cron": "Arrêt avec cron",
|
||||
"device_shutdown_desc": "Cette <strong>commande shell</strong> va s'exécuter au sein de votre conteneur (si vous utilisez Docker) ou sur votre hôte (si vous utilisez l'exécutable). Pour vérifier que cela fonctionne, vous pouvez d'abord exécuter la commande à l'intérieur du conteneur ou sur le shell de l'hôte. Les commandes courantes sont <span class='badge'>net rpc</span> pour Windows, <span class='badge'>sshpass</span> pour Linux ou <span class='badge'>curl</span> en général pour faire des requêtes web.",
|
||||
"device_shutdown_desc": "Cette <strong>commande shell</strong> va s'exécuter au sein de votre conteneur (si vous utilisez Docker) ou sur votre hôte (si vous utilisez l'exécutable). Pour vérifier que cela fonctionne, vous pouvez d'abord exécuter la commande à l'intérieur du conteneur ou sur le shell de l'hôte. Les commandes courantes sont <span class='badge'>net rpc</span> pour Windows, <span class='badge'>sshpass</span> pour Linux ou <span class='badge'>curl</span> en général pour faire des requêtes web. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> et <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> permettent de remplacer automatiquement les adresses IP et MAC réelles.",
|
||||
"device_shutdown_examples": "Exemples :",
|
||||
"device_shutdown_examples_linux": "Arrêter une machine Linux distante :",
|
||||
"device_shutdown_examples_windows": "Arrêter une machine Windows distante :",
|
||||
"device_shutdown_examples": "Exemples :",
|
||||
"device_shutdown_timeout": "Délai d'arrêt (secondes)",
|
||||
"device_shutdown": "Arrêt",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_sol_authorization": "Autorisation",
|
||||
"device_sol_desc1": "Vous pouvez mettre les ordinateurs en veille à l'aide de l'outil <a class='link' href='https://github.com/SR-G/sleep-on-lan' target='_blank'>Sleep-On-LAN</a>. Sleep-On-LAN (SOL) est un outil/daemon externe qui fonctionne sur les PC que vous souhaitez mettre en veille, fournissant un point de terminaison REST. Pour obtenir des instructions sur la configuration de Sleep-On-LAN, veuillez vous référer à la section <a href='https://github.com/SR-G/sleep-on-lan#usage' class='link' target='_blank'>Usage</a>.",
|
||||
"device_sol_desc2": "SOL est configuré pour envoyer des requêtes avec le protocole HTTP au lieu d'UDP pour activer l'autorisation et faire des requêtes plus fiables.",
|
||||
@@ -98,17 +118,18 @@
|
||||
"device_sol_password": "Mot de passe SOL",
|
||||
"device_sol_port": "Port SOL",
|
||||
"device_sol_user": "Utilisateur SOL",
|
||||
"device_sol": "Sleep-On-LAN",
|
||||
"device_tabs.0": "Manuel",
|
||||
"device_tabs.1": "Analyse du réseau",
|
||||
"device_wake_cmd": "Commande de réveil personnalisée",
|
||||
"device_wake_cron_enable": "Activer le réveil avec cron",
|
||||
"device_wake_cron": "Réveil avec cron",
|
||||
"device_wake_desc": "Vous pouvez allumer cet appareil en utilisant un job cron planifié.",
|
||||
"device_wake_timeout": "Délai de réveil (secondes)",
|
||||
"device_tabs_0": "Manuel",
|
||||
"device_tabs_1": "Analyse du réseau",
|
||||
"device_wake": "Réveil",
|
||||
"device_wake_cmd": "Commande de réveil personnalisée",
|
||||
"device_wake_cron": "Réveil avec cron",
|
||||
"device_wake_cron_enable": "Activer le réveil avec cron",
|
||||
"device_wake_desc": "Vous pouvez allumer cet appareil en utilisant un job cron planifié. <span class=\"badge\">\\{\\{ DEVICE_IP \\}\\}</span> et <span class=\"badge\">\\{\\{ DEVICE_MAC \\}\\}</span> permettent de remplacer automatiquement les adresses IP et MAC réelles.",
|
||||
"device_wake_timeout": "Délai de réveil (secondes)",
|
||||
"home_add_first_device": "Ajoutez votre premier appareil",
|
||||
"home_grant_permissions": "Veuillez demander à votre administrateur les permissions aux appareils existants ou créez-en de nouveaux.",
|
||||
"home_modal_confirm_shutdown_group_desc": "Veuillez confirmer l'arrêt de tous les appareils dans {group}.",
|
||||
"home_modal_confirm_shutdown_group_title": "Arrêter {group} ?",
|
||||
"home_no_devices": "Aucun appareil ici.",
|
||||
"home_order_groups": "Groupes",
|
||||
"home_order_ip": "IP",
|
||||
@@ -116,6 +137,7 @@
|
||||
"home_order_tooltip": "Tri",
|
||||
"home_page_title": "Accueil",
|
||||
"home_search_placeholder": "Recherche de dispositifs",
|
||||
"home_shutdown_group": "Groupe éteindre",
|
||||
"home_wake_group": "Groupe de réveil",
|
||||
"login_btn_login": "Connexion",
|
||||
"login_btn_more": "Plus",
|
||||
@@ -130,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",
|
||||
@@ -152,8 +175,8 @@
|
||||
"toasts_passwords_missmatch": "Les mots de passe ne correspondent pas",
|
||||
"toasts_permissions_created": "Permissions pour {username} créées",
|
||||
"toasts_permissions_deleted": "Permissions pour {username} supprimées",
|
||||
"toasts_permissions_updated_personal": "Vos permissions ont été mises à jour",
|
||||
"toasts_permissions_updated": "Permissions pour {username} mises à jour",
|
||||
"toasts_permissions_updated_personal": "Vos permissions ont été mises à jour",
|
||||
"toasts_settings_saved": "Paramètres sauvegardés",
|
||||
"toasts_user_created": "Utilisateur {username} créé",
|
||||
"toasts_user_deleted": "Utilisateur {username} supprimé",
|
||||
@@ -166,30 +189,16 @@
|
||||
"users_delete": "Supprimer",
|
||||
"users_device_permissions": "Permissions des appareils",
|
||||
"users_page_title": "Utilisateurs",
|
||||
"users_password_confirm": "Confirmation du mot de passe",
|
||||
"users_password": "Mot de passe",
|
||||
"users_password_confirm": "Confirmation du mot de passe",
|
||||
"users_power": "Allumer",
|
||||
"users_read": "Lire",
|
||||
"users_required_field": "champ requis",
|
||||
"users_toggle": "Inverser",
|
||||
"users_update": "Mettre à jour",
|
||||
"users_username": "Nom d'utilisateur",
|
||||
"welcome_not_expected_back": "Ramène-moi",
|
||||
"welcome_not_expected_desc": "Vous avez déjà terminé l'installation ! Il n'y a plus rien à faire.",
|
||||
"welcome_not_expected_title": "Je ne vous attendais pas ici ! 🧐",
|
||||
"welcome_progress_step1": "Bienvenue",
|
||||
"welcome_progress_step2": "Créer un compte",
|
||||
"welcome_progress_step3": "Fin",
|
||||
"welcome_step1_page_title": "Bienvenue sur UpSnap 🥳",
|
||||
"welcome_step1_setup_btn_next": "Suivant",
|
||||
"welcome_step1_setup_desc": "Veuillez suivre les étapes suivantes pour terminer l'installation.",
|
||||
"welcome_step2_btn_create": "Créer",
|
||||
"welcome_step2_label_email": "Courriel :",
|
||||
"welcome_step2_label_min_chars": "min. 10 caractères",
|
||||
"welcome_step2_label_password_confirm": "Confirmation du mot de passe :",
|
||||
"welcome_step2_label_password": "Mot de passe :",
|
||||
"welcome_step2_page_title": "Création du compte administrateur",
|
||||
"welcome_step3_btn_done": "C'est parti !",
|
||||
"welcome_step3_page_desc": "Allez-y et ajoutez quelques appareils à votre tableau de bord.",
|
||||
"welcome_step3_page_title": "Vous êtes tout bon ! 🎉"
|
||||
"welcome_btn_done": "Terminé",
|
||||
"welcome_desc": "Consultez les journaux de la console du serveur pour obtenir un lien permettant de créer le compte superutilisateur initial. Une fois le superutilisateur créé, revenez ici.",
|
||||
"welcome_not_ready": "Aucun superutilisateur trouvé pour l'instant. Veuillez d'abord terminer la configuration.",
|
||||
"welcome_title": "Configuration initiale requise"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user