Closed ildyria closed 5 months ago
@Kovah gave you write access to the repo, you should be able to take over that branch. :)
As follows are the change I made:
storage_disk
with default value images
. It is mapped to Enum StorageDiskType
.external_storage
(see migrations)AbstractSizeVariantNamingStrategy::IMAGE_DISK_NAME
in favour of StorageDiskType::Local
AbstractSizeVariantNamingStrategy::getImageDisk()
in favour of Storage::disk(StorageDiskType::LOCAL->value)
AbstractSizeVariantNamingStrategy::getImageDisk($this->external_storage)
into Storage::disk($this->storage_disk->value)
(cleaner)config/secure-headers.php
instead).Thanks! Will have a look in the next days.
So, I added the file deletion changes I had locally. Instead of paths, the size variants are pulled as model entries with only the path and disk information.
There are two issues:
Regarding live photos: it seems they are stored beside the photo. That's why I added the storage disk to the photo model too. Otherwise, there is currently no way to determine the storage location for live photos. What do you think?
I would consider it differently and use the position of original to determine where the video of SizeVariant is. The other possibility is to first check if the file exists on Local, if not try with s3, but ideally it should be on the same disk as original.
In the Album/Delete.php action, album tracks are added to the file deleter (s3-pipes/app/Actions/Album/Delete.php#L110) after the deleter was run. Can this be removed? Not sure if they are used for something.
I would approach it a different way, use the method Album::deleteTrack()
and not bother further with it. :)
Tracks are not used per say in the v5, but that is because I haven't had time to implement the functionalities.
Also a few nice tips.
make formatting
to apply the style.make test
.make phpstan
will run phpstan and will allow you to avoid some problems (like missing functions etc).Fixed code formatting. Not sure how you want to implement the album track deletion if it's not really used right now.
My issue right now is the immense complexity of the application and that I can't spend a lot of time digging into it. Sorry. I tested the S3 handling locally and everything seems to work, including temporary URLs if symlinks are enabled. File deletion seems to work properly. I think a large potion of the S3 feature is done.
I hate to say this, but I guess the completion of the feature is up to you. I don't feel confident in getting the whole picture right.
My issue right now is the immense complexity of the application.
I am sorry about that. :(
Not sure how you want to implement the album track deletion if it's not really used right now.
I will investigate. No worries. :)
I tested the S3 handling locally and everything seems to work, including temporary URLs if symlinks are enabled. File deletion seems to work properly. I think a large potion of the S3 feature is done.
Great to hear. I don't use S3 so I can't test it properly.
I hate to say this, but I guess the completion of the feature is up to you. I don't feel confident in getting the whole picture right.
No worries. I'll take it from there then. :)
Do note that due the limited number of people in the team, this PR may take while to hit master. :) That being said thank you for your help!
I hate to say this, but I guess the completion of the feature is up to you. I don't feel confident in getting the whole picture right.
I should have some time to take a look at it now. :)
Let me know if I can help test stuff. Have both Minio and Cloudflare R2 at hands.
@Kovah can I trouble you to test the latest code?
Please have PHOTO_PIPES=true
in your .env
In theory the videos should now be uploaded to s3 too.
If you can also try with the following two: https://github.com/LycheeOrg/Lychee/blob/master/tests/Samples/train.jpg https://github.com/LycheeOrg/Lychee/blob/master/tests/Samples/train.mov
First uploading the jpg then the mov. Then (after deleting) uploading the mov then the jpg. This would test the 2 code paths.
And also the following: https://github.com/LycheeOrg/Lychee/blob/master/tests/Samples/google_motion_photo.jpg
Test was not successful. Uploaded train.jpg and gut this error:
[2024-02-20 16:03:21] production.ERROR: App\Models\Photo::toArray:28 livewire.update:App\Models\Photo->toArray() is deprecated, use Resources instead.
App\Models\Photo::jsonSerialize:118 App\Models\Photo::toArray() failed; caused by
No more detail in the log files, unfortunately. But the original was uploaded to S3. When trying to upload it again, I get another error.
[2024-02-20 15:50:29] dev.ERROR: App\Actions\Photo\Pipes\Duplicate\ReplicateAsPhoto::handle:13 Call to a member function replicate() on null
Side note: something is heavily messing with the log files. There are thousands of lines added with random request details and json-formatted log entries not readable at all.
Thanks for the feedback!
App\Models\Photo::toArray:28 livewire.update:App\Models\Photo->toArray()
I will look into that.
[2024-02-20 15:50:29] dev.ERROR: App\Actions\Photo\Pipes\Duplicate\ReplicateAsPhoto::handle:13 Call to a member function replicate() on null
I will look into that too.
Side note: something is heavily messing with the log files. There are thousands of lines added with random request details and json-formatted log entries not readable at all.
My guess is that the connection to AWS is resulting in that.
2208 but on top of pipes. :)