add some backend code for photopage
This commit is contained in:
parent
f480df1e1b
commit
ec0e76d041
@ -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))
|
||||
|
||||
// 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
15
apiGo/api/Photos.go
Normal 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
|
||||
})
|
||||
}
|
@ -33,6 +33,7 @@ func main() {
|
||||
api.AddTagHandlers()
|
||||
api.AddActorsHandlers()
|
||||
api.AddTvshowHandlers()
|
||||
api.AddPhotoHandlers()
|
||||
|
||||
videoparser.SetupSettingsWebsocket()
|
||||
|
||||
|
@ -38,19 +38,6 @@ export function PhotoPage(): JSX.Element {
|
||||
target: '_blank'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
// HTML item:
|
||||
itemId: 'htmlItem',
|
||||
html: "<div style='width: 300px; height: 200px; background:pink;'>I am a text block</div>",
|
||||
metadata: {
|
||||
type: 'text',
|
||||
height: 200,
|
||||
width: 300,
|
||||
title: 'sample-title',
|
||||
description: 'sample-description',
|
||||
backgroundColor: 'pink'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
@ -73,16 +60,13 @@ export function PhotoPage(): JSX.Element {
|
||||
// The eventsListener will notify you anytime something has happened in the gallery.
|
||||
const eventsListener = (eventName: unknown, eventData: unknown): void => console.log({eventName, eventData});
|
||||
|
||||
// The scrollingElement is usually the window, if you are scrolling inside another element, suplly it here
|
||||
const scrollingElement = window;
|
||||
|
||||
return (
|
||||
<ExpandableProGallery
|
||||
items={items}
|
||||
options={options}
|
||||
container={container}
|
||||
eventsListener={eventsListener}
|
||||
scrollingElement={scrollingElement}
|
||||
scrollingElement={window}
|
||||
viewMode={1}
|
||||
/>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user