fix(immich): v3 API compatibility — use searchAssets for album assets, drop deviceAssetId (#5977)

This commit is contained in:
Thomas authored and GitHub committed 2026-07-03 15:59:08 +02:00
1 parent b588672709
commit a5ec880eec
6 files changed
+52 -39

No files matched your search

+5 -4
View File
@@ -77,11 +77,12 @@ export const releasesRouter = createTRPCRouter({
return await Promise.all( return await Promise.all(
input.repositories.map(async (repository) => { input.repositories.map(async (repository) => {
const repositoryId = repository.id ?? repository.identifier;
try { try {
const useToken = allowedRepoIds === null || allowedRepoIds.has(repository.id); const useToken = allowedRepoIds === null || allowedRepoIds.has(repositoryId);
const response = await releasesRequestHandler const response = await releasesRequestHandler
.handler({ .handler({
id: repository.id, id: repositoryId,
provider: repository.provider, provider: repository.provider,
identifier: repository.identifier, identifier: repository.identifier,
versionRegex: formatVersionFilterRegex(repository.versionFilter), versionRegex: formatVersionFilterRegex(repository.versionFilter),
@@ -93,14 +94,14 @@ export const releasesRouter = createTRPCRouter({
}); });
return { return {
id: repository.id, id: repositoryId,
provider: repository.provider, provider: repository.provider,
timestamp: response.timestamp, timestamp: response.timestamp,
...response.data, ...response.data,
}; };
} catch (error) { } catch (error) {
return { return {
id: repository.id, id: repositoryId,
provider: repository.provider, provider: repository.provider,
timestamp: new Date(), timestamp: new Date(),
success: false as const, success: false as const,
@@ -1,4 +1,13 @@
import { getAlbumInfo, getAllAlbums, getMyUser, getServerStatistics, init, searchUsers } from "@immich/sdk"; import {
getAlbumInfo,
getAllAlbums,
getMyUser,
getServerStatistics,
init,
searchAssets,
searchUsers,
} from "@immich/sdk";
import type { AssetResponseDto, MetadataSearchDto } from "@immich/sdk";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http"; import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import { createLogger } from "@homarr/core/infrastructure/logs"; import { createLogger } from "@homarr/core/infrastructure/logs";
@@ -23,7 +32,6 @@ export interface ImmichAlbum {
export interface ImmichAsset { export interface ImmichAsset {
id: string; id: string;
deviceAssetId: string;
originalPath: string; originalPath: string;
thumbhash: string | null; thumbhash: string | null;
fileModifiedAt: string; fileModifiedAt: string;
@@ -56,12 +64,16 @@ export class ImmichIntegration extends Integration {
public async getAlbumAsync(albumId: string): Promise<ImmichAlbum> { public async getAlbumAsync(albumId: string): Promise<ImmichAlbum> {
this.initClient(); this.initClient();
const album = await getAlbumInfo({ id: albumId }, this.getRequestOptions()); const requestOptions = this.getRequestOptions();
const [album, albumAssets] = await Promise.all([
getAlbumInfo({ id: albumId }, requestOptions),
this.searchAlbumAssetsAsync(albumId),
]);
const imageProxy = new ImageProxy(); const imageProxy = new ImageProxy();
return { return {
albumName: album.albumName, albumName: album.albumName,
assets: await Promise.all( assets: await Promise.all(
album.assets.map(async (asset) => { albumAssets.map(async (asset) => {
const publicLink = await imageProxy.createImageAsync( const publicLink = await imageProxy.createImageAsync(
this.url(`/api/assets/${asset.id}/original`).toString(), this.url(`/api/assets/${asset.id}/original`).toString(),
{ {
@@ -71,7 +83,6 @@ export class ImmichIntegration extends Integration {
return { return {
id: asset.id, id: asset.id,
type: asset.type, type: asset.type,
deviceAssetId: asset.deviceAssetId,
thumbhash: asset.thumbhash, thumbhash: asset.thumbhash,
fileCreatedAt: asset.fileCreatedAt, fileCreatedAt: asset.fileCreatedAt,
fileModifiedAt: asset.fileModifiedAt, fileModifiedAt: asset.fileModifiedAt,
@@ -104,6 +115,24 @@ export class ImmichIntegration extends Integration {
return { success: true }; return { success: true };
} }
private async searchAlbumAssetsAsync(albumId: string): Promise<AssetResponseDto[]> {
const requestOptions = this.getRequestOptions();
const assets: AssetResponseDto[] = [];
let nextPage: string | null = null;
do {
const metadataSearchDto: MetadataSearchDto = { albumIds: [albumId] };
if (nextPage !== null) {
metadataSearchDto.page = Number(nextPage);
}
const searchResult = await searchAssets({ metadataSearchDto }, requestOptions);
assets.push(...searchResult.assets.items);
nextPage = searchResult.assets.nextPage;
} while (nextPage !== null);
return assets;
}
private getRequestOptions(fetchAsync = fetchWithTrustedCertificatesAsync) { private getRequestOptions(fetchAsync = fetchWithTrustedCertificatesAsync) {
return { return {
// Undici and node types are not the same // Undici and node types are not the same
@@ -9,7 +9,7 @@ import { createLogger } from "@homarr/core/infrastructure/logs";
const logger = createLogger({ module: "releaseProviders" }); const logger = createLogger({ module: "releaseProviders" });
const PROVIDER_TIMEOUT_MS = 10_000; const PROVIDER_TIMEOUT_MS = 10_000;
const fetchProvider = (url: URL | RequestInfo, options?: RequestInit & { timeout?: number }) => const fetchProvider: typeof fetchWithTrustedCertificatesAsync = (url, options) =>
fetchWithTrustedCertificatesAsync(url, { timeout: PROVIDER_TIMEOUT_MS, ...options }); fetchWithTrustedCertificatesAsync(url, { timeout: PROVIDER_TIMEOUT_MS, ...options });
export interface ReleasesRepositoryRequest extends Record<string, unknown> { export interface ReleasesRepositoryRequest extends Record<string, unknown> {
@@ -76,7 +76,6 @@ function shuffle<T>(items: T[]) {
interface CarouselProps { interface CarouselProps {
assets: { assets: {
id: string; id: string;
deviceAssetId: string;
originalPath: string; originalPath: string;
fileModifiedAt: string; fileModifiedAt: string;
publicLink: string; publicLink: string;
+10 -27
View File
@@ -49,8 +49,8 @@ catalogs:
specifier: ^2.6.0 specifier: ^2.6.0
version: 2.6.0 version: 2.6.0
'@immich/sdk': '@immich/sdk':
specifier: ^2.7.5 specifier: ^3.0.0
version: 2.7.5 version: 3.0.0
'@jellyfin/sdk': '@jellyfin/sdk':
specifier: ^0.13.0 specifier: ^0.13.0
version: 0.13.0 version: 0.13.0
@@ -1929,7 +1929,7 @@ importers:
version: link:../validation version: link:../validation
'@immich/sdk': '@immich/sdk':
specifier: 'catalog:' specifier: 'catalog:'
version: 2.7.5 version: 3.0.0
'@jellyfin/sdk': '@jellyfin/sdk':
specifier: 'catalog:' specifier: 'catalog:'
version: 0.13.0(axios@1.15.0) version: 0.13.0(axios@1.15.0)
@@ -4230,9 +4230,6 @@ packages:
'@drizzle-team/brocli@0.12.0': '@drizzle-team/brocli@0.12.0':
resolution: {integrity: sha512-mlUE+rZ8CatQekLhnaiN91Iemdd+e2gFKooGlnRB3oPTL3VghLfX24dx7HrzMNeC1JrIB/0kpsfyty3f5HNfxQ==} resolution: {integrity: sha512-mlUE+rZ8CatQekLhnaiN91Iemdd+e2gFKooGlnRB3oPTL3VghLfX24dx7HrzMNeC1JrIB/0kpsfyty3f5HNfxQ==}
'@emnapi/core@1.11.0':
resolution: {integrity: sha512-l9Oo58x0HOP5znGzVhYW9U3e5wVuA4LAZU2AGezTmkhO1CgQRFDhDg4nneHsu/t3WniXg9QrG2nIXL/ZS8ln8Q==}
'@emnapi/core@1.11.1': '@emnapi/core@1.11.1':
resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==} resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==}
@@ -5174,8 +5171,8 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@immich/sdk@2.7.5': '@immich/sdk@3.0.0':
resolution: {integrity: sha512-gCTpFAWlFF+1Sx0jbqPVmwN+0JD+eZEHzhf3q+BbxuQF+ORpNqT0D453mOyonogvy17nJF1jGA2PtT6vOQiSnA==} resolution: {integrity: sha512-HUT+L5LEIRsW65GtGj1hLqv9XQzIWzEyaAnAUsVVYHAc3hs+bD8p+KV9Km6Yw8Kg5eOqt+pDcp0peHYkgwnZJQ==}
'@inquirer/ansi@1.0.2': '@inquirer/ansi@1.0.2':
resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==}
@@ -7626,9 +7623,6 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
'@tybys/wasm-util@0.10.2':
resolution: {integrity: sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==}
'@tybys/wasm-util@0.10.3': '@tybys/wasm-util@0.10.3':
resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==}
@@ -17909,12 +17903,6 @@ snapshots:
'@drizzle-team/brocli@0.12.0': {} '@drizzle-team/brocli@0.12.0': {}
'@emnapi/core@1.11.0':
dependencies:
'@emnapi/wasi-threads': 1.2.2
tslib: 2.8.1
optional: true
'@emnapi/core@1.11.1': '@emnapi/core@1.11.1':
dependencies: dependencies:
'@emnapi/wasi-threads': 1.2.2 '@emnapi/wasi-threads': 1.2.2
@@ -18538,7 +18526,7 @@ snapshots:
'@img/sharp-win32-x64@0.34.5': '@img/sharp-win32-x64@0.34.5':
optional: true optional: true
'@immich/sdk@2.7.5': '@immich/sdk@3.0.0':
dependencies: dependencies:
'@oazapfts/runtime': 1.2.0 '@oazapfts/runtime': 1.2.0
@@ -19201,9 +19189,9 @@ snapshots:
'@napi-rs/wasm-runtime@1.0.7': '@napi-rs/wasm-runtime@1.0.7':
dependencies: dependencies:
'@emnapi/core': 1.11.0 '@emnapi/core': 1.11.1
'@emnapi/runtime': 1.10.0 '@emnapi/runtime': 1.11.1
'@tybys/wasm-util': 0.10.2 '@tybys/wasm-util': 0.10.3
optional: true optional: true
'@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)':
@@ -21245,11 +21233,6 @@ snapshots:
'@turbo/windows-arm64@2.10.0': '@turbo/windows-arm64@2.10.0':
optional: true optional: true
'@tybys/wasm-util@0.10.2':
dependencies:
tslib: 2.8.1
optional: true
'@tybys/wasm-util@0.10.3': '@tybys/wasm-util@0.10.3':
dependencies: dependencies:
tslib: 2.8.1 tslib: 2.8.1
@@ -26271,7 +26254,7 @@ snapshots:
statuses: 2.0.2 statuses: 2.0.2
strict-event-emitter: 0.5.1 strict-event-emitter: 0.5.1
tough-cookie: 6.0.1 tough-cookie: 6.0.1
type-fest: 5.6.0 type-fest: 5.7.0
until-async: 3.0.2 until-async: 3.0.2
yargs: 17.7.2 yargs: 17.7.2
optionalDependencies: optionalDependencies:
+2 -1
View File
@@ -18,7 +18,7 @@ catalog:
"@gitbeaker/rest": ^43.8.0 "@gitbeaker/rest": ^43.8.0
"@homarr/gridstack": ^1.12.0 "@homarr/gridstack": ^1.12.0
"@homarr/node-unifi": ^2.6.0 "@homarr/node-unifi": ^2.6.0
"@immich/sdk": ^2.7.5 "@immich/sdk": ^3.0.0
"@jellyfin/sdk": ^0.13.0 "@jellyfin/sdk": ^0.13.0
"@kubernetes/client-node": ^1.4.0 "@kubernetes/client-node": ^1.4.0
"@modelcontextprotocol/sdk": 1.29.0 "@modelcontextprotocol/sdk": 1.29.0
@@ -199,6 +199,7 @@ minimumReleaseAge: 4320
minimumReleaseAgeExclude: minimumReleaseAgeExclude:
- next - next
- "@next/*" - "@next/*"
- "@immich/sdk@3.0.0"
# Renovate security update: turbo@2.9.14 # Renovate security update: turbo@2.9.14
- turbo@2.9.14 - turbo@2.9.14
# Renovate security update: form-data@4.0.6 # Renovate security update: form-data@4.0.6