Permalink
Browse files

Now browser notifications are disabled by default. Issue #156.

  • Loading branch information...
corpsee committed Apr 29, 2018
1 parent ddc5cd6 commit 84b2fefd19e18ddb1fe7bbb908887704e38e4d7d
@@ -39,6 +39,8 @@ php-censor:
log:
rotate: true
max_files: 10
notifications:
enabled: false # notify.js notifications to browser
ssh:
strength: 4096 # SSH keys strength (default: 2048)
comment: admin@php-censor.info # SSH keys comment (default: admin@php-censor)
@@ -164,13 +164,15 @@ var PHPCensor = {
error: PHPCensor.handleFailedAjax
});
$.ajax({
url: APP_URL + 'web-notifications/builds-updated',
success: function (data) {
PHPCensor.showWebNotification(data);
},
error: PHPCensor.handleFailedAjax
});
if (NOTIFICATIONS) {
$.ajax({
url: APP_URL + 'web-notifications/builds-updated',
success: function (data) {
PHPCensor.showWebNotification(data);
},
error: PHPCensor.handleFailedAjax
});
}
},
getProjectBuilds: function () {
@@ -34,15 +34,17 @@ PHPCensor.widgets.allProjects = {
error: PHPCensor.handleFailedAjax
});
$.ajax({
url: APP_URL +
if (NOTIFICATIONS) {
$.ajax({
url: APP_URL +
'web-notifications/widgets-all-projects-update/' +
projectId,
success: function (data) {
PHPCensor.showWebNotification(data);
},
error: PHPCensor.handleFailedAjax
});
projectId,
success: function (data) {
PHPCensor.showWebNotification(data);
},
error: PHPCensor.handleFailedAjax
});
}
});
}
};
@@ -258,13 +258,16 @@ protected function getConfigInformation(InputInterface $input, OutputInterface $
'rotate' => false,
'max_files' => 0,
],
'notifications' => [
'enabled' => false,
],
'email_settings' => [
'from_address' => 'PHP Censor <no-reply@php-censor.local>',
'smtp_address' => null,
'smtp_port' => null,
'smtp_username' => null,
'smtp_password' => null,
'smtp_encryption' => false,
'from_address' => 'PHP Censor <no-reply@php-censor.local>',
'smtp_address' => null,
'smtp_port' => null,
'smtp_username' => null,
'smtp_password' => null,
'smtp_encryption' => false,
],
'ssh' => [
'strength' => 2048,
@@ -2,8 +2,20 @@
use PHPCensor\Helper\Lang;
/**
* @var \PHPCensor\Model\User $user
*/
$user = $this->getUser();
/**
* @var string $title
* @var string $subtitle
* @var string $version
* @var string $content
* @var string $skin
* @var bool $notifications
*/
?>
<!DOCTYPE html>
<html>
@@ -35,7 +47,8 @@ $user = $this->getUser();
<script src="<?= APP_URL; ?>assets/vendor/notifyjs/dist/notify.js" type="text/javascript"></script>
<script>
var APP_URL = '<?= APP_URL; ?>';
var APP_URL = '<?= APP_URL; ?>';
var NOTIFICATIONS = <?= ($notifications ? 'true' : 'false'); ?>;
var LANGUAGE = '<?= Lang::getLanguage(); ?>';
<?php if (defined('JSON_UNESCAPED_UNICODE')): ?>
@@ -48,9 +48,12 @@ public function init()
if (!empty($this->layoutName)) {
$this->layout = new View($this->layoutName);
$this->layout->title = 'PHP Censor';
$this->layout->breadcrumb = [];
$this->layout->version = trim(file_get_contents(ROOT_DIR . 'VERSION.md'));
$notifications = (bool)Config::getInstance()->get('php-censor.notifications.enabled', false);
$this->layout->title = 'PHP Censor';
$this->layout->breadcrumb = [];
$this->layout->version = trim(file_get_contents(ROOT_DIR . 'VERSION.md'));
$this->layout->notifications = $notifications;
$groups = [];
$groupStore = Factory::getStore('ProjectGroup');

0 comments on commit 84b2fef

Please sign in to comment.