Commit Graph

1337 Commits

Author SHA1 Message Date
Kostiantyn
a8edb30ae4 Refactor Docker build workflows (#1221)
* Initial implementation

* Multiple fixes and improvemens

* Better `curl` retries timing

* Remove unused `TARGETOS` and `TARGETVARIANT` vars; add the version fetch fallback code to the build scripts

* Move the fallback code before the var usage

* Use double braces to make the code compatible with the `set -u`

---------

Co-authored-by: Konstantin Koval
2025-06-26 11:58:50 +03:00
Kostiantyn
73ae3e8132 Bump API deps to versions, released this week (#1220)
Co-authored-by: Konstantin Koval
2025-06-20 11:39:07 +03:00
Kostiantyn
2b1240b88b Refactor API video route (#1202)
* Refactored code; temp disable workflows on push

* remove printf leftovers

* A better sanitizing code

* extend auth routes tests

* more tests, fix 2 bugs in token processing

* more refactoring and fixes

* optimize video mediaURLs DB query and make testCachePath in utils thread-safe

* fix always passing test

* and more refactoring; 1 more test, but cleanup still has to be fixed

* more debug code in the test

* fix the test

* Final commit

* Adding a defer function just in case of panic

* Address some of review comments

* Protect the shared var by mutex; implement correct context-aware scanning

* Better error; better initial func wrap/capture; better log messages in `photos.go`;

* Addressing a few more review comments

* Order the query results; a better error type catch; setting the MP4 content type header explicitly

* try to fix the cancelation detection condition

* Extract a function and call it by name

---------

Co-authored-by: Konstantin Koval
2025-06-18 20:38:19 +03:00
Kostiantyn
9369f72d3b Bump API deps from last 2 weeks (#1218)
Co-authored-by: Konstantin Koval
2025-06-13 20:58:03 +03:00
Kostiantyn
a22967b7d0 Refactor the Periodic Scanner module (#1210)
* Initial fix of a race condition

* better logging

* some refactoring and graceful shutdown

* fix more potential race condition places; a better app shutdown

* add test and fix some issues

* some housekeeping

* more descriptive asserts

* Address review suggestions

* Better server shutdown logic + better message about the .env file not found

* Create context inside the shutdown goroutine; removed unnecessary shutdown from the main function

* Move HTTP server to the main process and remove unnecessary code

* log shutdown error if any

* Get back to the local `scanner` variable

* Protecting scanner with mutex

* Adding the mutex to the shutdown function

* Addressing the race condition at the init stage

---------

Co-authored-by: Konstantin Koval
2025-06-11 17:09:22 +03:00
Googol Lee
0da8bef69e Update log for passing attrs with context. (#1216)
* Update log for passing attrs with context.

* Check type-casting

* add tests.

* Use t.Cleanup() to restore the global value.

* Fix error.

* Update tests.

* Add comments.

* Remove cover.cov

* Update doc.

* Update git ignore.
2025-06-07 17:11:50 +02:00
marc7s
1d1305628a Add multiple face group merge support (#1162)
* Migrate multiple merge faces code from merge-multiple branch

* Revert translations

* Remove unnecessary node

* Add aria labels

* Code review changes

* Add frontend test for MergeFaceGroupsModal
2025-06-07 10:21:02 +03:00
Googol Lee
535f8e57fd Use Magickwand to handle images. (#1212)
* Add MagickWand perf test.

* Use MagickWand.

* Calculate the right thumbnail dimension.

* Remove magick bin file.

* Add building dependencies.

* Build images.

* Add --no-install-recommends

* Remove unused field.

* Fix typo

* Use uint in the worker.

* Add guard

* Always update apt.

* Fix EncodeJpeg() with the quality

* Rename the local error with a better name.

* Add worker.Terminate()

* Fix typo

* Rebase with master and rollback the build workflow.
2025-06-03 22:04:03 +02:00
Kostiantyn
c390f83355 Bump gorm and its postgres driver to the latest versions (#1215)
Co-authored-by: Konstantin Koval
2025-06-02 11:51:02 +03:00
Googol Lee
01cd0a9ce4 Enable shared build of ImageMagick.
#1211

* Add benchmark magickwand.

* Enable shared magick.

* Remove MagickWand test because it can't be compiled with current dependency image.

* Enable formats explicitly.
2025-05-23 20:33:19 +02:00
Googol Lee
8872ea1df3 Include MagicWand library in the dependency image. (#1209)
* Include MagicWand library.

* Remove duplication.

* Limit dynamic libraries in the release build.

* Use cp -a instead of -r.

* Use bash instead of sh.
2025-05-23 11:27:07 +02:00
Googol Lee
a378522af4 Use magick generating thumbnails.
Fix #1204

* Add bad medias to scanner_test.

* Fix the script.

* Add GenerateThumbnail function.

* Add identify dimension

* Use new API. Cover json condition.

* Use magick to generate thumbnails.

* Update go mod.

* Remove dependency of executable_worker -> test_utils

* Reduce dependency of magick.

* Use magick to get dimension.

* Remove almost all code around `image` package.

* Fix thumbnailing with multi-frame gif.

* Remove the struct in wrapper.

* Fix typo.

* Build images.

* Update logs

* Add jpeg decoder.

* Remove code dependency.

* Add log to confirm scan in parallel.

* Update log

* Add reformat image perf tests.

* Rollback the build workflow.
2025-05-22 09:01:43 +02:00
Googol Lee
9d7cf8ad33 Drop linux/arm/v7 2025-05-17 09:45:39 +02:00
Kostiantyn
a1aadf678d Bump several API dependencies to their latest versions (#1203)
Co-authored-by: Konstantin Koval
2025-05-11 12:08:58 +03:00
Googol Lee
fe3cc16026 Remove Thumbnail Preferences. (#1200)
* Remove thumbnail preferences. #1089

* Remove thumbnail preferences test.

* Remove thumbnail preferences from backend.

* Fix database.go

* Update generated TS files.

* Reorder the migrations.
2025-05-11 10:44:58 +02:00
Kostiantyn
27a0b082d1 Handle photo not found case in API routes (#1201)
* Handle media not found issue

* temporary run workflows for master pushes only; tests

* revert temp workflow changes

---------

Co-authored-by: Konstantin Koval
2025-05-10 17:45:32 +03:00
Kostiantyn
36f3924b4f Bump GQLgen, GQLparser and GORM versions in API (#1197)
* Bump GQLparser and GORM versions in API

* Bump GQLgen as well

* Revert GORM update

---------

Co-authored-by: Konstantin Koval
2025-05-05 18:14:59 +03:00
Kostiantyn
7cb949a6be More granular media-cache folder permissions (#1199)
* Add a preparation service to assign the correct permissions to the media cache folder

* Better docker capabilities with less privileges

* Expand the caps list

---------

Co-authored-by: Konstantin Koval
2025-05-03 19:09:52 +03:00
Kostiantyn
5d46478c01 Fix the incorrect thumbnails for albums issue (#1198)
* The fix with test

* Fix test's foreign key issue

* 2 more test cases

* Fix the empty album test expectation

* Return Nil for no thumbnail case instead of an empty album, as expected by frontend. More tests for thumbnail priority choice

* Fix failed tests

---------

Co-authored-by: Konstantin Koval
2025-05-03 18:48:57 +03:00
Googol Lee
07be0af1c2 Add more real media files to scanner_test (#1195)
* Add real_media to scanner tests.

* Fix tests.

* Remove old test files.

* Fix with reviews.
2025-04-28 11:10:32 +02:00
Peter Dave Hello
cda043ddb8 Add a basic zh-TW Traditional Chinese translation (#1187) 2025-04-22 19:09:49 +03:00
Kostiantyn
0961984134 Bump gqlgen and gqlparser versions in API (#1191)
* Bump `gqlgen` and `gqlparser` versions in API

* new gqlgen version

---------

Co-authored-by: Konstantin Koval
2025-04-21 22:54:49 +03:00
Kostiantyn
18360e71ae Bump several deps to the latest versions (#1189)
Co-authored-by: Konstantin Koval
2025-04-15 12:59:15 +03:00
Kostiantyn
862ac5af39 Bump gqlgen to 0.17.70 (#1184)
Co-authored-by: Konstantin Koval
2025-03-27 20:46:14 +02:00
Kostiantyn
0f19345d86 Bump several GO dependencies to the latest versions (#1182)
Co-authored-by: Konstantin Koval
2025-03-22 22:20:24 +02:00
Googol Lee
e4d5345d56 scan_test now checks title and face groups explicitly instead of only lengths. (#1180) 2025-03-11 20:20:07 +01:00
marc7s
d1636fb7ea Fix album page being empty for users with overlapping paths (#1159)
* Fix album page being empty for users with overlapping paths, closes #658

* Add test for non root album paths

* Add basic test for non root album path
2025-03-11 18:01:50 +02:00
Kostiantyn
736eb1c051 Bump crypto, fixing its CVE vulnerability (#1177)
* Bump `crypto`, fixing its CWE vulnerability

* Bumping several deps for this week

---------

Co-authored-by: Konstantin Koval
2025-03-11 17:45:33 +02:00
Googol Lee
0dbfcdf4f1 Add coverage of all sub-packages. (#1176) 2025-02-25 22:42:29 +01:00
Kostiantyn
c4d183627d Bump github.com/go-sql-driver/mysql and golang.org/x/crypto to the latest versions (#1174)
Co-authored-by: Konstantin Koval
2025-02-22 21:11:43 +02:00
Googol Lee
06acd165f2 Bump golang from 1.23-bookworm to 1.24-bookworm, as well as gqlgen. (#1172)
* Bump golang from 1.23-bookworm to 1.24-bookworm

Bumps golang from 1.23-bookworm to 1.24-bookworm.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update to use `go tool`, see https://go.dev/doc/go1.24#go-command.

* Update go.mod to go 1.24

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 18:45:30 +01:00
Kostiantyn
ba6a4ec07c Bump crypto and sys dependencies to new minor versions (#1170)
Co-authored-by: Konstantin Koval
2025-02-16 11:43:09 +02:00
Kostiantyn
d9627c2aef Bump x/image, x/text, and x/sync to their latest minor versions (#1167)
Co-authored-by: Konstantin Koval
2025-02-13 14:45:02 +02:00
Andreas
6d716a1f1e improved Thumbnail generation performance (#1158)
* improved Thumbnail generation performance

* unified SQL query style

* adjusted query

* changed query to make it more readable
2025-02-02 21:43:12 +02:00
Kostiantyn
b93d48f94e Bump gqlgen and gqlparser to the latest versions (#1166)
Co-authored-by: Konstantin Koval
2025-02-02 20:51:17 +02:00
marc7s
71394e39d6 Fix development mySQL URL pointing to non-existing container (#1164) 2025-02-01 16:57:46 +02:00
Kostiantyn
bdb2aef669 Bump gqlgen, copy, crypto, mint, sys deps to the latest versions in API (#1156)
Co-authored-by: Konstantin Koval
2025-01-19 21:53:50 +02:00
Googol Lee
ce68c25f45 Update apollo config to fix genSchemaTypes (#1154) 2025-01-09 19:51:39 +01:00
Googol Lee
e045e0f7ae Fix sqlite fk configuration and enable all tests for sqlite. Enable detail SQL log in tests (#1151)
* Fix sqlite fk configuration and enable all tests for sqlite.

* Add default severity to golangci-lint config.
2025-01-02 23:02:19 +01:00
Kostiantyn
33ef0981d7 Bump gqlparser to the latest minor version (#1149)
Co-authored-by: Konstantin Koval
2025-01-02 18:31:24 +02:00
Kostiantyn
9835c1949d Bump gqlgen in API to the latest version and regenerate the code (#1147)
Co-authored-by: Konstantin Koval
2024-12-30 17:17:06 +02:00
Googol Lee
f88fcaba69 Use libmagic to identify files type. (#1124)
* Use libmagic to identify file types.

* Fix mime array for database querying.

* go mod tidy

* Fix typo

* Another fix for the scheduled image build workflow for tag case (#1137)

* Try to fix the incorrect tag processing

* more debug code

* try with context=git

* hopefully, final debug

* the final commit with no debug code

---------

Co-authored-by: Konstantin Koval

* Add benchmark.

* rollback workflows.

* Fix AI comments.

* Build image.

* Fix AI comments.

* Fix AI comments.

* Rollback build workflow.

---------

Co-authored-by: Kostiantyn <32730812+kkovaletp@users.noreply.github.com>
2024-12-14 22:07:03 +01:00
Kostiantyn
f1d4d0a048 Bump crypto, go-ffprobe, and sqlite GO dependencies in /api (#1140)
Updated dependencies for improved performance and security:
- golang.org/x/crypto to version v0.31.0
- gopkg.in/vansante/go-ffprobe.v2 to version v2.2.1
- gorm.io/driver/sqlite to version v1.5.7

Co-authored-by: Konstantin Koval
2024-12-14 20:56:44 +02:00
Kostiantyn
bab6ccb538 Bump the anchore/scan-action to the version 6 in the Code analysis workflow (#1141)
Updated the version of the Anchore scan action to improve code analysis capabilities.

Co-authored-by: Konstantin Koval
2024-12-14 19:57:46 +02:00
Kostiantyn
3c53ccc304 Bump several API dependencies to the latest versions (#1138)
* Bump several API dependencies to the latest versions

Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 in /api
Bump github.com/vektah/gqlparser/v2 from 2.5.19 to 2.5.20 in /api
Bump gorm.io/driver/postgres from 1.5.10 to 1.5.11 in /api
Bump golang.org/x/image from 0.22.0 to 0.23.0 in /api
Bump golang.org/x/crypto from 0.29.0 to 0.30.0 in /api
Bump github.com/99designs/gqlgen from 0.17.56 to 0.17.57 in /api

* Regenerate GraphQL code

---------

Co-authored-by: Konstantin Koval
2024-12-06 16:20:48 +02:00
Kostiantyn
8f989df30a Another fix for the scheduled image build workflow for tag case (#1137)
* Try to fix the incorrect tag processing

* more debug code

* try with context=git

* hopefully, final debug

* the final commit with no debug code

---------

Co-authored-by: Konstantin Koval
2024-12-01 18:55:53 +02:00
Kostiantyn
6c020cc1f9 Enhance Codecov integration (#1136)
* Define sub-projects and set coverage threshold for failure in the `codecov.yml`; make both test execution engines to generate also JUnit reports; upload these JUnit reports to Codecov for analysis

* Fix UI Vite config and add more details to the API is-generated-code script

* Add API JUnit report file to `.gitignore`

* Fix the copy issue by mounting the volume

* put the exact report name to the `docker cp` command

* Added `set -euxo pipeline` to the `test_api_coverage.sh` script; try to fix the missing report issue by setting immutable flag and report directoty

* Revert `chattr` and `set` commands, as they cause errors

* debug

* put the filename of the JUnit report to upload

* `set -euxo pipefail` in `scripts/test_api_coverage.sh`

---------

Co-authored-by: Konstantin Koval
2024-11-25 16:25:38 +02:00
Googol Lee
f1b523a27e Include a group of small but real media files for testing. (#1131)
* Move scanner/test_data/* to a stand-alone directory.

* Include real medias.

* Rename testdata to test_data

* Rename test_data/scanner -> test_data/library

* Clean tests to avoid depneding env.

* Rename: scanner/test_data -> scanner/test_media

* Rename: test_data/bin -> test_data/mock_bin

* Fix paths in tests.
2024-11-23 09:02:11 +01:00
Kostiantyn
dde45c29b9 Bump gorm.io/driver/postgres from 1.5.9 to 1.5.10 in /api (#1135)
Co-authored-by: Konstantin Koval
2024-11-22 13:51:15 +02:00
Kostiantyn
54669fb0a8 A new try to fix the building tagged image in the scope of scheduled run (#1133)
* test putting '"' to make the resulting JSON correct

* revert the testing code and move the fixed line to its final location

---------

Co-authored-by: Konstantin Koval
2024-11-21 20:30:05 +02:00