/**
* 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();
'currentChannel' => $currentChannel,
'channels' => $channels,
'newVersionString' => ($updateState === []) ? '' : $updateState['updateVersion'],
+ 'downloadLink' => (empty($updateState['downloadLink'])) ? '' : $updateState['downloadLink'],
'notify_groups' => implode('|', $notifyGroups),
];
if(substr($data['web'], 0, 8) === 'https://') {
$result['updateLink'] = $data['web'];
}
+ if(substr($data['url'], 0, 8) === 'https://') {
+ $result['downloadLink'] = $data['url'];
+ }
return $result;
}
<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>