mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): add permission for server stats api (#854)
This commit is contained in:
parent
a6eea4d096
commit
7b954e21e7
4 changed files with 23 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Controller, Get } from '@nestjs/common';
|
||||
import { Controller, Get, UseGuards } from '@nestjs/common';
|
||||
import { ServerInfoService } from './server-info.service';
|
||||
import { serverVersion } from '../../constants/server_version.constant';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
|
@ -6,6 +6,8 @@ import { ServerPingResponse } from './response-dto/server-ping-response.dto';
|
|||
import { ServerVersionReponseDto } from './response-dto/server-version-response.dto';
|
||||
import { ServerInfoResponseDto } from './response-dto/server-info-response.dto';
|
||||
import { ServerStatsResponseDto } from './response-dto/server-stats-response.dto';
|
||||
import { JwtAuthGuard } from '../../modules/immich-jwt/guards/jwt-auth.guard';
|
||||
import { AdminRolesGuard } from '../../middlewares/admin-role-guard.middleware';
|
||||
|
||||
@ApiTags('Server Info')
|
||||
@Controller('server-info')
|
||||
|
|
@ -27,6 +29,8 @@ export class ServerInfoController {
|
|||
return serverVersion;
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(AdminRolesGuard)
|
||||
@Get('/stats')
|
||||
async getStats(): Promise<ServerStatsResponseDto> {
|
||||
return await this.serverInfoService.getStats();
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ import { ServerInfoService } from './server-info.service';
|
|||
import { ServerInfoController } from './server-info.controller';
|
||||
import { AssetEntity } from '@app/database/entities/asset.entity';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { ImmichJwtModule } from '../../modules/immich-jwt/immich-jwt.module';
|
||||
import { UserEntity } from '@app/database/entities/user.entity';
|
||||
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([AssetEntity])],
|
||||
imports: [TypeOrmModule.forFeature([AssetEntity, UserEntity]), ImmichJwtModule],
|
||||
controllers: [ServerInfoController],
|
||||
providers: [ServerInfoService],
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue