Skip to content

WIP: connect-go connectrpc#181

Open
DivineGod wants to merge 6 commits intomainfrom
feat/proto
Open

WIP: connect-go connectrpc#181
DivineGod wants to merge 6 commits intomainfrom
feat/proto

Conversation

@DivineGod
Copy link
Contributor

@DivineGod DivineGod commented Feb 10, 2026

This is a wip spike to see how well the connectrpc connect-go stuff would slot in to dogeboxd.

I think it's possible to make it work without too much trouble.

There's some work to create a protobuf schema for each of the rest api endpoints, but as this initial work shows it should be possible to do this work incrementally.

Important read is the getting started guide here: https://connectrpc.com/docs/go/getting-started

Frontend: Dogebox-WG/dpanel#190

References: Dogebox-WG/dpanel#187

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've yet to crystalise on how to handle this bit. So it's missing from the PR for now

pkg/web/rest.go Outdated
Comment on lines 63 to 67
authenticator := &AuthenticateServer{a}
authenticatePath, authenticateHandler := authenticatev1connect.NewAuthenticateServiceHandler(authenticator, connect.WithInterceptors(validate.NewInterceptor()))
// Recovery routes are the _only_ routes loaded in recovery mode.
recoveryRoutes := map[string]http.HandlerFunc{
"POST /authenticate": a.authenticate,
authenticatePath: authenticateHandler,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having handler functions being defined on the api struct, the *Server structs accept the api context (as a) to use in their handler functions.

type AuthenticateRequestBody struct {
Password string `json:"password"`
type AuthenticateServer struct {
a api
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We take in the api struct as context for the AuthenticateServer struct so the Authenticate function can use it when handling requests

Comment on lines -195 to -206
body, err := io.ReadAll(r.Body)
if err != nil {
sendErrorResponse(w, http.StatusBadRequest, "Error reading request body")
return
}
defer r.Body.Close()

var requestBody AuthenticateRequestBody
if err := json.Unmarshal(body, &requestBody); err != nil {
http.Error(w, "Error parsing payload", http.StatusBadRequest)
return
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the boilerplate is no longer needed since protobuf impl is handling this for us so we can focus on the fun parts of the implementation

@DivineGod DivineGod requested a review from a team February 10, 2026 02:43
@elusiveshiba
Copy link
Contributor

elusiveshiba commented Feb 10, 2026

@DivineGod - This still needs to be expanded to allow the new auth endpoint to be used when un-authed
https://github.com/Dogebox-WG/dogeboxd/blob/feat/proto/pkg/web/session.go#L126

Signed-off-by: Ando “Thor” Nando  <divinegod@gmail.com>
@DivineGod DivineGod marked this pull request as ready for review February 16, 2026 23:44
@DivineGod
Copy link
Contributor Author

Follow up to this would be slowly moving over each endpoint as we have spare time to do so

@elusiveshiba
Copy link
Contributor

I've split out the URL updates into #186 to clean this up a bit

Signed-off-by: Ben <elusiveshiba@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants