| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/admin/javascript/engine/libs/ |
Upload File : |
/* --------------------------------------------------------------
auto_updater.js 2019-02-07
Gambio GmbH
http://www.gambio.de
Copyright (c) 2019 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
jse.libs.auto_updater = jse.libs.auto_updater || {};
(function(exports) {
'use strict';
// ------------------------------------------------------------------------
// VARIABLES AND CONSTANTS
// ------------------------------------------------------------------------
/**
* Default options for controller,
*
* @type {object}
*/
const URLS = {
processInstallation: '../app_store.php?do=processUpdate',
permissionCheck: 'admin.php?do=AutoUpdaterAjax/checkPermission',
uninstallTheme: 'admin.php?do=AutoUpdaterAjax/uninstallTheme',
};
// ------------------------------------------------------------------------
// FUNCTIONS
// ------------------------------------------------------------------------
/**
* Installs a given update.
*/
exports.installAppStorePackage = function(appStoreData, updateProgressCallback) {
return new Promise((resolve, reject) => {
const request = {
url: URLS.processInstallation,
data: {appStoreData: JSON.stringify(appStoreData)},
};
jse.libs.xhr.post(request).done(response => {
if (response.success !== true) {
return reject('Unexpected error');
}
updateProgressCallback(response);
if (response.done === true) {
return resolve();
}
exports.installAppStorePackage(appStoreData, updateProgressCallback).then(() => {
resolve();
}).catch(error => {
reject('Unexpected error');
})
}).fail(() => {
reject('Install processing request failed');
});
});
};
/**
* Checks the file permissions for a given update.
*/
exports.checkAppStorePackageFilePermissions = function(appStoreData) {
return new Promise((resolve, reject) => {
const request = {
url: URLS.permissionCheck,
data: {appStoreData: JSON.stringify(appStoreData)},
};
jse.libs.xhr.post(request).done(response => {
if (response.success !== true || response.result !== true) {
reject('Permission check failed');
}
resolve();
}).fail(() => {
reject('Permission check request failed');
});
});
};
/**
* Checks the file permissions for a given update.
*/
exports.uninstallTheme = function(themeName) {
return new Promise((resolve, reject) => {
const request = {
url: URLS.uninstallTheme,
data: {themeName: themeName}
};
jse.libs.xhr.post(request).done(response => {
if (response.success !== true) {
reject('Uninstall failed');
}
resolve();
}).fail((data) => {
reject(data);
});
});
};
})(jse.libs.auto_updater);