slapid and player now links when registering

This commit is contained in:
2026-02-17 18:33:22 +11:00
parent 9362448f22
commit 42282d05b1
11 changed files with 137 additions and 28 deletions

View File

@@ -15,6 +15,7 @@ import (
"git.haelnorr.com/h/oslstats/internal/permissions"
"git.haelnorr.com/h/oslstats/internal/rbac"
"git.haelnorr.com/h/oslstats/internal/store"
"git.haelnorr.com/h/oslstats/pkg/slapshotapi"
)
func addRoutes(
@@ -25,6 +26,7 @@ func addRoutes(
auth *hwsauth.Authenticator[*db.User, bun.Tx],
store *store.Store,
discordAPI *discord.APIClient,
slapAPI *slapshotapi.SlapAPI,
perms *rbac.Checker,
) error {
// Create the routes
@@ -55,7 +57,7 @@ func addRoutes(
{
Path: "/register",
Methods: []hws.Method{hws.MethodGET, hws.MethodPOST},
Handler: auth.LogoutReq(handlers.Register(s, auth, conn, cfg, store)),
Handler: auth.LogoutReq(handlers.Register(s, auth, conn, slapAPI, cfg, store)),
},
{
Path: "/logout",

View File

@@ -15,6 +15,7 @@ import (
"git.haelnorr.com/h/oslstats/internal/handlers"
"git.haelnorr.com/h/oslstats/internal/rbac"
"git.haelnorr.com/h/oslstats/internal/store"
"git.haelnorr.com/h/oslstats/pkg/slapshotapi"
)
func Setup(
@@ -24,6 +25,7 @@ func Setup(
conn *db.DB,
store *store.Store,
discordAPI *discord.APIClient,
slapAPI *slapshotapi.SlapAPI,
) (server *hws.Server, err error) {
if staticFS == nil {
return nil, errors.New("No filesystem provided")
@@ -67,7 +69,7 @@ func Setup(
return nil, errors.Wrap(err, "rbac.NewChecker")
}
err = addRoutes(httpServer, &fs, cfg, conn, auth, store, discordAPI, perms)
err = addRoutes(httpServer, &fs, cfg, conn, auth, store, discordAPI, slapAPI, perms)
if err != nil {
return nil, errors.Wrap(err, "addRoutes")
}