* refactor(server): user endpoints
* feat(server): user preferences
* mobile: user preference
* wording
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* refactor(server): user endpoints
* fix repos
* fix unit tests
---------
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
Co-authored-by: Alex <alex.tran1502@gmail.com>
* fix(server): use mp4 file extension for motion photo videos in archive download
* always use mp4 for videos
* get file extension from originalPath
* remove console log
* store motion assets with mp4 extension
* add migration
* set originalFileName for live photo asset stubs
* leave down migration empty
* only set originalFileName for livePhotoStillAsset
* use separate stub
* shorter stub name
* feat(server): user metadata
* add missing method to user mock
* update migration to include cascades
* update sql files
* test: fix e2e
* chore: clean up
---------
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
* fix: when using old script args, just set the workers include var and move on
* fix: set process.title when using new bootstrap worker startup method
* feat: microservices be gone and api is a worker now too
* chore: remove very old startup scripts, surely nobody is using these anymore, right?
right?....
* duplicate detection job, entity, config
* queueing
* job panel, update api
* use embedding in db instead of fetching
* disable concurrency
* only queue visible assets
* handle multiple duplicateIds
* update concurrent queue check
* add provider
* add web placeholder, server endpoint, migration, various fixes
* update sql
* select embedding by default
* rename variable
* simplify
* remove separate entity, handle re-running with different threshold, set default back to 0.02
* fix tests
* add tests
* add index to entity
* formatting
* update asset mock
* fix `upsertJobStatus` signature
* update sql
* formatting
* default to 0.03
* optimize clustering
* use asset's `duplicateId` if present
* update sql
* update tests
* expose admin setting
* refactor
* formatting
* skip if ml is disabled
* debug trash e2e
* remove from web
* remove from sidebar
* test if ml is disabled
* update sql
* separate duplicate detection from clip in config, disable by default for now
* fix doc
* lower minimum `maxDistance`
* update api
* Add and Use Duplicate Detection Feature Flag (#9364)
* Add Duplicate Detection Flag
* Use Duplicate Detection Flag
* Attempt Fixes for Failing Checks
* lower minimum `maxDistance`
* fix tests
---------
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
* chore: fixes and additions after rebase
* chore: update api (remove new Role enum)
* fix: left join smart search so getAll works without machine learning
* test: trash e2e go back to checking length of assets is zero
* chore: regen api after rebase
* test: fix tests after rebase
* redundant join
---------
Co-authored-by: Nicholas Flamy <30300649+NicholasFlamy@users.noreply.github.com>
Co-authored-by: Zack Pollard <zackpollard@ymail.com>
Co-authored-by: Zack Pollard <zack@futo.org>
* chore(deps): update dependency eslint-plugin-unicorn to v53
* use structured clone to match new eslint rules
* use raw string instead of escaping slash
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
* feat(server, web): include pictures of shared albums on map
* run prettier
* re-create api clients
* implement suggestions from code review
* shared from partner -> shared from partners
* rename to 'include shared partner assets'
* chore: fix tsc error in server and prettier in web
* fix: include assets shared via owner albums
---------
Co-authored-by: Zack Pollard <zackpollard@ymail.com>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* do crop and resize together
* redundant `pipelineColorspace` call
* formatting
* fix rebase
* handle orientation
* remove unused import
* formatting
* use oriented dimensions for half size calculation
* default case for orientation
* simplify orientation code
---------
Co-authored-by: Alex <alex.tran1502@gmail.com>
* refactor: remove isReadOnly and isExternal usages
* chore: open api
* fix: linting
* remove mobile isReadOnly dependency
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* feat(server): add `react-mail` as mail template engine and `nodemailer`
* feat(server): add `smtp` related configs to `SystemConfig`
* feat(web): add page for SMTP settings
* feat(server): add `react-email.adapter`
This adapter render the React-Email into HTML and plain/text email.
The output is set as the body of the email.
* feat(server): add `MailRepository` and `MailService`
Allow to use the NestJS-modules-mailer module to send SMTP emails.
This is the base transport for the `NotificationRepository`
* feat(server): register the job dispatcher and Job for async email
This allows to queue email sending jobs for the `EmailService`.
* feat(server): add `NotificationRepository` and `NotificationService`
This act as a middleware to properly route the notification to the right transport.
As POC I've only implemented a simple SMTP transport.
* feat(server): add `welcome` email template
* feat(server): add the first notification on `createUser` in `UserService`
This trigger an event for the `NotificationRepository` that once processes
by using the global config and per-user config will carry the payload to the right notification transport.
* chore: clean up
* chore: clean up web
* fix: type errors"
* fix package lock
* fix mail sending, option to ignore certs
* chore: open api
* chore: clean up
* remove unused import
* feat: email feature flag
* chore: remove unused interface
* small styling
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* fix(server): stacked assets for full sync, userIds as array for delta sync
* refactor(server): sync
* fix getDeltaSync after partner removal
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* fix: improve reverse geocoding
* fix: update tests referencing states
* fix: expect state suggestion in any order
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* rename albums_shared_users_users to album_permissions and add readonly column
* disable synchronize on the original join table
* remove unnecessary FK names
* set readonly=true as default for new album shares
* separate and implement album READ and WRITE permission
* expose albumPermissions on the API, deprecate sharedUsers
* generate openapi
* create readonly view on frontend
* ??? move slideshow button out from ellipsis menu so that non-owners can have access too
* correct sharedUsers joins
* add album permission repository
* remove a log
* fix assetCount getting reset when adding users
* fix lint
* add set permission endpoint and UI
* sort users
* remove log
* Revert "??? move slideshow button out from ellipsis menu so that non-owners can have access too"
This reverts commit 1343bfa311.
* rename stuff
* fix db schema annotations
* sql generate
* change readonly default to follow migration
* fix deprecation notice
* change readonly boolean to role enum
* fix joincolumn as primary key
* rename albumUserRepository in album service
* clean up userId and albumId
* add write access to shared link
* fix existing tests
* switch to vitest
* format and fix tests on web
* add new test
* fix one e2e test
* rename new API field to albumUsers
* capitalize serverside enum
* remove unused ReadWrite type
* missed rename from previous commit
* rename to albumUsers in album entity as well
* remove outdated Equals calls
* unnecessary relation
* rename to updateUser in album service
* minor renamery
* move sorting to backend
* rename and separate ALBUM_WRITE as ADD_ASSET and REMOVE_ASSET
* fix tests
* fix "should migrate single moving picture" test failing on European system timezone
* generated changes after merge
* lint fix
* fix correct page to open after removing user from album
* fix e2e tests and some bugs
* rename updateAlbumUser rest endpoint
* add new e2e tests for updateAlbumUser endpoint
* small optimizations
* refactor album e2e test, add new album shared with viewer
* add new test to check if viewer can see the album
* add new e2e tests for readonly share
* failing test: User delete doesn't cascade to UserAlbum entity
* fix: handle deleted users
* use lodash for sort
* add role to addUsersToAlbum endpoint
* add UI for adding editors
* lint fixes
* change role back to editor as DB default
* fix server tests
* redesign user selection modal editor selector
* style tweaks
* fix type error
* Revert "style tweaks"
This reverts commit ab604f4c8f.
* Revert "redesign user selection modal editor selector"
This reverts commit e6f344856c.
* chore: cleanup and improve add user modal
* chore: open api
* small styling
---------
Co-authored-by: mgabor <>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* ignore non external assets in external libraries during syncUsage
* only update storage usage if asset is from internal libraries
* update storage usage on motion photo video asset creation
* updated metadata service tests
* added a test
* simplified syncUsage condition
* check for library type upload instead of not external
* fixed broken sql
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* Allow setting the host address for the server & microservices
Default to listen on all interfaces as per the current behavior.
* (Docs) format: fix lint
* added "isExternal" to the getLibraryAssetPaths query
* handleQueueAssetRefresh skip "non external" video asset, closes#8562
* correctly implements live photo deletion for external library
* use "external asset" for external library tests
* minor: external library asset checksum is "path hash" not file hash
* renamed to getExternalLibraryAssetPaths and added isExternal where clause
* generated sql
* reverted leftover change
* Add AV1 transcoding support
- AV1 encoding on CPU via SVT-AV1 (libsvtav1 in ffmpeg)
- Supports CRF and optionally capped CRF (max bitrate)
- Tested playback successfully in Chrome Win+Android, Firefox Win+Linux, Android app
* AV1: Add support for encoding threads option
* Revert previous commit; specifying params multiple times is bad
We need to specify all svtav1-params at once, so putting the thread option into getThreadOptions is not possible.
* AV1: Override VAAPI getSupportedCodecs as it does not yet support AV1 unlike nvenc, qsv, amf
* Change BaseHWConfig supported codecs to only H264/HEVC
Configs that support VP9 and/or AV1 need to override getSupportedCodecs()
* Set SVT-AV1 threads with svtav1-params, remove duplicate block in NVENCConfig
* AV1Config: Fix empty svtav1-params array being added to options
* add tests
* update api
* allow crf-based two-pass mode
* formatting
* suggest 35
---------
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
* delete thumbnail and other generated files even for readonly asset
* updated test
* don't delete sidecar file for readonly file
* fixed test
* improved external detection
* Fix isImmichPath
* prettier write
* Fis isImmichPath code comment
* Refactor isImmichPath function based on team suggestions
* Test isImmichPath
* fix: clean comments
* Refactor isImmichPath test based on team suggestions
* Clean code with lintern suggestions
* Added SVG Support
* Removed comment
* Server Test fixes
* Sorted the mimetypes
* Reverted mimetypes.assettype
* Lint
* fix test
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* clean up usage
* i'm not updating all these tests
* update tests
* add indices
* add indices to entities
remove index from person entity
add to face entity
fix
* simplify query
* update sql
* missing await
* remove synchronize false
* test(server): Load config from yaml
* docs: YAML config support
* feat(server): YAML config file support
* fix format
---------
Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
* feat(server,web): add force delete to immediately remove user
* update wording on force delete confirmation
* fix force delete css
* PR feedback
* cleanup user service delete for force
* adding user status column
* some cleanup and tests
* more test fixes
* run npm run sql:generate
* chore: cleanup and websocket
* chore: linting
* userRepository.restore
* removed bad color class from delete-confirm-dialoge
* additional confirmation for user force delete
* shorten confirmation message
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* feat(server,web): make user deletion delay configurable
* alphabetical order
* add min for user.deleteDelay in SettingInputField
* make config.user.deleteDelay SettingInputField min consistent format
* fix e2e test
* update description on user delete delay
* fix(server): stack info in asset response for mobile
* fix(server): getAllAssets - do not filter by stack ID
* tet(server): GET /assets stack e2e
* chore(server): fix checks
* stack asset height
---------
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
`dt.diffNow()` equals `dt.diff(DateTime.now())`, so it returns a
negative number when `dt` is in the past (which it always is in this
case).
Therefore we could only get over the condition during startup (when
`this.releaseVersionCheckedAt` isn't set yet), effectively breaking
update notifications while the server is running.
* alt text
* memory lane alt text
* revert sql generator change
* use getAltText
* oops
* handle large number of people in asset
* nit
* add aria-label to search button
* update api
* fixed tests
* fixed typing
* fixed spacing
* fix displaying null
* fix(deps): update exiftool
* documenting such changes would have been too easy
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
* feat: hybrid search
* fixing normal search
* building out the query
* okla
* filters
* date
* order by date
* Remove hybrid search endpoint
* remove search hybrid endpoint
* faces query
* search for person
* search and pagination
* with exif
* with exif
* justify gallery viewer
* memory view
* Fixed userId is null
* openapi and styling
* searchdto
* lint and format
* remove term
* generate sql
* fix test
* chips
* not showing true
* pr feedback
* pr feedback
* nit name
* linting
* pr feedback
* styling
* linting
* fix(server): recognize face when min. faces is set to 1
* update logic
* clarified log
---------
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
* feat(server): Include partner's photos on map - if included in timeline
* depend on query parameter withPartners
instead of partners.inTimeline
* web: map option to include partners images
* make open-api
* commit
* controller/service/repository logic
* use enum
* openapi
* suggest people
* suggest place/camera
* cursor hover
* refactor
* Add try catch
* Remove get people with name service
* Remove deadcode
* people selection
* People placement
* sort people
* Update server/src/domain/repositories/metadata.repository.ts
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* pr feedback
* styling
* done
* open api
* fix test
* use string type
* remmove bad merge
* use correct type
* fix test
* fix lint
* remove unused code
* remove unused code
* pr feedback
* pr feedback
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* check if sidecarPath exists
* Revert "check if sidecarPath exists"
This reverts commit 954a1097b870585afee34974d466e51c5172fed9.
* sidecar sync remove dead sidecarPaths and discover new ones
* tests and minor cleanup
* chore: linting
---------
Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* basic changes
update version check
set ef_search for clip
* pgvector compatibility
Revert "pgvector compatibility"
This reverts commit 2b66a52aa4097dd27da58138c5288fd87cb9b24a.
pgvector compatibility: minimal edition
pgvector startup check
* update extension at startup
* wording
shortened vector extension variable name
* nightly docker
* fixed version checks
* update tests
add tests for updating extension
remove unnecessary check
* simplify `getRuntimeConfig`
* wording
* reindex on minor version update
* 0.2 upgrade testing
update prod compose
* acquire lock for init
* wip vector down on shutdown
* use upgrade helper
* update image tag
* refine restart check
check error message
* test reindex
testing
upstream fix
formatting
fixed reindexing
* use enum in signature
* fix tests
remove unused code
* add reindexing tests
* update to official 0.2
remove alpha from version name
* add warning test if restart required
* update test image to 0.2.0
* linting and test cleanup
* formatting
* update sql
* wording
* handle setting search path for new and existing databases
* handle new db in reindex check
* fix post-update reindexing
* get dim size
* formatting
* use vbase
* handle different db name
* update sql
* linting
* fix suggested env
This change simplifies the Access repository methods, by using the
`ChunkedSet` decorator. As the methods expect sets, the `chunks` util
needed to be fixed, so it returns chunks of the same type it received.
Now `chunks` is overloaded, to have proper typing based on the input
parameter.
* feat: add oauth signing algorithm setting
* chore: open api
* chore: change default to RS256
* feat: test and clean up
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* add unicorn to eslint
* fix lint errors for cli
* fix merge
* fix album name extraction
* Update cli/src/commands/upload.command.ts
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
* es2k23
* use lowercase os
* return undefined album name
* fix bug in asset response dto
* auto fix issues
* fix server code style
* es2022 and formatting
* fix compilation error
* fix test
* fix config load
* fix last lint errors
* set string type
* bump ts
* start work on web
* web formatting
* Fix UUIDParamDto as UUIDParamDto
* fix library service lint
* fix web errors
* fix errors
* formatting
* wip
* lints fixed
* web can now start
* alphabetical package json
* rename error
* chore: clean up
---------
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* chore: rebase
* chore: open api
* Add Database-Migration for setting targetCodec as acceptedCodec if it was set by admin
* Add TranscodePolicy setting, to only transcode files with a bitrate higher than set max bitrate
* Rename enum value of TranscodePolicy
* calculate max_bitrate according to "k" and "m" suffix for comparison
* remove migration
* minor changes
* UnitTest for Bitrate Policy
* Fix UnitTest
* Add missing output options
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
* added a configuration option to select the dri node in transcoding
* chore: open api
* refactor: get hawrdware device
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* feat: search peoples
* fix: responsive design
* use existing count
* generate sql file
* fix: tests
* remove visible people
* fix: merge, hide...
* use component
* fix: linter
* chore: regenerate api
* fix: change name when searching for a face
* save search
* remove duplicate
* use enums for query parameters
* fix: increase to 20 for the local search
* use constants
* simplify
* fix: number of people more visible
* fix: merge
* fix: search
* fix: loading spinner position
* pr feedback
* Fix extraction of samsung motionphoto videos
* Refactor binary tag extraction to the repository to consolidate exiftool usage
* format
* fix linting and swap argument orders
* Fix tag name and conditional order
* Add unit test
* Update server test assets submodule
* Remove old motion photo video assets when a new one is extracted
* delete first, then write
* Include motion photo asset uuid's in the filename
If the filenames are not uniquified, then we can't delete old/corrupt ones
* Fix formatting and fix/add tests
* chore: only use new uuid
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* Feat: provide the ability to search archived photos
Adds a query parameter (`searchArchived`) to the search URL parameters
to allow the results to contain archived photos.
* chore: rename includeArchived => withArchived
* chore: open api
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Fixes https://github.com/immich-app/immich/issues/5982.
There are basically three options:
1. Search `originalFileName` by dropping a file extension from the query
(if present). Lower fidelity but very easy - just a standard index &
equality.
2. Search `originalPath` by adding an index on `reverse(originalPath)`
and using `starts_with(reverse(query) + "/", reverse(originalPath)`. A
weird index & query but high fidelity.
3. Add a new generated column called `originalFileNameWithExtension` or
something. More storage, kinda jank.
TBH, I think (1) is good enough and easy to make better in the future.
For example, if I search "DSC_4242.jpg", I don't really think it matters
if "DSC_4242.mov" also shows up.
edit: There's a fourth approach that we discussed a bit in Discord and
decided we could switch to it in the future: using a GIN. The minor
issue is that Postgres doesn't tokenize paths in a useful (they're a
single token and it won't match against partial components). We can
solve that by tokenizing it ourselves. For example:
```
immich=# with vecs as (select to_tsvector('simple', array_to_string(string_to_array('upload/library/sushain/2015/2015-08-09/IMG_275.JPG', '/'), ' ')) as vec) select * from vecs where vec @@ phraseto_tsquery('simple', array_to_string(string_to_array('library/sushain', '/'), ' '));
vec
-------------------------------------------------------------------------------
'-08':6 '-09':7 '2015':4,5 'img_275.jpg':8 'library':2 'sushain':3 'upload':1
(1 row)
```
The query is also tokenized with the 'split-by-slash-join-with-space'
strategy. This strategy results in `IMG_275.JPG`, `2015`, `sushain` and
`library/sushain` matching. But, `08` and `IMG_275` do not match. The
former is because the token is `-08` and the latter because the
`img_275.jpg` token is matched against exactly.
* chore(web): quota enhancement
* show quota in user table
* update quota for single user ioption
* Add a note how to set unlimited storage
* fixed deletion doesn't update quota
* refactor relation
* fixed test
* re-refactor
* update sql
* fix e2e test
* Update server/src/domain/user/user.service.ts
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* revert e2e test
---------
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
* fix(server): Split database queries based on PostgreSQL bound params limit
PostgreSQL uses a 16-bit integer to indicate the number of bound
parameters.
This means that the maximum number of parameters for any query is 65535.
Any query that tries to bind more than that (e.g. searching by a list of
IDs) requires splitting the query into multiple chunks.
This change includes refactoring every Repository that runs queries
using a list of ids, and either flattening or merging results.
Fixes#5788, #5997.
Also, potentially a fix for #4648 (at least based on
[this comment](https://github.com/immich-app/immich/issues/4648#issuecomment-1826134027)).
References:
* https://github.com/typeorm/typeorm/issues/7565
* [PostgreSQL message format - Bind](https://www.postgresql.org/docs/15/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-BIND)
* misc: Create Chunked decorator to simplify implementation
* feat: Add ChunkedArray/ChunkedSet decorators
* feat(server): Throw error when PostgreSQL version is not within the supported versions
The pgvecto.rs extension, though not distributed, can be built for PostgreSQL 12 and 13.
An installation of PostgreSQL 12 with the pgvecto.rs extensions installed will not be caught by immich.
This causes immich to attempt to run the database migrations without having a proper environment.
With assertPostgresql the server will throw an error if the PostgreSQL version is not within the supported range.
* Replaced assertion with lesser than comparison
As requested by @zackpollard
* Changed the comparison to use the minPostgresVersion variable.
If we define one we might as well use it. makes changing the versioning later easier
* Added two new tests, modified two existing tests
`should return if minimum supported PostgreSQL and vectors version are installed`:
Check if init returns properly and that getPostgresVersion is called twice
`should thrown an error if PostgreSQL version is below minimum supported version`:
Checks if the init function correctly returns an error
`should suggest image with postgres ${major} if database is ${major}`:
Modified to set MockResolvedValue instead of MockResolvedValueOnce. With the new check we get the PostgreSQL version twice. So it needs to be set during the entire test.
`should not suggest image if postgres version is not in 14, 15 or 16`:
Modified the bounds to [14, 18]. Because values below 14 now will not get called.
Also Modified to call `getPostgresVersion.MockResolvedValueOnce` for twice, because it gets called twice.
* Fixed two mistakes in the jest functions from previous commit #2abcb60
`should thrown an error if PostgreSQL version is below minimum supported version`:
The regex function I wrote mistakingly used the negate function which check that the error *did not* contain the phrase "PostgreSQL". Which is the opposite
`should not suggest image if postgres version is not in 14, 15 or 16`:
confused bounds for a normal javascript array. Changed the test to only check for values above 16. As values below 14 will get thrown out by test `should return if minimum supported PostgreSQL and vectors version are installed`
I apologise for the mistakes in my previous commit.
* Format fix
---------
Co-authored-by: max <wak@vanling.net>
The current `removeAsset` implementation just builds the query but does
not execute it. That also seems to be the reason the `@GenerateSql`
decorator was commented out.
* feat(web): onboarding
* feat: openapi
* feat: modulization
* feat: page advancing
* Animation
* Add storage templaete settings
* sql
* more style
* Theme
* information and styling
* hide/show table
* Styling
* Update user property
* fix test
* fix test:
* fix e2e
* test
* Update web/src/lib/components/onboarding-page/onboarding-hello.svelte
Co-authored-by: bo0tzz <git@bo0tzz.me>
* naming
* use System Metadata
* better return type
* onboarding using server metadata
* revert previous changes in user entity
* sql
* test web
* fix test server
* server/web test
* more test
* consolidate color theme change logic
* consolidate save button to storage template
* merge main
* fix web
---------
Co-authored-by: bo0tzz <git@bo0tzz.me>
* fix(deps): update dependency @nestjs/schedule to v4
* fix: change CronJob in addCronJob to match new type required by nestjs schedule module
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Zack Pollard <zackpollard@ymail.com>
* feat(server): Enqueue jobs in bulk
The Job Repository now has a `queueAll` method, that enqueues messages
in bulk (using BullMQ's
[`addBulk`](https://docs.bullmq.io/guide/queues/adding-bulks)),
improving performance when many jobs must be enqueued within the same
operation.
Primary change is in `src/domain/job/job.service.ts`, and other services
have been refactored to use `queueAll` when useful.
As a simple local benchmark, triggering a full thumbnail generation
process over a library of ~1,200 assets and ~350 faces went from
**~600ms** to **~250ms**.
* fix: Review feedback
* fix: locks need to be acquired and released using the same session
* feat: only allow a single storage template operation at a single time
this has been added to avoid possible rare race conditions where two files are moved at once to the same path with the same name, causing our duplicate iterator to not detect them and therefore both files will have the same name and overwrite eachother
* fix: pgvecto.rs extension breaks typeorm schema:drop command
* fix: parse postgres bigints to javascript number types when selecting data
* feat: verify file size is the same as original asset after copying file for storage template job
* feat: allow disabling of storage template job, defaults to disabled for new instances
* fix: don't allow setting concurrency for storage template migration, can cause race conditions above 1
* feat: add checksum verification when file is copied for storage template job
* fix: extract metadata for assets that aren't visible on timeline
* fix(server): Reduce number of bound parameters in Access queries
According to https://github.com/typeorm/typeorm/issues/7565, the
introduction of bulk queries for permission checks could quickly reach
the limit of 65536 bound parameters allowed by the PostgreSQL
connection.
To avoid reaching that limit, this first change refactors the Access
queries that are expanding the set of ids multiple times. For example,
`asset.checkSharedLinkAccess` expands the ids 4 times, so providing just
~16400 ids is enough to break the query.
Refactored queries:
* activity.checkCreateAccess
```sql
-- Before
SELECT "AlbumEntity"."id" AS "AlbumEntity_id"
FROM "albums" "AlbumEntity"
LEFT JOIN "albums_shared_users_users" "AlbumEntity_AlbumEntity__AlbumEntity_sharedUsers"
ON "AlbumEntity_AlbumEntity__AlbumEntity_sharedUsers"."albumsId"="AlbumEntity"."id"
LEFT JOIN "users" "AlbumEntity__AlbumEntity_sharedUsers"
ON "AlbumEntity__AlbumEntity_sharedUsers"."id"="AlbumEntity_AlbumEntity__AlbumEntity_sharedUsers"."usersId"
AND ("AlbumEntity__AlbumEntity_sharedUsers"."deletedAt" IS NULL)
WHERE
(
(
"AlbumEntity"."id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
AND "AlbumEntity"."isActivityEnabled" = $11
AND "AlbumEntity__AlbumEntity_sharedUsers"."id" = $12
)
OR (
"AlbumEntity"."id" IN ($13, $14, $15, $16, $17, $18, $19, $20, $21, $22)
AND "AlbumEntity"."isActivityEnabled" = $23
AND "AlbumEntity"."ownerId" = $24
)
)
AND "AlbumEntity"."deletedAt" IS NULL
-- After
SELECT "album"."id" AS "album_id"
FROM "albums" "album"
LEFT JOIN "albums_shared_users_users" "album_sharedUsers"
ON "album_sharedUsers"."albumsId"="album"."id"
LEFT JOIN "users" "sharedUsers"
ON "sharedUsers"."id"="album_sharedUsers"."usersId"
AND "sharedUsers"."deletedAt" IS NULL
WHERE
"album"."id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
AND "album"."isActivityEnabled" = true
AND (
"album"."ownerId" = $11
OR "sharedUsers"."id" = $12
)
AND "album"."deletedAt" IS NULL
```
* asset.checkAlbumAccess
```sql
-- Before
SELECT
"asset"."id" AS "assetId",
"asset"."livePhotoVideoId" AS "livePhotoVideoId"
FROM "albums" "album"
INNER JOIN "albums_assets_assets" "album_asset"
ON "album_asset"."albumsId"="album"."id"
INNER JOIN "assets" "asset"
ON "asset"."id"="album_asset"."assetsId"
AND "asset"."deletedAt" IS NULL
LEFT JOIN "albums_shared_users_users" "album_sharedUsers"
ON "album_sharedUsers"."albumsId"="album"."id"
LEFT JOIN "users" "sharedUsers"
ON "sharedUsers"."id"="album_sharedUsers"."usersId"
AND "sharedUsers"."deletedAt" IS NULL
WHERE
(
"album"."ownerId" = $1
OR "sharedUsers"."id" = $2
)
AND (
"asset"."id" IN ($3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
OR "asset"."livePhotoVideoId" IN ($13, $14, $15, $16, $17, $18, $19, $20, $21, $22)
)
AND "album"."deletedAt" IS NULL
-- After
WITH "assetIds" AS (
SELECT unnest(array[$1, $2, $3, $4, $5, $6, $7, $8, $9, $10])::uuid AS "id"
FROM (SELECT 1 AS dummy_column) "dummy_table"
)
SELECT
"asset"."id" AS "assetId",
"asset"."livePhotoVideoId" AS "livePhotoVideoId"
FROM "albums" "album"
INNER JOIN "albums_assets_assets" "album_asset"
ON "album_asset"."albumsId"="album"."id"
INNER JOIN "assets" "asset"
ON "asset"."id"="album_asset"."assetsId"
AND "asset"."deletedAt" IS NULL
LEFT JOIN "albums_shared_users_users" "album_sharedUsers"
ON "album_sharedUsers"."albumsId"="album"."id"
LEFT JOIN "users" "sharedUsers"
ON "sharedUsers"."id"="album_sharedUsers"."usersId"
AND "sharedUsers"."deletedAt" IS NULL
WHERE
(
"album"."ownerId" = $11
OR "sharedUsers"."id" = $12
)
AND (
"asset"."id" IN (SELECT id FROM "assetIds")
OR "asset"."livePhotoVideoId" IN (SELECT id FROM "assetIds")
)
AND "album"."deletedAt" IS NULL
```
* asset.checkSharedLinkAccess
```sql
-- Before
SELECT
"assets"."id" AS "assetId",
"assets"."livePhotoVideoId" AS "assetLivePhotoVideoId",
"albumAssets"."id" AS "albumAssetId",
"albumAssets"."livePhotoVideoId" AS "albumAssetLivePhotoVideoId"
FROM "shared_links" "sharedLink"
LEFT JOIN "albums" "album"
ON "album"."id"="sharedLink"."albumId"
AND "album"."deletedAt" IS NULL
LEFT JOIN "shared_link__asset" "assets_sharedLink"
ON "assets_sharedLink"."sharedLinksId"="sharedLink"."id"
LEFT JOIN "assets" "assets"
ON "assets"."id"="assets_sharedLink"."assetsId"
AND "assets"."deletedAt" IS NULL
LEFT JOIN "albums_assets_assets" "album_albumAssets"
ON "album_albumAssets"."albumsId"="album"."id"
LEFT JOIN "assets" "albumAssets"
ON "albumAssets"."id"="album_albumAssets"."assetsId"
AND "albumAssets"."deletedAt" IS NULL
WHERE
"sharedLink"."id" = $1
AND (
"assets"."id" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
OR "albumAssets"."id" IN ($12, $13, $14, $15, $16, $17, $18, $19, $20, $21)
OR "assets"."livePhotoVideoId" IN ($22, $23, $24, $25, $26, $27, $28, $29, $30, $31)
OR "albumAssets"."livePhotoVideoId" IN ($32, $33, $34, $35, $36, $37, $38, $39, $40, $41)
)
-- After
WITH "assetIds" AS (
SELECT unnest(array[$1, $2, $3, $4, $5, $6, $7, $8, $9, $10])::uuid AS "id"
FROM (SELECT 1 AS dummy_column) "dummy_table"
)
SELECT
"assets"."id" AS "assetId",
"assets"."livePhotoVideoId" AS "assetLivePhotoVideoId",
"albumAssets"."id" AS "albumAssetId",
"albumAssets"."livePhotoVideoId" AS "albumAssetLivePhotoVideoId"
FROM "shared_links" "sharedLink"
LEFT JOIN "albums" "album"
ON "album"."id"="sharedLink"."albumId"
AND "album"."deletedAt" IS NULL
LEFT JOIN "shared_link__asset" "assets_sharedLink"
ON "assets_sharedLink"."sharedLinksId"="sharedLink"."id"
LEFT JOIN "assets" "assets"
ON "assets"."id"="assets_sharedLink"."assetsId"
AND "assets"."deletedAt" IS NULL
LEFT JOIN "albums_assets_assets" "album_albumAssets"
ON "album_albumAssets"."albumsId"="album"."id"
LEFT JOIN "assets" "albumAssets"
ON "albumAssets"."id"="album_albumAssets"."assetsId"
AND "albumAssets"."deletedAt" IS NULL
WHERE
"sharedLink"."id" = $11
AND (
"assets"."id" IN (SELECT id FROM "assetIds")
OR "albumAssets"."id" IN (SELECT id FROM "assetIds")
OR "assets"."livePhotoVideoId" IN (SELECT id FROM "assetIds")
OR "albumAssets"."livePhotoVideoId" IN (SELECT id FROM "assetIds")
)
```
* fix: Use array overlapping instead of CTEs
included all thumbnail metadata. It seems this has to be explicitly disabled.
Refs: #4382
feat. basic metadata e2e test
fix: use tiff thumbnails in first step + e2e fix
fix: revert switch to tiff
feat: test metadata of both webp and jpg
feat: use upload in e2e test
fix: lint
strip metadata with exiftool
use `withIccProfile`
fix e2e
formatting
run jobs in e2e
* run migrations after checks
* optional migrations
* only run checks in server and e2e
* re-add migrations for microservices
* refactor
* move e2e init
* remove assert from migration
* update providers
* update microservices app service
* fixed logging
* refactored version check, added unit tests
* more version tests
* don't use mocks for sut
* refactor tests
* suggest image only if postgres is 14, 15 or 16
* review suggestions
* fixed regexp escape
* fix typing
* update migration
* Hide the person age if it is negative
* Add validation to prevent future birth dates
* Add comment
* Add test, Add birth date validation and update birth date modal
* Add birthDate validation in PersonService and SetBirthDateModal
* Running npm run format:fix
* Generating the migration file propoerly, and Make the birthdate form logic simpler
* Make birthDate type only string
* Adding useLocationPin back