feat(web,server): external domain setting (#6146)
* feat: external domain setting * chore: open api * mobile: handle serverconfig-externalDomain --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -8593,6 +8593,9 @@
|
||||
},
|
||||
"ServerConfigDto": {
|
||||
"properties": {
|
||||
"externalDomain": {
|
||||
"type": "string"
|
||||
},
|
||||
"isInitialized": {
|
||||
"type": "boolean"
|
||||
},
|
||||
@@ -8610,7 +8613,8 @@
|
||||
"trashDays",
|
||||
"oauthButtonText",
|
||||
"loginPageMessage",
|
||||
"isInitialized"
|
||||
"isInitialized",
|
||||
"externalDomain"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
@@ -9039,6 +9043,9 @@
|
||||
"reverseGeocoding": {
|
||||
"$ref": "#/components/schemas/SystemConfigReverseGeocodingDto"
|
||||
},
|
||||
"server": {
|
||||
"$ref": "#/components/schemas/SystemConfigServerDto"
|
||||
},
|
||||
"storageTemplate": {
|
||||
"$ref": "#/components/schemas/SystemConfigStorageTemplateDto"
|
||||
},
|
||||
@@ -9066,7 +9073,8 @@
|
||||
"thumbnail",
|
||||
"trash",
|
||||
"theme",
|
||||
"library"
|
||||
"library",
|
||||
"server"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
@@ -9359,6 +9367,17 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SystemConfigServerDto": {
|
||||
"properties": {
|
||||
"externalDomain": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"externalDomain"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"SystemConfigStorageTemplateDto": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
|
||||
@@ -86,6 +86,7 @@ export class ServerConfigDto {
|
||||
@ApiProperty({ type: 'integer' })
|
||||
trashDays!: number;
|
||||
isInitialized!: boolean;
|
||||
externalDomain!: string;
|
||||
}
|
||||
|
||||
export class ServerFeaturesDto implements FeatureFlags {
|
||||
|
||||
@@ -184,6 +184,7 @@ describe(ServerInfoService.name, () => {
|
||||
loginPageMessage: '',
|
||||
oauthButtonText: 'Login with OAuth',
|
||||
trashDays: 30,
|
||||
externalDomain: '',
|
||||
});
|
||||
expect(configMock.load).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -89,6 +89,7 @@ export class ServerInfoService {
|
||||
trashDays: config.trash.days,
|
||||
oauthButtonText: config.oauth.buttonText,
|
||||
isInitialized,
|
||||
externalDomain: config.server.externalDomain,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { IsString } from 'class-validator';
|
||||
|
||||
export class SystemConfigServerDto {
|
||||
@IsString()
|
||||
externalDomain!: string;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { SystemConfigNewVersionCheckDto } from './system-config-new-version-chec
|
||||
import { SystemConfigOAuthDto } from './system-config-oauth.dto';
|
||||
import { SystemConfigPasswordLoginDto } from './system-config-password-login.dto';
|
||||
import { SystemConfigReverseGeocodingDto } from './system-config-reverse-geocoding.dto';
|
||||
import { SystemConfigServerDto } from './system-config-server.dto';
|
||||
import { SystemConfigStorageTemplateDto } from './system-config-storage-template.dto';
|
||||
import { SystemConfigThemeDto } from './system-config-theme.dto';
|
||||
import { SystemConfigThumbnailDto } from './system-config-thumbnail.dto';
|
||||
@@ -86,6 +87,11 @@ export class SystemConfigDto implements SystemConfig {
|
||||
@ValidateNested()
|
||||
@IsObject()
|
||||
library!: SystemConfigLibraryDto;
|
||||
|
||||
@Type(() => SystemConfigServerDto)
|
||||
@ValidateNested()
|
||||
@IsObject()
|
||||
server!: SystemConfigServerDto;
|
||||
}
|
||||
|
||||
export function mapConfig(config: SystemConfig): SystemConfigDto {
|
||||
|
||||
@@ -127,6 +127,9 @@ export const defaults = Object.freeze<SystemConfig>({
|
||||
cronExpression: CronExpression.EVERY_DAY_AT_MIDNIGHT,
|
||||
},
|
||||
},
|
||||
server: {
|
||||
externalDomain: '',
|
||||
},
|
||||
});
|
||||
|
||||
export enum FeatureFlag {
|
||||
|
||||
@@ -100,6 +100,9 @@ const updatedConfig = Object.freeze<SystemConfig>({
|
||||
passwordLogin: {
|
||||
enabled: true,
|
||||
},
|
||||
server: {
|
||||
externalDomain: '',
|
||||
},
|
||||
storageTemplate: {
|
||||
enabled: false,
|
||||
hashVerificationEnabled: true,
|
||||
|
||||
@@ -84,6 +84,8 @@ export enum SystemConfigKey {
|
||||
|
||||
PASSWORD_LOGIN_ENABLED = 'passwordLogin.enabled',
|
||||
|
||||
SERVER_EXTERNAL_DOMAIN = 'server.externalDomain',
|
||||
|
||||
STORAGE_TEMPLATE_ENABLED = 'storageTemplate.enabled',
|
||||
STORAGE_TEMPLATE_HASH_VERIFICATION_ENABLED = 'storageTemplate.hashVerificationEnabled',
|
||||
STORAGE_TEMPLATE = 'storageTemplate.template',
|
||||
@@ -244,4 +246,7 @@ export interface SystemConfig {
|
||||
cronExpression: string;
|
||||
};
|
||||
};
|
||||
server: {
|
||||
externalDomain: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ describe(`${ServerInfoController.name} (e2e)`, () => {
|
||||
oauthButtonText: 'Login with OAuth',
|
||||
trashDays: 30,
|
||||
isInitialized: true,
|
||||
externalDomain: '',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user