diff --git a/CHANGELOG.md b/CHANGELOG.md index 996e61b8c..842db2889 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Update ApiV1Controller, include self likes in favourited_by endpoint ([58b331d2](https://github.com/pixelfed/pixelfed/commit/58b331d2)) - Update PublicApiController, remove expensive and unused relationships ([2ecc3144](https://github.com/pixelfed/pixelfed/commit/2ecc3144)) - Update status deletion, fix database lock issues and side effects ([04e8c96a](https://github.com/pixelfed/pixelfed/commit/04e8c96a)) +- Fix remote profile avatar urls when storing locally ([b0422d4f](https://github.com/pixelfed/pixelfed/commit/b0422d4f)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4) diff --git a/app/Services/MediaStorageService.php b/app/Services/MediaStorageService.php index e252aacf6..eac7da1a7 100644 --- a/app/Services/MediaStorageService.php +++ b/app/Services/MediaStorageService.php @@ -236,7 +236,10 @@ class MediaStorageService { $tmpBase = storage_path('app/remcache/'); $tmpPath = 'avatar_' . $avatar->profile_id . '-' . $path; $tmpName = $tmpBase . $tmpPath; - $data = file_get_contents($url, false, null, 0, $head['length']); + $data = @file_get_contents($url, false, null, 0, $head['length']); + if(!$data) { + return; + } file_put_contents($tmpName, $data); $disk = Storage::disk($driver); @@ -245,7 +248,7 @@ class MediaStorageService { $avatar->media_path = $base . $path; $avatar->is_remote = true; - $avatar->cdn_url = $permalink; + $avatar->cdn_url = $local ? config('app.url') . $permalink : $permalink; $avatar->size = $head['length']; $avatar->change_count = $avatar->change_count + 1; $avatar->last_fetched_at = now(); diff --git a/database/migrations/2022_10_09_043758_fix_cdn_url_in_avatars_table.php b/database/migrations/2022_10_09_043758_fix_cdn_url_in_avatars_table.php new file mode 100644 index 000000000..65b19496b --- /dev/null +++ b/database/migrations/2022_10_09_043758_fix_cdn_url_in_avatars_table.php @@ -0,0 +1,41 @@ +chunk(50, function($avatars) use($baseUrl) { + foreach($avatars as $avatar) { + if(substr($avatar->cdn_url, 0, 23) === '/storage/cache/avatars/') { + $avatar->cdn_url = $baseUrl . $avatar->cdn_url; + $avatar->save(); + } + Cache::forget('avatar:' . $avatar->profile_id); + AccountService::del($avatar->profile_id); + } + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +} diff --git a/public/css/admin.css b/public/css/admin.css index d84571aad..1f0afb047 100644 Binary files a/public/css/admin.css and b/public/css/admin.css differ diff --git a/public/css/app.css b/public/css/app.css index 5fd41e309..73ede6144 100644 Binary files a/public/css/app.css and b/public/css/app.css differ diff --git a/public/css/appdark.css b/public/css/appdark.css index 8af92116e..c71ee30c2 100644 Binary files a/public/css/appdark.css and b/public/css/appdark.css differ diff --git a/public/css/landing.css b/public/css/landing.css index c72597a2f..0e0d64338 100644 Binary files a/public/css/landing.css and b/public/css/landing.css differ diff --git a/public/js/compose-17lx4qxke.js b/public/js/compose-ivl9d2teh.js similarity index 99% rename from public/js/compose-17lx4qxke.js rename to public/js/compose-ivl9d2teh.js index ad3d45a7b..14cbab8a7 100644 Binary files a/public/js/compose-17lx4qxke.js and b/public/js/compose-ivl9d2teh.js differ diff --git a/public/js/daci-17lx4qxke.js b/public/js/daci-17lx4qxke.js deleted file mode 100644 index 6cd13b75c..000000000 Binary files a/public/js/daci-17lx4qxke.js and /dev/null differ diff --git a/public/js/daci-ivl9d2teh.js b/public/js/daci-ivl9d2teh.js new file mode 100644 index 000000000..601f4b2bd Binary files /dev/null and b/public/js/daci-ivl9d2teh.js differ diff --git a/public/js/dffc-17lx4qxke.js b/public/js/dffc-17lx4qxke.js deleted file mode 100644 index 6a88b3810..000000000 Binary files a/public/js/dffc-17lx4qxke.js and /dev/null differ diff --git a/public/js/dffc-ivl9d2teh.js b/public/js/dffc-ivl9d2teh.js new file mode 100644 index 000000000..738ad43e9 Binary files /dev/null and b/public/js/dffc-ivl9d2teh.js differ diff --git a/public/js/discover-17lx4qxke.js b/public/js/discover-ivl9d2teh.js similarity index 99% rename from public/js/discover-17lx4qxke.js rename to public/js/discover-ivl9d2teh.js index fc4f353b4..5a9c7a535 100644 Binary files a/public/js/discover-17lx4qxke.js and b/public/js/discover-ivl9d2teh.js differ diff --git a/public/js/dms-17lx4qxke.js b/public/js/dms-ivl9d2teh.js similarity index 99% rename from public/js/dms-17lx4qxke.js rename to public/js/dms-ivl9d2teh.js index 487a40d15..ab21dff4f 100644 Binary files a/public/js/dms-17lx4qxke.js and b/public/js/dms-ivl9d2teh.js differ diff --git a/public/js/dmsg-17lx4qxke.js b/public/js/dmsg-ivl9d2teh.js similarity index 99% rename from public/js/dmsg-17lx4qxke.js rename to public/js/dmsg-ivl9d2teh.js index 3fca6b739..bc1cdc56c 100644 Binary files a/public/js/dmsg-17lx4qxke.js and b/public/js/dmsg-ivl9d2teh.js differ diff --git a/public/js/dmyh-17lx4qxke.js b/public/js/dmyh-17lx4qxke.js deleted file mode 100644 index b64bb70e6..000000000 Binary files a/public/js/dmyh-17lx4qxke.js and /dev/null differ diff --git a/public/js/dmyh-ivl9d2teh.js b/public/js/dmyh-ivl9d2teh.js new file mode 100644 index 000000000..c7db737da Binary files /dev/null and b/public/js/dmyh-ivl9d2teh.js differ diff --git a/public/js/dmym-17lx4qxke.js b/public/js/dmym-17lx4qxke.js deleted file mode 100644 index d719785a7..000000000 Binary files a/public/js/dmym-17lx4qxke.js and /dev/null differ diff --git a/public/js/dmym-ivl9d2teh.js b/public/js/dmym-ivl9d2teh.js new file mode 100644 index 000000000..6ad3d9d04 Binary files /dev/null and b/public/js/dmym-ivl9d2teh.js differ diff --git a/public/js/dsfc-17lx4qxke.js b/public/js/dsfc-17lx4qxke.js deleted file mode 100644 index 0aec9d4c8..000000000 Binary files a/public/js/dsfc-17lx4qxke.js and /dev/null differ diff --git a/public/js/dsfc-ivl9d2teh.js b/public/js/dsfc-ivl9d2teh.js new file mode 100644 index 000000000..86c0bef88 Binary files /dev/null and b/public/js/dsfc-ivl9d2teh.js differ diff --git a/public/js/dssc-17lx4qxke.js b/public/js/dssc-17lx4qxke.js deleted file mode 100644 index 40627facc..000000000 Binary files a/public/js/dssc-17lx4qxke.js and /dev/null differ diff --git a/public/js/dssc-ivl9d2teh.js b/public/js/dssc-ivl9d2teh.js new file mode 100644 index 000000000..1661d3a32 Binary files /dev/null and b/public/js/dssc-ivl9d2teh.js differ diff --git a/public/js/home-17lx4qxke.js b/public/js/home-17lx4qxke.js deleted file mode 100644 index f54b38d6a..000000000 Binary files a/public/js/home-17lx4qxke.js and /dev/null differ diff --git a/public/js/home-ivl9d2teh.js b/public/js/home-ivl9d2teh.js new file mode 100644 index 000000000..235edd9d9 Binary files /dev/null and b/public/js/home-ivl9d2teh.js differ diff --git a/public/js/live-player.js b/public/js/live-player.js index 72ef56dc4..401d7c80e 100644 Binary files a/public/js/live-player.js and b/public/js/live-player.js differ diff --git a/public/js/manifest.js b/public/js/manifest.js index 8cffe5206..ccb043724 100644 Binary files a/public/js/manifest.js and b/public/js/manifest.js differ diff --git a/public/js/notifications-17lx4qxke.js b/public/js/notifications-17lx4qxke.js deleted file mode 100644 index 7976cdf3d..000000000 Binary files a/public/js/notifications-17lx4qxke.js and /dev/null differ diff --git a/public/js/notifications-ivl9d2teh.js b/public/js/notifications-ivl9d2teh.js new file mode 100644 index 000000000..c1e5ad38b Binary files /dev/null and b/public/js/notifications-ivl9d2teh.js differ diff --git a/public/js/post-17lx4qxke.js b/public/js/post-17lx4qxke.js deleted file mode 100644 index 0f2c4cece..000000000 Binary files a/public/js/post-17lx4qxke.js and /dev/null differ diff --git a/public/js/post-ivl9d2teh.js b/public/js/post-ivl9d2teh.js new file mode 100644 index 000000000..a1ce1f6a5 Binary files /dev/null and b/public/js/post-ivl9d2teh.js differ diff --git a/public/js/profile-17lx4qxke.js b/public/js/profile-17lx4qxke.js deleted file mode 100644 index 03ad5a3ce..000000000 Binary files a/public/js/profile-17lx4qxke.js and /dev/null differ diff --git a/public/js/profile-ivl9d2teh.js b/public/js/profile-ivl9d2teh.js new file mode 100644 index 000000000..12da3add7 Binary files /dev/null and b/public/js/profile-ivl9d2teh.js differ diff --git a/public/js/spa.js b/public/js/spa.js index 88f3980b7..55a473d1b 100644 Binary files a/public/js/spa.js and b/public/js/spa.js differ diff --git a/public/js/vendor.js b/public/js/vendor.js index 85c49a842..bd6dded15 100644 Binary files a/public/js/vendor.js and b/public/js/vendor.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 4fb7e1016..3803a4da1 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ