Mobile notifications for iOS (#210)
* mobile: wire notification registration and listener
* implement backend components for push notifications
* refactor: agentic comment cleanup
* docs: use proper module name for particle processor
* set required env variables for push notifications
* bump version
* fix: always upsert push token on mobile start
* Revert "fix: always upsert push token on mobile start"
This reverts commit 90ff18a788.
* send push notifications regardless of online status
This commit was merged in pull request #210.
This commit is contained in:
@@ -2,7 +2,7 @@ package middleware
|
||||
|
||||
import "net/http"
|
||||
|
||||
// CORS wraps a handler to add CORS headers and handle preflight requests.
|
||||
// CORS adds CORS headers and short-circuits preflight requests.
|
||||
func CORS(allowedOrigins []string) func(http.Handler) http.Handler {
|
||||
originSet := make(map[string]struct{}, len(allowedOrigins))
|
||||
for _, o := range allowedOrigins {
|
||||
@@ -13,7 +13,7 @@ func CORS(allowedOrigins []string) func(http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
origin := r.Header.Get("Origin")
|
||||
|
||||
// Check if the origin is allowed (empty allowedOrigins means allow all)
|
||||
// Empty allowedOrigins means allow all.
|
||||
allowed := len(originSet) == 0
|
||||
if !allowed {
|
||||
_, allowed = originSet[origin]
|
||||
@@ -27,7 +27,6 @@ func CORS(allowedOrigins []string) func(http.Handler) http.Handler {
|
||||
w.Header().Set("Access-Control-Max-Age", "86400")
|
||||
}
|
||||
|
||||
// Handle preflight
|
||||
if r.Method == http.MethodOptions {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user