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
+10 -7
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;
}
+2 -2
View File
@@ -233,7 +233,7 @@ async function verifyConfig({ id, provider, config }) {
// attempt to upload and delete a file with new credentials
const bucket = getBucket(config);
const testFile = bucket.file(path.join(config.prefix, 'cloudron-testfile'));
const testFile = bucket.file(path.join(config.prefix, 'snapshot/cloudron-testfile'));
const uploadStream = testFile.createWriteStream({ resumable: false });
@@ -257,7 +257,7 @@ async function verifyConfig({ id, provider, config }) {
const [listError] = await safe(bucket.getFiles(query));
if (listError) throw new BoxError(BoxError.EXTERNAL_ERROR, `Failed to get files: ${listError.message}`);
const [delError] = await safe(bucket.file(path.join(config.prefix, 'cloudron-testfile')).delete());
const [delError] = await safe(bucket.file(path.join(config.prefix, 'snapshot/cloudron-testfile')).delete());
if (delError) throw new BoxError(BoxError.EXTERNAL_ERROR, delError.message);
debug('testConfig: deleted cloudron-testfile');