Fix setup and restore to have a task style API
This commit is contained in:
@@ -11,9 +11,8 @@ exports = module.exports = {
|
||||
checkForUpdates: checkForUpdates,
|
||||
getLogs: getLogs,
|
||||
getLogStream: getLogStream,
|
||||
getStatus: getStatus,
|
||||
setDashboardDomain: setDashboardDomain,
|
||||
setDashboardDns: setDashboardDns,
|
||||
prepareDashboardDomain: prepareDashboardDomain,
|
||||
renewCerts: renewCerts
|
||||
};
|
||||
|
||||
@@ -187,10 +186,10 @@ function setDashboardDomain(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function setDashboardDns(req, res, next) {
|
||||
function prepareDashboardDomain(req, res, next) {
|
||||
if (!req.body.domain || typeof req.body.domain !== 'string') return next(new HttpError(400, 'domain must be a string'));
|
||||
|
||||
cloudron.setDashboardDns(req.body.domain, auditSource(req), function (error, taskId) {
|
||||
cloudron.prepareDashboardDomain(req.body.domain, auditSource(req), function (error, taskId) {
|
||||
if (error && error.reason === CloudronError.BAD_FIELD) return next(new HttpError(404, error.message));
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
@@ -198,14 +197,6 @@ function setDashboardDns(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function getStatus(req, res, next) {
|
||||
cloudron.getStatus(function (error, status) {
|
||||
if (error) return next(new HttpError(500, error));
|
||||
|
||||
next(new HttpSuccess(200, status));
|
||||
});
|
||||
}
|
||||
|
||||
function renewCerts(req, res, next) {
|
||||
cloudron.renewCerts({ domain: req.body.domain || null }, auditSource(req), function (error, taskId) {
|
||||
if (error && error.reason === CloudronError.NOT_FOUND) return next(new HttpError(404, error.message));
|
||||
|
||||
Reference in New Issue
Block a user