Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions apps/updatenotification/js/updatenotification.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/updatenotification/js/updatenotification.js.map

Large diffs are not rendered by default.

43 changes: 15 additions & 28 deletions apps/updatenotification/src/components/root.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,34 +251,21 @@
clickUpdaterButton: function() {
$.ajax({
url: OC.generateUrl('/apps/updatenotification/credentials')
}).success(function(data) {
$.ajax({
url: OC.getRootPath()+'/updater/',
headers: {
'X-Updater-Auth': data
},
method: 'POST',
success: function(data){
if(data !== 'false') {
var body = $('body');
$('head').remove();
body.html(data);

// Eval the script elements in the response
var dom = $(data);
dom.filter('script').each(function() {
eval(this.text || this.textContent || this.innerHTML || '');
});

body.removeAttr('id');
body.attr('id', 'body-settings');
}
},
error: function() {
OC.Notification.showTemporary(t('updatenotification', 'Could not start updater, please try the manual update'));
this.updaterEnabled = false;
}.bind(this)
});
}).success(function(token) {
// create a form to send a proper post request to the updater
var form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', OC.getRootPath() + '/updater/');

var hiddenField = document.createElement('input');
hiddenField.setAttribute('type', 'hidden');
hiddenField.setAttribute('name', 'updater-secret-input');
hiddenField.setAttribute('value', token);

form.appendChild(hiddenField);

document.body.appendChild(form);
form.submit();
}.bind(this));
},
changeReleaseChannel: function() {
Expand Down