Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

fix: resolves multiple storage integration issues

towfiqi02dbe0dd0d28
diff --git a/backend/src/utils/providers.ts b/backend/src/utils/providers.ts
index a6112fd..574202a 100644
--- a/backend/src/utils/providers.ts
+++ b/backend/src/utils/providers.ts
@@ -242,8 +242,15 @@ export const providers: Record<string, ProviderConfig> = {
name: 'Azure Blob Storage',
doc: '/storages/connecting-azure-blob-storage',
settings: azureblobSettings,
- authTypes: ['client', 'password'],
- setup: creds => ['account', creds.account, 'key', creds.key],
+ authTypes: ['client'],
+ setup: creds => {
+ if (!creds.account || !creds.key) {
+ return false;
+ }
+ // The key is the base64 string from the Azure portal. rclone passes it
+ // through and the Azure SDK decodes it, so do not encode it here.
+ return ['account', creds.account, 'key', creds.key];
+ },
features: providerFeatures['azureblob'],
},
gcs: {
@@ -329,7 +336,27 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-storj',
settings: storjSettings,
authTypes: ['client', 'password'],
- setup: creds => ['access_grant', creds.accessGrant],
+ setup: (creds, type) => {
+ if (type === 'client') {
+ if (!creds.satellite_address || !creds.api_key || !creds.passphrase) {
+ return false;
+ }
+ return [
+ 'provider',
+ 'new',
+ 'satellite_address',
+ creds.satellite_address,
+ 'api_key',
+ creds.api_key,
+ 'passphrase',
+ creds.passphrase,
+ ];
+ }
+ if (!creds.access_grant) {
+ return false;
+ }
+ return ['provider', 'existing', 'access_grant', creds.access_grant];
+ },
features: providerFeatures['storj'],
},
seafile: {
@@ -455,8 +482,8 @@ export const providers: Record<string, ProviderConfig> = {
creds.client_id,
'client_secret',
creds.client_secret,
- 'scope',
- creds.scope,
+ 'scope_access',
+ creds.scope_access,
'--hidrive-client-credentials',
];
}
@@ -504,14 +531,21 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-qingstor',
authTypes: ['client'],
settings: qingstorSettings,
- setup: creds => [
- 'access_key_id',
- creds.access_key_id,
- 'secret_access_key',
- creds.secret_access_key,
- 'zone',
- creds.zone,
- ],
+ setup: creds => {
+ const flags = [
+ 'access_key_id',
+ creds.access_key_id,
+ 'secret_access_key',
+ creds.secret_access_key,
+ 'zone',
+ creds.zone,
+ ];
+ if (creds.endpoint) {
+ flags.push('endpoint', creds.endpoint);
+ }
+
+ return flags;
+ },
features: providerFeatures['qingstor'],
},
premiumizeme: {
@@ -636,7 +670,22 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-files-com',
authTypes: ['client', 'password'],
settings: filesComSettings,
- setup: creds => ['api_key', creds.api_key],
+ setup: (creds, type) => {
+ if (type === 'password') {
+ if (!creds.site || !creds.username || !creds.password) {
+ return false;
+ }
+ return ['site', creds.site, 'username', creds.username, 'password', creds.password];
+ }
+ if (!creds.api_key) {
+ return false;
+ }
+ const args = ['api_key', creds.api_key];
+ if (creds.site) {
+ args.push('site', creds.site);
+ }
+ return args;
+ },
features: providerFeatures['filescom'],
},
gofile: {
@@ -644,7 +693,7 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-gofile',
authTypes: ['client'],
settings: gofileSettings,
- setup: creds => ['token', creds.token],
+ setup: creds => ['access_token', creds.access_token],
features: providerFeatures['gofile'],
},
gphotos: {
@@ -674,7 +723,7 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-linkbox',
authTypes: ['client'],
settings: linkboxSettings,
- setup: creds => ['api_key', creds.api_key],
+ setup: creds => ['token', creds.token, 'email', creds.email, 'password', creds.password],
features: providerFeatures['linkbox'],
},
oracleobjectstorage: {
@@ -701,7 +750,7 @@ export const providers: Record<string, ProviderConfig> = {
doc: '/storages/connecting-pikpak',
authTypes: ['password'],
settings: pikpakSettings,
- setup: creds => ['user', creds.username, 'pass', creds.password],
+ setup: creds => ['user', creds.user, 'pass', creds.pass],
features: providerFeatures['pikpak'],
},
pixeldrain: {
diff --git a/backend/src/utils/providers/azureblob.ts b/backend/src/utils/providers/azureblob.ts
index 4c27812..295bdf6 100644
--- a/backend/src/utils/providers/azureblob.ts
+++ b/backend/src/utils/providers/azureblob.ts
@@ -3,6 +3,7 @@ const azureblobSettings = [
label: 'Storage Account Name',
value: 'account',
fieldType: 'string',
+ authFieldType: 'client',
required: true,
default: '',
description: 'Azure Storage Account Name. Set this to the Azure Storage Account Name in use.',
@@ -42,18 +43,15 @@ const azureblobSettings = [
label: 'Tenant ID',
value: 'tenant',
fieldType: 'string',
- authFieldType: 'password',
required: false,
default: '',
- description:
- "ID of the service principal's tenant, also called its directory ID.",
+ description: "ID of the service principal's tenant, also called its directory ID.",
command: '--azureblob-tenant',
},
{
label: 'Client ID',
value: 'client_id',
fieldType: 'string',
- authFieldType: 'password',
required: false,
default: '',
description: 'The ID of the client in use.',
@@ -74,8 +72,7 @@ const azureblobSettings = [
fieldType: 'string',
required: false,
default: '',
- description:
- 'Path to a PEM or PKCS12 certificate file including the private key.',
+ description: 'Path to a PEM or PKCS12 certificate file including the private key.',
command: '--azureblob-client-certificate-path',
},
{
@@ -101,7 +98,6 @@ const azureblobSettings = [
label: 'Username',
value: 'username',
fieldType: 'string',
- authFieldType: 'password',
required: false,
default: '',
description: 'User name (usually an email address).',
@@ -111,7 +107,6 @@ const azureblobSettings = [
label: 'Password',
value: 'password',
fieldType: 'password',
- authFieldType: 'password',
required: false,
default: '',
description: "The user's password.",
@@ -196,8 +191,7 @@ const azureblobSettings = [
fieldType: 'bool',
required: false,
default: false,
- description:
- 'Use the Azure CLI tool (az) as the sole means of authentication.',
+ description: 'Use the Azure CLI tool (az) as the sole means of authentication.',
command: '--azureblob-use-az',
},
{
@@ -309,8 +303,7 @@ const azureblobSettings = [
fieldType: 'encoding',
required: false,
default: 'slash,backslash,del,ctl,rightperiod,invalidutf8',
- description:
- 'The encoding for the backend.',
+ description: 'The encoding for the backend.',
command: '--azureblob-encoding',
},
{
diff --git a/backend/src/utils/providers/filescom.ts b/backend/src/utils/providers/filescom.ts
index 18c7ab0..0cf6ae4 100644
--- a/backend/src/utils/providers/filescom.ts
+++ b/backend/src/utils/providers/filescom.ts
@@ -3,7 +3,7 @@ const filesSettings = [
label: 'Site Domain',
value: 'site',
fieldType: 'string',
- authFieldType: 'password',
+ authFieldType: 'all',
required: true,
default: '',
description:
diff --git a/backend/src/utils/providers/linkbox.ts b/backend/src/utils/providers/linkbox.ts
index e6c9475..472f635 100644
--- a/backend/src/utils/providers/linkbox.ts
+++ b/backend/src/utils/providers/linkbox.ts
@@ -1,10 +1,30 @@
const linkboxSettings = [
+ {
+ label: 'Email',
+ value: 'email',
+ command: '--linkbox-email',
+ fieldType: 'string',
+ authFieldType: 'password',
+ required: true,
+ default: '',
+ description: 'Your Linkbox account email address',
+ },
+ {
+ label: 'Password',
+ value: 'password',
+ command: '--linkbox-password',
+ fieldType: 'password',
+ authFieldType: 'password',
+ required: true,
+ default: '',
+ description: 'Your Linkbox account email password',
+ },
{
label: 'Token',
value: 'token',
command: '--linkbox-token',
fieldType: 'password',
- authFieldType: 'client',
+ authFieldType: 'password',
required: true,
default: '',
description: 'Token from https://www.linkbox.to/admin/account',
diff --git a/backend/src/utils/providers/storj.ts b/backend/src/utils/providers/storj.ts
index baf8dc0..039f62e 100644
--- a/backend/src/utils/providers/storj.ts
+++ b/backend/src/utils/providers/storj.ts
@@ -46,20 +46,6 @@ const storjSettings = [
'Encryption passphrase. To access existing objects enter passphrase used for uploading.',
command: '--storj-passphrase',
},
- {
- label: 'Auth Provider',
- value: 'provider',
- fieldType: 'select',
- authFieldType: 'client',
- required: false,
- default: 'existing',
- description: 'Choose an authentication method.',
- command: '--storj-provider',
- options: [
- { label: 'Use an existing access grant', value: 'existing' },
- { label: 'Create a new access grant', value: 'new' },
- ],
- },
{
label: 'Description',
value: 'description',
diff --git a/frontend/src/components/Storage/AddStorage/AddStorage.tsx b/frontend/src/components/Storage/AddStorage/AddStorage.tsx
index 2a8dbf2..c54267f 100644
--- a/frontend/src/components/Storage/AddStorage/AddStorage.tsx
+++ b/frontend/src/components/Storage/AddStorage/AddStorage.tsx
@@ -8,7 +8,7 @@ import TagsInput from '../../common/form/TagsInput/TagsInput';
import { storageOptionField } from '../../../@types/storages';
import StorageSettings from '../StorageSettings/StorageSettings';
// import { useGetDevice } from '../../../services/devices';
-import { shouldDisplayStorageField } from '../../../utils/helpers';
+import { matchesAuthType, shouldDisplayStorageField } from '../../../utils/helpers';
import StorageAuthSettings from '../StorageAuthSettings/StorageAuthSettings';
import StorageProviderSelect from '../../common/form/StorageProviderSelect/StorageProviderSelect';
@@ -122,7 +122,7 @@ const AddStorage = ({ close }: AddStorageProps) => {
// Check if this field is relevant to the current auth type
const isAuthField = !!fieldDef.authFieldType;
- const isRelevantAuthField = !isAuthField || fieldDef.authFieldType === currentAuthType;
+ const isRelevantAuthField = !isAuthField || matchesAuthType(fieldDef, currentAuthType);
if (!isRelevantAuthField) return;
// Get the field value from the appropriate state object
diff --git a/frontend/src/components/Storage/EditStorage/EditStorage.tsx b/frontend/src/components/Storage/EditStorage/EditStorage.tsx
index 9f7c46d..04fddb7 100644
--- a/frontend/src/components/Storage/EditStorage/EditStorage.tsx
+++ b/frontend/src/components/Storage/EditStorage/EditStorage.tsx
@@ -8,7 +8,7 @@ import TagsInput from '../../common/form/TagsInput/TagsInput';
import { Storage, storageOptionField } from '../../../@types/storages';
import StorageSettings from '../StorageSettings/StorageSettings';
import StorageAuthSettings from '../StorageAuthSettings/StorageAuthSettings';
-import { shouldDisplayStorageField } from '../../../utils/helpers';
+import { matchesAuthType, shouldDisplayStorageField } from '../../../utils/helpers';
type EditStorageProps = {
close: () => void;
@@ -67,7 +67,7 @@ const EditStorage = ({ close, storage }: EditStorageProps) => {
// Check if this field is relevant to the current auth type
const isAuthField = !!fieldDef.authFieldType;
- const isRelevantAuthField = !isAuthField || fieldDef.authFieldType === currentAuthType;
+ const isRelevantAuthField = !isAuthField || matchesAuthType(fieldDef, currentAuthType);
if (!isRelevantAuthField) return;
// Get the field value from the appropriate state object
diff --git a/frontend/src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx b/frontend/src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx
index ac34e69..6baae54 100644
--- a/frontend/src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx
+++ b/frontend/src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx
@@ -5,6 +5,7 @@ import Icon from '../../common/Icon/Icon';
import classes from '../AddStorage/AddStorage.module.scss';
import StorageSettings from '../StorageSettings/StorageSettings';
import { startStorageAuthorize, getStorageAuthorizeStatus, cancelStorageAuthorize } from '../../../services/storage';
+import { matchesAuthType } from '../../../utils/helpers';
interface StorageAuthSettingsProps {
storageType: string;
@@ -151,7 +152,7 @@ const StorageAuthSettings = ({
</div>
)}
<StorageSettings
- fields={fields.filter((f) => f.authFieldType === currentAuthType)}
+ fields={fields.filter((f) => matchesAuthType(f, currentAuthType))}
settings={settings}
onUpdate={(newSettings) => onUpdate(newSettings)}
errors={errors}
diff --git a/frontend/src/utils/helpers.ts b/frontend/src/utils/helpers.ts
index d1c4a7e..de1de82 100644
--- a/frontend/src/utils/helpers.ts
+++ b/frontend/src/utils/helpers.ts
@@ -355,6 +355,11 @@ export const isValidURL = (url: string): boolean => {
}
};
+// An auth field belongs to one auth type, or to every type when marked 'all'
+export const matchesAuthType = (field: storageOptionField, authType: string): boolean => {
+ return field.authFieldType === 'all' || field.authFieldType === authType;
+};
+
export const shouldDisplayStorageField = (field: storageOptionField, settings: Record<string, any>, allFields: storageOptionField[]): boolean => {
// If no conditions, always display the field
if (!field.condition || field.condition.length === 0) {