Add support for supplying credentials in the URL via the hash.
This commit is contained in:
parent
1b03fdb222
commit
fafed6a915
2 changed files with 20 additions and 1 deletions
|
@ -40,7 +40,7 @@
|
|||
<script type="text/javascript" src="js/plugins.js"></script>
|
||||
<script type="text/javascript" src="3rdparty/favico-0.3.5.min.js"></script>
|
||||
</head>
|
||||
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-keyup="handleKeyRelease($event)" ng-keypress="handleKeyPress($event)" ng-class="{'no-overflow': connected}" lang="en-US">
|
||||
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-keyup="handleKeyRelease($event)" ng-keypress="handleKeyPress($event)" ng-class="{'no-overflow': connected}" ng-init="init()" lang="en-US">
|
||||
<div ng-hide="connected" class="container">
|
||||
<h2>
|
||||
<img alt="logo" src="assets/img/glowing-bear.svg">
|
||||
|
|
|
@ -752,6 +752,25 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
|
|||
}
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
if (window.location.hash) {
|
||||
var rawStr = atob(window.location.hash.substring(1));
|
||||
window.location.hash = "";
|
||||
var spl = rawStr.split(":");
|
||||
var host = spl[0];
|
||||
var port = parseInt(spl[1]);
|
||||
var password = spl[2];
|
||||
var ssl = spl.length > 3;
|
||||
notifications.requestNotificationPermission();
|
||||
$rootScope.sslError = false;
|
||||
$rootScope.securityError = false;
|
||||
$rootScope.errorMessage = false;
|
||||
$rootScope.bufferBottom = true;
|
||||
$scope.connectbutton = 'Connecting ...';
|
||||
connection.connect(host, port, password, ssl);
|
||||
}
|
||||
};
|
||||
|
||||
}]);
|
||||
|
||||
weechat.config(['$routeProvider',
|
||||
|
|
Loading…
Reference in a new issue