tangled
alpha
login
or
join now
margin.at
/
margin
87
fork
atom
Write on the margins of the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
87
fork
atom
overview
issues
4
pulls
1
pipelines
this wasnt needed
scanash.com
1 week ago
e55e33dd
cb85af63
+1
-20
1 changed file
expand all
collapse all
unified
split
backend
cmd
server
main.go
+1
-20
backend/cmd/server/main.go
···
6
6
"net/http"
7
7
"os"
8
8
"os/signal"
9
9
-
"strings"
10
9
"syscall"
11
10
"time"
12
11
···
63
62
r.Use(middleware.Throttle(100))
64
63
65
64
r.Use(cors.Handler(cors.Options{
66
66
-
AllowOriginFunc: func(r *http.Request, origin string) bool {
67
67
-
if strings.HasPrefix(origin, "chrome-extension://") ||
68
68
-
strings.HasPrefix(origin, "moz-extension://") ||
69
69
-
strings.HasPrefix(origin, "safari-web-extension://") {
70
70
-
return true
71
71
-
}
72
72
-
allowedOrigins := []string{
73
73
-
"https://margin.at",
74
74
-
"https://www.margin.at",
75
75
-
"http://localhost:4321",
76
76
-
"http://localhost:8081",
77
77
-
}
78
78
-
for _, allowed := range allowedOrigins {
79
79
-
if origin == allowed {
80
80
-
return true
81
81
-
}
82
82
-
}
83
83
-
return false
84
84
-
},
65
65
+
AllowedOrigins: []string{"https://*", "http://*", "chrome-extension://*"},
85
66
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
86
67
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type", "X-CSRF-Token", "X-Session-Token"},
87
68
ExposedHeaders: []string{"Link"},