Commit Graph

663 Commits (fix/media-storage-optimized-charge)

Author SHA1 Message Date
Your Name 252dea7016 Track media storage quota via an explicit lifecycle enum
Charge the raw upload size immediately (enforce on raw, never under-count),
correct down to the optimized size in the finalize job, and refund on delete.
Each transition is guarded by media.quota_status so retries can't double-apply.
1 week ago
Daniel Supernault fbd52dd8fc
Improve federation handling 2 weeks ago
Daniel Supernault f371376789
Fix StatusDelete, handle StatusService deletion 2 weeks ago
Daniel Supernault 6e0d8454fd
Fix StatusDelete job, add logging 2 weeks ago
Daniel Supernault 15b46186b4
Delete NotificationEpochUpdatePipeline.php 2 weeks ago
Shlee 140221fe90
Merge pull request #7192 from pixelfed/refactor/str-of-to-native
Laravel 13 Prep: Replace Str::of() fluent chains with static Str::/native calls
2 weeks ago
Your Name a424493420 Replace Str::of() fluent chains with static Str::/native calls
Aligns with the app's dominant convention (171 static Str:: calls vs
24 Str::of() chains). Uses Str::afterLast() for the repeated
"segment after last slash" pattern, Str::matchAll() where a
Collection return is needed, and native explode()/substr() where a
plain array/string suffices.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 weeks ago
Your Name 277b8aa970 Use now() helper instead of Carbon::now() for current-time access
Aligns with the app's dominant convention (413 now()/today() call
sites vs 12 Carbon::now()). Carbon::parse() calls are untouched since
they parse arbitrary date strings, not current-time access.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 weeks ago
Your Name 5a9c235922 Backfill storage_used on upgrade via queued job + data migration
Repair accounts whose storage counter drifted before the self-heal logic
existed (#7169). A data migration dispatches RecalculateAllUserStoragePipeline
to the low queue so the deploy is not blocked while every user is recomputed
from source. The job is unique and idempotent, so re-runs are harmless.

- RecalculateAllUserStoragePipeline: chunked recalc of all active users
- Migration dispatches the job (no inline heavy work during deploy)
- Test covers bulk recalculation from actual media
2 weeks ago
Your Name 6496904293 Fix account storage limit not freeing on media deletion (#7169)
users.storage_used only ever grew: uploads incremented it but no deletion
path decremented it, so users hit the account size limit even when their
real media usage was well below it.

- Decrement storage_used in MediaDeletePipeline when media is removed
- Add UserStorageService::increaseStorageUsed / decrementStorageUsed as the
  fast, symmetric hot-path counter updates (floor-based, clamped at zero)
- Refactor the 6 upload call sites to use increaseStorageUsed instead of
  duplicated inline writes (also fixes ceil/floor drift vs the reconciler)
- Add (user_id, size) covering index so per-user SUM(size) is not a full
  table scan (INPLACE/LOCK=NONE, skipped on sqlite)
- Add user:storage:recalculate command to repair affected accounts, with a
  daily --stale=168 scheduled reconciler to correct any drift
- Add regression tests for the pipeline and UserStorageService
2 weeks ago
Your Name 9e14151228 Deliver posts regardless of profile no_autolink flag 2 weeks ago
Your Name 444c796bac Trigger StatusHashtag observer on deletion to keep cached_count accurate 2 weeks ago
Your Name 1ffda3eba9 Federate unlike before deleting Like so retries can deliver 2 weeks ago
Shlee 0fc121b685
Merge pull request #7134 from shleeable/fix/storyfetch-ssrf
Route StoryFetch outbound requests through SSRF-hardened fetch service
2 weeks ago
Shlee 58c83a2c6b
Merge pull request #7141 from shleeable/fix/import-instagram-missing-profile
Drop Instagram import job when profile is missing instead of crashing
2 weeks ago
Your Name 922d7f766e Drop Instagram import job when profile is missing instead of crashing 2 weeks ago
Your Name 9850aac676 Invalidate latest-story cache on remote story expiry and null-guard latest() 2 weeks ago
Your Name 9e84ad261d Route StoryFetch outbound requests through SSRF-hardened fetch service 2 weeks ago
Shlee aa152372c9
Merge pull request #7121 from shleeable/fix/status-remote-update-ssrf
Harden remote status update media fetch against SSRF
2 weeks ago
Shlee 1cb56f0ba0
Merge pull request #7120 from shleeable/fix/inbox-keyid-host-validation
Validate publicKey.id host on inbox actor ingest
2 weeks ago
Your Name 856f2f8f2d Harden remote status update media fetch against SSRF 2 weeks ago
Your Name 1905da723d Validate publicKey.id host on inbox actor ingest to prevent key_id poisoning 2 weeks ago
Your Name 6e7419bb96 Fix StatusDelete crashing on soft-deleted owning profile 2 weeks ago
Shlee 4acc0dd528
Update DeleteWorker.php 2 weeks ago
Shlee 56251cb05f
Update InboxValidator.php 2 weeks ago
Shlee 767c6ec201
Remove blindKeyRotation method from InboxWorker
Removed the blindKeyRotation method and its associated logic.
2 weeks ago
Daniel Supernault 40fedfca4f
Fix DeleteAccountPipeline 2 weeks ago
Shlee 8d375aed8a
Update DeleteAccountPipeline.php 3 weeks ago
Your Name 95e316e86f Apply staged formatting and session config changes 3 weeks ago
Shlee f51f1ef0db
Update DeleteAccountPipeline.php 3 weeks ago
Your Name 042ab0a6e4 Convert optional() to nullsafe operator
Applies patch 2/21 from pixelfed-staging PR #9: replaces optional($x)->y
with $x?->y across 16 files. Pint-clean.
3 weeks ago
Shlee 003953eb3e
Merge pull request #7045 from pixelfed/perf/follower-service-following-ids
Deduplocation: add FollowerService::getFollowingIds for common function
3 weeks ago
Your Name 667f6e2fc9 Extract following-ids lookup into FollowerService::getFollowingIds
The Cache::remember('profile:following:'.$pid, ...) block that plucks
following_id and appends the caller's own id was copy-pasted across four
call sites, with inconsistent TTLs (1440 minutes vs 1209600 seconds).

Add FollowerService::getFollowingIds($pid), which owns the cache key that
add()/remove() already invalidate, and use it from InternalApiController,
PublicApiController, ApiV1Controller and HashtagUnfollowPipeline. Removes
the now-unused Follower/Cache imports left behind.

Adds a test covering the followed-ids-plus-self result and the
follows-nobody case.
3 weeks ago
Your Name c4e5b96d25 Stream deletions with cursor and batch notification lookups in delete jobs
The status- and account-deletion jobs loaded whole collections with
->get() and then looped, running a per-row Notification lookup inside
each iteration.

- StatusDelete / RemoteStatusDelete: resolve associated DirectMessage and
  MediaTag ids, fetch their notifications in a single whereIn query,
  clear each via cursor (NotificationService::del must run per row for
  cache/redis cleanup), then bulk delete the DMs and media tags.
- DeleteAccountPipeline / DeleteRemoteProfilePipeline: stream Story and
  Collection deletions with cursor() instead of loading every row into
  memory. Per-row file unlink and item deletes are preserved.

Adds StatusDeleteCleanupTest covering DM + notification cleanup, media
tag + notification cleanup, and the no-associations case.
3 weeks ago
Daniel Supernault a6117a2407
Fix reblog handling 3 weeks ago
Your Name 69869536a1 Fix remote status deletion leaking attached media, add status:media command
MediaDeletePipeline skips deletion when media->status_id is set. status_id has
no FK/cascade, so deleting a status never clears it, and the delete jobs
dispatched by the status-delete paths were always skipped, leaking media files.

Detach media (status_id = null) before dispatching the delete in StatusDelete,
RemoteStatusDelete and DeleteRemoteStatusPipeline, so the row is genuinely
orphaned by the time the guard checks it and the deletion proceeds.

Also adds a status:media diagnostic command that dumps all metadata for a
media id (DB columns, computed URLs, attachment state, parent status including
the dangling status_id case, owner, metadata, and an optional live URL check).
3 weeks ago
Your Name d456b7b64a Add structured metadata to MediaDeletePipeline skip/failure logs
Replace interpolated log strings with structured context (media/status/profile/
user ids, mime, size, order, paths, hls_path, remote flag, timestamps) so
operators can trace why orphan-purge deletions are skipped or fail.
3 weeks ago
Your Name 400f00c5e1 feat: storage:maintenance command + in-flow cleanup of emptied dirs
Replace the remcache GC (GarbageCollectorRemcache / gc:remcache) with a
broader storage:maintenance command that sweeps stale remcache temp files and
recursively removes the random empty directories accumulated under the media,
story, avatar and import trees (--hours/--only/--except/--dry-run), scheduled
daily.

Fix the root causes so flows clean up after themselves rather than relying on
the sweep:
- MediaDeletePipeline removes its own emptied m/_v2 leaf dir
- AvatarOptimize logs the previously-swallowed exception, still cleans up the
  old avatar on failure, and removes the old file's now-empty splayed dir
- AvatarController::deleteAvatar removes the emptied splayed dir
- StoryExpire/StoryDelete remove the story's own emptied leaf dir
- TransformImports removes imports/{userId} once its files are moved out
- StoryFetch cleans up its remcache temp file in a finally block
3 weeks ago
Your Name 9f55f7204c revert: story cloud-migration work
Back out the story local->cloud migration so we can land and verify the
emoji cloud work first, one change at a time.

Reverts:
- 9f110bb74 feat: migrate local story media to cloud storage
- 842681b99 fix: schedule StoryMoveStorageLocalToCloud command

Removes StoryMoveStorageLocalToCloud command, its scheduler entry, and the
StoryExpire explicit-disk changes. Remcache and emoji work are untouched.
Will revisit story once emoji is confirmed.
4 weeks ago
Your Name 9f110bb74c feat: migrate local story media to cloud storage
Ensure story media lands on and stays on cloud storage for S3 instances.

- StoryExpire: archive expiring story media on the same explicit disk the
  media lives on (S3 move is a server-side copy+delete), with error handling
- Add admin:StoryMoveStorageLocalToCloud to migrate local story media
  (active + story_archives) to cloud: copy, verify by size, then delete local
- --orphans option relocates untracked story_archives/ files to cloud using
  the same copy/verify/delete flow (media is moved, never discarded)
- Schedule it hourly alongside the media migration when cloud storage is on
4 weeks ago
Shlee 79af98f9d0
Merge pull request #6667 from vinzgreg/fix/blurhash-memory-strands-video-uploads
Fix videos never reaching cloud storage by downscaling in Blurhash (#2652)
4 weeks ago
Shlee 186fa7c860
Update VideoThumbnail.php 4 weeks ago
Your Name 8b53f23e77 refactor: migrate LikePipeline to use NotificationService::firstOrCreateNotification 4 weeks ago
Your Name e7b70c6084 refactor: extract duplicate patterns into shared methods
1. Add FractalService with static item() and collection() helpers
   replacing 22 call sites that repeated the 4-line Fractal Manager
   + ArraySerializer boilerplate.

2. Add AccountInterstitial::createFromStatus() factory method
   consolidating 4 identical 15-line blocks that create interstitials
   with status metadata.

3. Add NotificationService::createNotification() to handle the
   repeated pattern of creating, caching, and registering a
   notification in the recipient's feed.

4. Add NotificationService::firstOrCreateNotification() for
   idempotent notifications (share/boost, mention) that should
   only notify once per actor+action+item combination.
4 weeks ago
Your Name 9c9e2a5a22 refactor: extract shared ActivityPub pool delivery into ActivityPubDeliveryService
Add ActivityPubDeliveryService::pool() using Laravel's Http::pool() to
consolidate the duplicated delivery pattern found across 10 jobs.

Updated jobs:
- StatusActivityPubDeliver
- StatusDelete
- StatusLocalUpdateActivityPubDeliverPipeline
- FanoutDeletePipeline
- SharePipeline
- UndoSharePipeline
- StoryFanout
- StoryExpire
- StoryDelete
- ProfileMigrationDeliverMoveActivityPipeline

The shared method accepts a Profile (sender), audience (inbox URLs),
and activity (payload array), handling signing, user-agent, timeout,
and concurrency in one place. No direct Guzzle usage remains in
app/Jobs/.
4 weeks ago
Shlee f018004b56
Merge pull request #6892 from pixelfed/refactor/move-models-to-namespace
Refactor/move models to namespace
4 weeks ago
Shlee b4afda12d5
Merge pull request #6889 from pixelfed/refactor/status-delete-http-client
refactor: replace Guzzle pool with Laravel HTTP client in StatusDelete
4 weeks ago
Your Name c0cde2f682 refactor: move 52 legacy models from App\ to App\Models\
Move all Eloquent models from the app/ root directory to app/Models/
for consistency with modern Laravel conventions. The project already had
54 models in App\Models; this migrates the remaining 52 legacy models.

Changes:
- Move 52 model files from app/ to app/Models/
- Update namespace declarations in each model
- Update all ~1000 import references across the codebase
- Add Relation::morphMap() in AppServiceProvider for backward
  compatibility with existing polymorphic database records
- Add missing HasSnowflakePrimary imports for models that relied
  on same-namespace resolution
4 weeks ago
Your Name a142db87b4 polish 4 weeks ago
Your Name 2b1c9c818b polish 4 weeks ago