delete useless custombackend popup

correct load of subpage when standalone binary
ability to set external videourl when using standalone binary
This commit is contained in:
2021-04-02 17:04:15 +00:00
parent c0405cd79a
commit d9d6907745
13 changed files with 145 additions and 173 deletions

View File

@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"openmediacenter/apiGo/api/oauth"
)
@ -37,7 +36,7 @@ func AddHandler(action string, apiNode int, n interface{}, h func() []byte) {
handlers = append(handlers, Handler{action, h, n, apiNode})
}
func ServerInit(port uint16) {
func ServerInit() {
http.Handle(APIPREFIX+"/video", oauth.ValidateToken(videoHandler))
http.Handle(APIPREFIX+"/tags", oauth.ValidateToken(tagHandler))
http.Handle(APIPREFIX+"/settings", oauth.ValidateToken(settingsHandler))
@ -48,9 +47,6 @@ func ServerInit(port uint16) {
// initialize oauth service and add corresponding auth routes
oauth.InitOAuth()
fmt.Printf("OpenMediacenter server up and running on port %d\n", port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}
func handleAPICall(action string, requestBody string, apiNode int) []byte {

View File

@ -3,6 +3,8 @@ package api
import (
"encoding/json"
"openmediacenter/apiGo/database/settings"
"regexp"
"strings"
)
func AddInitHandlers() {
@ -20,11 +22,15 @@ func passwordNeeded() {
VideoPath string
}
regexMatchUrl := regexp.MustCompile("^http(|s):\\/\\/([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}:[0-9]{1,5}")
videoUrl := regexMatchUrl.FindString(sett.VideoPath)
serverVideoPath := strings.TrimPrefix(sett.VideoPath, videoUrl)
res := InitialDataTypeResponse{
DarkMode: sett.DarkMode,
Pasword: sett.Pasword != "-1",
MediacenterName: sett.Mediacenter_name,
VideoPath: sett.VideoPath,
VideoPath: serverVideoPath,
}
str, _ := json.Marshal(res)