An implementation of the ATProto statusphere example app but in Go
20
fork

Configure Feed

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

update the oauth routes and update the readme

+8 -10
+3 -3
cmd/main.go
··· 66 66 scopes := []string{"atproto", "transition:generic"} 67 67 if host == "" { 68 68 config = oauth.NewLocalhostConfig( 69 - fmt.Sprintf("http://127.0.0.1%s/oauth/callback", bind), 69 + fmt.Sprintf("http://127.0.0.1%s/oauth-callback", bind), 70 70 scopes, 71 71 ) 72 72 slog.Info("configuring localhost OAuth client", "CallbackURL", config.CallbackURL) 73 73 } else { 74 74 config = oauth.NewPublicConfig( 75 - fmt.Sprintf("%s/oauth/client-metadata.json", host), 76 - fmt.Sprintf("%s/oauth/oauth-callback", host), 75 + fmt.Sprintf("%s/oauth-client-metadata.json", host), 76 + fmt.Sprintf("%s/oauth-callback", host), 77 77 scopes, 78 78 ) 79 79 }
+1 -3
readme.md
··· 2 2 3 3 This is an implementation of the example [ATProto application Statusphere](https://atproto.com/guides/applications) but in Go. 4 4 5 - It makes use of an ATProto OAuth [library](https://github.com/haileyok/atproto-oauth-golang). Shout out to [Hailey](https://bsky.app/profile/hailey.at) for implementing a Go OAuth library! 6 - 7 5 ### What is the Statusphere app? 8 6 If you haven't read the [ATProto application Statusphere](https://atproto.com/guides/applications) guide about what this is, here is a quick summary. 9 7 ··· 17 15 18 16 A few environment variables are required to run the app. Use the `example.env` file as a template and store your environment variables in a `.env` file. 19 17 20 - * PRIVATEJWKS: This is a private JWKS. You can generate one using the same Go OAuth [library](https://github.com/haileyok/atproto-oauth-golang). Once created, base64 encode it so it's easier to store in your env. 18 + * PRIVATEJWKS: This is a private JWKS. You can generate one using this Go OAuth [library](https://github.com/haileyok/atproto-oauth-golang). Once created, base64 encode it so it's easier to store in your env. 21 19 * SESSION_KEY: This can be anything as it's what's used to encrypt session data sent to/from the client. 22 20 * HOST: This needs to be a http URL where the server is running. For local dev I suggest using something like [ngrok](https://ngrok.com) to run you app locally and make it accessable externally. This is important for OAuth as the callback URL configured needs to be a publically accessable. 23 21 * DATABASE_MOUNT_PATH: This is where you wish the mysql database to be located.
+4 -4
server.go
··· 79 79 mux.HandleFunc("POST /logout", srv.HandleLogOut) 80 80 81 81 mux.HandleFunc("/public/app.css", serveCSS) 82 - mux.HandleFunc("/oauth/jwks.json", srv.serveJwks) 83 - mux.HandleFunc("/oauth/client-metadata.json", srv.serveClientMetadata) 84 - mux.HandleFunc("/oauth/oauth-callback", srv.handleOauthCallback) 82 + mux.HandleFunc("/jwks.json", srv.serveJwks) 83 + mux.HandleFunc("/oauth-client-metadata.json", srv.serveClientMetadata) 84 + mux.HandleFunc("/oauth-callback", srv.handleOauthCallback) 85 85 86 86 addr := fmt.Sprintf("0.0.0.0:%d", port) 87 87 srv.httpserver = &http.Server{ ··· 140 140 metadata.ClientName = &clientName 141 141 metadata.ClientURI = &s.host 142 142 if s.oauthClient.Config.IsConfidential() { 143 - jwksURI := fmt.Sprintf("%s/oauth/jwks.json", r.Host) 143 + jwksURI := fmt.Sprintf("%s/jwks.json", r.Host) 144 144 metadata.JWKSURI = &jwksURI 145 145 } 146 146