Skip to content

Commit

Permalink
feat(server)!: move welcome message to settings (immich-app#6157)
Browse files Browse the repository at this point in the history
* feat(server): move welcome message to settings

* chore: open api
  • Loading branch information
jrasm91 authored Jan 4, 2024
1 parent 52e92e9 commit f8d64be
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 18 deletions.
6 changes: 6 additions & 0 deletions cli/src/api/open-api/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions docs/docs/install/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ These environment variables are used by the `docker-compose.yml` file and do **N

## General

| Variable | Description | Default | Services |
| :-------------------------- | :------------------------------------------- | :-----------------: | :------------------------------------------- |
| `TZ` | Timezone | | microservices |
| `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning, web |
| `LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices |
| `IMMICH_MEDIA_LOCATION` | Media Location | `./upload` | server, microservices |
| `PUBLIC_LOGIN_PAGE_MESSAGE` | Public Login Page Message | | web |
| `IMMICH_CONFIG_FILE` | Path to config file | | server |
| `IMMICH_WEB_ROOT` | Path of root index.html | `/usr/src/app/www'` | server |
| Variable | Description | Default | Services |
| :---------------------- | :------------------------------------------- | :-----------------: | :------------------------------------------- |
| `TZ` | Timezone | | microservices |
| `NODE_ENV` | Environment (production, development) | `production` | server, microservices, machine learning, web |
| `LOG_LEVEL` | Log Level (verbose, debug, log, warn, error) | `log` | server, microservices |
| `IMMICH_MEDIA_LOCATION` | Media Location | `./upload` | server, microservices |
| `IMMICH_CONFIG_FILE` | Path to config file | | server |
| `IMMICH_WEB_ROOT` | Path of root index.html | `/usr/src/app/www'` | server |

:::tip

Expand Down
1 change: 1 addition & 0 deletions mobile/openapi/doc/SystemConfigServerDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions mobile/openapi/lib/model/system_config_server_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mobile/openapi/test/system_config_server_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion server/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -9371,10 +9371,14 @@
"properties": {
"externalDomain": {
"type": "string"
},
"loginPageMessage": {
"type": "string"
}
},
"required": [
"externalDomain"
"externalDomain",
"loginPageMessage"
],
"type": "object"
},
Expand Down
6 changes: 1 addition & 5 deletions server/src/domain/server-info/server-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ export class ServerInfoService {

async getConfig(): Promise<ServerConfigDto> {
const config = await this.configCore.getConfig();

// TODO move to system config
const loginPageMessage = process.env.PUBLIC_LOGIN_PAGE_MESSAGE || '';

const isInitialized = await this.userRepository.hasAdmin();

return {
loginPageMessage,
loginPageMessage: config.server.loginPageMessage,
trashDays: config.trash.days,
oauthButtonText: config.oauth.buttonText,
isInitialized,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ import { IsString } from 'class-validator';
export class SystemConfigServerDto {
@IsString()
externalDomain!: string;

@IsString()
loginPageMessage!: string;
}
1 change: 1 addition & 0 deletions server/src/domain/system-config/system-config.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const defaults = Object.freeze<SystemConfig>({
},
server: {
externalDomain: '',
loginPageMessage: '',
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const updatedConfig = Object.freeze<SystemConfig>({
},
server: {
externalDomain: '',
loginPageMessage: '',
},
storageTemplate: {
enabled: false,
Expand Down
2 changes: 2 additions & 0 deletions server/src/infra/entities/system-config.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export enum SystemConfigKey {
PASSWORD_LOGIN_ENABLED = 'passwordLogin.enabled',

SERVER_EXTERNAL_DOMAIN = 'server.externalDomain',
SERVER_LOGIN_PAGE_MESSAGE = 'server.loginPageMessage',

STORAGE_TEMPLATE_ENABLED = 'storageTemplate.enabled',
STORAGE_TEMPLATE_HASH_VERIFICATION_ENABLED = 'storageTemplate.hashVerificationEnabled',
Expand Down Expand Up @@ -248,5 +249,6 @@ export interface SystemConfig {
};
server: {
externalDomain: string;
loginPageMessage: string;
};
}
6 changes: 6 additions & 0 deletions web/src/api/open-api/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@
bind:value={serverConfig.externalDomain}
isEdited={serverConfig.externalDomain !== savedConfig.externalDomain}
/>

<SettingInputField
inputType={SettingInputFieldType.TEXT}
label="WELCOME MESSAGE"
desc="A message that is displayed on the login page."
bind:value={serverConfig.loginPageMessage}
isEdited={serverConfig.loginPageMessage !== savedConfig.loginPageMessage}
/>

<div class="ml-4">
<SettingButtonsRow
on:reset={({ detail }) => handleReset(detail)}
Expand Down

0 comments on commit f8d64be

Please sign in to comment.