mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2025-07-04 11:42:15 +02:00
Compare commits
1 Commits
1520e78bad
...
ovenmediae
Author | SHA1 | Date | |
---|---|---|---|
91b7f3d789 |
@ -20,7 +20,7 @@ type Options struct {
|
|||||||
|
|
||||||
// Backend to log user in
|
// Backend to log user in
|
||||||
type Backend interface {
|
type Backend interface {
|
||||||
Login(string, string) (bool, string, error)
|
Login(string, string) (bool, error)
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,15 +23,15 @@ type Basic struct {
|
|||||||
|
|
||||||
// Login hashs password and compare
|
// Login hashs password and compare
|
||||||
// Returns (true, nil) if success
|
// Returns (true, nil) if success
|
||||||
func (a Basic) Login(username string, password string) (bool, string, error) {
|
func (a Basic) Login(username string, password string) (bool, error) {
|
||||||
hash, ok := a.Cfg.Credentials[username]
|
hash, ok := a.Cfg.Credentials[username]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false, "", errors.New("user not found in credentials")
|
return false, errors.New("user not found in credentials")
|
||||||
}
|
}
|
||||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||||
|
|
||||||
// Login succeeded if no error
|
// Login succeeded if no error
|
||||||
return err == nil, username, err
|
return err == nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close has no connection to close
|
// Close has no connection to close
|
||||||
|
@ -3,13 +3,10 @@ package ldap
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-ldap/ldap/v3"
|
"github.com/go-ldap/ldap/v3"
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options holds package configuration
|
// Options holds package configuration
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Aliases map[string]map[string]string
|
|
||||||
URI string
|
URI string
|
||||||
UserDn string
|
UserDn string
|
||||||
}
|
}
|
||||||
@ -22,35 +19,13 @@ type LDAP struct {
|
|||||||
|
|
||||||
// Login tries to bind to LDAP
|
// Login tries to bind to LDAP
|
||||||
// Returns (true, nil) if success
|
// Returns (true, nil) if success
|
||||||
func (a LDAP) Login(username string, password string) (bool, string, error) {
|
func (a LDAP) Login(username string, password string) (bool, error) {
|
||||||
aliasSplit := strings.SplitN(username, "__", 2)
|
|
||||||
potentialUsernames := []string{username}
|
|
||||||
|
|
||||||
if len(aliasSplit) == 2 {
|
|
||||||
alias := aliasSplit[0]
|
|
||||||
trueUsername := aliasSplit[1]
|
|
||||||
// Resolve stream alias if necessary
|
|
||||||
if aliases, ok := a.Cfg.Aliases[alias]; ok {
|
|
||||||
if _, ok := aliases[trueUsername]; ok {
|
|
||||||
log.Printf("[LDAP] Use stream alias %s for username %s", alias, trueUsername)
|
|
||||||
potentialUsernames = append(potentialUsernames, trueUsername)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var err error = nil
|
|
||||||
for _, username := range potentialUsernames {
|
|
||||||
// Try to bind as user
|
// Try to bind as user
|
||||||
bindDn := "cn=" + username + "," + a.Cfg.UserDn
|
bindDn := "cn=" + username + "," + a.Cfg.UserDn
|
||||||
err = a.Conn.Bind(bindDn, password)
|
err := a.Conn.Bind(bindDn, password)
|
||||||
if err == nil {
|
|
||||||
// Login succeeded if no error
|
|
||||||
return true, aliasSplit[0], nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unable to log in
|
// Login succeeded if no error
|
||||||
return err == nil, "", err
|
return err == nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close LDAP connection
|
// Close LDAP connection
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
<HLS>
|
<HLS>
|
||||||
<Port>80</Port>
|
<Port>80</Port>
|
||||||
</HLS>
|
</HLS>
|
||||||
<DASH>
|
|
||||||
<Port>80</Port>
|
|
||||||
</DASH>
|
|
||||||
</Publishers>
|
</Publishers>
|
||||||
</Bind>
|
</Bind>
|
||||||
|
|
||||||
@ -55,15 +52,14 @@
|
|||||||
</Video>
|
</Video>
|
||||||
</Encode>
|
</Encode>
|
||||||
<Encode>
|
<Encode>
|
||||||
<Name>bypass</Name>
|
<Name>BYPASS</Name>
|
||||||
<Audio>
|
|
||||||
<Bypass>true</Bypass>
|
|
||||||
</Audio>
|
|
||||||
<Video>
|
<Video>
|
||||||
<Bypass>true</Bypass>
|
<Bypass>true</Bypass>
|
||||||
</Video>
|
</Video>
|
||||||
|
<Audio>
|
||||||
|
<Bypass>true</Bypass>
|
||||||
|
</Audio>
|
||||||
</Encode>
|
</Encode>
|
||||||
|
|
||||||
</Encodes>
|
</Encodes>
|
||||||
<Streams>
|
<Streams>
|
||||||
<Stream>
|
<Stream>
|
||||||
@ -75,10 +71,9 @@
|
|||||||
<Stream>
|
<Stream>
|
||||||
<Name>${OriginStreamName}_bypass</Name>
|
<Name>${OriginStreamName}_bypass</Name>
|
||||||
<Profiles>
|
<Profiles>
|
||||||
<Profile>bypass</Profile>
|
<Profile>BYPASS</Profile>
|
||||||
</Profiles>
|
</Profiles>
|
||||||
</Stream>
|
</Stream>
|
||||||
|
|
||||||
</Streams>
|
</Streams>
|
||||||
<Providers>
|
<Providers>
|
||||||
<RTMP>
|
<RTMP>
|
||||||
@ -91,25 +86,12 @@
|
|||||||
<Timeout>30000</Timeout>
|
<Timeout>30000</Timeout>
|
||||||
</WebRTC>
|
</WebRTC>
|
||||||
<HLS>
|
<HLS>
|
||||||
<SegmentDuration>2</SegmentDuration>
|
<SegmentDuration>5</SegmentDuration>
|
||||||
<SegmentCount>2</SegmentCount>
|
<SegmentCount>2</SegmentCount>
|
||||||
<CrossDomain>
|
<CrossDomain>
|
||||||
<Url>*</Url>
|
<Url>*</Url>
|
||||||
</CrossDomain>
|
</CrossDomain>
|
||||||
</HLS>
|
</HLS>
|
||||||
<DASH>
|
|
||||||
<SegmentDuration>2</SegmentDuration>
|
|
||||||
<SegmentCount>2</SegmentCount>
|
|
||||||
<CrossDomain>
|
|
||||||
<Url>*</Url>
|
|
||||||
</CrossDomain>
|
|
||||||
</DASH>
|
|
||||||
<LLDASH>
|
|
||||||
<SegmentDuration>2</SegmentDuration>
|
|
||||||
<CrossDomain>
|
|
||||||
<Url>*</Url>
|
|
||||||
</CrossDomain>
|
|
||||||
</LLDASH>
|
|
||||||
</Publishers>
|
</Publishers>
|
||||||
</Application>
|
</Application>
|
||||||
</Applications>
|
</Applications>
|
||||||
|
@ -34,13 +34,6 @@ auth:
|
|||||||
#ldap:
|
#ldap:
|
||||||
# uri: ldap://127.0.0.1:389
|
# uri: ldap://127.0.0.1:389
|
||||||
# userdn: cn=users,dc=example,dc=com
|
# userdn: cn=users,dc=example,dc=com
|
||||||
#
|
|
||||||
# # You can define aliases, to stream on stream.example.com/example with the credentials of the demo account.
|
|
||||||
# # You will have to use the streamid example__demo:password
|
|
||||||
# aliases:
|
|
||||||
# example:
|
|
||||||
# demo: ignored
|
|
||||||
#
|
|
||||||
|
|
||||||
## Stream forwarding ##
|
## Stream forwarding ##
|
||||||
# Forward an incoming stream to other servers
|
# Forward an incoming stream to other servers
|
||||||
|
@ -42,7 +42,6 @@ func New() *Config {
|
|||||||
Credentials: make(map[string]string),
|
Credentials: make(map[string]string),
|
||||||
},
|
},
|
||||||
LDAP: ldap.Options{
|
LDAP: ldap.Options{
|
||||||
Aliases: make(map[string]map[string]string),
|
|
||||||
URI: "ldap://127.0.0.1:389",
|
URI: "ldap://127.0.0.1:389",
|
||||||
UserDn: "cn=users,dc=example,dc=com",
|
UserDn: "cn=users,dc=example,dc=com",
|
||||||
},
|
},
|
||||||
|
@ -82,9 +82,7 @@ func Serve(streams *messaging.Streams, authBackend auth.Backend, cfg *Options) {
|
|||||||
name, password := split[0], split[1]
|
name, password := split[0], split[1]
|
||||||
if authBackend != nil {
|
if authBackend != nil {
|
||||||
// check password
|
// check password
|
||||||
ok, username, err := authBackend.Login(name, password)
|
if ok, err := authBackend.Login(name, password); !ok || err != nil {
|
||||||
name = username
|
|
||||||
if ok || err != nil {
|
|
||||||
log.Printf("Failed to authenticate for stream %s", name)
|
log.Printf("Failed to authenticate for stream %s", name)
|
||||||
s.Close()
|
s.Close()
|
||||||
continue
|
continue
|
||||||
|
@ -47,20 +47,10 @@ export function initViewerPage(stream, omeApp, viewersCounterRefreshPeriod, post
|
|||||||
"label": " WebRTC - Source"
|
"label": " WebRTC - Source"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "https://" + window.location.host + "/" + omeApp + "/" + stream + "_bypass/playlist.m3u8",
|
|
||||||
"type": "hls",
|
"type": "hls",
|
||||||
|
"file": "https://" + window.location.host + "/" + omeApp + "/" + stream + "_bypass/playlist.m3u8",
|
||||||
"label": " HLS"
|
"label": " HLS"
|
||||||
},
|
}
|
||||||
{
|
|
||||||
"file": "https://" + window.location.host + "/" + omeApp + "/" + stream + "_bypass/manifest.mpd",
|
|
||||||
"type": "dash",
|
|
||||||
"label": "DASH"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file": "https://" + window.location.host + "/" + omeApp + "/" + stream + "_bypass/manifest_ll.mpd",
|
|
||||||
"type": "dash",
|
|
||||||
"label": "LL-DASH"
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
player.on("stateChanged", function (data) {
|
player.on("stateChanged", function (data) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
/*! OvenPlayerv0.9.0 | (c)2020 AirenSoft Co., Ltd. | MIT license (https://github.com/AirenSoft/OvenPlayerPrivate/blob/master/LICENSE) | Github : https://github.com/AirenSoft/OvenPlayer */
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
/*! OvenPlayerv0.9.0 | (c)2020 AirenSoft Co., Ltd. | MIT license (https://github.com/AirenSoft/OvenPlayerPrivate/blob/master/LICENSE) | Github : https://github.com/AirenSoft/OvenPlayer */
|
|
@ -36,7 +36,6 @@
|
|||||||
|
|
||||||
{{if .OMECfg.Enabled}}
|
{{if .OMECfg.Enabled}}
|
||||||
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/dashjs/2.9.3/dash.all.min.js"></script>
|
|
||||||
<script src="/static/ovenplayer/ovenplayer.js"></script>
|
<script src="/static/ovenplayer/ovenplayer.js"></script>
|
||||||
<script src="/static/js/ovenplayer.js"></script>
|
<script src="/static/js/ovenplayer.js"></script>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Reference in New Issue
Block a user