Merge pull request #575 from bradrydzewski/master

adding auth_token to ws request
This commit is contained in:
Brad Rydzewski 2014-10-15 19:31:29 -07:00
commit dc1851c4be
4 changed files with 5 additions and 4 deletions

View file

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
<title></title> <title></title>
<link rel="shortcut icon" href="/favicon.ico" /> <link rel="shortcut icon" href="/static/favicon.ico" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/pure-min.css" /> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/pure-min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/grids-responsive-min.css" /> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pure/0.5.0/grids-responsive-min.css" />
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" /> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" />

View file

@ -2,8 +2,9 @@
angular.module('app').service('feed', ['$http', '$window', function($http, $window) { angular.module('app').service('feed', ['$http', '$window', function($http, $window) {
var token = localStorage.getItem('access_token');
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws'); var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
var route = [proto, "://", $window.location.host, '/api/stream/user'].join(''); var route = [proto, "://", $window.location.host, '/api/stream/user?access_token=', token].join('');
var wsCallback = undefined; var wsCallback = undefined;
var ws = new WebSocket(route); var ws = new WebSocket(route);

View file

@ -3,12 +3,13 @@
angular.module('app').service('stdout', ['$window', function($window) { angular.module('app').service('stdout', ['$window', function($window) {
var callback = undefined; var callback = undefined;
var websocket = undefined; var websocket = undefined;
var token = localStorage.getItem('access_token');
this.subscribe = function(path, _callback) { this.subscribe = function(path, _callback) {
callback = _callback; callback = _callback;
var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws'); var proto = ($window.location.protocol == 'https:' ? 'wss' : 'ws');
var route = [proto, "://", $window.location.host, '/api/stream/stdout/', path].join(''); var route = [proto, "://", $window.location.host, '/api/stream/stdout/', path, '?access_token=', token].join('');
websocket = new WebSocket(route); websocket = new WebSocket(route);
websocket.onmessage = function(event) { websocket.onmessage = function(event) {

View file

@ -5,7 +5,6 @@
<li><a href="/account/profile"><i class="fa fa-user"></i> Account</a></li> <li><a href="/account/profile"><i class="fa fa-user"></i> Account</a></li>
<li ng-if="user.admin == true"><span class="divider"></span></li> <li ng-if="user.admin == true"><span class="divider"></span></li>
<li ng-if="user.admin == true"><a href="/admin/users"><i class="fa fa-users"></i> Users</a></li> <li ng-if="user.admin == true"><a href="/admin/users"><i class="fa fa-users"></i> Users</a></li>
<li ng-if="user.admin == true"><a href="/admin/settings"><i class="fa fa-cog"></i> Settings</a></li>
</ul> </ul>
<a href="/logout" class="signout">Signout <i class="fa fa-sign-out"></i></a> <a href="/logout" class="signout">Signout <i class="fa fa-sign-out"></i></a>
</div> </div>