1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-15 23:00:10 +00:00

userpage: register routes on reverse proxy subfolder

fixes #289.
This commit is contained in:
Harvey Tindall 2023-10-02 09:45:38 +01:00
parent 5a2d3d2ee2
commit ff1ea8549a
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 19 additions and 21 deletions

View File

@ -160,12 +160,11 @@ func (app *appContext) loadRoutes(router *gin.Engine) {
api := router.Group("/", app.webAuth()) api := router.Group("/", app.webAuth())
for _, p := range routePrefixes {
var user *gin.RouterGroup var user *gin.RouterGroup
if userPageEnabled { if userPageEnabled {
user = router.Group("/my", app.userAuth()) user = router.Group(p+"/my", app.userAuth())
} }
for _, p := range routePrefixes {
router.POST(p+"/logout", app.Logout) router.POST(p+"/logout", app.Logout)
api.DELETE(p+"/users", app.DeleteUsers) api.DELETE(p+"/users", app.DeleteUsers)
api.GET(p+"/users", app.GetUsers) api.GET(p+"/users", app.GetUsers)
@ -234,22 +233,22 @@ func (app *appContext) loadRoutes(router *gin.Engine) {
} }
if userPageEnabled { if userPageEnabled {
user.GET(p+"/details", app.MyDetails) user.GET("/details", app.MyDetails)
user.POST(p+"/contact", app.SetMyContactMethods) user.POST("/contact", app.SetMyContactMethods)
user.POST(p+"/logout", app.LogoutUser) user.POST("/logout", app.LogoutUser)
user.POST(p+"/email", app.ModifyMyEmail) user.POST("/email", app.ModifyMyEmail)
user.GET(p+"/discord/invite", app.MyDiscordServerInvite) user.GET("/discord/invite", app.MyDiscordServerInvite)
user.GET(p+"/pin/:service", app.GetMyPIN) user.GET("/pin/:service", app.GetMyPIN)
user.GET(p+"/discord/verified/:pin", app.MyDiscordVerifiedInvite) user.GET("/discord/verified/:pin", app.MyDiscordVerifiedInvite)
user.GET(p+"/telegram/verified/:pin", app.MyTelegramVerifiedInvite) user.GET("/telegram/verified/:pin", app.MyTelegramVerifiedInvite)
user.POST(p+"/matrix/user", app.MatrixSendMyPIN) user.POST("/matrix/user", app.MatrixSendMyPIN)
user.GET(p+"/matrix/verified/:userID/:pin", app.MatrixCheckMyPIN) user.GET("/matrix/verified/:userID/:pin", app.MatrixCheckMyPIN)
user.DELETE(p+"/discord", app.UnlinkMyDiscord) user.DELETE("/discord", app.UnlinkMyDiscord)
user.DELETE(p+"/telegram", app.UnlinkMyTelegram) user.DELETE("/telegram", app.UnlinkMyTelegram)
user.DELETE(p+"/matrix", app.UnlinkMyMatrix) user.DELETE("/matrix", app.UnlinkMyMatrix)
user.POST(p+"/password", app.ChangeMyPassword) user.POST("/password", app.ChangeMyPassword)
if app.config.Section("user_page").Key("referrals").MustBool(false) { if app.config.Section("user_page").Key("referrals").MustBool(false) {
user.GET(p+"/referral", app.GetMyReferral) user.GET("/referral", app.GetMyReferral)
} }
} }
} }

View File

@ -556,7 +556,6 @@ changePasswordButton.addEventListener("click", () => {
} }
}); });
}); });
// FIXME: Submit & Validate
document.addEventListener("details-reload", () => { document.addEventListener("details-reload", () => {
_get("/my/details", null, (req: XMLHttpRequest) => { _get("/my/details", null, (req: XMLHttpRequest) => {