diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-08 11:59:14 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-09-08 12:08:17 +0300 |
commit | b42ee95383cbedb6a0fadf315fcdccba226286a9 (patch) | |
tree | d4d7523949d3de348f29c68f455dc42ef27c0c94 | |
parent | 83515c90e9d48f00aa1ebd5794cda243ac9006b4 (diff) |
Show an update button instead of the updater
-rw-r--r-- | apps/updatenotification/controller/admincontroller.php | 1 | ||||
-rw-r--r-- | apps/updatenotification/js/admin.js | 25 | ||||
-rw-r--r-- | apps/updatenotification/lib/updatechecker.php | 3 | ||||
-rw-r--r-- | apps/updatenotification/templates/admin.php | 6 |
4 files changed, 6 insertions, 29 deletions
diff --git a/apps/updatenotification/controller/admincontroller.php b/apps/updatenotification/controller/admincontroller.php index 8635b3f3e3d..55ef26c59a7 100644 --- a/apps/updatenotification/controller/admincontroller.php +++ b/apps/updatenotification/controller/admincontroller.php @@ -134,6 +134,7 @@ class AdminController extends Controller { 'channels' => $channels, 'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'], 'updaterRequirementsFulfilled' => $this->isCompatibleWithUpdater(), + 'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'], ]; return new TemplateResponse($this->appName, 'admin', $params, ''); diff --git a/apps/updatenotification/js/admin.js b/apps/updatenotification/js/admin.js index 3bc5dd21527..4332df78909 100644 --- a/apps/updatenotification/js/admin.js +++ b/apps/updatenotification/js/admin.js @@ -13,32 +13,7 @@ /** * Creates a new authentication token and loads the updater URL */ -var loginToken = ''; $(document).ready(function(){ - $('#oca_updatenotification_button').click(function() { - // Load the new token - $.ajax({ - url: OC.generateUrl('/apps/updatenotification/credentials') - }).success(function(data) { - loginToken = data; - $.ajax({ - url: OC.webroot+'/updater/', - headers: { - 'X-Updater-Auth': loginToken - }, - method: 'POST', - success: function(data){ - if(data !== 'false') { - var body = $('body'); - $('head').remove(); - body.html(data); - body.removeAttr('id'); - body.attr('id', 'body-settings'); - } - } - }); - }); - }); $('#release-channel').change(function() { var newChannel = $('#release-channel').find(":selected").val(); $.post( diff --git a/apps/updatenotification/lib/updatechecker.php b/apps/updatenotification/lib/updatechecker.php index 32eab405a62..153a6ae4aa3 100644 --- a/apps/updatenotification/lib/updatechecker.php +++ b/apps/updatenotification/lib/updatechecker.php @@ -48,6 +48,9 @@ class UpdateChecker { 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 67f693ce7ea..32ad7ffd1ad 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -20,10 +20,8 @@ <?php if($isNewVersionAvailable === true): ?> <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> - <?php if($updaterRequirementsFulfilled === true): ?> - <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> - <?php else: ?> - <br/><?php p($l->t('At the moment only manual updates are supported on your environment. This is very likely the case because functions such as shell_exec are not available.')); ?> + <?php if ($_['downloadLink']): ?> + <a href="<?php p($_['downloadLink']); ?>" class="button"><?php p($l->t('Download now')) ?></a> <?php endif; ?> <?php else: ?> <strong><?php print_unescaped($l->t('Your version is up to date.')); ?></strong> |