2024-05-26 18:15:52 -04:00
|
|
|
import { getAssetStatistics, getMyUser, getServerVersion, getSupportedMediaTypes } from '@immich/sdk';
|
2024-03-14 19:09:28 -04:00
|
|
|
import { BaseOptions, authenticate } from 'src/utils';
|
|
|
|
|
|
|
|
|
|
export const serverInfo = async (options: BaseOptions) => {
|
2024-03-27 15:01:36 -04:00
|
|
|
const { url } = await authenticate(options);
|
2024-03-14 19:09:28 -04:00
|
|
|
|
2024-03-27 15:01:36 -04:00
|
|
|
const [versionInfo, mediaTypes, stats, userInfo] = await Promise.all([
|
|
|
|
|
getServerVersion(),
|
|
|
|
|
getSupportedMediaTypes(),
|
|
|
|
|
getAssetStatistics({}),
|
2024-05-26 18:15:52 -04:00
|
|
|
getMyUser(),
|
2024-03-27 15:01:36 -04:00
|
|
|
]);
|
2024-03-14 19:09:28 -04:00
|
|
|
|
2024-03-27 15:01:36 -04:00
|
|
|
console.log(`Server Info (via ${userInfo.email})`);
|
|
|
|
|
console.log(` Url: ${url}`);
|
|
|
|
|
console.log(` Version: ${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`);
|
|
|
|
|
console.log(` Formats:`);
|
|
|
|
|
console.log(` Images: ${mediaTypes.image.map((extension) => extension.replace('.', ''))}`);
|
|
|
|
|
console.log(` Videos: ${mediaTypes.video.map((extension) => extension.replace('.', ''))}`);
|
|
|
|
|
console.log(` Statistics:`);
|
|
|
|
|
console.log(` Images: ${stats.images}`);
|
|
|
|
|
console.log(` Videos: ${stats.videos}`);
|
|
|
|
|
console.log(` Total: ${stats.total}`);
|
2024-03-14 19:09:28 -04:00
|
|
|
};
|