Merge branch 'feature/mobile-push'
CI / test (push) Successful in 1m58s

# Conflicts:
#	internal/sandbar/api.go
This commit is contained in:
Veillax committed 2026-10-27 17:14:00 -06:00
commit 4cb24f7085
12 files changed
+1056 -18

No files matched your search

+19
View File
@@ -1,6 +1,7 @@
package sandbar
import (
"crypto/ecdsa"
_ "embed"
"log"
"net/http"
@@ -28,6 +29,17 @@ type Options struct {
HitDays int // how long website analytics are kept (default 365)
TrustProxy bool // take the client address from X-Forwarded-For, for use behind a reverse proxy
// Mobile companion (see push.go and mobile.go).
AppDir string // folder with the companion PWA, served at /app/
AppOrigin string // origin allowed to call the API from another site, such as https://sandbar-app.example.com
VapidSubject string // contact sent to push services: a mailto: or https: address (default: URL, if https)
PushAllowPrivate bool // allow push endpoints on private addresses and plain http, for development only
// Hammerhead link: when set, GET /api/v1/hammerhead/edges shows its edge and tunnel status.
HammerheadURL string
HammerheadEmail string
HammerheadPassword string
// Self-update (see update.go). Version is the running release, such as v0.2.0; anything else
// ("dev") never updates. Restart is called after a new binary is installed and should close
// what the process holds open before re-executing it.
@@ -57,6 +69,13 @@ type Server struct {
upd updateState
pushMu sync.Mutex // the VAPID key pair, loaded or created on first use
vapid *ecdsa.PrivateKey
vapidPub string
hhMu sync.Mutex
hhClient *http.Client
anaMu sync.Mutex // website analytics: the visitor salt and a per-address rate limit
anaSecret string
anaTry map[string][]time.Time