Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 469d480988 | |||
| 87bf05528c | |||
| 93a72207cc | |||
| df9f549d65 | |||
| c43bcbd299 | |||
| 79a70b6053 | |||
| f061c7d00a | |||
| 59bc936237 | |||
| 1b299aa3a3 | |||
| 327b47c2a1 | |||
| d7c4a922e2 | |||
| 8c4c402c2c | |||
| 9351889337 | |||
| 327ac67e33 | |||
| 2764ed6ac5 | |||
| c519084e78 | |||
| 0d9a743b09 | |||
| 12689b19f9 | |||
| 5ed25bb06b | |||
| 94fabed6dd | |||
| 5493df087b | |||
| 8d479669f4 | |||
| 40f6bddff6 | |||
| 9a6b3a0c07 | |||
| a1de1638a9 | |||
| 5469a2b0aa |
@@ -12,7 +12,7 @@ RUN wget https://github.com/seriousm4x/UpSnap/releases/download/${VERSION}/UpSna
|
||||
|
||||
FROM alpine:3
|
||||
RUN apk update &&\
|
||||
apk add --no-cache tzdata ca-certificates nmap samba-common-tools openssh sshpass curl &&\
|
||||
apk add --no-cache tzdata ca-certificates nmap samba samba-common-tools openssh sshpass curl &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
WORKDIR /app
|
||||
COPY --from=downloader /app/upsnap upsnap
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div align="center" width="100%">
|
||||
<img src="frontend/static/favicon.png" width="128" />
|
||||
<img src="frontend/static/gopher.svg" width="150" />
|
||||
</div>
|
||||
|
||||
<div align="center" width="100%">
|
||||
@@ -11,7 +11,6 @@
|
||||
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/releases"><img src="https://img.shields.io/github/v/release/seriousm4x/upsnap?display_name=tag" /></a>
|
||||
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/actions"><img src="https://github.com/seriousm4x/upsnap/actions/workflows/deploy.yml/badge.svg?event=push" /></a>
|
||||
<a target="_blank" href="https://github.com/seriousm4x/UpSnap/commits/master"><img src="https://img.shields.io/github/last-commit/seriousm4x/upsnap" /></a>
|
||||
<h3><a href="https://github.com/seriousm4x/UpSnap/releases/tag/3.0.0">v3 is here! 🤩 Check it out</a></h3>
|
||||
</div>
|
||||
|
||||
## ✨ Features
|
||||
@@ -20,6 +19,7 @@
|
||||
- Set timed wake and shutdown events via cron
|
||||
- Add custom ports to devices which will be pinged
|
||||
- Discover devices by scanning network
|
||||
- User/Password protected login
|
||||
- Dark/light or system prefered color scheme
|
||||
- [Docker images](https://github.com/seriousm4x/UpSnap/pkgs/container/upsnap) for amd64, arm64, arm/v7
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
| Dark | Light |
|
||||
| ------------------------------ | ------------------------------- |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|  |  |
|
||||
@@ -41,7 +42,7 @@ If you need network discovery, make sure to have `nmap` installed and run upsnap
|
||||
|
||||
## 🐳 Run in docker
|
||||
|
||||
Alternatively 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.
|
||||
|
||||
If you want to change the port, change the following (5000 in this case):
|
||||
|
||||
@@ -70,6 +71,36 @@ upsnap.example.com {
|
||||
}
|
||||
```
|
||||
|
||||
## 🔒 Authorisation
|
||||
|
||||
**Since version 3.1 authorisation is enabled by default.**
|
||||
|
||||
User management is done through the PocketBase webinterface at [http://localhost:8090/\_/](http://localhost:8090/_/). This is mainly for internal use, such as within a home or corporate network. For external use please see below.
|
||||
|
||||
- To manage users, click the "Collections" icon on the left and select "users".
|
||||
- To manage admins, click the "Settings" icon on the left and select "Admin".
|
||||
|
||||
Api permissions listed by user role:
|
||||
|
||||
| Api | Unauthorized | Users | Admins |
|
||||
| ---------------- | ------------ | ----- | ------ |
|
||||
| List/Search Rule | ❌ | ✅ | ✅ |
|
||||
| View Rule | ❌ | ✅ | ✅ |
|
||||
| Create Rule | ❌ | ❌ | ✅ |
|
||||
| Delete Rule | ❌ | ❌ | ✅ |
|
||||
| Manage Rule | ❌ | ❌ | ✅ |
|
||||
| Wake devices | ❌ | ✅ | ✅ |
|
||||
| Shutdown devices | ❌ | ✅ | ✅ |
|
||||
| Scan network | ❌ | ❌ | ✅ |
|
||||
|
||||
## 🌍 Exposing to the open web
|
||||
|
||||
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.
|
||||
|
||||
**Recommended**: If you need access from outside your network, please use a vpn. Wireguard or OpenVPN is your way to go.
|
||||
|
||||
## 🔧 Help developing
|
||||
|
||||
Fork this branch and clone it.
|
||||
|
||||
|
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 326 KiB |
|
Before Width: | Height: | Size: 163 KiB After Width: | Height: | Size: 324 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 223 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 289 KiB After Width: | Height: | Size: 690 KiB |
|
Before Width: | Height: | Size: 292 KiB After Width: | Height: | Size: 696 KiB |
@@ -13,14 +13,14 @@ var CronPing *cron.Cron
|
||||
var CronWakeShutdown *cron.Cron
|
||||
|
||||
func RunPing(app *pocketbase.PocketBase) {
|
||||
settingsRecords, err := app.Dao().FindRecordsByExpr("settings")
|
||||
settingsPrivateRecords, err := app.Dao().FindRecordsByExpr("settings_private")
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
}
|
||||
|
||||
// init cronjob
|
||||
CronPing = cron.New()
|
||||
CronPing.AddFunc(settingsRecords[0].GetString("interval"), func() {
|
||||
CronPing.AddFunc(settingsPrivateRecords[0].GetString("interval"), func() {
|
||||
// skip cron if no realtime clients connected
|
||||
realtimeClients := len(app.SubscriptionsBroker().Clients())
|
||||
if realtimeClients == 0 {
|
||||
|
||||
@@ -13,8 +13,8 @@ require (
|
||||
|
||||
require (
|
||||
github.com/AlecAivazis/survey/v2 v2.3.6 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.209 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.214 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.5 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.15 // indirect
|
||||
@@ -78,9 +78,9 @@ require (
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/api v0.110.0 // indirect
|
||||
google.golang.org/api v0.111.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
lukechampine.com/uint128 v1.2.0 // indirect
|
||||
|
||||
@@ -36,8 +36,8 @@ cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+
|
||||
cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU=
|
||||
cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA=
|
||||
cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM=
|
||||
cloud.google.com/go v0.107.0 h1:qkj22L7bgkl6vIeZDlOY2po43Mx/TIa2Wsa7VR+PEww=
|
||||
cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I=
|
||||
cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys=
|
||||
cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4=
|
||||
cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw=
|
||||
cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o=
|
||||
@@ -202,7 +202,7 @@ cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp
|
||||
cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc=
|
||||
cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc=
|
||||
cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg=
|
||||
cloud.google.com/go/iam v0.11.0 h1:kwCWfKwB6ePZoZnGLwrd3B6Ru/agoHANTUBWpVNIdnM=
|
||||
cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE=
|
||||
cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc=
|
||||
cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A=
|
||||
cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM=
|
||||
@@ -219,8 +219,8 @@ cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEy
|
||||
cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8=
|
||||
cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08=
|
||||
cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE=
|
||||
cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs=
|
||||
cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc=
|
||||
cloud.google.com/go/longrunning v0.4.1 h1:v+yFJOfKC3yZdY6ZUI933pIYdhyhV8S3NpWrXWmg7jM=
|
||||
cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE=
|
||||
cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM=
|
||||
cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4=
|
||||
@@ -506,8 +506,9 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg=
|
||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
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=
|
||||
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||
github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
|
||||
github.com/aws/aws-sdk-go v1.15.27/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
|
||||
@@ -517,81 +518,53 @@ github.com/aws/aws-sdk-go v1.43.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4
|
||||
github.com/aws/aws-sdk-go v1.43.31/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
|
||||
github.com/aws/aws-sdk-go v1.44.128/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
|
||||
github.com/aws/aws-sdk-go v1.44.151/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U=
|
||||
github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go v1.44.209 h1:wZuiaA4eaqYZmoZXqGgNHqVD7y7kUGFvACDGBgowTps=
|
||||
github.com/aws/aws-sdk-go v1.44.209/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go v1.44.214 h1:YzDuC+9UtrAOUkItlK7l3BvKI9o6qAog9X8i289HORc=
|
||||
github.com/aws/aws-sdk-go v1.44.214/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw=
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.4 h1:wyC6p9Yfq6V2y98wfDsj6OnNQa4w2BLGCLIxzNhwOGY=
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.4/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.5 h1:TzCUW1Nq4H8Xscph5M/skINUitxM5UBAyvm2s7XBzL4=
|
||||
github.com/aws/aws-sdk-go-v2 v1.17.5/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.9/go.mod h1:vCmV1q1VK8eoQJ5+aYE7PkK1K6v41qJ5pJdK3ggCDvg=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 h1:dK82zF6kkPeCo8J1e+tGx4JdvDIQzj7ygIoLg8WMuGs=
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10/go.mod h1:VeTZetY5KRJLuD/7fkQXMU6Mw7H5m/KP2J5Iy9osMno=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.3/go.mod h1:BYdrbeCse3ZnOD5+2/VE/nATOK8fEUpBtmPMdKSyhMU=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.13 h1:v0xlYqbO6/EVlM8tUn2QEOA7btQxcgidEq2JRDBPTho=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.13/go.mod h1:r39wGSZB7wPDW1i54JyQXUpc5KsWjh5z/3S5D9eCqDg=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.15 h1:509yMO0pJUGUugBP2H9FOFyV+7Mz7sRR+snfDN5W4NY=
|
||||
github.com/aws/aws-sdk-go-v2/config v1.18.15/go.mod h1:vS0tddZqpE8cD9CyW0/kITHF5Bq2QasW9Y1DFHD//O0=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.3/go.mod h1:/rOMmqYBcFfNbRPU0iN9IgGqD5+V2yp3iWNmIlz0wI4=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.13 h1:zw1KAc1kl00NYd3ofVmFrb09qnYlSQMeh+fmlQRAihI=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.13/go.mod h1:DW9nbIIF9MrIja0cBQrUpeWYQMSlNmP8fevLUyF9W38=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.15 h1:0rZQIi6deJFjOEgHI9HI2eZcLPPEGQPictX66oRFLL8=
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.15/go.mod h1:vRMLMD3/rXU+o6j2MW5YefrGMBmdTvkLLGqFwMLBHQc=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22 h1:3aMfcTmoXtTZnaT86QlVaYh+BRMbvrrmZwIQ5jWqCZQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.22/go.mod h1:YGSIJyQ6D6FjKMQh16hVFSIUD54L4F7zTGePqYMYYJU=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.23 h1:Kbiv9PGnQfG/imNI4L/heyUXvzKmcWSBeDvkrQz5pFc=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.23/go.mod h1:mOtmAg65GT1HIL/HT/PynwPbS+UG0BgCZ6vhkPqnxWo=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.42/go.mod h1:LHOsygMiW/14CkFxdXxvzKyMh3jbk/QfZVaDtCbLkl8=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.53 h1:h1MmqGtYgkf49DhG2BSjGukpm8c+BJ9CL+bBbdFGzlk=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.53/go.mod h1:mlWLxwKZNeEwE+3Pko07lSr1NvHZwUtdzmo9AiGn7QU=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.55 h1:ClZKHmu2QIRQCEQ2Y2upfu4JPO0pG69Ce5eiq3PS2V4=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.55/go.mod h1:L/h5B6I7reig2QJXCGY0e0NVx4hYCcjETmsfR02hFng=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28 h1:r+XwaCLpIvCKjBIYy/HVZujQS9tsz5ohHG3ZIe0wKoE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.28/go.mod h1:3lwChorpIM/BhImY/hy+Z6jekmN92cXGPI1QJasVPYY=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.29 h1:9/aKwwus0TQxppPXFmf010DFrE+ssSbzroLVYINA+xE=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.29/go.mod h1:Dip3sIGv485+xerzVv24emnjX5Sg88utCL8fwGmCeWg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22 h1:7AwGYXDdqRQYsluvKFmWoqpcOQJ4bH634SkYf3FNj/A=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.22/go.mod h1:EqK7gVrIGAHyZItrD1D8B0ilgwMD1GiWAmbU4u/JHNk=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.23 h1:b/Vn141DBuLVgXbhRWIrl9g+ww7G+ScV5SzniWR13jQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.23/go.mod h1:mr6c4cHC+S/MMkrjtSlG4QA36kOznDep+0fga5L/fGQ=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26/go.mod h1:Y2OJ+P+MC1u1VKnavT+PshiEuGPyh/7DqxoDNij4/bg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29 h1:J4xhFd6zHhdF9jPP0FQJ6WknzBboGMBNjKOv4iTuw4A=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.29/go.mod h1:TwuqRBGzxjQJIwH16/fOZodwXt2Zxa9/cwJC5ke4j7s=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.30 h1:IVx9L7YFhpPq0tTnGo8u8TpluFu7nAn9X3sUDMb11c0=
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.30/go.mod h1:vsbq62AOBwQ1LJ/GWKFxX8beUEYeRp/Agitrxee2/qM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.16/go.mod h1:XH+3h395e3WVdd6T2Z3mPxuI+x/HVtdqVOREkTiyubs=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.20 h1:YIvKIfPXQVp0EhXUV644kmQo6cQPPSRmC44A1HSoJeg=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.20/go.mod h1:8W88sW3PjamQpKFUQvHWWKay6ARsNvZnzU7+a4apubw=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.21 h1:QdxdY43AiwsqG/VAqHA7bIVSm3rKr8/p9i05ydA0/RM=
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.21/go.mod h1:QtIEat7ksHH8nFItljyvMI0dGj8lipK2XZ4PhNihTEU=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.10/go.mod h1:9cBNUHI2aW4ho0A5T87O294iPDuuUOSIEDjnd1Lq/z0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11 h1:y2+VQzC6Zh2ojtV2LoC0MNwHWc6qXv/j2vrQtlftkdA=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.11/go.mod h1:iV4q2hsqtNECrfmlXyord9u4zyuFEJX9eLgLpSPzWA8=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.20/go.mod h1:Mp4XI/CkWGD79AQxZ5lIFlgvC0A+gl+4BmyG1F+SfNc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.23 h1:c5+bNdV8E4fIPteWx4HZSkqI07oY9exbfQ7JH7Yx4PI=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.23/go.mod h1:1jcUfF+FAOEwtIcNiHPaV4TSoZqkUIPzrohmD7fb95c=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.24 h1:Qmm8klpAdkuN3/rPrIMa/hZQ1z93WMBPjOzdAsbSnlo=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.24/go.mod h1:QelGeWBVRh9PbbXsfXKTFlU9FjT6W2yP+dW5jMQzOkg=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22 h1:LjFQf8hFuMO22HkV5VWGLBvmCLBCLPivUAmpdpnp4Vs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.22/go.mod h1:xt0Au8yPIwYXf/GYPy/vl4K3CgwhfQMYbrH7DlUUIws=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.23 h1:QoOybhwRfciWUBbZ0gp9S7XaDnCuSTeK/fySB99V1ls=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.23/go.mod h1:9uPh+Hrz2Vn6oMnQYiUi/zbh3ovbnQk19YKINkQny44=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.19/go.mod h1:BmQWRVkLTmyNzYPFAZgon53qKLWBNSvonugD1MrSWUs=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.22 h1:ISLJ2BKXe4zzyZ7mp5ewKECiw0U7KpLgS3S6OxY9Cm0=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.22/go.mod h1:QFVbqK54XArazLvn2wvWMRBi/jGrWii46qbr5DyPGjc=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.23 h1:qc+RW0WWZ2KApMnsu/EVCPqLTyIH55uc7YQq7mq4XqE=
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.23/go.mod h1:FJhZWVWBCcgAF8jbep7pxQ1QUsjzTwa9tvEXGw2TDRo=
|
||||
github.com/aws/aws-sdk-go-v2/service/kms v1.19.0/go.mod h1:kZodDPTQjSH/qM6/OvyTfM5mms5JHB/EKYp5dhn/vI4=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.29.4/go.mod h1:/NHbqPRiwxSPVOB2Xr+StDEH+GWV/64WwnUjv4KYzV0=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.3 h1:PVieHTwugdlHedlxLpYLQsOZAq736RScuEb/m4zhzc4=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.3/go.mod h1:XN3YcdmnWYZ3Hrnojvo5p2mc/wfF973nkq3ClXPDMHk=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.5 h1:kFfb+NMap4R7nDvBYyABa/nw7KFMtAfygD1Hyoxh4uE=
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.30.5/go.mod h1:Dze3kNt4T+Dgb8YCfuIFSBLmE6hadKNxqfdF0Xmqz1I=
|
||||
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.16.8/go.mod h1:k6CPuxyzO247nYEM1baEwHH1kRtosRCvgahAepaaShw=
|
||||
@@ -599,18 +572,12 @@ github.com/aws/aws-sdk-go-v2/service/sns v1.18.6/go.mod h1:2cPUjR63iE9MPMPJtSyzY
|
||||
github.com/aws/aws-sdk-go-v2/service/sqs v1.19.15/go.mod h1:DKX/7/ZiAzHO6p6AhArnGdrV4r+d461weby8KeVtvC4=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssm v1.33.1/go.mod h1:rEsqsZrOp9YvSGPOrcL3pR9+i/QJaWRkAYbuxMa7yCU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.11.25/go.mod h1:IARHuzTXmj1C0KS35vboR0FeJ89OkEy1M9mWbK2ifCI=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.2 h1:EN102fWY7hI5u/2FPheTrwwMHkSXfl49RYkeEnJsrCU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.2/go.mod h1:IgV8l3sj22nQDd5qcAGY0WenwCzCphqdbFOpfktZPrI=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.4 h1:qJdM48OOLl1FBSzI7ZrA1ZfLwOyCYqkXV5lko1hYDBw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.4/go.mod h1:jtLIhd+V+lft6ktxpItycqHqiVXrPIRjWIsFIlzMriw=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcBBKNGCT3CarImmdFzishsqBmSRI=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.2 h1:f1lmlce7r13CX1BPyPqt9oh/H+uqOWc9367lDoGGwNQ=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.2/go.mod h1:O1YSOg3aekZibh2SngvCRRG+cRHKKlYgxf/JBF/Kr/k=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.4 h1:YRkWXQveFb0tFC0TLktmmhGsOcCgLwvq88MC2al47AA=
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.4/go.mod h1:zVwRrfdSmbRZWkUkWjOItY7SOalnFnq/Yg2LVPqDjwc=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.17.5/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3 h1:s49mSnsBZEXjfGBkRfmK+nPqzT7Lt3+t2SmAKNyHblw=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.3/go.mod h1:b+psTJn33Q4qGoDaM7ZiOVVG8uVjGI6HaZ8WBHdgDgU=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.5 h1:L1600eLr0YvTT7gNh3Ni24yGI7NSHkq9Gp62vijPRCs=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.5/go.mod h1:1mKZHLLpDMHTNSYPJ7qrcnCQdHCWsNQaT0xRvq2u80s=
|
||||
github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
|
||||
@@ -848,8 +815,6 @@ github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDD
|
||||
github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
github.com/domodwyer/mailyak/v3 v3.3.5 h1:4rQV4ADpFIizCR8VVCASO+7bLof3aPhdFGnzCrXMDRc=
|
||||
github.com/domodwyer/mailyak/v3 v3.3.5/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c=
|
||||
github.com/domodwyer/mailyak/v3 v3.4.0 h1:U9U9ctj+F8AmW5qT6ZJMwA/6INqsmvR7nOhPUSkbVUQ=
|
||||
github.com/domodwyer/mailyak/v3 v3.4.0/go.mod h1:lOm/u9CyCVWHeaAmHIdF4RiKVxKUT/H5XX10lIKAL6c=
|
||||
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
@@ -1033,12 +998,10 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
|
||||
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
@@ -1612,12 +1575,8 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pocketbase/dbx v1.9.0 h1:HYY0hQcbopfJFFqJqcjt39lg6VTKlIRoDbUFY6ZC4iM=
|
||||
github.com/pocketbase/dbx v1.9.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/dbx v1.10.0 h1:58VIT7r6T+BnVbYVosvGBsPjQEic3/VFRYGT823vWSQ=
|
||||
github.com/pocketbase/dbx v1.10.0/go.mod h1:xXRCIAKTHMgUCyCKZm55pUOdvFziJjQfXaWKhu2vhMs=
|
||||
github.com/pocketbase/pocketbase v0.12.3 h1:UnAeLhHqQ75Gnl+2Ph7xrxjrmgePDFiLxPy/dQtE2vU=
|
||||
github.com/pocketbase/pocketbase v0.12.3/go.mod h1:pKq7Zp2jwzMbyK8qbi59RPvscgjXRsOfb389YgGeMtE=
|
||||
github.com/pocketbase/pocketbase v0.13.0 h1:9alieWiFu+9wZQknEiKZdE7UT9HW5UOY6axjj5Q8WZs=
|
||||
github.com/pocketbase/pocketbase v0.13.0/go.mod h1:rW0KXzlfkarJmueSfyoVuEfH7/SQHdZjpyVetMaKm1M=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
@@ -2507,8 +2466,8 @@ google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91
|
||||
google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70=
|
||||
google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo=
|
||||
google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0=
|
||||
google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU=
|
||||
google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
|
||||
google.golang.org/api v0.111.0 h1:bwKi+z2BsdwYFRKrqwutM+axAlYLz83gt5pDSXCJT+0=
|
||||
google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -2642,10 +2601,8 @@ google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZV
|
||||
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
||||
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
||||
google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
|
||||
google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14=
|
||||
google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA=
|
||||
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 h1:znp6mq/drrY+6khTAlJUDNFFcDGV2ENLYKpMq8SyCds=
|
||||
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw=
|
||||
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488 h1:QQF+HdiI4iocoxUjjpLgvTYDHKm99C/VtTBFnfiCJos=
|
||||
google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA=
|
||||
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
|
||||
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
@@ -2830,8 +2787,6 @@ modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw=
|
||||
modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY=
|
||||
modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=
|
||||
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
|
||||
modernc.org/libc v1.22.2 h1:4U7v51GyhlWqQmwCHj28Rdq2Yzwk55ovjFrdPjs8Hb0=
|
||||
modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug=
|
||||
modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY=
|
||||
modernc.org/libc v1.22.3/go.mod h1:MQrloYP209xa2zHome2a8HLiLm6k0UT8CoHpV74tOFw=
|
||||
modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ=
|
||||
@@ -2840,13 +2795,11 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
|
||||
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.20.4 h1:J8+m2trkN+KKoE7jglyHYYYiaq5xmz2HoHJIiBlRzbE=
|
||||
modernc.org/sqlite v1.20.4/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A=
|
||||
modernc.org/sqlite v1.21.0 h1:4aP4MdUf15i3R3M2mx6Q90WHKz3nZLoz96zlB6tNdow=
|
||||
modernc.org/sqlite v1.21.0/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI=
|
||||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
modernc.org/tcl v1.15.0 h1:oY+JeD11qVVSgVvodMJsu7Edf8tr5E/7tuhF5cNYz34=
|
||||
modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws=
|
||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
|
||||
modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE=
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
jsonData := `{
|
||||
"id": "27do0wbcuyfmbmx",
|
||||
"created": "2023-03-04 20:33:00.558Z",
|
||||
"updated": "2023-03-04 20:33:00.558Z",
|
||||
"name": "users",
|
||||
"type": "auth",
|
||||
"system": false,
|
||||
"schema": [],
|
||||
"listRule": null,
|
||||
"viewRule": null,
|
||||
"createRule": null,
|
||||
"updateRule": null,
|
||||
"deleteRule": null,
|
||||
"options": {
|
||||
"allowEmailAuth": true,
|
||||
"allowOAuth2Auth": false,
|
||||
"allowUsernameAuth": true,
|
||||
"exceptEmailDomains": [],
|
||||
"manageRule": null,
|
||||
"minPasswordLength": 8,
|
||||
"onlyEmailDomains": [],
|
||||
"requireEmail": false
|
||||
}
|
||||
}`
|
||||
|
||||
collection := &models.Collection{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &collection); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return daos.New(db).SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("27do0wbcuyfmbmx")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dao.DeleteCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.CreateRule = nil
|
||||
|
||||
collection.UpdateRule = nil
|
||||
|
||||
collection.DeleteRule = nil
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("z5lghx2r3tm45n1")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = nil
|
||||
|
||||
collection.ViewRule = nil
|
||||
|
||||
collection.CreateRule = types.Pointer("")
|
||||
|
||||
collection.UpdateRule = types.Pointer("")
|
||||
|
||||
collection.DeleteRule = types.Pointer("")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("cti4l8f4mz8df3r")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.CreateRule = nil
|
||||
|
||||
collection.UpdateRule = nil
|
||||
|
||||
collection.DeleteRule = nil
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("cti4l8f4mz8df3r")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = nil
|
||||
|
||||
collection.ViewRule = nil
|
||||
|
||||
collection.CreateRule = types.Pointer("")
|
||||
|
||||
collection.UpdateRule = types.Pointer("")
|
||||
|
||||
collection.DeleteRule = types.Pointer("")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.CreateRule = nil
|
||||
|
||||
collection.UpdateRule = nil
|
||||
|
||||
collection.DeleteRule = nil
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.ListRule = nil
|
||||
|
||||
collection.ViewRule = nil
|
||||
|
||||
collection.CreateRule = types.Pointer("")
|
||||
|
||||
collection.UpdateRule = types.Pointer("")
|
||||
|
||||
collection.DeleteRule = types.Pointer("")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
jsonData := `{
|
||||
"id": "t1rajoyzl6691g3",
|
||||
"created": "2023-03-09 22:17:29.463Z",
|
||||
"updated": "2023-03-09 22:17:29.463Z",
|
||||
"name": "settings_public",
|
||||
"type": "base",
|
||||
"system": false,
|
||||
"schema": [
|
||||
{
|
||||
"system": false,
|
||||
"id": "s1grje98",
|
||||
"name": "website_title",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"system": false,
|
||||
"id": "tlzz87pj",
|
||||
"name": "favicon",
|
||||
"type": "file",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"maxSelect": 1,
|
||||
"maxSize": 5242880,
|
||||
"mimeTypes": [
|
||||
"image/x-icon",
|
||||
"image/png",
|
||||
"image/svg+xml",
|
||||
"image/gif",
|
||||
"image/jpeg"
|
||||
],
|
||||
"thumbs": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"listRule": "",
|
||||
"viewRule": "",
|
||||
"createRule": null,
|
||||
"updateRule": null,
|
||||
"deleteRule": null,
|
||||
"options": {}
|
||||
}`
|
||||
|
||||
collection := &models.Collection{}
|
||||
if err := json.Unmarshal([]byte(jsonData), &collection); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return daos.New(db).SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("t1rajoyzl6691g3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return dao.DeleteCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
"github.com/pocketbase/pocketbase/tools/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.Name = "settings_private"
|
||||
|
||||
collection.ListRule = nil
|
||||
|
||||
collection.ViewRule = nil
|
||||
|
||||
// remove
|
||||
collection.Schema.RemoveField("slrjkipw")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("nmj3ko20gzkg8n3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
collection.Name = "settings"
|
||||
|
||||
collection.ListRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
collection.ViewRule = types.Pointer("@request.auth.id != \"\"")
|
||||
|
||||
// add
|
||||
del_website_title := &schema.SchemaField{}
|
||||
json.Unmarshal([]byte(`{
|
||||
"system": false,
|
||||
"id": "slrjkipw",
|
||||
"name": "website_title",
|
||||
"type": "text",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {
|
||||
"min": null,
|
||||
"max": null,
|
||||
"pattern": ""
|
||||
}
|
||||
}`), del_website_title)
|
||||
collection.Schema.AddField(del_website_title)
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pocketbase/dbx"
|
||||
"github.com/pocketbase/pocketbase/daos"
|
||||
m "github.com/pocketbase/pocketbase/migrations"
|
||||
"github.com/pocketbase/pocketbase/models/schema"
|
||||
)
|
||||
|
||||
func init() {
|
||||
m.Register(func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("t1rajoyzl6691g3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// add
|
||||
new_setup_completed := &schema.SchemaField{}
|
||||
json.Unmarshal([]byte(`{
|
||||
"system": false,
|
||||
"id": "vrxqcsnv",
|
||||
"name": "setup_completed",
|
||||
"type": "bool",
|
||||
"required": false,
|
||||
"unique": false,
|
||||
"options": {}
|
||||
}`), new_setup_completed)
|
||||
collection.Schema.AddField(new_setup_completed)
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
}, func(db dbx.Builder) error {
|
||||
dao := daos.New(db);
|
||||
|
||||
collection, err := dao.FindCollectionByNameOrId("t1rajoyzl6691g3")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// remove
|
||||
collection.Schema.RemoveField("vrxqcsnv")
|
||||
|
||||
return dao.SaveCollection(collection)
|
||||
})
|
||||
}
|
||||
@@ -70,12 +70,12 @@ func HandlerScan(c echo.Context) error {
|
||||
}
|
||||
|
||||
// check if scan range is valid
|
||||
allSettings, err := App.Dao().FindRecordsByExpr("settings")
|
||||
allPrivateSettings, err := App.Dao().FindRecordsByExpr("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settings := allSettings[0]
|
||||
scanRange := settings.GetString("scan_range")
|
||||
settingsPrivate := allPrivateSettings[0]
|
||||
scanRange := settingsPrivate.GetString("scan_range")
|
||||
_, ipNet, err := net.ParseCIDR(scanRange)
|
||||
if err != nil {
|
||||
return apis.NewBadRequestError(err.Error(), nil)
|
||||
|
||||
@@ -41,6 +41,7 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
Handler: HandlerWake,
|
||||
Middlewares: []echo.MiddlewareFunc{
|
||||
apis.ActivityLogger(App),
|
||||
apis.RequireAdminOrRecordAuth("users"),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -51,6 +52,7 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
Handler: HandlerShutdown,
|
||||
Middlewares: []echo.MiddlewareFunc{
|
||||
apis.ActivityLogger(App),
|
||||
apis.RequireAdminOrRecordAuth("users"),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -61,6 +63,7 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
Handler: HandlerScan,
|
||||
Middlewares: []echo.MiddlewareFunc{
|
||||
apis.ActivityLogger(App),
|
||||
apis.RequireAdminAuth(),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -82,13 +85,16 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
// add event hook before starting server.
|
||||
// using this outside App.OnBeforeServe() would not work
|
||||
App.OnModelAfterUpdate().Add(func(e *core.ModelEvent) error {
|
||||
if e.Model.TableName() == "settings" {
|
||||
if e.Model.TableName() == "settings_private" {
|
||||
for _, job := range cronjobs.CronPing.Entries() {
|
||||
cronjobs.CronPing.Remove(job.ID)
|
||||
}
|
||||
go cronjobs.RunPing(App)
|
||||
} else if e.Model.TableName() == "devices" {
|
||||
refreshDeviceList()
|
||||
if err := refreshDeviceList(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
for _, job := range cronjobs.CronWakeShutdown.Entries() {
|
||||
cronjobs.CronWakeShutdown.Remove(job.ID)
|
||||
}
|
||||
@@ -101,11 +107,31 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
|
||||
// refresh the device list on database events
|
||||
App.OnModelAfterCreate().Add(func(e *core.ModelEvent) error {
|
||||
refreshDeviceList()
|
||||
if e.Model.TableName() == "_admins" {
|
||||
if err := setSetupCompleted(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := refreshDeviceList(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
App.OnModelAfterDelete().Add(func(e *core.ModelEvent) error {
|
||||
refreshDeviceList()
|
||||
if e.Model.TableName() == "_admins" {
|
||||
if err := setSetupCompleted(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
if err := refreshDeviceList(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -116,18 +142,32 @@ func StartPocketBase(distDirFS fs.FS) {
|
||||
}
|
||||
|
||||
func importSettings() error {
|
||||
// get first settings record
|
||||
settingsRecords, err := App.Dao().FindRecordsByExpr("settings")
|
||||
// get first settingsPrivate record
|
||||
settingsPrivateRecords, err := App.Dao().FindRecordsByExpr("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsCollection, err := App.Dao().FindCollectionByNameOrId("settings")
|
||||
settingsPrivateCollection, err := App.Dao().FindCollectionByNameOrId("settings_private")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settings := models.NewRecord(settingsCollection)
|
||||
if len(settingsRecords) > 0 {
|
||||
settings = settingsRecords[0]
|
||||
settingsPrivate := models.NewRecord(settingsPrivateCollection)
|
||||
if len(settingsPrivateRecords) > 0 {
|
||||
settingsPrivate = settingsPrivateRecords[0]
|
||||
}
|
||||
|
||||
// get first settingsPublic record
|
||||
settingsPublicRecords, err := App.Dao().FindRecordsByExpr("settings_public")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPublicCollection, err := App.Dao().FindCollectionByNameOrId("settings_public")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPublic := models.NewRecord(settingsPublicCollection)
|
||||
if len(settingsPublicRecords) > 0 {
|
||||
settingsPublic = settingsPublicRecords[0]
|
||||
}
|
||||
|
||||
// set ping interval settings. priority:
|
||||
@@ -135,22 +175,33 @@ func importSettings() error {
|
||||
// 2nd: database entry
|
||||
// 3rd: default values
|
||||
interval := "@every 3s"
|
||||
if settings.GetString("interval") != "" {
|
||||
interval = settings.GetString("interval")
|
||||
if settingsPrivate.GetString("interval") != "" {
|
||||
interval = settingsPrivate.GetString("interval")
|
||||
}
|
||||
if os.Getenv("UPSNAP_INTERVAL") != "" {
|
||||
interval = os.Getenv("UPSNAP_INTERVAL")
|
||||
}
|
||||
|
||||
// save settings to db
|
||||
settings.Set("interval", interval)
|
||||
// set private settings
|
||||
settingsPrivate.Set("interval", interval)
|
||||
if scanRange := os.Getenv("UPSNAP_SCAN_RANGE"); scanRange != "" {
|
||||
settings.Set("scan_range", scanRange)
|
||||
settingsPrivate.Set("scan_range", scanRange)
|
||||
}
|
||||
if scanRange := os.Getenv("UPSNAP_WEBSITE_TITLE"); scanRange != "" {
|
||||
settings.Set("website_title", scanRange)
|
||||
|
||||
// set public settings
|
||||
if websiteTitle := os.Getenv("UPSNAP_WEBSITE_TITLE"); websiteTitle != "" {
|
||||
settingsPublic.Set("website_title", websiteTitle)
|
||||
}
|
||||
if err := App.Dao().SaveRecord(settings); err != nil {
|
||||
|
||||
// save records
|
||||
if err := App.Dao().SaveRecord(settingsPrivate); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := App.Dao().SaveRecord(settingsPublic); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := setSetupCompleted(); err != nil {
|
||||
logger.Error.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -173,10 +224,30 @@ func resetDeviceStates() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func refreshDeviceList() {
|
||||
func refreshDeviceList() error {
|
||||
var err error
|
||||
cronjobs.Devices, err = App.Dao().FindRecordsByExpr("devices")
|
||||
if err != nil {
|
||||
logger.Error.Println(err)
|
||||
if cronjobs.Devices, err = App.Dao().FindRecordsByExpr("devices"); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setSetupCompleted() error {
|
||||
totalAdmins, err := App.Dao().TotalAdmins()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
settingsPublicRecords, err := App.Dao().FindRecordsByExpr("settings_public")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if totalAdmins > 0 {
|
||||
settingsPublicRecords[0].Set("setup_completed", true)
|
||||
} else {
|
||||
settingsPublicRecords[0].Set("setup_completed", false)
|
||||
}
|
||||
if err := App.Dao().SaveRecord(settingsPublicRecords[0]); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -18,17 +18,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-static": "^1.0.6",
|
||||
"@sveltejs/kit": "^1.8.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
||||
"@typescript-eslint/parser": "^5.53.0",
|
||||
"@sveltejs/kit": "^1.11.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
||||
"@typescript-eslint/parser": "^5.54.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.7.0",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.1.2",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier-plugin-svelte": "^2.9.0",
|
||||
"svelte": "^3.55.1",
|
||||
"svelte": "^3.56.0",
|
||||
"svelte-preprocess": "^5.0.1",
|
||||
"typescript": "^4.9.5",
|
||||
"vite": "^4.1.4"
|
||||
@@ -538,9 +538,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@sveltejs/kit": {
|
||||
"version": "1.8.5",
|
||||
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.8.5.tgz",
|
||||
"integrity": "sha512-b6kbjVAivoPd3oL9IVBaZBWiuHeI0qBKfszSDXcqsPfiSMyUK7ilHDFVSWNn+2EMPO48+87iuho71yTCOXZE3w==",
|
||||
"version": "1.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.11.0.tgz",
|
||||
"integrity": "sha512-PwViZcMoLgEU/jhLoSyjf5hSrHS67wvSm0ifBo4prP9irpGa5HuPOZeVDTL5tPDSBoKxtdYi1zlGdoiJfO86jA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
@@ -614,12 +614,6 @@
|
||||
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.14.1.tgz",
|
||||
"integrity": "sha512-QH+37Qds3E0eDlReeboBxfHbX9omAcBCXEzswCu6jySP642jiM3cYSIkU/REqwhCUqXdonHFuBfJDiAJxMNhaQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/pug": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz",
|
||||
@@ -627,12 +621,13 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/sass": {
|
||||
"version": "1.43.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.43.1.tgz",
|
||||
"integrity": "sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==",
|
||||
"version": "1.45.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/sass/-/sass-1.45.0.tgz",
|
||||
"integrity": "sha512-jn7qwGFmJHwUSphV8zZneO3GmtlgLsmhs/LQyVvQbIIa+fzGMUiHI4HXJZL3FT8MJmgXWbLGiVVY7ElvHq6vDA==",
|
||||
"deprecated": "This is a stub types definition. sass provides its own type definitions, so you do not need this installed.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
"sass": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
@@ -642,14 +637,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.53.0.tgz",
|
||||
"integrity": "sha512-alFpFWNucPLdUOySmXCJpzr6HKC3bu7XooShWM+3w/EL6J2HIoB2PFxpLnq4JauWVk6DiVeNKzQlFEaE+X9sGw==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.1.tgz",
|
||||
"integrity": "sha512-a2RQAkosH3d3ZIV08s3DcL/mcGc2M/UC528VkPULFxR9VnVPT8pBu0IyBAJJmVsCmhVfwQX1v6q+QGnmSe1bew==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/type-utils": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.1",
|
||||
"@typescript-eslint/type-utils": "5.54.1",
|
||||
"@typescript-eslint/utils": "5.54.1",
|
||||
"debug": "^4.3.4",
|
||||
"grapheme-splitter": "^1.0.4",
|
||||
"ignore": "^5.2.0",
|
||||
@@ -676,14 +671,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.53.0.tgz",
|
||||
"integrity": "sha512-MKBw9i0DLYlmdOb3Oq/526+al20AJZpANdT6Ct9ffxcV8nKCHz63t/S0IhlTFNsBIHJv+GY5SFJ0XfqVeydQrQ==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.54.1.tgz",
|
||||
"integrity": "sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.1",
|
||||
"@typescript-eslint/types": "5.54.1",
|
||||
"@typescript-eslint/typescript-estree": "5.54.1",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@@ -703,13 +698,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.53.0.tgz",
|
||||
"integrity": "sha512-Opy3dqNsp/9kBBeCPhkCNR7fmdSQqA+47r21hr9a14Bx0xnkElEQmhoHga+VoaoQ6uDHjDKmQPIYcUcKJifS7w==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz",
|
||||
"integrity": "sha512-zWKuGliXxvuxyM71UA/EcPxaviw39dB2504LqAmFDjmkpO8qNLHcmzlh6pbHs1h/7YQ9bnsO8CCcYCSA8sykUg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0"
|
||||
"@typescript-eslint/types": "5.54.1",
|
||||
"@typescript-eslint/visitor-keys": "5.54.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -720,13 +715,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.53.0.tgz",
|
||||
"integrity": "sha512-HO2hh0fmtqNLzTAme/KnND5uFNwbsdYhCZghK2SoxGp3Ifn2emv+hi0PBUjzzSh0dstUIFqOj3bp0AwQlK4OWw==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz",
|
||||
"integrity": "sha512-WREHsTz0GqVYLIbzIZYbmUUr95DKEKIXZNH57W3s+4bVnuF1TKe2jH8ZNH8rO1CeMY3U4j4UQeqPNkHMiGem3g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/utils": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.54.1",
|
||||
"@typescript-eslint/utils": "5.54.1",
|
||||
"debug": "^4.3.4",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
@@ -747,9 +742,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.53.0.tgz",
|
||||
"integrity": "sha512-5kcDL9ZUIP756K6+QOAfPkigJmCPHcLN7Zjdz76lQWWDdzfOhZDTj1irs6gPBKiXx5/6O3L0+AvupAut3z7D2A==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.1.tgz",
|
||||
"integrity": "sha512-G9+1vVazrfAfbtmCapJX8jRo2E4MDXxgm/IMOF4oGh3kq7XuK3JRkOg6y2Qu1VsTRmWETyTkWt1wxy7X7/yLkw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -760,13 +755,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.53.0.tgz",
|
||||
"integrity": "sha512-eKmipH7QyScpHSkhbptBBYh9v8FxtngLquq292YTEQ1pxVs39yFBlLC1xeIZcPPz1RWGqb7YgERJRGkjw8ZV7w==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.1.tgz",
|
||||
"integrity": "sha512-bjK5t+S6ffHnVwA0qRPTZrxKSaFYocwFIkZx5k7pvWfsB1I57pO/0M0Skatzzw1sCkjJ83AfGTL0oFIFiDX3bg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/visitor-keys": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.1",
|
||||
"@typescript-eslint/visitor-keys": "5.54.1",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@@ -787,16 +782,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.53.0.tgz",
|
||||
"integrity": "sha512-VUOOtPv27UNWLxFwQK/8+7kvxVC+hPHNsJjzlJyotlaHjLSIgOCKj9I0DBUjwOOA64qjBwx5afAPjksqOxMO0g==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.1.tgz",
|
||||
"integrity": "sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.9",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@typescript-eslint/scope-manager": "5.53.0",
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/typescript-estree": "5.53.0",
|
||||
"@typescript-eslint/scope-manager": "5.54.1",
|
||||
"@typescript-eslint/types": "5.54.1",
|
||||
"@typescript-eslint/typescript-estree": "5.54.1",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0",
|
||||
"semver": "^7.3.7"
|
||||
@@ -813,12 +808,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.53.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.53.0.tgz",
|
||||
"integrity": "sha512-JqNLnX3leaHFZEN0gCh81sIvgrp/2GOACZNgO4+Tkf64u51kTpAyWFOY8XHx8XuXr3N2C9zgPPHtcpMg6z1g0w==",
|
||||
"version": "5.54.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.1.tgz",
|
||||
"integrity": "sha512-q8iSoHTgwCfgcRJ2l2x+xCbu8nBlRAlsQ33k24Adj8eoVBE0f8dUeI+bAa8F84Mv05UGbAx57g2zrRsYIooqQg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.53.0",
|
||||
"@typescript-eslint/types": "5.54.1",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -1409,9 +1404,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-config-prettier": {
|
||||
"version": "8.6.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
|
||||
"integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
|
||||
"version": "8.7.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.7.0.tgz",
|
||||
"integrity": "sha512-HHVXLSlVUhMSmyW4ZzEuvjpwqamgmlfkutD53cYXLikh4pt/modINRcCIApJ84czDxM4GZInwUrromsDdTImTA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"eslint-config-prettier": "bin/cli.js"
|
||||
@@ -1525,9 +1520,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esquery": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.2.tgz",
|
||||
"integrity": "sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz",
|
||||
"integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"estraverse": "^5.1.0"
|
||||
@@ -2915,9 +2910,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "3.17.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.17.3.tgz",
|
||||
"integrity": "sha512-p5LaCXiiOL/wrOkj8djsIDFmyU9ysUxcyW+EKRLHb6TKldJzXpImjcRSR+vgo09DBdofGcOoLOsRyxxG2n5/qQ==",
|
||||
"version": "3.19.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.19.0.tgz",
|
||||
"integrity": "sha512-xZzJZlH9Ca6cosfdNGPwl2z7Pby8dTi9TrYLPeg6/j7aUoDOhBd706tCUFvbiBj45h/cS7z/a4gS8xd5Yg0jBw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
@@ -3271,9 +3266,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/svelte": {
|
||||
"version": "3.55.1",
|
||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.55.1.tgz",
|
||||
"integrity": "sha512-S+87/P0Ve67HxKkEV23iCdAh/SX1xiSfjF1HOglno/YTbSTW7RniICMCofWGdJJbdjw3S+0PfFb1JtGfTXE0oQ==",
|
||||
"version": "3.56.0",
|
||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-3.56.0.tgz",
|
||||
"integrity": "sha512-LvXiJbjdvJKwB/0CQyYpDX0q+hFqCyWmybzC2G6eK1tJJA/RSRCytTfNmjHv+RHlLuA70vWG7nXp6gbeErYvRA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-static": "^1.0.6",
|
||||
"@sveltejs/kit": "^1.8.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
||||
"@typescript-eslint/parser": "^5.53.0",
|
||||
"@sveltejs/kit": "^1.11.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
||||
"@typescript-eslint/parser": "^5.54.1",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-prettier": "^8.7.0",
|
||||
"eslint-plugin-svelte3": "^4.0.0",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^13.1.2",
|
||||
"prettier": "^2.8.4",
|
||||
"prettier-plugin-svelte": "^2.9.0",
|
||||
"svelte": "^3.55.1",
|
||||
"svelte": "^3.56.0",
|
||||
"svelte-preprocess": "^5.0.1",
|
||||
"typescript": "^4.9.5",
|
||||
"vite": "^4.1.4"
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<html lang="en" class="h-100">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
|
||||
<body data-sveltekit-preload-data="hover" class="h-100">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script>
|
||||
import { dev } from '$app/environment';
|
||||
import { parseISO, formatDistance } from 'date-fns';
|
||||
import { pocketbase } from '@stores/pocketbase';
|
||||
import Fa from 'svelte-fa/src/fa.svelte';
|
||||
import {
|
||||
faPowerOff,
|
||||
faEllipsisVertical,
|
||||
@@ -9,18 +11,25 @@
|
||||
faCircleDown,
|
||||
faLock
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import Fa from 'svelte-fa';
|
||||
import { sortPorts } from '../sorts';
|
||||
|
||||
export let device;
|
||||
export let now;
|
||||
|
||||
function shutdown() {
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/shutdown/${device.id}`);
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/shutdown/${device.id}`, {
|
||||
headers: {
|
||||
Authorization: $pocketbase.authStore.baseToken
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function wake() {
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/wake/${device.id}`);
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/wake/${device.id}`, {
|
||||
headers: {
|
||||
Authorization: $pocketbase.authStore.baseToken
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script>
|
||||
import { goto } from '$app/navigation';
|
||||
import { pocketbase, devices } from '@stores/pocketbase';
|
||||
import Fa from 'svelte-fa/src/fa.svelte';
|
||||
import { faEye, faEyeSlash, faPlus, faTrashCan } from '@fortawesome/free-solid-svg-icons';
|
||||
import Fa from 'svelte-fa';
|
||||
|
||||
export let device;
|
||||
export let mode;
|
||||
@@ -185,6 +185,7 @@
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="65535"
|
||||
aria-label="Number"
|
||||
class="form-control"
|
||||
@@ -212,6 +213,7 @@
|
||||
/>
|
||||
<input
|
||||
type="number"
|
||||
min="0"
|
||||
max="65535"
|
||||
aria-label="Number"
|
||||
class="form-control"
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<script>
|
||||
import { pocketbase, authorizedStore, settings_public } from '@stores/pocketbase';
|
||||
|
||||
let username;
|
||||
let password;
|
||||
let passwordConfirm;
|
||||
let isAdmin;
|
||||
let callout = {
|
||||
hidden: true,
|
||||
level: 'danger',
|
||||
title: '',
|
||||
msg: ''
|
||||
};
|
||||
|
||||
$: if ($settings_public.setup_completed === false) {
|
||||
callout.title = '';
|
||||
callout.msg = 'No admin account has been set up. Please create one.';
|
||||
callout.level = 'info';
|
||||
callout.hidden = false;
|
||||
}
|
||||
|
||||
async function login() {
|
||||
if (isAdmin) {
|
||||
$pocketbase.admins
|
||||
.authWithPassword(username, password)
|
||||
.then(() => {
|
||||
authorizedStore.set(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
authorizedStore.set(false);
|
||||
callout.level = 'danger';
|
||||
callout.title = err.status;
|
||||
callout.msg = err.message;
|
||||
callout.hidden = false;
|
||||
});
|
||||
} else {
|
||||
$pocketbase
|
||||
.collection('users')
|
||||
.authWithPassword(username, password)
|
||||
.then(() => {
|
||||
authorizedStore.set(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
authorizedStore.set(false);
|
||||
callout.level = 'danger';
|
||||
callout.title = err.status;
|
||||
callout.msg = err.message;
|
||||
callout.hidden = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function register() {
|
||||
if (password !== passwordConfirm) {
|
||||
callout.level = 'danger';
|
||||
callout.title = "Passwords don't match";
|
||||
callout.msg = 'Please try again';
|
||||
callout.hidden = false;
|
||||
return;
|
||||
} else {
|
||||
callout.hidden = true;
|
||||
}
|
||||
$pocketbase.admins
|
||||
.create({
|
||||
email: username,
|
||||
password: password,
|
||||
passwordConfirm: passwordConfirm
|
||||
})
|
||||
.then(() => {
|
||||
$pocketbase.admins
|
||||
.authWithPassword(username, password)
|
||||
.then(() => {
|
||||
authorizedStore.set(true);
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
authorizedStore.set(false);
|
||||
callout.level = 'danger';
|
||||
callout.title = err.status;
|
||||
callout.msg = err.message;
|
||||
callout.hidden = false;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container text-dark-emphasis">
|
||||
<div class="row justify-content-center align-items-center">
|
||||
<div class="col text-center p-3 p-md-5">
|
||||
<img
|
||||
src={$settings_public.favicon !== ''
|
||||
? `${$pocketbase.baseUrl}/api/files/settings_public/${$settings_public.id}/${$settings_public.favicon}`
|
||||
: '/gopher.svg'}
|
||||
alt={$settings_public.website_title ? $settings_public.website_title : 'UpSnap'}
|
||||
class="logo pe-none user-select-none"
|
||||
/>
|
||||
<h2 class="text-dark-emphasis fw-bold text-center mt-3">
|
||||
{$settings_public.setup_completed === true ? 'Login' : 'Register'}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center align-items-center p-2">
|
||||
<div class="col-md-6 col-lg-5 p-4 login rounded-5 shadow-sm">
|
||||
<div class="callout callout-{callout.level} mt-0" class:d-none={callout.hidden}>
|
||||
{#if callout.title !== ''}
|
||||
<h5>{callout.title}</h5>
|
||||
{/if}
|
||||
{#if callout.msg !== ''}
|
||||
<p class="m-0">{callout.msg}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $settings_public.setup_completed === true}
|
||||
<form class="w-100" on:submit|preventDefault={login}>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Username or email</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="username"
|
||||
placeholder="user@example.com"
|
||||
bind:value={username}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Password</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
placeholder="secret-password"
|
||||
bind:value={password}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="form-check form-switch mb-3">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
role="switch"
|
||||
id="flexSwitchCheckChecked"
|
||||
bind:checked={isAdmin}
|
||||
/>
|
||||
<label class="form-check-label" for="flexSwitchCheckChecked"
|
||||
>Admin login</label
|
||||
>
|
||||
</div>
|
||||
<button class="btn btn-secondary w-100" type="submit">Login</button>
|
||||
</form>
|
||||
<p class="text-center m-0 mt-3">
|
||||
<!-- hacky way of linking a non existing route in svelte -->
|
||||
<a href="/_/" rel="external" class="text-muted cursor-pointer">Manage users</a>
|
||||
</p>
|
||||
{:else}
|
||||
<form class="w-100" on:submit|preventDefault={register}>
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Email</label>
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
id="username"
|
||||
placeholder="user@example.com"
|
||||
bind:value={username}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label"
|
||||
>Password (min. 10 characters)</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="password"
|
||||
placeholder="secret-password"
|
||||
minlength="10"
|
||||
bind:value={password}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="passwordConfirm" class="form-label">Password confirm</label>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="passwordConfirm"
|
||||
placeholder="secret-password"
|
||||
minlength="10"
|
||||
bind:value={passwordConfirm}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button class="btn btn-secondary w-100" type="submit">Create and login</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.logo {
|
||||
width: 40%;
|
||||
min-width: 50px;
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
.cursor-pointer {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,55 +1,84 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { theme } from '@stores/theme';
|
||||
import { pocketbase, settings } from '@stores/pocketbase';
|
||||
import { faSun, faMoon, faCircleHalfStroke, faBrush } from '@fortawesome/free-solid-svg-icons';
|
||||
import Fa from 'svelte-fa';
|
||||
import { onMount } from 'svelte';
|
||||
import { pocketbase, authorizedStore, settings_public } from '@stores/pocketbase';
|
||||
import Fa from 'svelte-fa/src/fa.svelte';
|
||||
import {
|
||||
faSun,
|
||||
faMoon,
|
||||
faCircleHalfStroke,
|
||||
faBrush,
|
||||
faRightFromBracket
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
let userInfo = {
|
||||
usernameOrEmail: '',
|
||||
role: ''
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
$pocketbase.collection('settings').subscribe('*', function (e) {
|
||||
settings.set(e.record);
|
||||
document.title = $settings.website_title;
|
||||
});
|
||||
if ($pocketbase.authStore.baseModel?.collectionName === 'users') {
|
||||
userInfo.role = 'user';
|
||||
} else {
|
||||
userInfo.role = 'admin';
|
||||
}
|
||||
if ($pocketbase.authStore.baseModel?.username) {
|
||||
userInfo.usernameOrEmail = $pocketbase.authStore.baseModel.username;
|
||||
} else {
|
||||
userInfo.usernameOrEmail = $pocketbase.authStore.baseModel.email;
|
||||
}
|
||||
});
|
||||
|
||||
async function logout() {
|
||||
$pocketbase.authStore.clear();
|
||||
authorizedStore.set(false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
{#if $settings.website_title !== ''}
|
||||
<title>{$settings.website_title}</title>
|
||||
{:else}
|
||||
<title>UpSnap</title>
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
<nav class="navbar navbar-expand">
|
||||
<nav class="navbar navbar-expand-sm pt-0">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">
|
||||
<img
|
||||
src="/favicon.png"
|
||||
alt="UpSnap"
|
||||
width="30"
|
||||
height="30"
|
||||
class:me-2={$settings.website_title !== ''}
|
||||
/>{$settings.website_title ? $settings.website_title : ''}
|
||||
src={$settings_public.favicon !== ''
|
||||
? `${$pocketbase.baseUrl}/api/files/settings_public/${$settings_public.id}/${$settings_public.favicon}`
|
||||
: '/gopher.svg'}
|
||||
alt={$settings_public.website_title ? $settings_public.website_title : 'UpSnap'}
|
||||
width="45"
|
||||
height="45"
|
||||
class:me-2={$settings_public.website_title !== ''}
|
||||
/>{$settings_public.website_title ? $settings_public.website_title : ''}
|
||||
</a>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<button
|
||||
class="navbar-toggler border-0"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent"
|
||||
aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false"
|
||||
aria-label="Toggle navigation"
|
||||
>
|
||||
<span class="navbar-toggler-icon" />
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link"
|
||||
class:active={$page.url.pathname === '/' ? true : false}
|
||||
href="/">Home</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link"
|
||||
class:active={$page.url.pathname === '/settings' ? true : false}
|
||||
href="/settings">Settings</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item dropdown ms-3">
|
||||
{#if userInfo.role !== 'user'}
|
||||
<li class="nav-item">
|
||||
<a
|
||||
class="nav-link"
|
||||
class:active={$page.url.pathname === '/' ? true : false}
|
||||
href="/">Home</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item me-3">
|
||||
<a
|
||||
class="nav-link"
|
||||
class:active={$page.url.pathname === '/settings/' ? true : false}
|
||||
href="/settings/">Settings</a
|
||||
>
|
||||
</li>
|
||||
{/if}
|
||||
<li class="nav-item dropdown">
|
||||
<div
|
||||
class="nav-link dropdown-toggle"
|
||||
role="button"
|
||||
@@ -59,7 +88,7 @@
|
||||
<Fa icon={faBrush} class="me-2" />
|
||||
Theme
|
||||
</div>
|
||||
<ul class="dropdown-menu border-0 p-1">
|
||||
<ul class="dropdown-menu border-0 p-1 shadow-sm mb-2">
|
||||
<li>
|
||||
<div
|
||||
class="dropdown-item"
|
||||
@@ -96,6 +125,16 @@
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="ms-auto d-flex">
|
||||
<button
|
||||
class="text-dark-emphasis nav-link active border-0"
|
||||
data-toggle="tooltip"
|
||||
title="Logged in as {userInfo.role} "{userInfo.usernameOrEmail}""
|
||||
on:click={() => logout()}
|
||||
>
|
||||
<Fa icon={faRightFromBracket} class="me-2" />Logout ({userInfo.usernameOrEmail})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<script>
|
||||
import { pocketbase } from '@stores/pocketbase';
|
||||
|
||||
let isUser = false;
|
||||
$: isUser = $pocketbase.authStore.baseModel?.collectionName === 'users';
|
||||
</script>
|
||||
|
||||
{#if isUser}
|
||||
<div class="row justify-content-center align-items-center">
|
||||
<div class="col-auto">
|
||||
<div class="callout callout-danger m-0">
|
||||
Logged in as read only user. To make changes, please log in as admin.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,32 +1,26 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { theme } from '@stores/theme';
|
||||
import Navbar from '@components/Navbar.svelte';
|
||||
import Login from '@components/Login.svelte';
|
||||
import Transition from '@components/Transition.svelte';
|
||||
import { pocketbase, settings, devices } from '@stores/pocketbase';
|
||||
import { theme } from '@stores/theme';
|
||||
import {
|
||||
pocketbase,
|
||||
authorizedStore,
|
||||
devices,
|
||||
settings_private,
|
||||
settings_public
|
||||
} from '@stores/pocketbase';
|
||||
|
||||
let favicon;
|
||||
let preferesDark;
|
||||
let isAuth = false;
|
||||
|
||||
onMount(async () => {
|
||||
let settingsRes = {};
|
||||
settingsRes = await $pocketbase.collection('settings').getList(1, 1);
|
||||
settings.set(settingsRes.items[0]);
|
||||
|
||||
let tempDevices = {};
|
||||
const devicesRes = await $pocketbase.collection('devices').getFullList(200, {
|
||||
sort: 'name',
|
||||
expand: 'ports'
|
||||
});
|
||||
devicesRes.forEach((device) => {
|
||||
tempDevices[device.id] = device;
|
||||
});
|
||||
devices.set(tempDevices);
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
// import bootstrap js
|
||||
import('bootstrap/js/dist/dropdown');
|
||||
import('bootstrap/js/dist/collapse');
|
||||
|
||||
// set dark mode
|
||||
preferesDark = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
@@ -46,10 +40,72 @@
|
||||
}
|
||||
document.documentElement.setAttribute('data-bs-theme', t);
|
||||
});
|
||||
|
||||
authorizedStore.subscribe((state) => {
|
||||
isAuth = state;
|
||||
});
|
||||
|
||||
// load public settings and subscribe to changes and change favicon
|
||||
const settingsPublicRes = await $pocketbase.collection('settings_public').getList(1, 1);
|
||||
settings_public.set(settingsPublicRes.items[0]);
|
||||
updateSettingsPublic();
|
||||
$pocketbase.collection('settings_public').subscribe('*', function (e) {
|
||||
settings_public.set(e.record);
|
||||
updateSettingsPublic();
|
||||
});
|
||||
|
||||
// load auth from localstorage
|
||||
const pbCookie = localStorage.getItem('pocketbase_auth');
|
||||
if (pbCookie) {
|
||||
$pocketbase.authStore.loadFromCookie('pb_auth=' + pbCookie);
|
||||
|
||||
// try to refresh auth token if valid
|
||||
if ($pocketbase.authStore.isValid) {
|
||||
if ($pocketbase.authStore.model?.collectionName === 'users') {
|
||||
await $pocketbase.collection('users').authRefresh();
|
||||
} else {
|
||||
await $pocketbase.admins.authRefresh();
|
||||
}
|
||||
}
|
||||
authorizedStore.set($pocketbase.authStore.isValid);
|
||||
}
|
||||
});
|
||||
|
||||
function updateSettingsPublic() {
|
||||
favicon.href =
|
||||
$settings_public.favicon === ''
|
||||
? '/gopher.svg'
|
||||
: `${$pocketbase.baseUrl}/api/files/settings_public/${$settings_public.id}/${$settings_public.favicon}`;
|
||||
document.title =
|
||||
$settings_public.website_title === '' ? 'UpSnap' : $settings_public.website_title;
|
||||
}
|
||||
|
||||
async function getSettingsPrivateAndDevices() {
|
||||
if (!$pocketbase.authStore.model?.collectionName === 'users') {
|
||||
const settingsPrivateRes = await $pocketbase
|
||||
.collection('settings_private')
|
||||
.getList(1, 1);
|
||||
settings_private.set(settingsPrivateRes.items[0]);
|
||||
}
|
||||
|
||||
let tempDevices = {};
|
||||
const devicesRes = await $pocketbase.collection('devices').getFullList(200, {
|
||||
sort: 'name',
|
||||
expand: 'ports'
|
||||
});
|
||||
devicesRes.forEach((device) => {
|
||||
tempDevices[device.id] = device;
|
||||
});
|
||||
devices.set(tempDevices);
|
||||
}
|
||||
|
||||
$: if (isAuth) {
|
||||
getSettingsPrivateAndDevices();
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="shortcut icon" href="/gopher.svg" bind:this={favicon} />
|
||||
<script>
|
||||
if (document) {
|
||||
preferesDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
@@ -67,11 +123,14 @@
|
||||
</script>
|
||||
</svelte:head>
|
||||
|
||||
<Navbar />
|
||||
|
||||
<Transition url={$page.url}>
|
||||
<slot />
|
||||
</Transition>
|
||||
{#if isAuth}
|
||||
<Navbar />
|
||||
<Transition url={$page.url}>
|
||||
<slot />
|
||||
</Transition>
|
||||
{:else}
|
||||
<Login />
|
||||
{/if}
|
||||
|
||||
<style lang="scss" global>
|
||||
@import '../scss/main.scss';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script>
|
||||
import { devices } from '@stores/pocketbase';
|
||||
import DeviceForm from '@components/DeviceForm.svelte';
|
||||
import UnauthorizedMsg from '@components/UnauthorizedMsg.svelte';
|
||||
|
||||
export let data;
|
||||
let device;
|
||||
@@ -11,11 +12,11 @@
|
||||
device.expand.ports = [];
|
||||
}
|
||||
}
|
||||
$:;
|
||||
</script>
|
||||
|
||||
{#if device}
|
||||
<div class="container">
|
||||
<UnauthorizedMsg />
|
||||
<DeviceForm bind:device mode="edit" />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
<script>
|
||||
import { dev } from '$app/environment';
|
||||
import { pocketbase, settings, devices } from '@stores/pocketbase';
|
||||
import { pocketbase, settings_private, settings_public, devices } from '@stores/pocketbase';
|
||||
import UnauthorizedMsg from '@components/UnauthorizedMsg.svelte';
|
||||
import DeviceForm from '@components/DeviceForm.svelte';
|
||||
import Fa from 'svelte-fa/src/fa.svelte';
|
||||
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
||||
import Fa from 'svelte-fa';
|
||||
|
||||
let version = import.meta.env.UPSNAP_VERSION;
|
||||
|
||||
let files;
|
||||
let iconFiles = [];
|
||||
let iconPreview;
|
||||
let restoreFiles = [];
|
||||
let timeout;
|
||||
let buttons = {
|
||||
settings: {
|
||||
@@ -42,13 +45,38 @@
|
||||
};
|
||||
let scannedDevices = {};
|
||||
|
||||
$: if (iconPreview && iconFiles.length > 0) {
|
||||
iconPreview.src = URL.createObjectURL(iconFiles[0]);
|
||||
} else if (iconPreview && $settings_public.favicon !== '') {
|
||||
iconPreview.src = `${$pocketbase.baseUrl}/api/files/settings_public/${$settings_public.id}/${$settings_public.favicon}`;
|
||||
} else if (iconPreview) {
|
||||
iconPreview.src = '/gopher.svg';
|
||||
}
|
||||
|
||||
async function saveSettings() {
|
||||
buttons.settings.state = 'waiting';
|
||||
try {
|
||||
if ($settings.interval === '') {
|
||||
$settings.interval = '@every 3s';
|
||||
// update settings private
|
||||
if ($settings_private.interval === '') {
|
||||
$settings_private.interval = '@every 3s';
|
||||
}
|
||||
await $pocketbase.collection('settings').update($settings.id, $settings);
|
||||
await $pocketbase
|
||||
.collection('settings_private')
|
||||
.update($settings_private.id, $settings_private);
|
||||
|
||||
// update settings public
|
||||
if (iconFiles.length > 0) {
|
||||
const formData = new FormData();
|
||||
formData.append('favicon', iconFiles[0]);
|
||||
await $pocketbase
|
||||
.collection('settings_public')
|
||||
.update($settings_public.id, formData);
|
||||
}
|
||||
await $pocketbase
|
||||
.collection('settings_public')
|
||||
.update($settings_public.id, $settings_public);
|
||||
|
||||
//set button
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
buttons.settings.state = 'none';
|
||||
@@ -67,9 +95,24 @@
|
||||
|
||||
async function scanDevices() {
|
||||
buttons.scan.state = 'waiting';
|
||||
await $pocketbase.collection('settings').update($settings.id, $settings);
|
||||
await $pocketbase
|
||||
.collection('settings_private')
|
||||
.update($settings_private.id, $settings_private)
|
||||
.catch((err) => {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
buttons.scan.error = '';
|
||||
buttons.scan.state = 'none';
|
||||
}, 3000);
|
||||
buttons.scan.error = err;
|
||||
buttons.scan.state = 'failed';
|
||||
});
|
||||
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/scan`)
|
||||
fetch(`${dev ? 'http://localhost:8090' : ''}/api/upsnap/scan`, {
|
||||
headers: {
|
||||
Authorization: $pocketbase.authStore.baseToken
|
||||
}
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
if (data.message) {
|
||||
@@ -121,7 +164,7 @@
|
||||
}
|
||||
|
||||
let reader = new FileReader();
|
||||
reader.readAsText(files[0]);
|
||||
reader.readAsText(restoreFiles[0]);
|
||||
reader.onload = async (e) => {
|
||||
// parse uploaded file
|
||||
let data = JSON.parse(e.target.result);
|
||||
@@ -176,11 +219,12 @@
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<UnauthorizedMsg />
|
||||
<section class="m-0 mt-4 p-4 shadow-sm">
|
||||
<form on:submit|preventDefault={saveSettings}>
|
||||
<h3 class="mb-3">Ping interval</h3>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h3 class="mb-3">Ping interval</h3>
|
||||
<p>Sets the interval in which the devices are pinged.</p>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">Cron</span>
|
||||
@@ -190,11 +234,11 @@
|
||||
aria-label="Interval"
|
||||
aria-describedby="addon-wrapping"
|
||||
type="text"
|
||||
bind:value={$settings.interval}
|
||||
bind:value={$settings_private.interval}
|
||||
/>
|
||||
</div>
|
||||
<h3 class="my-3">Website title</h3>
|
||||
<p>Set the website title in the navbar.</p>
|
||||
<h3 class="my-3">Title</h3>
|
||||
<p>Sets the title of the website and in the browser tab.</p>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="website-title">Title</span>
|
||||
<input
|
||||
@@ -203,13 +247,41 @@
|
||||
placeholder="e.g. 'UpSnap'"
|
||||
aria-label="Website title"
|
||||
aria-describedby="website-title"
|
||||
bind:value={$settings.website_title}
|
||||
bind:value={$settings_public.website_title}
|
||||
/>
|
||||
</div>
|
||||
<h3 class="my-3">Icon</h3>
|
||||
<img
|
||||
src=""
|
||||
alt=""
|
||||
class="img-fluid icon-preview mb-3"
|
||||
bind:this={iconPreview}
|
||||
/>
|
||||
<div class="mb-3">
|
||||
<label for="iconInput" class="form-label">Set a custom favicon.</label>
|
||||
<div class="input-group">
|
||||
<input
|
||||
class="form-control"
|
||||
type="file"
|
||||
id="iconInput"
|
||||
accept=".ico,.png,.svg,.gif,.jpg,.jpeg"
|
||||
bind:files={iconFiles}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-outline-danger"
|
||||
on:click={() => {
|
||||
iconFiles = [];
|
||||
$settings_public.favicon = '';
|
||||
}}>Back to Gopher</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="callout callout-info m-0">
|
||||
<p class="m-0">
|
||||
<h5>Ping interval:</h5>
|
||||
<p>
|
||||
Leave blank to use default value of <span class="fw-bold"
|
||||
>"@every 3s"</span
|
||||
>. Learn more about the correct syntax for cron on
|
||||
@@ -226,6 +298,15 @@
|
||||
>package documentation</a
|
||||
>
|
||||
</p>
|
||||
<h5>Icon:</h5>
|
||||
<p class="m-0">
|
||||
Supported file types are
|
||||
<span class="badge text-bg-secondary">.ico</span>,
|
||||
<span class="badge text-bg-secondary">.png</span>,
|
||||
<span class="badge text-bg-secondary">.svg</span>,
|
||||
<span class="badge text-bg-secondary">.gif</span> and
|
||||
<span class="badge text-bg-secondary">.jpg/.jpeg</span>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -264,7 +345,7 @@
|
||||
placeholder="e.g. '192.168.1.0/24'"
|
||||
aria-label="ip-range"
|
||||
aria-describedby="ip-range"
|
||||
bind:value={$settings.scan_range}
|
||||
bind:value={$settings_private.scan_range}
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
@@ -273,7 +354,8 @@
|
||||
class:btn-success={buttons.scan.state === 'success' ? true : false}
|
||||
class:btn-warning={buttons.scan.state === 'waiting' ? true : false}
|
||||
class:btn-danger={buttons.scan.state === 'failed' ? true : false}
|
||||
disabled={$settings.scan_range === '' || buttons.scan.state !== 'none'
|
||||
disabled={$settings_private.scan_range === '' ||
|
||||
buttons.scan.state !== 'none'
|
||||
? true
|
||||
: false}
|
||||
>
|
||||
@@ -358,7 +440,7 @@
|
||||
aria-describedby="Restore"
|
||||
type="file"
|
||||
accept=".json"
|
||||
bind:files
|
||||
bind:files={restoreFiles}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
@@ -366,7 +448,7 @@
|
||||
class:btn-success={buttons.restore.state === 'success' ? true : false}
|
||||
class:btn-warning={buttons.restore.state === 'waiting' ? true : false}
|
||||
class:btn-danger={buttons.restore.state === 'failed' ? true : false}
|
||||
disabled={files ? false : true}
|
||||
disabled={restoreFiles ? false : true}
|
||||
on:click={() => restoreV2Backup()}
|
||||
>
|
||||
{#if buttons.restore.state === 'none'}
|
||||
@@ -391,3 +473,9 @@
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.icon-preview {
|
||||
height: 130px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -21,6 +21,10 @@ $grays: (
|
||||
$body-bg-dark: $gray-1000;
|
||||
$dropdown-link-active-bg: $gray-1000;
|
||||
$dropdown-min-width: 0;
|
||||
$form-check-input-checked-bg-color: $orange-300;
|
||||
$form-check-input-checked-border-color: $orange-500;
|
||||
$input-focus-border-color: $gray-500;
|
||||
$input-focus-box-shadow: $gray-900;
|
||||
|
||||
// import rest
|
||||
@import '../../node_modules/bootstrap/scss/maps';
|
||||
@@ -41,6 +45,7 @@ $dropdown-min-width: 0;
|
||||
@import '../../node_modules/bootstrap/scss/buttons';
|
||||
@import '../../node_modules/bootstrap/scss/spinners';
|
||||
@import '../../node_modules/bootstrap/scss/badge';
|
||||
@import '../../node_modules/bootstrap/scss/transitions';
|
||||
|
||||
@import '../../node_modules/bootstrap/scss/utilities/api';
|
||||
|
||||
@@ -59,6 +64,12 @@ section {
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-toggler {
|
||||
&:focus {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
@@ -116,7 +127,8 @@ html[data-bs-theme='light'] {
|
||||
}
|
||||
|
||||
section,
|
||||
.card {
|
||||
.card,
|
||||
.login {
|
||||
background: #ffffff;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +140,8 @@ html[data-bs-theme='dark'] {
|
||||
}
|
||||
|
||||
section,
|
||||
.card {
|
||||
.card,
|
||||
.login {
|
||||
background: #25252b;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,7 @@ import { writable } from 'svelte/store';
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
// set backend url based on environment
|
||||
let backend_url = '/';
|
||||
let isDevMode = import.meta.env.DEV;
|
||||
if (isDevMode) {
|
||||
backend_url = 'http://127.0.0.1:8090';
|
||||
}
|
||||
let backend_url = import.meta.env.DEV ? 'http://127.0.0.1:8090' : '/';
|
||||
|
||||
// get default values for stores
|
||||
const pb = new PocketBase(backend_url);
|
||||
@@ -14,7 +10,13 @@ pb.autoCancellation(false);
|
||||
|
||||
// export stores
|
||||
export const pocketbase = writable(pb);
|
||||
export const settings = writable({
|
||||
website_title: ''
|
||||
export const settings_private = writable({
|
||||
interal: '',
|
||||
scan_range: ''
|
||||
});
|
||||
export const settings_public = writable({
|
||||
website_title: '',
|
||||
favicon: ''
|
||||
});
|
||||
export const devices = writable({});
|
||||
export const authorizedStore = writable(false);
|
||||
|
||||
|
Before Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 54 KiB |
@@ -17,7 +17,7 @@ const config = {
|
||||
'@stores': path.resolve('./src/stores')
|
||||
},
|
||||
prerender: {
|
||||
entries: ['/device/[id]']
|
||||
entries: ['/device/[id]', '/settings', '/']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||