An atproto PDS written in Go

remove fallback proxy header

Changed files
+22 -35
cmd
cocoon
server
+2 -8
cmd/cocoon/main.go
··· 132 EnvVars: []string{"COCOON_SESSION_SECRET"}, 133 }, 134 &cli.StringFlag{ 135 - Name: "default-atproto-proxy", 136 - EnvVars: []string{"COCOON_DEFAULT_ATPROTO_PROXY"}, 137 - Value: "did:web:api.bsky.app#bsky_appview", 138 - }, 139 - &cli.StringFlag{ 140 Name: "blockstore-variant", 141 EnvVars: []string{"COCOON_BLOCKSTORE_VARIANT"}, 142 Value: "sqlite", ··· 189 AccessKey: cmd.String("s3-access-key"), 190 SecretKey: cmd.String("s3-secret-key"), 191 }, 192 - SessionSecret: cmd.String("session-secret"), 193 - DefaultAtprotoProxy: cmd.String("default-atproto-proxy"), 194 - BlockstoreVariant: server.MustReturnBlockstoreVariant(cmd.String("blockstore-variant")), 195 }) 196 if err != nil { 197 fmt.Printf("error creating cocoon: %v", err)
··· 132 EnvVars: []string{"COCOON_SESSION_SECRET"}, 133 }, 134 &cli.StringFlag{ 135 Name: "blockstore-variant", 136 EnvVars: []string{"COCOON_BLOCKSTORE_VARIANT"}, 137 Value: "sqlite", ··· 184 AccessKey: cmd.String("s3-access-key"), 185 SecretKey: cmd.String("s3-secret-key"), 186 }, 187 + SessionSecret: cmd.String("session-secret"), 188 + BlockstoreVariant: server.MustReturnBlockstoreVariant(cmd.String("blockstore-variant")), 189 }) 190 if err != nil { 191 fmt.Printf("error creating cocoon: %v", err)
-3
server/handle_proxy.go
··· 19 20 func (s *Server) getAtprotoProxyEndpointFromRequest(e echo.Context) (string, string, error) { 21 svc := e.Request().Header.Get("atproto-proxy") 22 - if svc == "" { 23 - svc = s.config.DefaultAtprotoProxy 24 - } 25 26 svcPts := strings.Split(svc, "#") 27 if len(svcPts) != 2 {
··· 19 20 func (s *Server) getAtprotoProxyEndpointFromRequest(e echo.Context) (string, string, error) { 21 svc := e.Request().Header.Get("atproto-proxy") 22 23 svcPts := strings.Split(svc, "#") 24 if len(svcPts) != 2 {
+20 -24
server/server.go
··· 104 105 SessionSecret string 106 107 - DefaultAtprotoProxy string 108 - 109 BlockstoreVariant BlockstoreVariant 110 } 111 112 type config struct { 113 - Version string 114 - Did string 115 - Hostname string 116 - ContactEmail string 117 - EnforcePeering bool 118 - Relays []string 119 - AdminPassword string 120 - SmtpEmail string 121 - SmtpName string 122 - DefaultAtprotoProxy string 123 - BlockstoreVariant BlockstoreVariant 124 } 125 126 type CustomValidator struct { ··· 343 plcClient: plcClient, 344 privateKey: &pkey, 345 config: &config{ 346 - Version: args.Version, 347 - Did: args.Did, 348 - Hostname: args.Hostname, 349 - ContactEmail: args.ContactEmail, 350 - EnforcePeering: false, 351 - Relays: args.Relays, 352 - AdminPassword: args.AdminPassword, 353 - SmtpName: args.SmtpName, 354 - SmtpEmail: args.SmtpEmail, 355 - DefaultAtprotoProxy: args.DefaultAtprotoProxy, 356 - BlockstoreVariant: args.BlockstoreVariant, 357 }, 358 evtman: events.NewEventManager(events.NewMemPersister()), 359 passport: identity.NewPassport(h, identity.NewMemCache(10_000)),
··· 104 105 SessionSecret string 106 107 BlockstoreVariant BlockstoreVariant 108 } 109 110 type config struct { 111 + Version string 112 + Did string 113 + Hostname string 114 + ContactEmail string 115 + EnforcePeering bool 116 + Relays []string 117 + AdminPassword string 118 + SmtpEmail string 119 + SmtpName string 120 + BlockstoreVariant BlockstoreVariant 121 } 122 123 type CustomValidator struct { ··· 340 plcClient: plcClient, 341 privateKey: &pkey, 342 config: &config{ 343 + Version: args.Version, 344 + Did: args.Did, 345 + Hostname: args.Hostname, 346 + ContactEmail: args.ContactEmail, 347 + EnforcePeering: false, 348 + Relays: args.Relays, 349 + AdminPassword: args.AdminPassword, 350 + SmtpName: args.SmtpName, 351 + SmtpEmail: args.SmtpEmail, 352 + BlockstoreVariant: args.BlockstoreVariant, 353 }, 354 evtman: events.NewEventManager(events.NewMemPersister()), 355 passport: identity.NewPassport(h, identity.NewMemCache(10_000)),