immich/cli/src/commands/base-command.ts
Jonathan Jogenfors ce6dc3b7af
fix(cli): auth file should be chmod 600 (#6925)
* wip new tests

* test for auth file mode

* check perms internally

* chore: lint
2024-02-06 00:40:22 +01:00

21 lines
730 B
TypeScript

import { ServerVersionResponseDto, UserResponseDto } from '@immich/sdk';
import { ImmichApi } from '../services/api.service';
import { SessionService } from '../services/session.service';
export abstract class BaseCommand {
protected sessionService!: SessionService;
protected immichApi!: ImmichApi;
protected user!: UserResponseDto;
protected serverVersion!: ServerVersionResponseDto;
constructor(options: { configDirectory?: string }) {
if (!options.configDirectory) {
throw new Error('Config directory is required');
}
this.sessionService = new SessionService(options.configDirectory);
}
public async connect(): Promise<void> {
this.immichApi = await this.sessionService.connect();
}
}