diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js
index b823f72ee..f001883ab 100644
--- a/static/websiteFunctions/websiteFunctions.js
+++ b/static/websiteFunctions/websiteFunctions.js
@@ -5836,6 +5836,8 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
$scope.autoCommitCurrent = response.data.autoCommitCurrent;
$scope.autoPushCurrent = response.data.autoPushCurrent;
$scope.emailLogsCurrent = response.data.emailLogsCurrent;
+ $scope.currentCommands = response.data.commands;
+ $scope.webhookCommandCurrent = response.data.webhookCommandCurrent;
} else {
$scope.gitTracking = false;
$scope.gitEnable = true;
@@ -6675,6 +6677,8 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
autoCommit: $scope.autoCommit,
autoPush: $scope.autoPush,
emailLogs: $scope.emailLogs,
+ commands: $scope.commands,
+ webhookCommand: $scope.webhookCommand
};
var config = {
@@ -6737,7 +6741,6 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
-
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
index b823f72ee..f001883ab 100755
--- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js
+++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js
@@ -5836,6 +5836,8 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
$scope.autoCommitCurrent = response.data.autoCommitCurrent;
$scope.autoPushCurrent = response.data.autoPushCurrent;
$scope.emailLogsCurrent = response.data.emailLogsCurrent;
+ $scope.currentCommands = response.data.commands;
+ $scope.webhookCommandCurrent = response.data.webhookCommandCurrent;
} else {
$scope.gitTracking = false;
$scope.gitEnable = true;
@@ -6675,6 +6677,8 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
autoCommit: $scope.autoCommit,
autoPush: $scope.autoPush,
emailLogs: $scope.emailLogs,
+ commands: $scope.commands,
+ webhookCommand: $scope.webhookCommand
};
var config = {
@@ -6737,7 +6741,6 @@ app.controller('manageGIT', function ($scope, $http, $timeout, $window) {
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
-
function ListInitialDatas(response) {
$scope.cyberpanelLoading = true;
if (response.data.status === 1) {
diff --git a/websiteFunctions/templates/websiteFunctions/manageGIT.html b/websiteFunctions/templates/websiteFunctions/manageGIT.html
index c11d2b332..21fa0fb1f 100755
--- a/websiteFunctions/templates/websiteFunctions/manageGIT.html
+++ b/websiteFunctions/templates/websiteFunctions/manageGIT.html
@@ -227,6 +227,29 @@
+
+
+
+
@@ -534,7 +557,8 @@
{% trans "Git Logs" %} 
+ ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
+
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py
index 0c96b9906..356692f5d 100755
--- a/websiteFunctions/website.py
+++ b/websiteFunctions/website.py
@@ -3018,10 +3018,21 @@ StrictHostKeyChecking no
autoCommitCurrent = gitConf['autoCommit']
autoPushCurrent = gitConf['autoPush']
emailLogsCurrent = gitConf['emailLogs']
+ try:
+ commands = gitConf['commands']
+ except:
+ commands = "Add Commands to run after every commit, separate commands using comma."
+
+ try:
+ webhookCommandCurrent = gitConf['webhookCommand']
+ except:
+ webhookCommandCurrent = "False"
else:
autoCommitCurrent = 'Never'
autoPushCurrent = 'Never'
emailLogsCurrent = 'False'
+ webhookCommandCurrent = 'False'
+ commands = "Add Commands to run after every commit, separate commands using comma."
##
@@ -3030,7 +3041,7 @@ StrictHostKeyChecking no
data_ret = {'status': 1, 'repo': 1, 'finalBranches': branches, 'deploymentKey': deploymentKey,
'remote': remote, 'remoteResult': remoteResult, 'totalCommits': totalCommits, 'home': home,
'webHookURL': webHookURL, 'autoCommitCurrent': autoCommitCurrent,
- 'autoPushCurrent':autoPushCurrent, 'emailLogsCurrent': emailLogsCurrent}
+ 'autoPushCurrent':autoPushCurrent, 'emailLogsCurrent': emailLogsCurrent, 'commands': commands, "webhookCommandCurrent": webhookCommandCurrent}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -3287,6 +3298,41 @@ StrictHostKeyChecking no
commandStatus = ProcessUtilities.outputExecutioner(command)
if commandStatus.find('nothing to commit') == -1:
+ gitConfFolder = '/home/cyberpanel/git/%s' % (self.domain)
+ finalFile = '%s/%s' % (gitConfFolder, self.folder.split('/')[-1])
+
+ gitConf = json.loads(open(finalFile, 'r').read())
+ web = Websites.objects.get(domain=self.domain)
+
+ try:
+
+ if gitConf['commands'] != 'NONE':
+
+ GitLogs(owner=web, type='INFO', message='Running commands after successful git commit..').save()
+
+ if gitConf['commands'].find(',') > -1:
+ commands = gitConf['commands'].split(',')
+
+ for command in commands:
+ GitLogs(owner=web, type='INFO',
+ message='Running: %s' % (command)).save()
+
+ result = ProcessUtilities.outputExecutioner(command, web.externalApp)
+ GitLogs(owner=web, type='INFO',
+ message='Result: %s' % (result)).save()
+ else:
+ GitLogs(owner=web, type='INFO',
+ message='Running: %s' % (gitConf['commands'])).save()
+
+ result = ProcessUtilities.outputExecutioner(gitConf['commands'], web.externalApp)
+ GitLogs(owner=web, type='INFO',
+ message='Result: %s' % (result)).save()
+
+ GitLogs(owner=web, type='INFO',
+ message='Finished running commands.').save()
+ except:
+ pass
+
data_ret = {'status': 1, 'commandStatus': commandStatus}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -3808,6 +3854,16 @@ StrictHostKeyChecking no
except:
dic['emailLogs'] = False
+ try:
+ dic['commands'] = data['commands']
+ except:
+ dic['commands'] = 'NONE'
+
+ try:
+ dic['webhookCommand'] = data['webhookCommand']
+ except:
+ dic['webhookCommand'] = False
+
if ACLManager.checkOwnership(self.domain, admin, currentACL) == 1:
pass
@@ -3924,6 +3980,42 @@ StrictHostKeyChecking no
if commandStatus.find('Already up to date') == -1:
message = '[Webhook Fired] Status: %s.' % (commandStatus)
GitLogs(owner=web, type='INFO', message=message).save()
+
+ gitConfFolder = '/home/cyberpanel/git/%s' % (self.domain)
+ finalFile = '%s/%s' % (gitConfFolder, self.folder.split('/')[-1])
+
+ gitConf = json.loads(open(finalFile, 'r').read())
+ web = Websites.objects.get(domain=self.domain)
+
+ try:
+ if gitConf['webhookCommand']:
+ if gitConf['commands'] != 'NONE':
+
+ GitLogs(owner=web, type='INFO', message='Running commands after successful git commit..').save()
+
+ if gitConf['commands'].find(',') > -1:
+ commands = gitConf['commands'].split(',')
+
+ for command in commands:
+ GitLogs(owner=web, type='INFO',
+ message='Running: %s' % (command)).save()
+
+ result = ProcessUtilities.outputExecutioner(command, web.externalApp)
+ GitLogs(owner=web, type='INFO',
+ message='Result: %s' % (result)).save()
+ else:
+ GitLogs(owner=web, type='INFO',
+ message='Running: %s' % (gitConf['commands'])).save()
+
+ result = ProcessUtilities.outputExecutioner(gitConf['commands'], web.externalApp)
+ GitLogs(owner=web, type='INFO',
+ message='Result: %s' % (result)).save()
+
+ GitLogs(owner=web, type='INFO',
+ message='Finished running commands.').save()
+ except:
+ pass
+
data_ret = {'status': 1, 'commandStatus': commandStatus}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)