@@ -4,7 +4,7 @@ var ipcRenderer = require('ipc-renderer'),
44 __ = require ( 'underscore' ) ,
55 Backbone = require ( 'backbone' ) ,
66 $ = require ( 'jquery' ) ,
7- app = require ( './App' ) . getApp ( ) ,
7+ app = require ( './App' ) . getApp ( ) ,
88 homeView = require ( './views/homeVw' ) ,
99 userPageView = require ( './views/userPageVw' ) ,
1010 settingsView = require ( './views/settingsVw' ) ,
@@ -35,7 +35,7 @@ module.exports = Backbone.Router.extend({
3535
3636 routes . forEach ( ( route ) => {
3737 this . route . apply ( this , route ) ;
38- } ) ;
38+ } ) ;
3939
4040 /*
4141 expects options.userModel, options userProfile, socketView from main.js
@@ -49,7 +49,7 @@ module.exports = Backbone.Router.extend({
4949 this . navigate ( translatedRoute , { trigger : true } ) ;
5050 } ) ;
5151 } ) ;
52-
52+
5353 originalHistoryBack = history . back ;
5454 history . back = function ( ) {
5555 self . historyAction = 'back' ;
@@ -61,7 +61,7 @@ module.exports = Backbone.Router.extend({
6161 self . historyAction = 'forward' ;
6262 return originalHistoryForward . apply ( this , arguments ) ;
6363 } ;
64-
64+
6565 this . historySize = - 1 ;
6666 this . historyPosition = - 1 ;
6767 this . historyAction = 'default' ;
@@ -80,7 +80,7 @@ module.exports = Backbone.Router.extend({
8080 delete this . viewCache [ key ] ;
8181 }
8282 }
83- }
83+ }
8484 } , this . cleanCacheInterval ) ;
8585 } ,
8686
@@ -92,19 +92,19 @@ module.exports = Backbone.Router.extend({
9292 // clear any cache for the view, so a fresh view is created
9393 delete this . viewCache [ this . view . constructor . getCacheIndex ( Backbone . history . getFragment ( ) ) ] ;
9494 }
95-
95+
9696 Backbone . history . loadUrl ( ) ;
9797 } ,
9898
9999 translateRoute : function ( route ) {
100100 if ( ! route ) throw new Error ( 'You must provide a route' ) ;
101-
101+
102102 var guid = "" ,
103103 state = "" ,
104104 itemHash = "" ,
105105 routeArray = route . replace ( "ob://" , "" ) . replace ( / / g, "" ) . split ( "/" ) ,
106106 deferred = $ . Deferred ( ) ;
107-
107+
108108 state = routeArray [ 1 ] ? "/" + routeArray [ 1 ] : "" ;
109109 itemHash = routeArray [ 2 ] ? "/" + routeArray [ 2 ] : "" ;
110110
@@ -150,7 +150,7 @@ module.exports = Backbone.Router.extend({
150150
151151 return deferred . promise ( ) ;
152152 } ,
153-
153+
154154 execute : function ( callback , args , name ) {
155155 if ( this . historyAction == 'default' ) {
156156 this . historyPosition += 1 ;
@@ -169,16 +169,16 @@ module.exports = Backbone.Router.extend({
169169 } else {
170170 $ ( '.js-navFwd' ) . removeClass ( 'disabled-icon' ) ;
171171 }
172-
172+
173173 if ( this . historyPosition == 1 ) {
174174 $ ( '.js-navBack' ) . addClass ( 'disabled-icon' ) ;
175175 } else {
176176 $ ( '.js-navBack' ) . removeClass ( 'disabled-icon' ) ;
177177 }
178-
178+
179179 if ( callback ) callback . apply ( this , args ) ;
180180 } ,
181-
181+
182182 cleanup : function ( ) {
183183 app . loadingModal . close ( ) ;
184184 app . simpleMessageModal . close ( ) ;
@@ -190,7 +190,7 @@ module.exports = Backbone.Router.extend({
190190
191191 fragment = fragment || Backbone . history . getFragment ( ) ;
192192 index = view . constructor . getCacheIndex ( fragment ) ;
193-
193+
194194 this . viewCache [ index ] = {
195195 cachedAt : Date . now ( ) ,
196196 view : this . view
@@ -219,7 +219,7 @@ module.exports = Backbone.Router.extend({
219219
220220 $ ( 'body' ) . attr ( 'id' , options . bodyID ) ;
221221 $ ( 'body' ) . attr ( 'class' , options . bodyClass ) ;
222-
222+
223223 this . pageConnectModal && this . pageConnectModal . remove ( ) ;
224224 this . pageConnectModal = null ;
225225
@@ -246,7 +246,7 @@ module.exports = Backbone.Router.extend({
246246 this . view . $el . detach ( ) ;
247247 this . trigger ( 'cache-detached' , { view : this . view } ) ;
248248 } else {
249- this . view . close ? this . view . close ( ) : this . view . remove ( ) ;
249+ this . view . close ? this . view . close ( ) : this . view . remove ( ) ;
250250 }
251251 }
252252
@@ -278,7 +278,7 @@ module.exports = Backbone.Router.extend({
278278 } ) ;
279279 } else {
280280 this . view . cacheExpires && this . cacheView ( this . view ) ;
281- }
281+ }
282282 }
283283 } ,
284284
@@ -305,7 +305,7 @@ module.exports = Backbone.Router.extend({
305305 statusText : config . connectText ,
306306 tooltip : config . connectTooltip
307307 }
308- } ) . render ( ) . open ( ) ;
308+ } ) . render ( ) . open ( ) ;
309309
310310 this . pageConnectModal . on ( 'back' , ( ) => {
311311 history . back ( ) ;
@@ -343,8 +343,10 @@ module.exports = Backbone.Router.extend({
343343 } ,
344344
345345 index : function ( ) {
346- if ( localStorage . getItem ( "route" ) ) {
347- this . navigate ( '#' + localStorage . getItem ( "route" ) , { trigger : true } ) ;
346+ const host = encodeURIComponent ( app . serverConfigs . getActive ( ) . getServerBaseUrl ( ) ) ;
347+ const route = localStorage . getItem ( host ) ;
348+ if ( route ) {
349+ this . navigate ( '#' + route , { trigger : true } ) ;
348350 } else {
349351 this . navigate ( '#home' , { trigger : true } ) ;
350352 }
0 commit comments