mirror of
https://github.com/immich-app/immich.git
synced 2026-03-06 10:07:48 +03:00
chore: migrate database files (#8126)
This commit is contained in:
21
server/src/repositories/server-info.repository.ts
Normal file
21
server/src/repositories/server-info.repository.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Instrumentation } from 'src/infra/instrumentation';
|
||||
import { GitHubRelease, IServerInfoRepository } from 'src/interfaces/server-info.repository';
|
||||
|
||||
@Instrumentation()
|
||||
@Injectable()
|
||||
export class ServerInfoRepository implements IServerInfoRepository {
|
||||
async getGitHubRelease(): Promise<GitHubRelease> {
|
||||
try {
|
||||
const response = await fetch('https://api.github.com/repos/immich-app/immich/releases/latest');
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`GitHub API request failed with status ${response.status}: ${await response.text()}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to fetch GitHub release: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user