feat: yucca integration - #27817
Conversation
Signed-off-by: izzy <me@insrt.uk>
Signed-off-by: izzy <me@insrt.uk>
Signed-off-by: izzy <me@insrt.uk>
8df2ac9 to
b803a7d
Compare
| if (request.path.startsWith('/api/yucca')) { | ||
| request.user = await this.authService.authenticate({ | ||
| headers: request.headers, | ||
| queryParams: request.query as Record<string, string>, |
There was a problem hiding this comment.
Can you change the flow so that if the path is yucca is sets the metadata directly otherwise it gets it from this.reflector, and then both paths have a single request.user = await this.authService.authenticate({ metadata }) call?
| import { EventsGateway, ModuleConfigRepository } from '@futo-org/backups-orchestrator-api/dist'; | ||
| import { GatewayEvent } from '@futo-org/backups-orchestrator-api/dist/events/events.gateway'; |
There was a problem hiding this comment.
These should just import directly from @futo-org/backups-orchestrator-api
| onModuleInit() { | ||
| if (this.eventsGateway) { | ||
| this.eventsGateway.setAuthFn(async (client) => | ||
| this.authService.authenticate({ | ||
| headers: client.request.headers, | ||
| queryParams: {}, | ||
| metadata: { adminRoute: true, sharedLinkRoute: false, uri: '/api/yucca/socket.io' }, | ||
| }), | ||
| ); | ||
|
|
||
| this.eventsGateway.on(this.onInternalEvent); | ||
| } | ||
| } |
There was a problem hiding this comment.
This is configuration that belongs in Module.forRoot(). The Yucca module should have it's own websocket gateway, path, etc. If it wants to defer authentication to Immich's system, it should do something like:
OrchestrationApiModule.forRootAsync({
...
useFactory: (authService) => {
authenticate: (request) => authService.authenticate(...)
},
inject: [AuthService],
})There was a problem hiding this comment.
this whole file should just be "on immich events, call a method on the YuccaService", which should be injected via @Optional() private readonly yuccaService: YuccaService. The file should just be, onConfig => call this yuccaService method, onLibraryCreate => call this yuccaService method.
|
|
||
| onError(name: ImmichWorker, error: Error) { | ||
| console.error(`${name} worker error: ${error}, stack: ${error.stack}`); | ||
| console.error(`${name} worker error: ${JSON.stringify(error)}, stack: ${error.stack}`); |
|
Deploying preview environment to https://pr-27817.preview.internal.immich.build/ |
Signed-off-by: izzy <me@insrt.uk>
a4b8b0f to
7b093bc
Compare
Integrates yucca with the:
Some key things to point out from the PR:
@futo-org/backups-orchestrator-*dependencies/api/yuccato api & maintenance auth guardsLibraryCreate|Update|Deleteevents for synchronising state to orchestratorbetter-sqlite3as a native dependency/link?target=backups, which enables "Backups" in the sidebarbackups.beta: booleanto system config which is exposed in the server features APITBD:
How Has This Been Tested?
Screenshots
Main interface
Setup flow
Restore flow
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
Used where appropriate for prototypes.