Skip to content

Commit

Permalink
Merge branch 'main' into feat/show-archived-assets-for-a-person
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Oct 18, 2024
2 parents cd26b62 + b114988 commit 5077932
Show file tree
Hide file tree
Showing 59 changed files with 954 additions and 487 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ jobs:
with:
submodules: 'recursive'

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_READ_USERNAME }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: Production build
if: ${{ !cancelled() }}
run: docker compose -f e2e/docker-compose.yml build
Expand All @@ -278,6 +284,12 @@ jobs:
with:
submodules: 'recursive'

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_READ_USERNAME }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -320,6 +332,12 @@ jobs:
with:
submodules: 'recursive'

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_READ_USERNAME }}
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}

- name: Setup Node
uses: actions/setup-node@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/features/hardware-transcoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You do not need to redo any transcoding jobs after enabling hardware acceleratio
- Raspberry Pi is currently not supported.
- Two-pass mode is only supported for NVENC. Other APIs will ignore this setting.
- By default, only encoding is currently hardware accelerated. This means the CPU is still used for software decoding and tone-mapping.
- NVENC and RKMPP can be fully accelerated by enabling hardware decoding in the video transcoding settings.
- You can benefit from end-to-end acceleration by enabling hardware decoding in the video transcoding settings.
- Hardware dependent
- Codec support varies, but H.264 and HEVC are usually supported.
- Notably, NVIDIA and AMD GPUs do not support VP9 encoding.
Expand Down Expand Up @@ -66,7 +66,7 @@ For RKMPP to work:

3. Redeploy the `immich-server` container with these updated settings.
4. In the Admin page under `Video transcoding settings`, change the hardware acceleration setting to the appropriate option and save.
5. (Optional) If using a compatible backend, you may enable hardware decoding for optimal performance.
5. (Optional) Enable hardware decoding for optimal performance.

#### Single Compose File

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/install/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The default configuration looks like this:
"targetVideoCodec": "h264",
"acceptedVideoCodecs": ["h264"],
"targetAudioCodec": "aac",
"acceptedAudioCodecs": ["aac", "mp3", "libopus"],
"acceptedAudioCodecs": ["aac", "mp3", "libopus", "pcm_s16le"],
"acceptedContainers": ["mov", "ogg", "webm"],
"targetResolution": "720",
"maxBitrate": "0",
Expand Down
3 changes: 3 additions & 0 deletions mobile/openapi/lib/model/audio_codec.dart

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

3 changes: 2 additions & 1 deletion open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8515,7 +8515,8 @@
"enum": [
"mp3",
"aac",
"libopus"
"libopus",
"pcm_s16le"
],
"type": "string"
},
Expand Down
3 changes: 2 additions & 1 deletion open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3512,7 +3512,8 @@ export enum TranscodeHWAccel {
export enum AudioCodec {
Mp3 = "mp3",
Aac = "aac",
Libopus = "libopus"
Libopus = "libopus",
PcmS16Le = "pcm_s16le"
}
export enum VideoContainer {
Mov = "mov",
Expand Down
16 changes: 8 additions & 8 deletions server/package-lock.json

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

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"sanitize-filename": "^1.6.3",
"semver": "^7.6.2",
"sharp": "^0.33.0",
"sirv": "^2.0.4",
"sirv": "^3.0.0",
"tailwindcss-preset-email": "^1.3.2",
"thumbhash": "^0.1.1",
"typeorm": "^0.3.17",
Expand Down
13 changes: 8 additions & 5 deletions server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TypeOrmModule } from '@nestjs/typeorm';
import { ClsModule } from 'nestjs-cls';
import { OpenTelemetryModule } from 'nestjs-otel';
import { commands } from 'src/commands';
import { bullConfig, bullQueues, clsConfig, immichAppConfig } from 'src/config';
import { clsConfig, immichAppConfig } from 'src/config';
import { controllers } from 'src/controllers';
import { databaseConfig } from 'src/database.config';
import { entities } from 'src/entities';
Expand All @@ -20,9 +20,9 @@ import { FileUploadInterceptor } from 'src/middleware/file-upload.interceptor';
import { GlobalExceptionFilter } from 'src/middleware/global-exception.filter';
import { LoggingInterceptor } from 'src/middleware/logging.interceptor';
import { repositories } from 'src/repositories';
import { ConfigRepository } from 'src/repositories/config.repository';
import { services } from 'src/services';
import { DatabaseService } from 'src/services/database.service';
import { otelConfig } from 'src/utils/instrumentation';

const common = [...services, ...repositories];

Expand All @@ -35,12 +35,15 @@ const middleware = [
{ provide: APP_GUARD, useClass: AuthGuard },
];

const configRepository = new ConfigRepository();
const { bull, otel } = configRepository.getEnv();

const imports = [
BullModule.forRoot(bullConfig),
BullModule.registerQueue(...bullQueues),
BullModule.forRoot(bull.config),
BullModule.registerQueue(...bull.queues),
ClsModule.forRoot(clsConfig),
ConfigModule.forRoot(immichAppConfig),
OpenTelemetryModule.forRoot(otelConfig),
OpenTelemetryModule.forRoot(otel),
TypeOrmModule.forRootAsync({
inject: [ModuleRef],
useFactory: (moduleRef: ModuleRef) => {
Expand Down
6 changes: 4 additions & 2 deletions server/src/bin/sync-sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { entities } from 'src/entities';
import { ILoggerRepository } from 'src/interfaces/logger.interface';
import { repositories } from 'src/repositories';
import { AccessRepository } from 'src/repositories/access.repository';
import { ConfigRepository } from 'src/repositories/config.repository';
import { AuthService } from 'src/services/auth.service';
import { otelConfig } from 'src/utils/instrumentation';
import { Logger } from 'typeorm';

export class SqlLogger implements Logger {
Expand Down Expand Up @@ -74,6 +74,8 @@ class SqlGenerator {
await rm(this.options.targetDir, { force: true, recursive: true });
await mkdir(this.options.targetDir);

const { otel } = new ConfigRepository().getEnv();

const moduleFixture = await Test.createTestingModule({
imports: [
TypeOrmModule.forRoot({
Expand All @@ -84,7 +86,7 @@ class SqlGenerator {
logger: this.sqlLogger,
}),
TypeOrmModule.forFeature(entities),
OpenTelemetryModule.forRoot(otelConfig),
OpenTelemetryModule.forRoot(otel),
],
providers: [...repositories, AuthService, SchedulerRegistry],
}).compile();
Expand Down
39 changes: 2 additions & 37 deletions server/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { RegisterQueueOptions } from '@nestjs/bullmq';
import { ConfigModuleOptions } from '@nestjs/config';
import { CronExpression } from '@nestjs/schedule';
import { QueueOptions } from 'bullmq';
import { Request, Response } from 'express';
import { RedisOptions } from 'ioredis';
import Joi, { Root } from 'joi';
import { CLS_ID, ClsModuleOptions } from 'nestjs-cls';
import { ImmichHeader } from 'src/dtos/auth.dto';
import {
AudioCodec,
Colorspace,
CQMode,
ImageFormat,
ImmichEnvironment,
ImmichHeader,
LogLevel,
ToneMapping,
TranscodeHWAccel,
Expand Down Expand Up @@ -166,7 +163,7 @@ export const defaults = Object.freeze<SystemConfig>({
targetVideoCodec: VideoCodec.H264,
acceptedVideoCodecs: [VideoCodec.H264],
targetAudioCodec: AudioCodec.AAC,
acceptedAudioCodecs: [AudioCodec.AAC, AudioCodec.MP3, AudioCodec.LIBOPUS],
acceptedAudioCodecs: [AudioCodec.AAC, AudioCodec.MP3, AudioCodec.LIBOPUS, AudioCodec.PCMS16LE],
acceptedContainers: [VideoContainer.MOV, VideoContainer.OGG, VideoContainer.WEBM],
targetResolution: '720',
maxBitrate: '0',
Expand Down Expand Up @@ -363,38 +360,6 @@ export const immichAppConfig: ConfigModuleOptions = {
}),
};

export function parseRedisConfig(): RedisOptions {
const redisUrl = process.env.REDIS_URL;
if (redisUrl && redisUrl.startsWith('ioredis://')) {
try {
const decodedString = Buffer.from(redisUrl.slice(10), 'base64').toString();
return JSON.parse(decodedString);
} catch (error) {
throw new Error(`Failed to decode redis options: ${error}`);
}
}
return {
host: process.env.REDIS_HOSTNAME || 'redis',
port: Number.parseInt(process.env.REDIS_PORT || '6379'),
db: Number.parseInt(process.env.REDIS_DBINDEX || '0'),
username: process.env.REDIS_USERNAME || undefined,
password: process.env.REDIS_PASSWORD || undefined,
path: process.env.REDIS_SOCKET || undefined,
};
}

export const bullConfig: QueueOptions = {
prefix: 'immich_bull',
connection: parseRedisConfig(),
defaultJobOptions: {
attempts: 3,
removeOnComplete: true,
removeOnFail: false,
},
};

export const bullQueues: RegisterQueueOptions[] = Object.values(QueueName).map((name) => ({ name }));

export const clsConfig: ClsModuleOptions = {
middleware: {
mount: true,
Expand Down
31 changes: 0 additions & 31 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const AUDIT_LOG_MAX_DURATION = Duration.fromObject({ days: 100 });
export const ONE_HOUR = Duration.fromObject({ hours: 1 });

export const APP_MEDIA_LOCATION = process.env.IMMICH_MEDIA_LOCATION || './upload';
const HOST_SERVER_PORT = process.env.IMMICH_PORT || '2283';
export const DEFAULT_EXTERNAL_DOMAIN = 'http://localhost:' + HOST_SERVER_PORT;

export const citiesFile = 'cities500.txt';

Expand All @@ -32,35 +30,6 @@ export const excludePaths = ['/.well-known/immich', '/custom.css', '/favicon.ico

export const FACE_THUMBNAIL_SIZE = 250;

export const supportedYearTokens = ['y', 'yy'];
export const supportedMonthTokens = ['M', 'MM', 'MMM', 'MMMM'];
export const supportedWeekTokens = ['W', 'WW'];
export const supportedDayTokens = ['d', 'dd'];
export const supportedHourTokens = ['h', 'hh', 'H', 'HH'];
export const supportedMinuteTokens = ['m', 'mm'];
export const supportedSecondTokens = ['s', 'ss', 'SSS'];
export const supportedPresetTokens = [
'{{y}}/{{y}}-{{MM}}-{{dd}}/{{filename}}',
'{{y}}/{{MM}}-{{dd}}/{{filename}}',
'{{y}}/{{MMMM}}-{{dd}}/{{filename}}',
'{{y}}/{{MM}}/{{filename}}',
'{{y}}/{{#if album}}{{album}}{{else}}Other/{{MM}}{{/if}}/{{filename}}',
'{{y}}/{{MMM}}/{{filename}}',
'{{y}}/{{MMMM}}/{{filename}}',
'{{y}}/{{MM}}/{{dd}}/{{filename}}',
'{{y}}/{{MMMM}}/{{dd}}/{{filename}}',
'{{y}}/{{y}}-{{MM}}/{{y}}-{{MM}}-{{dd}}/{{filename}}',
'{{y}}-{{MM}}-{{dd}}/{{filename}}',
'{{y}}-{{MMM}}-{{dd}}/{{filename}}',
'{{y}}-{{MMMM}}-{{dd}}/{{filename}}',
'{{y}}/{{y}}-{{MM}}/{{filename}}',
'{{y}}/{{y}}-{{WW}}/{{filename}}',
'{{y}}/{{y}}-{{MM}}-{{dd}}/{{assetId}}',
'{{y}}/{{y}}-{{MM}}/{{assetId}}',
'{{y}}/{{y}}-{{WW}}/{{assetId}}',
'{{album}}/{{filename}}',
];

type ModelInfo = { dimSize: number };
export const CLIP_MODEL_INFO: Record<string, ModelInfo> = {
RN101__openai: { dimSize: 512 },
Expand Down
4 changes: 2 additions & 2 deletions server/src/controllers/asset-media.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import {
CheckExistingAssetsDto,
UploadFieldName,
} from 'src/dtos/asset-media.dto';
import { AuthDto, ImmichHeader } from 'src/dtos/auth.dto';
import { RouteKey } from 'src/enum';
import { AuthDto } from 'src/dtos/auth.dto';
import { ImmichHeader, RouteKey } from 'src/enum';
import { ILoggerRepository } from 'src/interfaces/logger.interface';
import { AssetUploadInterceptor } from 'src/middleware/asset-upload.interceptor';
import { Auth, Authenticated, FileResponse } from 'src/middleware/auth.guard';
Expand Down
3 changes: 1 addition & 2 deletions server/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { Request, Response } from 'express';
import {
AuthDto,
ChangePasswordDto,
ImmichCookie,
LoginCredentialDto,
LoginResponseDto,
LogoutResponseDto,
SignUpDto,
ValidateAccessTokenResponseDto,
} from 'src/dtos/auth.dto';
import { UserAdminResponseDto } from 'src/dtos/user.dto';
import { AuthType } from 'src/enum';
import { AuthType, ImmichCookie } from 'src/enum';
import { Auth, Authenticated, GetLoginDetails } from 'src/middleware/auth.guard';
import { AuthService, LoginDetails } from 'src/services/auth.service';
import { respondWithCookie, respondWithoutCookie } from 'src/utils/response';
Expand Down
3 changes: 1 addition & 2 deletions server/src/controllers/oauth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { ApiTags } from '@nestjs/swagger';
import { Request, Response } from 'express';
import {
AuthDto,
ImmichCookie,
LoginResponseDto,
OAuthAuthorizeResponseDto,
OAuthCallbackDto,
OAuthConfigDto,
} from 'src/dtos/auth.dto';
import { UserAdminResponseDto } from 'src/dtos/user.dto';
import { AuthType } from 'src/enum';
import { AuthType, ImmichCookie } from 'src/enum';
import { Auth, Authenticated, GetLoginDetails } from 'src/middleware/auth.guard';
import { AuthService, LoginDetails } from 'src/services/auth.service';
import { respondWithCookie } from 'src/utils/response';
Expand Down
Loading

0 comments on commit 5077932

Please sign in to comment.