Rename backup label to name and separate backup listing into new view

This commit is contained in:
Johannes Zellner
2025-08-04 14:40:29 +02:00
parent 0ff760fe4a
commit 1016d41d7a
8 changed files with 77 additions and 41 deletions

View File

@@ -346,24 +346,27 @@ async function verifyConfig({ id, provider, config }) {
}
}
const tmp = _.pick(config, ['noHardlinks', 'chown', 'preserveAttributes', 'backupDir', 'prefix', 'mountOptions', 'mountPoint']);
const newConfig = { _provider: provider, _managedMountPath: managedMountPath, ...tmp };
const fullPath = getRootPath(newConfig);
const newConfig = _.pick(config, ['noHardlinks', 'chown', 'preserveAttributes', 'backupDir', 'prefix', 'mountOptions', 'mountPoint']);
newConfig._provider = provider;
const fullPath = getRootPath({ ...newConfig, _managedMountPath: `${managedMountPath}-validation` });
if (!safe.fs.mkdirSync(path.join(fullPath, 'snapshot'), { recursive: true }) && safe.error.code !== 'EEXIST') {
if (safe.error && safe.error.code === 'EACCES') throw new BoxError(BoxError.BAD_FIELD, `Access denied. Create ${fullPath}/snapshot and run "chown yellowtent:yellowtent ${fullPath}" on the server`);
throw new BoxError(BoxError.BAD_FIELD, safe.error.message);
}
if (!safe.fs.writeFileSync(path.join(fullPath, 'cloudron-testfile'), 'testcontent')) {
if (!safe.fs.writeFileSync(path.join(fullPath, 'snapshot/cloudron-testfile'), 'testcontent')) {
throw new BoxError(BoxError.BAD_FIELD, `Unable to create test file as 'yellowtent' user in ${fullPath}: ${safe.error.message}. Check dir/mount permissions`);
}
}
if (!safe.fs.unlinkSync(path.join(fullPath, 'cloudron-testfile'))) {
if (!safe.fs.unlinkSync(path.join(fullPath, 'snapshot/cloudron-testfile'))) {
throw new BoxError(BoxError.BAD_FIELD, `Unable to remove test file as 'yellowtent' user in ${fullPath}: ${safe.error.message}. Check dir/mount permissions`);
}
if (mounts.isManagedProvider(provider)) await mounts.removeMount({ hostPath: `${managedMountPath}-validation`, mountType: provider, mountOptions: config.mountOptions });
if (mounts.isManagedProvider(provider)) {
await mounts.removeMount({ hostPath: `${managedMountPath}-validation`, mountType: provider, mountOptions: config.mountOptions });
newConfig._managedMountPath = managedMountPath;
}
return newConfig;
}