mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
feat(tautulli): validate upon saving settings (#2511)
This commit is contained in:
@@ -90,6 +90,27 @@ interface TautulliWatchUsersResponse {
|
||||
};
|
||||
}
|
||||
|
||||
interface TautulliInfo {
|
||||
tautulli_install_type: string;
|
||||
tautulli_version: string;
|
||||
tautulli_branch: string;
|
||||
tautulli_commit: string;
|
||||
tautulli_platform: string;
|
||||
tautulli_platform_release: string;
|
||||
tautulli_platform_version: string;
|
||||
tautulli_platform_linux_distro: string;
|
||||
tautulli_platform_device_name: string;
|
||||
tautulli_python_version: string;
|
||||
}
|
||||
|
||||
interface TautulliInfoResponse {
|
||||
response: {
|
||||
result: string;
|
||||
message?: string;
|
||||
data: TautulliInfo;
|
||||
};
|
||||
}
|
||||
|
||||
class TautulliAPI {
|
||||
private axios: AxiosInstance;
|
||||
|
||||
@@ -102,6 +123,24 @@ class TautulliAPI {
|
||||
});
|
||||
}
|
||||
|
||||
public async getInfo(): Promise<TautulliInfo> {
|
||||
try {
|
||||
return (
|
||||
await this.axios.get<TautulliInfoResponse>('/api/v2', {
|
||||
params: { cmd: 'get_tautulli_info' },
|
||||
})
|
||||
).data.response.data;
|
||||
} catch (e) {
|
||||
logger.error('Something went wrong fetching Tautulli server info', {
|
||||
label: 'Tautulli API',
|
||||
errorMessage: e.message,
|
||||
});
|
||||
throw new Error(
|
||||
`[Tautulli] Failed to fetch Tautulli server info: ${e.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public async getMediaWatchStats(
|
||||
ratingKey: string
|
||||
): Promise<TautulliWatchStats[]> {
|
||||
|
Reference in New Issue
Block a user