2023-01-21 09:11:55 -07:00
|
|
|
import { SystemConfig, UserEntity } from '@app/infra/db/entities';
|
2023-01-18 07:40:15 -07:00
|
|
|
import { AuthUserDto } from '../src';
|
|
|
|
|
|
|
|
export const authStub = {
|
|
|
|
admin: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'admin_id',
|
|
|
|
email: 'admin@test.com',
|
|
|
|
isAdmin: true,
|
|
|
|
isPublicUser: false,
|
|
|
|
isAllowUpload: true,
|
|
|
|
}),
|
|
|
|
user1: Object.freeze<AuthUserDto>({
|
|
|
|
id: 'immich_id',
|
|
|
|
email: 'immich@test.com',
|
|
|
|
isAdmin: false,
|
|
|
|
isPublicUser: false,
|
|
|
|
isAllowUpload: true,
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
export const entityStub = {
|
|
|
|
admin: Object.freeze<UserEntity>({
|
|
|
|
...authStub.admin,
|
|
|
|
password: 'admin_password',
|
|
|
|
firstName: 'admin_first_name',
|
|
|
|
lastName: 'admin_last_name',
|
|
|
|
oauthId: '',
|
|
|
|
shouldChangePassword: false,
|
|
|
|
profileImagePath: '',
|
|
|
|
createdAt: '2021-01-01',
|
|
|
|
tags: [],
|
|
|
|
}),
|
|
|
|
user1: Object.freeze<UserEntity>({
|
|
|
|
...authStub.user1,
|
|
|
|
password: 'immich_password',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
oauthId: '',
|
|
|
|
shouldChangePassword: false,
|
|
|
|
profileImagePath: '',
|
|
|
|
createdAt: '2021-01-01',
|
|
|
|
tags: [],
|
|
|
|
}),
|
|
|
|
};
|
2023-01-21 09:11:55 -07:00
|
|
|
|
|
|
|
export const systemConfigStub = {
|
|
|
|
defaults: Object.freeze({
|
|
|
|
ffmpeg: {
|
|
|
|
crf: '23',
|
|
|
|
preset: 'ultrafast',
|
2023-01-21 19:09:02 -07:00
|
|
|
targetAudioCodec: 'aac',
|
2023-01-21 09:11:55 -07:00
|
|
|
targetScaling: '1280:-2',
|
2023-01-21 19:09:02 -07:00
|
|
|
targetVideoCodec: 'h264',
|
|
|
|
transcodeAll: false,
|
2023-01-21 09:11:55 -07:00
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
autoLaunch: false,
|
|
|
|
autoRegister: true,
|
|
|
|
buttonText: 'Login with OAuth',
|
|
|
|
clientId: '',
|
|
|
|
clientSecret: '',
|
|
|
|
enabled: false,
|
|
|
|
issuerUrl: '',
|
|
|
|
mobileOverrideEnabled: false,
|
|
|
|
mobileRedirectUri: '',
|
|
|
|
scope: 'openid email profile',
|
|
|
|
},
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
storageTemplate: {
|
|
|
|
template: '{{y}}/{{y}}-{{MM}}-{{dd}}/{{filename}}',
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
2023-01-23 21:13:42 -07:00
|
|
|
enabled: Object.freeze({
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: true,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
|
|
|
disabled: Object.freeze({
|
|
|
|
passwordLogin: {
|
|
|
|
enabled: false,
|
|
|
|
},
|
|
|
|
oauth: {
|
|
|
|
enabled: false,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
issuerUrl: 'http://issuer,',
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
} as SystemConfig),
|
|
|
|
noAutoRegister: {
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: false,
|
|
|
|
autoLaunch: false,
|
|
|
|
},
|
|
|
|
passwordLogin: { enabled: true },
|
|
|
|
} as SystemConfig,
|
|
|
|
override: {
|
|
|
|
oauth: {
|
|
|
|
enabled: true,
|
|
|
|
autoRegister: true,
|
|
|
|
autoLaunch: false,
|
|
|
|
buttonText: 'OAuth',
|
|
|
|
mobileOverrideEnabled: true,
|
|
|
|
mobileRedirectUri: 'http://mobile-redirect',
|
|
|
|
},
|
|
|
|
passwordLogin: { enabled: true },
|
|
|
|
} as SystemConfig,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const loginResponseStub = {
|
|
|
|
user1oauth: {
|
|
|
|
response: {
|
|
|
|
accessToken: 'signed-jwt',
|
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
|
|
|
'immich_access_token=signed-jwt; Secure; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
'immich_auth_type=oauth; Secure; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
user1password: {
|
|
|
|
response: {
|
|
|
|
accessToken: 'signed-jwt',
|
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
|
|
|
'immich_access_token=signed-jwt; Secure; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
'immich_auth_type=password; Secure; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
user1insecure: {
|
|
|
|
response: {
|
|
|
|
accessToken: 'signed-jwt',
|
|
|
|
userId: 'immich_id',
|
|
|
|
userEmail: 'immich@test.com',
|
|
|
|
firstName: 'immich_first_name',
|
|
|
|
lastName: 'immich_last_name',
|
|
|
|
profileImagePath: '',
|
|
|
|
isAdmin: false,
|
|
|
|
shouldChangePassword: false,
|
|
|
|
},
|
|
|
|
cookie: [
|
|
|
|
'immich_access_token=signed-jwt; HttpOnly; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
'immich_auth_type=password; HttpOnly; Path=/; Max-Age=604800; SameSite=Strict;',
|
|
|
|
],
|
|
|
|
},
|
2023-01-21 09:11:55 -07:00
|
|
|
};
|