Skip to content

Commit b42ee95

Browse files
committed
Show an update button instead of the updater
1 parent 83515c9 commit b42ee95

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
lines changed

apps/updatenotification/controller/admincontroller.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function displayPanel() {
134134
'channels' => $channels,
135135
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
136136
'updaterRequirementsFulfilled' => $this->isCompatibleWithUpdater(),
137+
'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
137138
];
138139

139140
return new TemplateResponse($this->appName, 'admin', $params, '');

apps/updatenotification/js/admin.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,7 @@
1313
/**
1414
* Creates a new authentication token and loads the updater URL
1515
*/
16-
var loginToken = '';
1716
$(document).ready(function(){
18-
$('#oca_updatenotification_button').click(function() {
19-
// Load the new token
20-
$.ajax({
21-
url: OC.generateUrl('/apps/updatenotification/credentials')
22-
}).success(function(data) {
23-
loginToken = data;
24-
$.ajax({
25-
url: OC.webroot+'/updater/',
26-
headers: {
27-
'X-Updater-Auth': loginToken
28-
},
29-
method: 'POST',
30-
success: function(data){
31-
if(data !== 'false') {
32-
var body = $('body');
33-
$('head').remove();
34-
body.html(data);
35-
body.removeAttr('id');
36-
body.attr('id', 'body-settings');
37-
}
38-
}
39-
});
40-
});
41-
});
4217
$('#release-channel').change(function() {
4318
var newChannel = $('#release-channel').find(":selected").val();
4419
$.post(

apps/updatenotification/lib/updatechecker.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public function getUpdateState() {
4848
if(substr($data['web'], 0, 8) === 'https://') {
4949
$result['updateLink'] = $data['web'];
5050
}
51+
if(substr($data['url'], 0, 8) === 'https://') {
52+
$result['downloadLink'] = $data['url'];
53+
}
5154

5255
return $result;
5356
}

apps/updatenotification/templates/admin.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020

2121
<?php if($isNewVersionAvailable === true): ?>
2222
<strong><?php p($l->t('A new version is available: %s', [$newVersionString])); ?></strong>
23-
<?php if($updaterRequirementsFulfilled === true): ?>
24-
<input type="button" id="oca_updatenotification_button" value="<?php p($l->t('Open updater')) ?>">
25-
<?php else: ?>
26-
<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.')); ?>
23+
<?php if ($_['downloadLink']): ?>
24+
<a href="<?php p($_['downloadLink']); ?>" class="button"><?php p($l->t('Download now')) ?></a>
2725
<?php endif; ?>
2826
<?php else: ?>
2927
<strong><?php print_unescaped($l->t('Your version is up to date.')); ?></strong>

0 commit comments

Comments
 (0)