Skip to content

Commit 0303e86

Browse files
committed
Merge pull request #152 from oskarhane/follow-server-init-cmd
On connect, exec command from server config
2 parents a48a51c + 5079f1f commit 0303e86

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/scripts/controllers/Main.coffee

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ angular.module('neo4jApp.controllers')
4141
($scope, $window,$q, Server, Frame, AuthService, AuthDataService, ConnectionStatusService, Settings, SettingsStore, motdService, UDC, Utils, CurrentUser, ProtocolFactory) ->
4242
$scope.CurrentUser = CurrentUser
4343
$scope.ConnectionStatusService = ConnectionStatusService
44+
initailConnect = yes
4445

4546
$scope.kernel = {}
4647
$scope.refresh = ->
@@ -76,6 +77,7 @@ angular.module('neo4jApp.controllers')
7677
refreshPolicies $scope.kernel['browser.retain_connection_credentials'], $scope.kernel['browser.credential_timeout']
7778
allow_connections = [no, 'false', 'no'].indexOf($scope.kernel['browser.allow_outgoing_browser_connections']) < 0 ? yes : no
7879
refreshAllowOutgoingConnections allow_connections
80+
executePostConnectCmd $scope.kernel['browser.post_connect_cmd']
7981
).catch((r)-> $scope.kernel = {})
8082

8183
refreshAllowOutgoingConnections = (allow_connections) ->
@@ -153,6 +155,12 @@ angular.module('neo4jApp.controllers')
153155

154156
pickFirstFrame()
155157

158+
executePostConnectCmd = (cmd) ->
159+
return unless cmd
160+
return unless initailConnect
161+
initailConnect = no
162+
Frame.create({input:"#{Settings.cmdchar}#{cmd}"})
163+
156164
$scope.$on 'ntn:data_loaded', (evt, authenticated, newUser) ->
157165
return Frame.createOne({input:"#{Settings.initCmd}"}) if ConnectionStatusService.isConnected()
158166
return Frame.create({input:"#{Settings.cmdchar}play welcome"}) if newUser

0 commit comments

Comments
 (0)