userpage: use form langfile, move login strings to common

login-related stuff was moved into common using the langmover script, so
that the user page doesn't have to use the admin language files.
This commit is contained in:
Harvey Tindall
2023-06-17 12:48:28 +01:00
parent 96c62f556b
commit d3c5feaf1b
131 changed files with 569 additions and 474 deletions

View File

@@ -2,6 +2,23 @@ package main
import "github.com/gin-gonic/gin"
func (app *appContext) HelloWorld(gc *gin.Context) {
gc.JSON(200, stringResponse{"It worked!", "none"})
// @Summary Returns the logged-in user's Jellyfin ID & Username.
// @Produce json
// @Success 200 {object} MyDetailsDTO
// @Router /my/details [get]
// @tags User Page
func (app *appContext) MyDetails(gc *gin.Context) {
resp := MyDetailsDTO{
Id: gc.GetString("jfId"),
}
user, status, err := app.jf.UserByID(resp.Id, false)
if status != 200 || err != nil {
app.err.Printf("Failed to get Jellyfin user (%d): %+v\n", status, err)
respond(500, "Failed to get user", gc)
return
}
resp.Username = user.Name
gc.JSON(200, resp)
}