PLT-4550 move webrtc to TE (#4440)
* PLT-4550 move webrtc to TE * remove webrtc from makefile enterprise tests
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
6289c72686
Коммит
772b57386f
21
Makefile
21
Makefile
@@ -77,6 +77,14 @@ start-docker:
|
|||||||
docker start mattermost-postgres > /dev/null; \
|
docker start mattermost-postgres > /dev/null; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@if [ $(shell docker ps -a | grep -ci mattermost-webrtc) -eq 0 ]; then \
|
||||||
|
echo starting mattermost-webrtc; \
|
||||||
|
docker run --name mattermost-webrtc -p 7088:7088 -p 7089:7089 -p 8188:8188 -p 8189:8189 -d mattermost/webrtc:latest > /dev/null; \
|
||||||
|
elif [ $(shell docker ps | grep -ci mattermost-webrtc) -eq 0 ]; then \
|
||||||
|
echo restarting mattermost-webrtc; \
|
||||||
|
docker start mattermost-webrtc > /dev/null; \
|
||||||
|
fi
|
||||||
|
|
||||||
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
ifeq ($(BUILD_ENTERPRISE_READY),true)
|
||||||
@echo Ldap test user test.one
|
@echo Ldap test user test.one
|
||||||
@if [ $(shell docker ps -a | grep -ci mattermost-openldap) -eq 0 ]; then \
|
@if [ $(shell docker ps -a | grep -ci mattermost-openldap) -eq 0 ]; then \
|
||||||
@@ -99,14 +107,6 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|||||||
docker start mattermost-openldap > /dev/null; \
|
docker start mattermost-openldap > /dev/null; \
|
||||||
sleep 10; \
|
sleep 10; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@if [ $(shell docker ps -a | grep -ci mattermost-webrtc) -eq 0 ]; then \
|
|
||||||
echo starting mattermost-webrtc; \
|
|
||||||
docker run --name mattermost-webrtc -p 7088:7088 -p 7089:7089 -p 8188:8188 -p 8189:8189 -d mattermost/webrtc:latest > /dev/null; \
|
|
||||||
elif [ $(shell docker ps | grep -ci mattermost-webrtc) -eq 0 ]; then \
|
|
||||||
echo restarting mattermost-webrtc; \
|
|
||||||
docker start mattermost-webrtc > /dev/null; \
|
|
||||||
fi
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
stop-docker:
|
stop-docker:
|
||||||
@@ -209,7 +209,6 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|||||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/saml && ./saml.test -test.v -test.timeout=60s -test.coverprofile=csaml.out || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/saml && ./saml.test -test.v -test.timeout=60s -test.coverprofile=csaml.out || exit 1
|
||||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/cluster && ./cluster.test -test.v -test.timeout=60s -test.coverprofile=ccluster.out || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/cluster && ./cluster.test -test.v -test.timeout=60s -test.coverprofile=ccluster.out || exit 1
|
||||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/account_migration && ./account_migration.test -test.v -test.timeout=60s -test.coverprofile=caccount_migration.out || exit 1
|
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/account_migration && ./account_migration.test -test.v -test.timeout=60s -test.coverprofile=caccount_migration.out || exit 1
|
||||||
$(GO) test $(GOFLAGS) -run=$(TESTS) -covermode=count -c ./enterprise/webrtc && ./webrtc.test -test.v -test.timeout=60s -test.coverprofile=cwebrtc.out || exit 1
|
|
||||||
|
|
||||||
tail -n +2 cldap.out >> ecover.out
|
tail -n +2 cldap.out >> ecover.out
|
||||||
tail -n +2 ccompliance.out >> ecover.out
|
tail -n +2 ccompliance.out >> ecover.out
|
||||||
@@ -218,8 +217,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|||||||
tail -n +2 csaml.out >> ecover.out
|
tail -n +2 csaml.out >> ecover.out
|
||||||
tail -n +2 ccluster.out >> ecover.out
|
tail -n +2 ccluster.out >> ecover.out
|
||||||
tail -n +2 caccount_migration.out >> ecover.out
|
tail -n +2 caccount_migration.out >> ecover.out
|
||||||
tail -n +2 cwebrtc.out >> ecover.out
|
rm -f cldap.out ccompliance.out cmfa.out cemoji.out csaml.out ccluster.out caccount_migration.out
|
||||||
rm -f cldap.out ccompliance.out cmfa.out cemoji.out csaml.out ccluster.out caccount_migration.out cwebrtc.out
|
|
||||||
rm -r ldap.test
|
rm -r ldap.test
|
||||||
rm -r compliance.test
|
rm -r compliance.test
|
||||||
rm -r mfa.test
|
rm -r mfa.test
|
||||||
@@ -227,7 +225,6 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
|
|||||||
rm -r saml.test
|
rm -r saml.test
|
||||||
rm -r cluster.test
|
rm -r cluster.test
|
||||||
rm -r account_migration.test
|
rm -r account_migration.test
|
||||||
rm -r webrtc.test
|
|
||||||
rm -f config/*.crt
|
rm -f config/*.crt
|
||||||
rm -f config/*.key
|
rm -f config/*.key
|
||||||
endif
|
endif
|
||||||
|
|||||||
12
api/user.go
12
api/user.go
@@ -750,9 +750,7 @@ func RevokeSessionById(c *Context, sessionId string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if webrtcInterface := einterfaces.GetWebrtcInterface(); webrtcInterface != nil {
|
RevokeWebrtcToken(session.Id)
|
||||||
webrtcInterface.RevokeToken(session.Id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -776,9 +774,7 @@ func RevokeAllSession(c *Context, userId string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if webrtcInterface := einterfaces.GetWebrtcInterface(); webrtcInterface != nil {
|
RevokeWebrtcToken(session.Id)
|
||||||
webrtcInterface.RevokeToken(session.Id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -801,9 +797,7 @@ func RevokeAllSessionsNoContext(userId string) *model.AppError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if webrtcInterface := einterfaces.GetWebrtcInterface(); webrtcInterface != nil {
|
RevokeWebrtcToken(session.Id)
|
||||||
webrtcInterface.RevokeToken(session.Id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
103
api/webrtc.go
103
api/webrtc.go
@@ -4,11 +4,18 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/hmac"
|
||||||
|
"crypto/sha1"
|
||||||
|
"crypto/tls"
|
||||||
|
"encoding/base64"
|
||||||
l4g "github.com/alecthomas/log4go"
|
l4g "github.com/alecthomas/log4go"
|
||||||
"github.com/mattermost/platform/einterfaces"
|
|
||||||
"github.com/mattermost/platform/model"
|
"github.com/mattermost/platform/model"
|
||||||
"github.com/mattermost/platform/utils"
|
"github.com/mattermost/platform/utils"
|
||||||
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitWebrtc() {
|
func InitWebrtc() {
|
||||||
@@ -20,18 +27,26 @@ func InitWebrtc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func webrtcToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
func webrtcToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
webrtcInterface := einterfaces.GetWebrtcInterface()
|
if token, err := getWebrtcToken(c.Session.Id); err != nil {
|
||||||
|
|
||||||
if webrtcInterface == nil {
|
|
||||||
c.Err = model.NewLocAppError("webrtcToken", "api.webrtc.not_available.app_error", nil, "")
|
|
||||||
c.Err.StatusCode = http.StatusNotImplemented
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if result, err := webrtcInterface.Token(c.Session.Id); err != nil {
|
|
||||||
c.Err = err
|
c.Err = err
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
|
result := make(map[string]string)
|
||||||
|
result["token"] = token
|
||||||
|
result["gateway_url"] = *utils.Cfg.WebrtcSettings.GatewayWebsocketUrl
|
||||||
|
|
||||||
|
if len(*utils.Cfg.WebrtcSettings.StunURI) > 0 {
|
||||||
|
result["stun_uri"] = *utils.Cfg.WebrtcSettings.StunURI
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(*utils.Cfg.WebrtcSettings.TurnURI) > 0 {
|
||||||
|
timestamp := strconv.FormatInt(utils.EndOfDay(time.Now().AddDate(0, 0, 1)).Unix(), 10)
|
||||||
|
username := timestamp + ":" + *utils.Cfg.WebrtcSettings.TurnUsername
|
||||||
|
|
||||||
|
result["turn_uri"] = *utils.Cfg.WebrtcSettings.TurnURI
|
||||||
|
result["turn_password"] = generateTurnPassword(username, *utils.Cfg.WebrtcSettings.TurnSharedKey)
|
||||||
|
result["turn_username"] = username
|
||||||
|
}
|
||||||
w.Write([]byte(model.MapToJson(result)))
|
w.Write([]byte(model.MapToJson(result)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,3 +64,71 @@ func webrtcMessage(req *model.WebSocketRequest) (map[string]interface{}, *model.
|
|||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getWebrtcToken(sessionId string) (string, *model.AppError) {
|
||||||
|
if !*utils.Cfg.WebrtcSettings.Enable {
|
||||||
|
return "", model.NewLocAppError("WebRTC.getWebrtcToken", "api.webrtc.disabled.app_error", nil, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
token := base64.StdEncoding.EncodeToString([]byte(sessionId))
|
||||||
|
|
||||||
|
data := make(map[string]string)
|
||||||
|
data["janus"] = "add_token"
|
||||||
|
data["token"] = token
|
||||||
|
data["transaction"] = model.NewId()
|
||||||
|
data["admin_secret"] = *utils.Cfg.WebrtcSettings.GatewayAdminSecret
|
||||||
|
|
||||||
|
rq, _ := http.NewRequest("POST", *utils.Cfg.WebrtcSettings.GatewayAdminUrl, strings.NewReader(model.MapToJson(data)))
|
||||||
|
rq.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
tr := &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections},
|
||||||
|
}
|
||||||
|
httpClient := &http.Client{Transport: tr}
|
||||||
|
if rp, err := httpClient.Do(rq); err != nil {
|
||||||
|
return "", model.NewLocAppError("WebRTC.Token", "model.client.connecting.app_error", nil, err.Error())
|
||||||
|
} else if rp.StatusCode >= 300 {
|
||||||
|
defer closeBody(rp)
|
||||||
|
return "", model.AppErrorFromJson(rp.Body)
|
||||||
|
} else {
|
||||||
|
janusResponse := model.GatewayResponseFromJson(rp.Body)
|
||||||
|
if janusResponse.Status != "success" {
|
||||||
|
return "", model.NewLocAppError("getWebrtcToken", "api.webrtc.register_token.app_error", nil, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return token, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateTurnPassword(username string, secret string) string {
|
||||||
|
key := []byte(secret)
|
||||||
|
h := hmac.New(sha1.New, key)
|
||||||
|
h.Write([]byte(username))
|
||||||
|
return base64.StdEncoding.EncodeToString(h.Sum(nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
func closeBody(r *http.Response) {
|
||||||
|
if r.Body != nil {
|
||||||
|
ioutil.ReadAll(r.Body)
|
||||||
|
r.Body.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func RevokeWebrtcToken(sessionId string) {
|
||||||
|
token := base64.StdEncoding.EncodeToString([]byte(sessionId))
|
||||||
|
data := make(map[string]string)
|
||||||
|
data["janus"] = "remove_token"
|
||||||
|
data["token"] = token
|
||||||
|
data["transaction"] = model.NewId()
|
||||||
|
data["admin_secret"] = *utils.Cfg.WebrtcSettings.GatewayAdminSecret
|
||||||
|
|
||||||
|
rq, _ := http.NewRequest("POST", *utils.Cfg.WebrtcSettings.GatewayAdminUrl, strings.NewReader(model.MapToJson(data)))
|
||||||
|
rq.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
// we do not care about the response
|
||||||
|
tr := &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: *utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections},
|
||||||
|
}
|
||||||
|
httpClient := &http.Client{Transport: tr}
|
||||||
|
httpClient.Do(rq)
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,16 +3,41 @@
|
|||||||
|
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/mattermost/platform/model"
|
||||||
|
"github.com/mattermost/platform/utils"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func TestWebrtcToken(t *testing.T) {
|
func TestWebrtcToken(t *testing.T) {
|
||||||
th := Setup().InitBasic()
|
th := Setup().InitBasic()
|
||||||
|
|
||||||
if _, err := th.BasicClient.GetWebrtcToken(); err != nil {
|
*utils.Cfg.WebrtcSettings.Enable = false
|
||||||
if err.Id != "api.webrtc.not_available.app_error" {
|
if _, err := th.BasicClient.GetWebrtcToken(); err == nil {
|
||||||
t.Fatal("Should have fail, webrtc not availble")
|
t.Fatal("should have failed")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
t.Fatal("Should have fail, webrtc not availble")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*utils.Cfg.WebrtcSettings.Enable = true
|
||||||
|
*utils.Cfg.WebrtcSettings.GatewayAdminUrl = "https://dockerhost:7089/admin"
|
||||||
|
*utils.Cfg.WebrtcSettings.GatewayWebsocketUrl = "wss://dockerhost:8189"
|
||||||
|
*utils.Cfg.WebrtcSettings.GatewayAdminSecret = "janusoverlord"
|
||||||
|
*utils.Cfg.WebrtcSettings.StunURI = "stun:dockerhost:5349"
|
||||||
|
*utils.Cfg.WebrtcSettings.TurnURI = "turn:dockerhost:5349"
|
||||||
|
*utils.Cfg.WebrtcSettings.TurnUsername = "test"
|
||||||
|
*utils.Cfg.WebrtcSettings.TurnSharedKey = "mattermost"
|
||||||
|
*utils.Cfg.ServiceSettings.EnableInsecureOutgoingConnections = true
|
||||||
|
sessionId := model.NewId()
|
||||||
|
if result, err := th.BasicClient.GetWebrtcToken(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
} else {
|
||||||
|
fmt.Println("Token", result["token"])
|
||||||
|
fmt.Println("Gateway Websocket", result["gateway_url"])
|
||||||
|
fmt.Println("Stun URI", result["stun_uri"])
|
||||||
|
fmt.Println("Turn URI", result["turn_uri"])
|
||||||
|
fmt.Println("Turn Username", result["turn_username"])
|
||||||
|
fmt.Println("Turn Password", result["turn_password"])
|
||||||
|
}
|
||||||
|
|
||||||
|
RevokeWebrtcToken(sessionId)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
||||||
// See License.txt for license information.
|
|
||||||
|
|
||||||
package einterfaces
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/mattermost/platform/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type WebrtcInterface interface {
|
|
||||||
Token(sessionId string) (map[string]string, *model.AppError)
|
|
||||||
RevokeToken(sessionId string)
|
|
||||||
}
|
|
||||||
|
|
||||||
var theWebrtcInterface WebrtcInterface
|
|
||||||
|
|
||||||
func RegisterWebrtcInterface(newInterface WebrtcInterface) {
|
|
||||||
theWebrtcInterface = newInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetWebrtcInterface() WebrtcInterface {
|
|
||||||
return theWebrtcInterface
|
|
||||||
}
|
|
||||||
20
i18n/en.json
20
i18n/en.json
@@ -2527,13 +2527,17 @@
|
|||||||
"id": "api.webhook.regen_outgoing_token.permissions.app_error",
|
"id": "api.webhook.regen_outgoing_token.permissions.app_error",
|
||||||
"translation": "Inappropriate permissions to regenerate outcoming webhook token"
|
"translation": "Inappropriate permissions to regenerate outcoming webhook token"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "api.webrtc.disabled.app_error",
|
||||||
|
"translation": "WebRTC is not enabled in this server."
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "api.webrtc.init.debug",
|
"id": "api.webrtc.init.debug",
|
||||||
"translation": "Initializing WebRTC api routes"
|
"translation": "Initializing WebRTC api routes"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "api.webrtc.not_available.app_error",
|
"id": "api.webrtc.register_token.app_error",
|
||||||
"translation": "WebRTC is not available on this server."
|
"translation": "We encountered an error trying to register the WebRTC Token"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "api.websocket_handler.invalid_param.app_error",
|
"id": "api.websocket_handler.invalid_param.app_error",
|
||||||
@@ -2823,18 +2827,6 @@
|
|||||||
"id": "ent.saml.update_saml_user.unable_error",
|
"id": "ent.saml.update_saml_user.unable_error",
|
||||||
"translation": "Unable to update existing SAML user. Allowing login anyway. err=%v"
|
"translation": "Unable to update existing SAML user. Allowing login anyway. err=%v"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": "ent.webrtc.disabled.app_error",
|
|
||||||
"translation": "WebRTC is not enabled in this server."
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ent.webrtc.license_disable.app_error",
|
|
||||||
"translation": "Your license does not support using Mattermost WebRTC"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "ent.webrtc.register_token.app_error",
|
|
||||||
"translation": "We encountered an error trying to register the WebRTC Token"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": "error.generic.link_message",
|
"id": "error.generic.link_message",
|
||||||
"translation": "Back to Mattermost"
|
"translation": "Back to Mattermost"
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ type Features struct {
|
|||||||
SAML *bool `json:"saml"`
|
SAML *bool `json:"saml"`
|
||||||
PasswordRequirements *bool `json:"password_requirements"`
|
PasswordRequirements *bool `json:"password_requirements"`
|
||||||
// after we enabled more features for webrtc we'll need to control them with this
|
// after we enabled more features for webrtc we'll need to control them with this
|
||||||
Webrtc *bool `json:"webrtc"`
|
|
||||||
FutureFeatures *bool `json:"future_features"`
|
FutureFeatures *bool `json:"future_features"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,11 +123,6 @@ func (f *Features) SetDefaults() {
|
|||||||
f.PasswordRequirements = new(bool)
|
f.PasswordRequirements = new(bool)
|
||||||
*f.PasswordRequirements = *f.FutureFeatures
|
*f.PasswordRequirements = *f.FutureFeatures
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Webrtc == nil {
|
|
||||||
f.Webrtc = new(bool)
|
|
||||||
*f.Webrtc = *f.FutureFeatures
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *License) IsExpired() bool {
|
func (l *License) IsExpired() bool {
|
||||||
|
|||||||
21
model/webrtc.go
Обычный файл
21
model/webrtc.go
Обычный файл
@@ -0,0 +1,21 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GatewayResponse struct {
|
||||||
|
Status string `json:"janus"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GatewayResponseFromJson(data io.Reader) *GatewayResponse {
|
||||||
|
decoder := json.NewDecoder(data)
|
||||||
|
var o GatewayResponse
|
||||||
|
err := decoder.Decode(&o)
|
||||||
|
if err == nil {
|
||||||
|
return &o
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -292,6 +292,8 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["AndroidAppDownloadLink"] = *c.NativeAppSettings.AndroidAppDownloadLink
|
props["AndroidAppDownloadLink"] = *c.NativeAppSettings.AndroidAppDownloadLink
|
||||||
props["IosAppDownloadLink"] = *c.NativeAppSettings.IosAppDownloadLink
|
props["IosAppDownloadLink"] = *c.NativeAppSettings.IosAppDownloadLink
|
||||||
|
|
||||||
|
props["EnableWebrtc"] = strconv.FormatBool(*c.WebrtcSettings.Enable)
|
||||||
|
|
||||||
if IsLicensed {
|
if IsLicensed {
|
||||||
if *License.Features.CustomBrand {
|
if *License.Features.CustomBrand {
|
||||||
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
props["EnableCustomBrand"] = strconv.FormatBool(*c.TeamSettings.EnableCustomBrand)
|
||||||
@@ -342,10 +344,6 @@ func getClientConfig(c *model.Config) map[string]string {
|
|||||||
props["PasswordRequireNumber"] = strconv.FormatBool(*c.PasswordSettings.Number)
|
props["PasswordRequireNumber"] = strconv.FormatBool(*c.PasswordSettings.Number)
|
||||||
props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
|
props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *License.Features.Webrtc {
|
|
||||||
props["EnableWebrtc"] = strconv.FormatBool(*c.WebrtcSettings.Enable)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return props
|
return props
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ func getClientLicense(l *model.License) map[string]string {
|
|||||||
props["Cluster"] = strconv.FormatBool(*l.Features.Cluster)
|
props["Cluster"] = strconv.FormatBool(*l.Features.Cluster)
|
||||||
props["GoogleOAuth"] = strconv.FormatBool(*l.Features.GoogleOAuth)
|
props["GoogleOAuth"] = strconv.FormatBool(*l.Features.GoogleOAuth)
|
||||||
props["Office365OAuth"] = strconv.FormatBool(*l.Features.Office365OAuth)
|
props["Office365OAuth"] = strconv.FormatBool(*l.Features.Office365OAuth)
|
||||||
props["Webrtc"] = strconv.FormatBool(*l.Features.Webrtc)
|
|
||||||
props["Compliance"] = strconv.FormatBool(*l.Features.Compliance)
|
props["Compliance"] = strconv.FormatBool(*l.Features.Compliance)
|
||||||
props["CustomBrand"] = strconv.FormatBool(*l.Features.CustomBrand)
|
props["CustomBrand"] = strconv.FormatBool(*l.Features.CustomBrand)
|
||||||
props["MHPNS"] = strconv.FormatBool(*l.Features.MHPNS)
|
props["MHPNS"] = strconv.FormatBool(*l.Features.MHPNS)
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ export default class AdminSidebar extends React.Component {
|
|||||||
let samlSettings = null;
|
let samlSettings = null;
|
||||||
let clusterSettings = null;
|
let clusterSettings = null;
|
||||||
let complianceSettings = null;
|
let complianceSettings = null;
|
||||||
let webrtcSettings = null;
|
|
||||||
|
|
||||||
let license = null;
|
let license = null;
|
||||||
let audits = null;
|
let audits = null;
|
||||||
@@ -270,20 +269,6 @@ export default class AdminSidebar extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.window.mm_license.Webrtc === 'true') {
|
|
||||||
webrtcSettings = (
|
|
||||||
<AdminSidebarSection
|
|
||||||
name='webrtc'
|
|
||||||
title={
|
|
||||||
<FormattedMessage
|
|
||||||
id='admin.sidebar.webrtc'
|
|
||||||
defaultMessage='WebRTC (Beta)'
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
oauthSettings = (
|
oauthSettings = (
|
||||||
<AdminSidebarSection
|
<AdminSidebarSection
|
||||||
name='oauth'
|
name='oauth'
|
||||||
@@ -370,6 +355,18 @@ export default class AdminSidebar extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const webrtcSettings = (
|
||||||
|
<AdminSidebarSection
|
||||||
|
name='webrtc'
|
||||||
|
title={
|
||||||
|
<FormattedMessage
|
||||||
|
id='admin.sidebar.webrtc'
|
||||||
|
defaultMessage='WebRTC (Beta)'
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='admin-sidebar'>
|
<div className='admin-sidebar'>
|
||||||
<AdminSidebarHeader/>
|
<AdminSidebarHeader/>
|
||||||
|
|||||||
@@ -290,8 +290,7 @@ export default class ChannelHeader extends React.Component {
|
|||||||
const teammateId = Utils.getUserIdFromChannelName(channel);
|
const teammateId = Utils.getUserIdFromChannelName(channel);
|
||||||
channelTitle = Utils.displayUsername(teammateId);
|
channelTitle = Utils.displayUsername(teammateId);
|
||||||
|
|
||||||
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true' && global.mm_license.Webrtc === 'true' &&
|
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true' && userMedia && Utils.isFeatureEnabled(PreReleaseFeatures.WEBRTC_PREVIEW);
|
||||||
global.mm_config.EnableDeveloper === 'true' && userMedia && Utils.isFeatureEnabled(PreReleaseFeatures.WEBRTC_PREVIEW);
|
|
||||||
|
|
||||||
if (webrtcEnabled) {
|
if (webrtcEnabled) {
|
||||||
const isOffline = UserStore.getStatus(contact.id) === UserStatuses.OFFLINE;
|
const isOffline = UserStore.getStatus(contact.id) === UserStatuses.OFFLINE;
|
||||||
|
|||||||
@@ -90,8 +90,7 @@ export default class UserProfile extends React.Component {
|
|||||||
let webrtc;
|
let webrtc;
|
||||||
const userMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
const userMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
|
||||||
|
|
||||||
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true' && global.mm_license.Webrtc === 'true' &&
|
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true' && userMedia && Utils.isFeatureEnabled(PreReleaseFeatures.WEBRTC_PREVIEW);
|
||||||
global.mm_config.EnableDeveloper === 'true' && userMedia && Utils.isFeatureEnabled(PreReleaseFeatures.WEBRTC_PREVIEW);
|
|
||||||
|
|
||||||
if (webrtcEnabled && this.props.user.id !== this.state.currentUserId) {
|
if (webrtcEnabled && this.props.user.id !== this.state.currentUserId) {
|
||||||
const isOnline = this.props.status !== UserStatuses.OFFLINE;
|
const isOnline = this.props.status !== UserStatuses.OFFLINE;
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
|
|
||||||
let enabledFeatures = 0;
|
let enabledFeatures = 0;
|
||||||
for (const [name, value] of advancedSettings) {
|
for (const [name, value] of advancedSettings) {
|
||||||
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true' && global.mm_license.Webrtc === 'true' &&
|
const webrtcEnabled = global.mm_config.EnableWebrtc === 'true';
|
||||||
global.mm_config.EnableDeveloper === 'true';
|
|
||||||
|
|
||||||
if (!webrtcEnabled) {
|
if (!webrtcEnabled) {
|
||||||
preReleaseFeaturesKeys = preReleaseFeaturesKeys.filter((f) => f !== 'WEBRTC_PREVIEW');
|
preReleaseFeaturesKeys = preReleaseFeaturesKeys.filter((f) => f !== 'WEBRTC_PREVIEW');
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user