mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
28 lines
779 B
Go
28 lines
779 B
Go
package subsonic
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/deluan/navidrome/server/subsonic/responses"
|
|
)
|
|
|
|
type UsersController struct{}
|
|
|
|
func NewUsersController() *UsersController {
|
|
return &UsersController{}
|
|
}
|
|
|
|
// TODO This is a placeholder. The real one has to read this info from a config file or the database
|
|
func (c *UsersController) GetUser(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
|
user, err := RequiredParamString(r, "username", "Required string parameter 'username' is not present")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
response := NewResponse()
|
|
response.User = &responses.User{}
|
|
response.User.Username = user
|
|
response.User.StreamRole = true
|
|
response.User.DownloadRole = true
|
|
response.User.ScrobblingEnabled = true
|
|
return response, nil
|
|
}
|