diff --git a/apps/updatenotification/controller/admincontroller.php b/apps/updatenotification/controller/admincontroller.php
index 8635b3f3e3d4a..55ef26c59a73e 100644
--- a/apps/updatenotification/controller/admincontroller.php
+++ b/apps/updatenotification/controller/admincontroller.php
@@ -134,6 +134,7 @@ public function displayPanel() {
'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 3bc5dd21527e7..4332df7890954 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 32eab405a62f7..153a6ae4aa38f 100644
--- a/apps/updatenotification/lib/updatechecker.php
+++ b/apps/updatenotification/lib/updatechecker.php
@@ -48,6 +48,9 @@ public function getUpdateState() {
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 67f693ce7ea9f..32ad7ffd1ad57 100644
--- a/apps/updatenotification/templates/admin.php
+++ b/apps/updatenotification/templates/admin.php
@@ -20,10 +20,8 @@
t('A new version is available: %s', [$newVersionString])); ?>
-
-
-
-
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.')); ?>
+
+ t('Download now')) ?>
t('Your version is up to date.')); ?>
diff --git a/apps/updatenotification/tests/UpdateCheckerTest.php b/apps/updatenotification/tests/UpdateCheckerTest.php
index e83d4c9a24d9b..d8818a2e60e3f 100644
--- a/apps/updatenotification/tests/UpdateCheckerTest.php
+++ b/apps/updatenotification/tests/UpdateCheckerTest.php
@@ -46,13 +46,14 @@ public function testGetUpdateStateWithUpdateAndInvalidLink() {
->method('check')
->willReturn([
'version' => 123,
- 'versionstring' => 'ownCloud 123',
+ 'versionstring' => 'Nextcloud 123',
'web'=> 'javascript:alert(1)',
+ 'url'=> 'javascript:alert(2)',
]);
$expected = [
'updateAvailable' => true,
- 'updateVersion' => 'ownCloud 123',
+ 'updateVersion' => 'Nextcloud 123',
];
$this->assertSame($expected, $this->updateChecker->getUpdateState());
}
@@ -63,14 +64,16 @@ public function testGetUpdateStateWithUpdateAndValidLink() {
->method('check')
->willReturn([
'version' => 123,
- 'versionstring' => 'ownCloud 123',
- 'web'=> 'https://owncloud.org/myUrl',
+ 'versionstring' => 'Nextcloud 123',
+ 'web'=> 'https://docs.nextcloud.com/myUrl',
+ 'url'=> 'https://downloads.nextcloud.org/server',
]);
$expected = [
'updateAvailable' => true,
- 'updateVersion' => 'ownCloud 123',
- 'updateLink' => 'https://owncloud.org/myUrl',
+ 'updateVersion' => 'Nextcloud 123',
+ 'updateLink' => 'https://docs.nextcloud.com/myUrl',
+ 'downloadLink' => 'https://downloads.nextcloud.org/server',
];
$this->assertSame($expected, $this->updateChecker->getUpdateState());
}
diff --git a/apps/updatenotification/tests/controller/AdminControllerTest.php b/apps/updatenotification/tests/controller/AdminControllerTest.php
index 18135239e9eee..ef07fbc498ba3 100644
--- a/apps/updatenotification/tests/controller/AdminControllerTest.php
+++ b/apps/updatenotification/tests/controller/AdminControllerTest.php
@@ -127,6 +127,7 @@ public function testDisplayPanelWithUpdate() {
'channels' => $channels,
'newVersionString' => '8.1.2',
'updaterRequirementsFulfilled' => true,
+ 'downloadLink' => '',
];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
@@ -160,7 +161,10 @@ public function testDisplayPanelWithUpdateAndIncompatibleUpdaterApp() {
$this->updateChecker
->expects($this->once())
->method('getUpdateState')
- ->willReturn(['updateVersion' => '8.1.2']);
+ ->willReturn([
+ 'updateVersion' => '8.1.2',
+ 'downloadLink' => 'https://downloads.nextcloud.org/server',
+ ]);
$this->adminController
->expects($this->once())
->method('isCompatibleWithUpdater')
@@ -173,6 +177,7 @@ public function testDisplayPanelWithUpdateAndIncompatibleUpdaterApp() {
'channels' => $channels,
'newVersionString' => '8.1.2',
'updaterRequirementsFulfilled' => false,
+ 'downloadLink' => 'https://downloads.nextcloud.org/server',
];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
@@ -219,6 +224,7 @@ public function testDisplayPanelWithoutUpdate() {
'channels' => $channels,
'newVersionString' => '',
'updaterRequirementsFulfilled' => true,
+ 'downloadLink' => '',
];
$expected = new TemplateResponse('updatenotification', 'admin', $params, '');
diff --git a/config/config.sample.php b/config/config.sample.php
index ca020113a3642..538dd9d7a6efb 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -498,7 +498,7 @@
/**
* URL that Nextcloud should use to look for updates
*/
-'updater.server.url' => 'https://updates.nextcloud.org/server/',
+'updater.server.url' => 'https://updates.nextcloud.com/update-server/',
/**
* Release channel to use for updates
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 58d5bec7cbf02..2ebc332bd5658 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -144,7 +144,7 @@ public function check() {
return json_decode($this->config->getAppValue('core', 'lastupdateResult'), true);
}
- $updaterUrl = $this->config->getSystemValue('updater.server.url', 'https://updates.nextcloud.org/server/');
+ $updaterUrl = $this->config->getSystemValue('updater.server.url', 'https://updates.nextcloud.com/update-server/');
$this->config->setAppValue('core', 'lastupdatedat', time());
diff --git a/tests/lib/updater.php b/tests/lib/updater.php
index 1363fb735cad8..2ceb260407628 100644
--- a/tests/lib/updater.php
+++ b/tests/lib/updater.php
@@ -222,8 +222,8 @@ public function testCheckWithoutUpdateUrl() {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('updater.server.url', 'https://updates.nextcloud.org/server/')
- ->willReturn('https://updates.nextcloud.org/server/');
+ ->with('updater.server.url', 'https://updates.nextcloud.com/update-server/')
+ ->willReturn('https://updates.nextcloud.com/update-server/');
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -253,7 +253,7 @@ public function testCheckWithoutUpdateUrl() {
$this->httpHelper
->expects($this->once())
->method('getUrlContent')
- ->with($this->buildUpdateUrl('https://updates.nextcloud.org/server/'))
+ ->with($this->buildUpdateUrl('https://updates.nextcloud.com/update-server/'))
->will($this->returnValue($updateXml));
$this->assertSame($expectedResult, $this->updater->check());
@@ -268,8 +268,8 @@ public function testCheckWithInvalidXml() {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('updater.server.url', 'https://updates.nextcloud.org/server/')
- ->willReturn('https://updates.nextcloud.org/server/');
+ ->with('updater.server.url', 'https://updates.nextcloud.com/update-server/')
+ ->willReturn('https://updates.nextcloud.com/update-server/');
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -293,7 +293,7 @@ public function testCheckWithInvalidXml() {
$this->httpHelper
->expects($this->once())
->method('getUrlContent')
- ->with($this->buildUpdateUrl('https://updates.nextcloud.org/server/'))
+ ->with($this->buildUpdateUrl('https://updates.nextcloud.com/update-server/'))
->will($this->returnValue($updateXml));
$this->assertSame([], $this->updater->check());
@@ -315,8 +315,8 @@ public function testCheckWithEmptyValidXmlResponse() {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('updater.server.url', 'https://updates.nextcloud.org/server/')
- ->willReturn('https://updates.nextcloud.org/server/');
+ ->with('updater.server.url', 'https://updates.nextcloud.com/update-server/')
+ ->willReturn('https://updates.nextcloud.com/update-server/');
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -342,7 +342,7 @@ public function testCheckWithEmptyValidXmlResponse() {
$this->httpHelper
->expects($this->once())
->method('getUrlContent')
- ->with($this->buildUpdateUrl('https://updates.nextcloud.org/server/'))
+ ->with($this->buildUpdateUrl('https://updates.nextcloud.com/update-server/'))
->will($this->returnValue($updateXml));
$this->assertSame($expectedResult, $this->updater->check());
@@ -359,8 +359,8 @@ public function testCheckWithEmptyInvalidXmlResponse() {
$this->config
->expects($this->at(1))
->method('getSystemValue')
- ->with('updater.server.url', 'https://updates.nextcloud.org/server/')
- ->willReturn('https://updates.nextcloud.org/server/');
+ ->with('updater.server.url', 'https://updates.nextcloud.com/update-server/')
+ ->willReturn('https://updates.nextcloud.com/update-server/');
$this->config
->expects($this->at(2))
->method('setAppValue')
@@ -384,7 +384,7 @@ public function testCheckWithEmptyInvalidXmlResponse() {
$this->httpHelper
->expects($this->once())
->method('getUrlContent')
- ->with($this->buildUpdateUrl('https://updates.nextcloud.org/server/'))
+ ->with($this->buildUpdateUrl('https://updates.nextcloud.com/update-server/'))
->will($this->returnValue($updateXml));
$this->assertSame($expectedResult, $this->updater->check());