dashboard: add UI to change background image

This commit is contained in:
Johannes Zellner
2024-04-05 16:26:59 +02:00
parent 2515b032d0
commit 544b8180b2
4 changed files with 50 additions and 20 deletions

View File

@@ -826,8 +826,16 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
});
};
Client.prototype.hasCloudronBackground = function (callback) {
get('/api/v1/branding/cloudron_background', null, function (error, data, status) {
console.log('hasCloudronBackground...')
if (error && error.statusCode !== 404) callback(error);
else if (error) callback(null, false);
else callback(null, status === 200);
});
};
Client.prototype.changeCloudronBackground = function (background, callback) {
// Blob type if object
var fd = new FormData();
if (background) fd.append('background', background);
@@ -839,6 +847,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
post('/api/v1/branding/cloudron_background', fd, config, function (error, data, status) {
if (error) return callback(error);
if (status !== 202) return callback(new ClientError(status, data));
callback(null);
});
};