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