Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add CORS to bskyweb (#5221)

authored by

Jaz and committed by
GitHub
9e1eb1f9 f2408939

+14
+7
bskyweb/cmd/bskyweb/main.go
··· 80 80 Value: "", 81 81 EnvVars: []string{"BASIC_AUTH_PASSWORD"}, 82 82 }, 83 + &cli.StringSliceFlag{ 84 + Name: "cors-allowed-origins", 85 + Usage: "list of allowed origins for CORS requests", 86 + Required: false, 87 + Value: cli.NewStringSlice("https://bsky.app", "https://main.bsky.dev", "https://app.staging.bsky.dev"), 88 + EnvVars: []string{"CORS_ALLOWED_ORIGINS"}, 89 + }, 83 90 }, 84 91 }, 85 92 }
+7
bskyweb/cmd/bskyweb/server.go
··· 57 57 linkHost := cctx.String("link-host") 58 58 ipccHost := cctx.String("ipcc-host") 59 59 basicAuthPassword := cctx.String("basic-auth-password") 60 + corsOrigins := cctx.StringSlice("cors-allowed-origins") 60 61 61 62 // Echo 62 63 e := echo.New() ··· 166 167 // all of our current endpoints have no trailing slash. 167 168 e.Use(middleware.RemoveTrailingSlashWithConfig(middleware.TrailingSlashConfig{ 168 169 RedirectCode: http.StatusFound, 170 + })) 171 + 172 + // CORS middleware 173 + e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ 174 + AllowOrigins: corsOrigins, 175 + AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions}, 169 176 })) 170 177 171 178 //