mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	feat(server): add api key to openapi spec (#2362)
* feat(server): add api key to openapi spec * regenerate api
This commit is contained in:
		@@ -1,5 +1,7 @@
 | 
			
		||||
export const IMMICH_ACCESS_COOKIE = 'immich_access_token';
 | 
			
		||||
export const IMMICH_AUTH_TYPE_COOKIE = 'immich_auth_type';
 | 
			
		||||
export const IMMICH_API_KEY_NAME = 'api_key';
 | 
			
		||||
export const IMMICH_API_KEY_HEADER = 'x-api-key';
 | 
			
		||||
export enum AuthType {
 | 
			
		||||
  PASSWORD = 'password',
 | 
			
		||||
  OAUTH = 'oauth',
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import { IncomingHttpHeaders } from 'http';
 | 
			
		||||
import { OAuthCore } from '../oauth/oauth.core';
 | 
			
		||||
import { INITIAL_SYSTEM_CONFIG, ISystemConfigRepository } from '../system-config';
 | 
			
		||||
import { IUserRepository, UserCore } from '../user';
 | 
			
		||||
import { AuthType, IMMICH_ACCESS_COOKIE } from './auth.constant';
 | 
			
		||||
import { AuthType, IMMICH_ACCESS_COOKIE, IMMICH_API_KEY_HEADER } from './auth.constant';
 | 
			
		||||
import { AuthCore, LoginDetails } from './auth.core';
 | 
			
		||||
import { ICryptoRepository } from '../crypto/crypto.repository';
 | 
			
		||||
import { AuthUserDto, ChangePasswordDto, LoginCredentialDto, SignUpDto } from './dto';
 | 
			
		||||
@@ -137,7 +137,7 @@ export class AuthService {
 | 
			
		||||
      params.userToken ||
 | 
			
		||||
      this.getBearerToken(headers) ||
 | 
			
		||||
      this.getCookieToken(headers)) as string;
 | 
			
		||||
    const apiKey = (headers['x-api-key'] || params.apiKey) as string;
 | 
			
		||||
    const apiKey = (headers[IMMICH_API_KEY_HEADER] || params.apiKey) as string;
 | 
			
		||||
 | 
			
		||||
    if (shareKey) {
 | 
			
		||||
      return this.shareCore.validate(shareKey);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user