merge: origin/dev (immich v3, release-providers cleanup)

Take dev's cleaner fetchProvider typing and repositoryId extraction.
No architectural changes — our simplified caching patterns preserved.
This commit is contained in:
Thomas Camlong committed 2026-07-03 16:01:22 +02:00
commit 8b38c83cc0
8 files changed
+56 -44

No files matched your search

+5 -5
View File
@@ -77,12 +77,12 @@ export const releasesRouter = createTRPCRouter({
return await Promise.all(
input.repositories.map(async (repository) => {
const repositoryId = repository.id ?? repository.identifier;
try {
const repoId = repository.id ?? repository.identifier;
const useToken = allowedRepoIds === null || allowedRepoIds.has(repoId);
const useToken = allowedRepoIds === null || allowedRepoIds.has(repositoryId);
const response = await releasesRequestHandler
.handler({
id: repoId,
id: repositoryId,
provider: repository.provider,
identifier: repository.identifier,
versionRegex: formatVersionFilterRegex(repository.versionFilter),
@@ -92,14 +92,14 @@ export const releasesRouter = createTRPCRouter({
.getDataAsync();
return {
id: repository.id,
id: repositoryId,
provider: repository.provider,
timestamp: response.timestamp,
...response.data,
};
} catch (error) {
return {
id: repository.id,
id: repositoryId,
provider: repository.provider,
timestamp: new Date(),
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 { createLogger } from "@homarr/core/infrastructure/logs";
@@ -23,7 +32,6 @@ export interface ImmichAlbum {
export interface ImmichAsset {
id: string;
deviceAssetId: string;
originalPath: string;
thumbhash: string | null;
fileModifiedAt: string;
@@ -56,12 +64,16 @@ export class ImmichIntegration extends Integration {
public async getAlbumAsync(albumId: string): Promise<ImmichAlbum> {
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();
return {
albumName: album.albumName,
assets: await Promise.all(
album.assets.map(async (asset) => {
albumAssets.map(async (asset) => {
const publicLink = await imageProxy.createImageAsync(
this.url(`/api/assets/${asset.id}/original`).toString(),
{
@@ -71,7 +83,6 @@ export class ImmichIntegration extends Integration {
return {
id: asset.id,
type: asset.type,
deviceAssetId: asset.deviceAssetId,
thumbhash: asset.thumbhash,
fileCreatedAt: asset.fileCreatedAt,
fileModifiedAt: asset.fileModifiedAt,
@@ -104,6 +115,24 @@ export class ImmichIntegration extends Integration {
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) {
return {
// Undici and node types are not the same
@@ -9,10 +9,8 @@ import { createLogger } from "@homarr/core/infrastructure/logs";
const logger = createLogger({ module: "releaseProviders" });
const PROVIDER_TIMEOUT_MS = 10_000;
const fetchProvider = (url: string, options?: RequestInit & { timeout?: number }) =>
fetchWithTrustedCertificatesAsync(url, { timeout: PROVIDER_TIMEOUT_MS, ...options } as Parameters<
typeof fetchWithTrustedCertificatesAsync
>[1]);
const fetchProvider: typeof fetchWithTrustedCertificatesAsync = (url, options) =>
fetchWithTrustedCertificatesAsync(url, { timeout: PROVIDER_TIMEOUT_MS, ...options });
export interface ReleasesRepositoryRequest extends Record<string, unknown> {
id: string;
@@ -76,7 +76,6 @@ function shuffle<T>(items: T[]) {
interface CarouselProps {
assets: {
id: string;
deviceAssetId: string;
originalPath: string;
fileModifiedAt: string;
publicLink: string;