diff --git a/src/app/app.js b/src/app/app.js index 8107d4b4b..4ee794a18 100644 --- a/src/app/app.js +++ b/src/app/app.js @@ -3,5 +3,6 @@ export default angular.module('app', [ 'ngMessages', 'ngMaterial', 'ngAnimate', + 'ngCookies', 'md.data.table', ]) diff --git a/src/app/components/login/login.js b/src/app/components/login/login.js index 758c322a1..79c07cf9a 100644 --- a/src/app/components/login/login.js +++ b/src/app/components/login/login.js @@ -12,16 +12,17 @@ app.component('login', { onLogin: '&', }, controller: class login { - constructor ($scope, $rootScope, $timeout, $document, $mdDialog, $mdMedia) { + constructor ($scope, $rootScope, $timeout, $document, $mdDialog, $mdMedia, $cookies) { this.$scope = $scope this.$rootScope = $rootScope this.$timeout = $timeout this.$document = $document this.$mdDialog = $mdDialog this.$mdMedia = $mdMedia + this.$cookies = $cookies this.$scope.$watch('$ctrl.input_passphrase', this.isValid.bind(this)) - // this.$timeout(this.devTestAccount.bind(this), 200) + this.$timeout(this.devTestAccount.bind(this), 200) this.$scope.$watch(() => { return this.$mdMedia('xs') || this.$mdMedia('sm'); @@ -175,8 +176,10 @@ app.component('login', { } devTestAccount () { - this.input_passphrase = 'stay undo beyond powder sand laptop grow gloom apology hamster primary arrive' - this.$timeout(this.go.bind(this), 100) + this.input_passphrase = this.$cookies.get('passphrase'); + if (this.input_passphrase) { + this.$timeout(this.go.bind(this), 100) + } } fix (v) { diff --git a/src/app/index.js b/src/app/index.js index 718925019..11071190f 100644 --- a/src/app/index.js +++ b/src/app/index.js @@ -3,6 +3,7 @@ import 'jquery' import 'angular' import 'angular-animate' +import 'angular-cookies' import 'angular-aria' import 'angular-messages' import 'angular-material' diff --git a/src/app/services/peers/peers.js b/src/app/services/peers/peers.js index 32a59af10..6fb508bcc 100644 --- a/src/app/services/peers/peers.js +++ b/src/app/services/peers/peers.js @@ -5,7 +5,7 @@ import './peer' const UPDATE_INTERVAL_CHECK = 10000 -app.factory('$peers', ($peer, $timeout) => { +app.factory('$peers', ($peer, $timeout, $cookies) => { class $peers { constructor () { this.stack = { @@ -38,7 +38,9 @@ app.factory('$peers', ($peer, $timeout) => { setActive () { this.active = _.chain([]) - .concat(this.stack.official, this.stack.public) + .concat($cookies.get('peerStack') == 'testnet' ? + this.stack.testnet : this.stack.official, + this.stack.public) .sample() .value() diff --git a/src/package.json b/src/package.json index 69ecded56..2e59085d8 100644 --- a/src/package.json +++ b/src/package.json @@ -10,6 +10,7 @@ "dependencies": { "angular": "^1.5.8", "angular-animate": "^1.5.8", + "angular-cookies": "=1.5.8", "angular-aria": "^1.5.8", "angular-material": "^1.1.1", "angular-material-data-table": "^0.10.9",