mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
a1438e3b98
no issue - removed occurrences of csrf from client
61 lines
1.9 KiB
JavaScript
61 lines
1.9 KiB
JavaScript
var DebugController = Ember.Controller.extend(Ember.Evented, {
|
|
uploadButtonText: 'Import',
|
|
|
|
exportPath: function () {
|
|
return this.get('ghostPaths').apiUrl('db');
|
|
}.property(),
|
|
|
|
actions: {
|
|
onUpload: function (file) {
|
|
var self = this,
|
|
formData = new FormData();
|
|
|
|
this.set('uploadButtonText', 'Importing');
|
|
|
|
formData.append('importfile', file);
|
|
|
|
ic.ajax.request(this.get('ghostPaths').apiUrl('db'), {
|
|
type: 'POST',
|
|
data: formData,
|
|
dataType: 'json',
|
|
cache: false,
|
|
contentType: false,
|
|
processData: false
|
|
}).then(function () {
|
|
self.notifications.showSuccess('Import successful.');
|
|
}).catch(function (response) {
|
|
self.notifications.showErrors(response);
|
|
}).finally(function () {
|
|
self.set('uploadButtonText', 'Import');
|
|
self.trigger('reset');
|
|
});
|
|
},
|
|
|
|
exportData: function () {
|
|
var self = this;
|
|
|
|
ic.ajax.request(this.get('ghostPaths').apiUrl('db'), {
|
|
type: 'GET'
|
|
}).then(function () {
|
|
self.notifications.showSuccess('Data exported successfully.');
|
|
}).catch(function (response) {
|
|
self.notifications.showErrors(response);
|
|
});
|
|
},
|
|
|
|
sendTestEmail: function () {
|
|
var self = this;
|
|
|
|
ic.ajax.request(this.get('ghostPaths').apiUrl('mail', 'test'), {
|
|
type: 'POST'
|
|
}).then(function () {
|
|
self.notifications.showSuccess('Check your email for the test message:');
|
|
}).catch(function (response) {
|
|
self.notifications.showErrors(response);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
|
|
export default DebugController;
|