add some backend code for photopage

This commit is contained in:
2021-07-24 21:46:54 +02:00
parent f480df1e1b
commit ec0e76d041
4 changed files with 26 additions and 18 deletions

View File

@ -7,6 +7,7 @@ import (
"gopkg.in/oauth2.v3"
"net/http"
"openmediacenter/apiGo/api/oauth"
"openmediacenter/apiGo/database/settings"
)
const APIPREFIX = "/api"
@ -17,6 +18,7 @@ const (
SettingsNode = iota
ActorNode = iota
TVShowNode = iota
PhotoNode = iota
)
type HandlerInfo struct {
@ -47,7 +49,13 @@ func ServerInit() {
http.Handle(APIPREFIX+"/tags", oauth.ValidateToken(handlefunc, TagNode))
http.Handle(APIPREFIX+"/settings", oauth.ValidateToken(handlefunc, SettingsNode))
http.Handle(APIPREFIX+"/actor", oauth.ValidateToken(handlefunc, ActorNode))
http.Handle(APIPREFIX+"/tvshow", oauth.ValidateToken(handlefunc, TVShowNode))
// add tvshow endpoint only if tvshows enabled
if settings.TVShowsEnabled() {
http.Handle(APIPREFIX+"/tvshow", oauth.ValidateToken(handlefunc, TVShowNode))
}
http.Handle(APIPREFIX+"/photos", oauth.ValidateToken(handlefunc, PhotoNode))
// initialize oauth service and add corresponding auth routes
oauth.InitOAuth()

15
apiGo/api/Photos.go Normal file
View File

@ -0,0 +1,15 @@
package api
func AddPhotoHandlers() {
/**
* @api {post} /api/photos [getPhotos]
* @apiDescription get all available pictures
* @apiName getPhotos
* @apiGroup Photos
*
* @apiSuccess {string} result 'success' if successfully or error message if not
*/
AddHandler("getPhotos", PhotoNode, func(info *HandlerInfo) []byte {
return nil
})
}