summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-08 10:59:14 +0200
committerJoas Schilling <coding@schilljs.com>2016-09-08 10:59:14 +0200
commit202ae42506e9bbb167889735b2c56ccebace594b (patch)
tree7374b08be73cddf4382e72c1debce42c255ad60a
parentff691b4d8a26c08dcf9555c70a071cdebd1266e6 (diff)
downloadnextcloud-server-202ae42506e9bbb167889735b2c56ccebace594b.tar.gz
nextcloud-server-202ae42506e9bbb167889735b2c56ccebace594b.zip
Show an update button instead of the updater
-rw-r--r--apps/updatenotification/js/admin.js26
-rw-r--r--apps/updatenotification/lib/Controller/AdminController.php1
-rw-r--r--apps/updatenotification/lib/UpdateChecker.php3
-rw-r--r--apps/updatenotification/templates/admin.php4
4 files changed, 7 insertions, 27 deletions
diff --git a/apps/updatenotification/js/admin.js b/apps/updatenotification/js/admin.js
index 3ca45a191d4..e60e77ab89a 100644
--- a/apps/updatenotification/js/admin.js
+++ b/apps/updatenotification/js/admin.js
@@ -13,33 +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();
diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php
index 9f10f1b32f2..16ae8144b16 100644
--- a/apps/updatenotification/lib/Controller/AdminController.php
+++ b/apps/updatenotification/lib/Controller/AdminController.php
@@ -112,6 +112,7 @@ class AdminController extends Controller implements ISettings {
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
+ 'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
'notify_groups' => implode('|', $notifyGroups),
];
diff --git a/apps/updatenotification/lib/UpdateChecker.php b/apps/updatenotification/lib/UpdateChecker.php
index dd51831007c..5f759b7c843 100644
--- a/apps/updatenotification/lib/UpdateChecker.php
+++ b/apps/updatenotification/lib/UpdateChecker.php
@@ -49,6 +49,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 68ef1d423b4..0dd8aec4a04 100644
--- a/apps/updatenotification/templates/admin.php
+++ b/apps/updatenotification/templates/admin.php
@@ -16,7 +16,9 @@
<form id="oca_updatenotification_section" class="followupsection">
<?php if($isNewVersionAvailable === true): ?>
<strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
- <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>">
+ <?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>
<span class="icon-info svg" title="<?php p($l->t('Checked on %s', [$lastCheckedDate])) ?>"></span>