diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 22:28:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-26 22:28:21 +0200 |
commit | a43c680d9f0704e74a0642fc0be2699b4659ac6b (patch) | |
tree | dd76ae01952c0cea59ccd56a14a93d40daf0b55b /apps/updatenotification | |
parent | 56437ad88190a7a2d495a06997d5e646680f1f79 (diff) | |
parent | afe40ac99604d0c9666dd751507225609771dd19 (diff) | |
download | nextcloud-server-a43c680d9f0704e74a0642fc0be2699b4659ac6b.tar.gz nextcloud-server-a43c680d9f0704e74a0642fc0be2699b4659ac6b.zip |
Merge pull request #1499 from nextcloud/updater
Add repair step and revert "Open updater" button
Diffstat (limited to 'apps/updatenotification')
6 files changed, 28 insertions, 14 deletions
diff --git a/apps/updatenotification/js/admin.js b/apps/updatenotification/js/admin.js index e60e77ab89a..3ca45a191d4 100644 --- a/apps/updatenotification/js/admin.js +++ b/apps/updatenotification/js/admin.js @@ -13,7 +13,33 @@ /** * 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 16ae8144b16..9f10f1b32f2 100644 --- a/apps/updatenotification/lib/Controller/AdminController.php +++ b/apps/updatenotification/lib/Controller/AdminController.php @@ -112,7 +112,6 @@ 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 5f759b7c843..dd51831007c 100644 --- a/apps/updatenotification/lib/UpdateChecker.php +++ b/apps/updatenotification/lib/UpdateChecker.php @@ -49,9 +49,6 @@ 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 0dd8aec4a04..68ef1d423b4 100644 --- a/apps/updatenotification/templates/admin.php +++ b/apps/updatenotification/templates/admin.php @@ -16,9 +16,7 @@ <form id="oca_updatenotification_section" class="followupsection"> <?php if($isNewVersionAvailable === true): ?> <strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong> - <?php if ($_['downloadLink']): ?> - <a href="<?php p($_['downloadLink']); ?>" class="button"><?php p($l->t('Download now')) ?></a> - <?php endif; ?> + <input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>"> <?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> diff --git a/apps/updatenotification/tests/Controller/AdminControllerTest.php b/apps/updatenotification/tests/Controller/AdminControllerTest.php index 6d1ee219561..336edffc957 100644 --- a/apps/updatenotification/tests/Controller/AdminControllerTest.php +++ b/apps/updatenotification/tests/Controller/AdminControllerTest.php @@ -111,10 +111,7 @@ class AdminControllerTest extends TestCase { $this->updateChecker ->expects($this->once()) ->method('getUpdateState') - ->willReturn([ - 'updateVersion' => '8.1.2', - 'downloadLink' => 'https://downloads.nextcloud.org/server', - ]); + ->willReturn(['updateVersion' => '8.1.2']); $params = [ 'isNewVersionAvailable' => true, @@ -123,7 +120,6 @@ class AdminControllerTest extends TestCase { 'channels' => $channels, 'newVersionString' => '8.1.2', 'notify_groups' => 'admin', - 'downloadLink' => 'https://downloads.nextcloud.org/server', ]; $expected = new TemplateResponse('updatenotification', 'admin', $params, ''); @@ -168,7 +164,6 @@ class AdminControllerTest extends TestCase { 'channels' => $channels, 'newVersionString' => '', 'notify_groups' => 'admin', - 'downloadLink' => '', ]; $expected = new TemplateResponse('updatenotification', 'admin', $params, ''); diff --git a/apps/updatenotification/tests/UpdateCheckerTest.php b/apps/updatenotification/tests/UpdateCheckerTest.php index 38e64b6b5e5..ce19cc60f2c 100644 --- a/apps/updatenotification/tests/UpdateCheckerTest.php +++ b/apps/updatenotification/tests/UpdateCheckerTest.php @@ -74,7 +74,6 @@ class UpdateCheckerTest extends TestCase { 'updateAvailable' => true, 'updateVersion' => 'Nextcloud 123', 'updateLink' => 'https://docs.nextcloud.com/myUrl', - 'downloadLink' => 'https://downloads.nextcloud.org/server', ]; $this->assertSame($expected, $this->updateChecker->getUpdateState()); } |