diff --git a/docs/docs/install/config-file.md b/docs/docs/install/config-file.md index 9806af760..54d7c61bb 100644 --- a/docs/docs/install/config-file.md +++ b/docs/docs/install/config-file.md @@ -123,7 +123,7 @@ The default configuration looks like this: "buttonText": "Login with OAuth", "clientId": "", "clientSecret": "", - "defaultStorageQuota": 0, + "defaultStorageQuota": null, "enabled": false, "issuerUrl": "", "mobileOverrideEnabled": false, diff --git a/i18n/en.json b/i18n/en.json index 28aef5162..d8b4bd55c 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -204,7 +204,7 @@ "oauth_storage_quota_claim": "Storage quota claim", "oauth_storage_quota_claim_description": "Automatically set the user's storage quota to the value of this claim.", "oauth_storage_quota_default": "Default storage quota (GiB)", - "oauth_storage_quota_default_description": "Quota in GiB to be used when no claim is provided (Enter 0 for unlimited quota).", + "oauth_storage_quota_default_description": "Quota in GiB to be used when no claim is provided.", "oauth_timeout": "Request Timeout", "oauth_timeout_description": "Timeout for requests in milliseconds", "password_enable_description": "Login with email and password", diff --git a/mobile/openapi/lib/model/system_config_o_auth_dto.dart b/mobile/openapi/lib/model/system_config_o_auth_dto.dart index 24384a47b..e100e8e5c 100644 Binary files a/mobile/openapi/lib/model/system_config_o_auth_dto.dart and b/mobile/openapi/lib/model/system_config_o_auth_dto.dart differ diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 96819184e..242845761 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -14344,8 +14344,10 @@ "type": "string" }, "defaultStorageQuota": { + "format": "int64", "minimum": 0, - "type": "number" + "nullable": true, + "type": "integer" }, "enabled": { "type": "boolean" diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index f5650a630..9a642a2d4 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -1392,7 +1392,7 @@ export type SystemConfigOAuthDto = { buttonText: string; clientId: string; clientSecret: string; - defaultStorageQuota: number; + defaultStorageQuota: number | null; enabled: boolean; issuerUrl: string; mobileOverrideEnabled: boolean; diff --git a/server/src/config.ts b/server/src/config.ts index a9fdffbd6..ae4bdcd90 100644 --- a/server/src/config.ts +++ b/server/src/config.ts @@ -89,7 +89,7 @@ export interface SystemConfig { buttonText: string; clientId: string; clientSecret: string; - defaultStorageQuota: number; + defaultStorageQuota: number | null; enabled: boolean; issuerUrl: string; mobileOverrideEnabled: boolean; @@ -253,7 +253,7 @@ export const defaults = Object.freeze({ buttonText: 'Login with OAuth', clientId: '', clientSecret: '', - defaultStorageQuota: 0, + defaultStorageQuota: null, enabled: false, issuerUrl: '', mobileOverrideEnabled: false, diff --git a/server/src/dtos/system-config.dto.ts b/server/src/dtos/system-config.dto.ts index 6991baf10..03ef9192d 100644 --- a/server/src/dtos/system-config.dto.ts +++ b/server/src/dtos/system-config.dto.ts @@ -360,7 +360,9 @@ class SystemConfigOAuthDto { @IsNumber() @Min(0) - defaultStorageQuota!: number; + @Optional({ nullable: true }) + @ApiProperty({ type: 'integer', format: 'int64' }) + defaultStorageQuota!: number | null; @ValidateBoolean() enabled!: boolean; diff --git a/server/src/services/auth.service.spec.ts b/server/src/services/auth.service.spec.ts index a773f4a1c..e84db72fc 100644 --- a/server/src/services/auth.service.spec.ts +++ b/server/src/services/auth.service.spec.ts @@ -704,7 +704,7 @@ describe(AuthService.name, () => { expect(mocks.user.create).toHaveBeenCalledWith(expect.objectContaining({ quotaSizeInBytes: 1_073_741_824 })); }); - it('should not set quota for 0 quota', async () => { + it('should set quota for 0 quota', async () => { const user = factory.userAdmin({ oauthId: 'oauth-id' }); mocks.systemMetadata.get.mockResolvedValue(systemConfigStub.oauthWithStorageQuota); @@ -726,7 +726,7 @@ describe(AuthService.name, () => { email: user.email, name: ' ', oauthId: user.oauthId, - quotaSizeInBytes: null, + quotaSizeInBytes: 0, storageLabel: null, }); }); diff --git a/server/src/services/auth.service.ts b/server/src/services/auth.service.ts index e6c541a62..cbe892054 100644 --- a/server/src/services/auth.service.ts +++ b/server/src/services/auth.service.ts @@ -300,7 +300,7 @@ export class AuthService extends BaseService { name: userName, email: profile.email, oauthId: profile.sub, - quotaSizeInBytes: storageQuota * HumanReadableSize.GiB || null, + quotaSizeInBytes: storageQuota === null ? null : storageQuota * HumanReadableSize.GiB, storageLabel: storageLabel || null, }); } diff --git a/server/src/services/system-config.service.spec.ts b/server/src/services/system-config.service.spec.ts index e83e8aff4..87bd92129 100644 --- a/server/src/services/system-config.service.spec.ts +++ b/server/src/services/system-config.service.spec.ts @@ -112,7 +112,7 @@ const updatedConfig = Object.freeze({ buttonText: 'Login with OAuth', clientId: '', clientSecret: '', - defaultStorageQuota: 0, + defaultStorageQuota: null, enabled: false, issuerUrl: '', mobileOverrideEnabled: false, diff --git a/web/src/lib/components/admin-page/settings/auth/auth-settings.svelte b/web/src/lib/components/admin-page/settings/auth/auth-settings.svelte index a5384e9b4..f0dbc1a2d 100644 --- a/web/src/lib/components/admin-page/settings/auth/auth-settings.svelte +++ b/web/src/lib/components/admin-page/settings/auth/auth-settings.svelte @@ -182,7 +182,7 @@ label={$t('admin.oauth_storage_quota_default').toUpperCase()} description={$t('admin.oauth_storage_quota_default_description')} bind:value={config.oauth.defaultStorageQuota} - required={true} + required={false} disabled={disabled || !config.oauth.enabled} isEdited={!(config.oauth.defaultStorageQuota == savedConfig.oauth.defaultStorageQuota)} /> diff --git a/web/src/lib/components/shared-components/settings/setting-input-field.svelte b/web/src/lib/components/shared-components/settings/setting-input-field.svelte index 2cab6e95e..87451667c 100644 --- a/web/src/lib/components/shared-components/settings/setting-input-field.svelte +++ b/web/src/lib/components/shared-components/settings/setting-input-field.svelte @@ -9,7 +9,7 @@ interface Props { inputType: SettingInputFieldType; - value: string | number | undefined; + value: string | number | undefined | null; min?: number; max?: number; step?: string;