Verify the websocket request

This commit is contained in:
Johannes Zellner
2017-08-17 09:33:00 +02:00
committed by Girish Ramakrishnan
parent 65bc3491f6
commit 52db28e876
5 changed files with 61 additions and 30 deletions

View File

@@ -58,6 +58,8 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
reset();
if (!$scope.selected) return;
var func = $scope.selected.type === 'platform' ? Client.getPlatformLogs : Client.getAppLogs;
func($scope.selected.value, true, $scope.lines, function handleLogs(error, result) {
if (error) return console.error(error);
@@ -91,6 +93,8 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
reset();
if (!$scope.selected) return;
// we can only connect to apps here
if ($scope.selected.type !== 'app') {
var tmp = $('.logs-and-term-container');
@@ -104,7 +108,7 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
try {
// websocket cannot use relative urls
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/execws?tty=true';
var url = Client.apiOrigin.replace('https', 'wss') + '/api/v1/apps/' + $scope.selected.value + '/execws?tty=true&access_token=' + Client.getToken();
$scope.terminalSocket = new WebSocket(url);
$scope.terminal.attach($scope.terminalSocket);