221 changed files with 5709 additions and 3116 deletions
@ -1 +0,0 @@
@@ -1 +0,0 @@
|
||||
<%define "logo"%><span class="logo" title="<%.Cfg.Title%>"><span><a target="_blank" href="https://github.com/strukturag/spreed-webrtc">WebRTC</a></span></span><%end%> |
@ -1,62 +1,13 @@
@@ -1,62 +1,13 @@
|
||||
<%define "mainPage"%><!doctype html> |
||||
<html class="no-js"<%if.Csp%> ng-csp<%end%>> |
||||
<html class="no-js wf-loading"<%if.Csp%> ng-csp<%end%>> |
||||
<head> |
||||
<%template "head" .%> |
||||
</head> |
||||
<body spreed-webrtc> |
||||
<div id="background"></div> |
||||
<div id="loader"><div><i class="fa fa-circle-o-notch fa-spin"></i><div class="loader-message"></div></div></div> |
||||
<page></page> |
||||
<div id="bar" class="navbar navbar-default navbar-fixed-top bar"> |
||||
<div class="container-fluid"> |
||||
<div class="navbar-header"> |
||||
<button type="button" class="navbar-toggle collapsed" ng-click="isCollapsed = !isCollapsed"> |
||||
<span class="icon-bar"></span> |
||||
<span class="icon-bar"></span> |
||||
<span class="icon-bar"></span> |
||||
</button> |
||||
<div class="navbar-brand left"> |
||||
<%template "logo" .%> |
||||
</div> |
||||
</div> |
||||
<div class="navbar-collapse collapse" collapse="isCollapsed"> |
||||
<ul class="nav navbar-nav navbar-right right"> |
||||
<li class="ng-cloak"> |
||||
<menu></menu> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div class="callbar middle"> |
||||
<status-message></status-message> |
||||
</div> |
||||
</div> |
||||
<div id="roombar" class="ng-cloak"> |
||||
<room-bar/> |
||||
</div> |
||||
<div id="audiolevel" class="ng-cloak"> |
||||
<div class="audio-level" title="{{_('Your audio level')}}"></div> |
||||
</div> |
||||
<div id="audiovideo" class="ng-cloak" ng-show="peer"> |
||||
<audio-video/> |
||||
</div> |
||||
<div id="screenshare" class="ng-cloak mainview"> |
||||
<screenshare/> |
||||
</div> |
||||
<div id="presentation" class="ng-cloak mainview"> |
||||
<presentation/> |
||||
</div> |
||||
<div id="youtubevideo" class="ng-cloak mainview"> |
||||
<youtubevideo/> |
||||
</div> |
||||
<div class="ng-cloak" id="rightslide"> |
||||
<div class="rightslidepane"> |
||||
<div id="buddylist"><buddy-list/></div> |
||||
<div id="chat"><chat/></div> |
||||
</div> |
||||
</div> |
||||
<div class="ng-cloak" id="settings" ng-class="{show: layout.settings}"><settings/></div> |
||||
<ui></ui> |
||||
<script data-main="<%.Cfg.S%>/js/<%.App%>" data-plugin="<%.Cfg.Plugin%>" src="<%.Cfg.S%>/js/libs/require/require.js"></script> |
||||
<%template "extra-body" .%> |
||||
</body> |
||||
</html><%end%> |
||||
</html><%end%> |
@ -1,234 +0,0 @@
@@ -1,234 +0,0 @@
|
||||
/** |
||||
* A RESTful framework for Go |
||||
* |
||||
* Modified version of sleepy to support Gorilla muxers. |
||||
* https://github.com/strukturag/sleepy
|
||||
* |
||||
* Copyright (c) 2014 struktur AG |
||||
* Copyright (c) 2013-2014 Doug Black and the Sleepy authors |
||||
* |
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
* of this software and associated documentation files (the "Software"), to deal |
||||
* in the Software without restriction, including without limitation the rights |
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
* copies of the Software, and to permit persons to whom the Software is |
||||
* furnished to do so, subject to the following conditions: |
||||
* |
||||
* The above copyright notice and this permission notice shall be included in |
||||
* all copies or substantial portions of the Software. |
||||
* |
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
* THE SOFTWARE. |
||||
* |
||||
**/ |
||||
|
||||
package sleepy |
||||
|
||||
import ( |
||||
"encoding/json" |
||||
"errors" |
||||
"fmt" |
||||
"github.com/gorilla/mux" |
||||
"net/http" |
||||
) |
||||
|
||||
const ( |
||||
GET = "GET" |
||||
POST = "POST" |
||||
PUT = "PUT" |
||||
DELETE = "DELETE" |
||||
HEAD = "HEAD" |
||||
PATCH = "PATCH" |
||||
) |
||||
|
||||
// GetSupported is the interface that provides the Get
|
||||
// method a resource must support to receive HTTP GETs.
|
||||
type GetSupported interface { |
||||
Get(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// PostSupported is the interface that provides the Post
|
||||
// method a resource must support to receive HTTP POSTs.
|
||||
type PostSupported interface { |
||||
Post(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// PutSupported is the interface that provides the Put
|
||||
// method a resource must support to receive HTTP PUTs.
|
||||
type PutSupported interface { |
||||
Put(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// DeleteSupported is the interface that provides the Delete
|
||||
// method a resource must support to receive HTTP DELETEs.
|
||||
type DeleteSupported interface { |
||||
Delete(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// HeadSupported is the interface that provides the Head
|
||||
// method a resource must support to receive HTTP HEADs.
|
||||
type HeadSupported interface { |
||||
Head(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// PatchSupported is the interface that provides the Patch
|
||||
// method a resource must support to receive HTTP PATCHs.
|
||||
type PatchSupported interface { |
||||
Patch(*http.Request) (int, interface{}, http.Header) |
||||
} |
||||
|
||||
// Interface for arbitrary muxer support (like http.ServeMux).
|
||||
type APIMux interface { |
||||
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) *mux.Route |
||||
ServeHTTP(w http.ResponseWriter, r *http.Request) |
||||
} |
||||
|
||||
// An API manages a group of resources by routing requests
|
||||
// to the correct method on a matching resource and marshalling
|
||||
// the returned data to JSON for the HTTP response.
|
||||
//
|
||||
// You can instantiate multiple APIs on separate ports. Each API
|
||||
// will manage its own set of resources.
|
||||
type API struct { |
||||
mux APIMux |
||||
muxInitialized bool |
||||
} |
||||
|
||||
// NewAPI allocates and returns a new API.
|
||||
func NewAPI() *API { |
||||
return &API{} |
||||
} |
||||
|
||||
func (api *API) requestHandler(resource interface{}) http.HandlerFunc { |
||||
return func(rw http.ResponseWriter, request *http.Request) { |
||||
|
||||
if request.ParseForm() != nil { |
||||
rw.WriteHeader(http.StatusBadRequest) |
||||
return |
||||
} |
||||
|
||||
var handler func(*http.Request) (int, interface{}, http.Header) |
||||
|
||||
switch request.Method { |
||||
case GET: |
||||
if resource, ok := resource.(GetSupported); ok { |
||||
handler = resource.Get |
||||
} |
||||
case POST: |
||||
if resource, ok := resource.(PostSupported); ok { |
||||
handler = resource.Post |
||||
} |
||||
case PUT: |
||||
if resource, ok := resource.(PutSupported); ok { |
||||
handler = resource.Put |
||||
} |
||||
case DELETE: |
||||
if resource, ok := resource.(DeleteSupported); ok { |
||||
handler = resource.Delete |
||||
} |
||||
case HEAD: |
||||
if resource, ok := resource.(HeadSupported); ok { |
||||
handler = resource.Head |
||||
} |
||||
case PATCH: |
||||
if resource, ok := resource.(PatchSupported); ok { |
||||
handler = resource.Patch |
||||
} |
||||
} |
||||
|
||||
if handler == nil { |
||||
rw.WriteHeader(http.StatusMethodNotAllowed) |
||||
return |
||||
} |
||||
|
||||
code, data, header := handler(request) |
||||
|
||||
var content []byte |
||||
var err error |
||||
|
||||
switch data.(type) { |
||||
case string: |
||||
content = []byte(data.(string)) |
||||
case []byte: |
||||
content = data.([]byte) |
||||
default: |
||||
// Encode JSON.
|
||||
content, err = json.MarshalIndent(data, "", " ") |
||||
if err != nil { |
||||
if header == nil { |
||||
header = http.Header{"Content-Type": {"application/json"}} |
||||
} else if header.Get("Content-Type") == "" { |
||||
header.Set("Content-Type", "application/json") |
||||
} |
||||
} |
||||
} |
||||
|
||||
if err != nil { |
||||
rw.WriteHeader(http.StatusInternalServerError) |
||||
return |
||||
} |
||||
for name, values := range header { |
||||
for _, value := range values { |
||||
rw.Header().Add(name, value) |
||||
} |
||||
} |
||||
rw.WriteHeader(code) |
||||
rw.Write(content) |
||||
} |
||||
} |
||||
|
||||
// Mux returns the muxer used by an API. If a ServeMux does not
|
||||
// yet exist, a new *http.ServeMux will be created and returned.
|
||||
func (api *API) Mux() APIMux { |
||||
if api.muxInitialized { |
||||
return api.mux |
||||
} else { |
||||
api.mux = mux.NewRouter() |
||||
api.muxInitialized = true |
||||
return api.mux |
||||
} |
||||
} |
||||
|
||||
// SetMux sets the muxer to use by an API. A muxer needs to
|
||||
// implement the APIMux interface (eg. http.ServeMux).
|
||||
func (api *API) SetMux(mux APIMux) error { |
||||
if api.muxInitialized { |
||||
return errors.New("You cannot set a muxer when already initialized.") |
||||
} else { |
||||
api.mux = mux |
||||
api.muxInitialized = true |
||||
return nil |
||||
} |
||||
} |
||||
|
||||
// AddResource adds a new resource to an API. The API will route
|
||||
// requests that match one of the given paths to the matching HTTP
|
||||
// method on the resource.
|
||||
func (api *API) AddResource(resource interface{}, paths ...string) { |
||||
for _, path := range paths { |
||||
api.Mux().HandleFunc(path, api.requestHandler(resource)) |
||||
} |
||||
} |
||||
|
||||
// AddResourceWithWrapper behaves exactly like AddResource but wraps
|
||||
// the generated handler function with a give wrapper function to allow
|
||||
// to hook in Gzip support and similar.
|
||||
func (api *API) AddResourceWithWrapper(resource interface{}, wrapper func(handler http.HandlerFunc) http.HandlerFunc, paths ...string) { |
||||
for _, path := range paths { |
||||
api.Mux().HandleFunc(path, wrapper(api.requestHandler(resource))) |
||||
} |
||||
} |
||||
|
||||
// Start causes the API to begin serving requests on the given port.
|
||||
func (api *API) Start(port int) error { |
||||
if !api.muxInitialized { |
||||
return errors.New("You must add at least one resource to this API.") |
||||
} |
||||
portString := fmt.Sprintf(":%d", port) |
||||
return http.ListenAndServe(portString, api.Mux()) |
||||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
/* |
||||
* Spreed WebRTC. |
||||
* Copyright (C) 2013-2015 struktur AG |
||||
* |
||||
* This file is part of Spreed WebRTC. |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU Affero General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU Affero General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
*/ |
||||
|
||||
"use strict"; |
||||
define(["jquery", "angular", "underscore"], function($, angular, _) { |
||||
|
||||
// AppController
|
||||
return ["$scope", "$window", "appData", "userSettingsData", "$timeout", function($scope, $window, appData, userSettingsData, $timeout) { |
||||
|
||||
// Disable drag and drop.
|
||||
$($window).on("dragover dragenter drop", function(event) { |
||||
event.preventDefault(); |
||||
}); |
||||
|
||||
appData.set($scope); |
||||
|
||||
// User related scope data.
|
||||
$scope.authorizing = false; |
||||
$scope.roomsHistory = []; |
||||
$scope.defaults = { |
||||
displayName: null, |
||||
buddyPicture: null, |
||||
message: null, |
||||
settings: { |
||||
videoQuality: "high", |
||||
sendStereo: false, |
||||
maxFrameRate: 20, |
||||
defaultRoom: "", |
||||
language: "", |
||||
audioRenderToAssociatedSkin: true, |
||||
videoCpuOveruseDetection: true, |
||||
experimental: { |
||||
enabled: false, |
||||
audioEchoCancellation2: true, |
||||
audioAutoGainControl2: true, |
||||
audioNoiseSuppression2: true, |
||||
audioTypingNoiseDetection: true, |
||||
videoLeakyBucket: true, |
||||
videoNoiseReduction: false |
||||
} |
||||
} |
||||
}; |
||||
$scope.master = angular.copy($scope.defaults); |
||||
|
||||
$scope.update = function(user) { |
||||
$scope.master = angular.copy(user); |
||||
if (appData.flags.connected) { |
||||
$scope.updateStatus(); |
||||
} |
||||
$scope.refreshWebrtcSettings(); |
||||
}; |
||||
|
||||
$scope.reset = function() { |
||||
$scope.user = angular.copy($scope.master); |
||||
}; |
||||
|
||||
$scope.loadUserSettings = function() { |
||||
$scope.master = angular.copy($scope.defaults); |
||||
var storedUser = userSettingsData.load(); |
||||
if (storedUser) { |
||||
$scope.user = $.extend(true, {}, $scope.master, storedUser); |
||||
$scope.user.settings = $.extend(true, {}, $scope.user.settings, $scope.master.settings, $scope.user.settings); |
||||
$scope.update($scope.user); |
||||
$scope.loadedUser = storedUser.displayName && true; |
||||
} else { |
||||
$scope.loadedUser = false; |
||||
} |
||||
$scope.roomsHistory = []; |
||||
appData.e.triggerHandler("userSettingsLoaded", [$scope.loadedUser, $scope.user]); |
||||
$scope.reset(); |
||||
}; |
||||
|
||||
$scope.manualReloadApp = function(url) { |
||||
appData.flags.manualUnload = true; |
||||
if (url) { |
||||
$window.location.href = url; |
||||
$timeout(function() { |
||||
appData.flags.manualUnload = false; |
||||
}, 0); |
||||
} else { |
||||
$window.location.reload(true); |
||||
} |
||||
}; |
||||
|
||||
$scope.$on("room.joined", function(event, roomName) { |
||||
if (roomName) { |
||||
_.pull($scope.roomsHistory, roomName); |
||||
$scope.roomsHistory.unshift(roomName); |
||||
if ($scope.roomsHistory.length > 15) { |
||||
// Limit the history.
|
||||
$scope.roomsHistory = $scope.roomsHistory.splice(0, 15); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
appData.e.on("authorizing", function(event, authorizing) { |
||||
$scope.authorizing = !!authorizing; |
||||
}); |
||||
|
||||
$scope.reset(); // Call once for bootstrap.
|
||||
|
||||
}]; |
||||
|
||||
}); |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue