diff --git a/apps/updatenotification/controller/admincontroller.php b/apps/updatenotification/controller/admincontroller.php index eddedb6c1b..5eafb1449f 100644 --- a/apps/updatenotification/controller/admincontroller.php +++ b/apps/updatenotification/controller/admincontroller.php @@ -102,11 +102,13 @@ class AdminController extends Controller { } $updateState = $this->updateChecker->getUpdateState(); $params = [ - 'isNewVersionAvailable' => ($updateState === []) ? false : true, + 'isNewVersionAvailable' => !empty($updateState['updateAvailable']), 'lastChecked' => $lastUpdateCheck, 'currentChannel' => $currentChannel, 'channels' => $channels, - 'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'], + 'newVersionString' => (empty($updateState['updateVersion'])) ? '' : $updateState['updateVersion'], + 'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'], + 'updaterEnabled' => $updateState['updaterEnabled'], ]; return new TemplateResponse($this->appName, 'admin', $params, ''); diff --git a/apps/updatenotification/js/admin.js b/apps/updatenotification/js/admin.js index 3bc5dd2152..d1d51e7239 100644 --- a/apps/updatenotification/js/admin.js +++ b/apps/updatenotification/js/admin.js @@ -35,6 +35,11 @@ $(document).ready(function(){ body.removeAttr('id'); body.attr('id', 'body-settings'); } + }, + error: function() { + OC.Notification.showTemporary(t('updatenotification', 'Could not start updater, please try the manual update')); + $('#oca_updatenotification_button').addClass('hidden'); + $('#oca_updatenotification_section .button').removeClass('hidden'); } }); }); diff --git a/apps/updatenotification/lib/updatechecker.php b/apps/updatenotification/lib/updatechecker.php index 32eab405a6..dc5de9d068 100644 --- a/apps/updatenotification/lib/updatechecker.php +++ b/apps/updatenotification/lib/updatechecker.php @@ -45,9 +45,13 @@ class UpdateChecker { if(isset($data['version']) && $data['version'] !== '' && $data['version'] !== []) { $result['updateAvailable'] = true; $result['updateVersion'] = $data['versionstring']; + $result['updaterEnabled'] = $data['autoupdater'] === '1'; if(substr($data['web'], 0, 8) === 'https://') { $result['updateLink'] = $data['web']; } + if(substr($data['url'], 0, 8) === 'https://') { + $result['downloadLink'] = $data['url']; + } return $result; } diff --git a/apps/updatenotification/templates/admin.php b/apps/updatenotification/templates/admin.php index 534a3032d9..4400dd277c 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -16,13 +16,18 @@