diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2b6cb11..02ae77b6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ - Update ApiV1Dot1Controller, allow iar rate limits to be configurable ([28a80803](https://github.com/pixelfed/pixelfed/commit/28a80803)) - Update ApiV1Dot1Controller, add domain to iar redirect ([1f82d47c](https://github.com/pixelfed/pixelfed/commit/1f82d47c)) - Update ApiV1Dot1Controller, add configurable app confirm rate limit ttl ([4c6a0719](https://github.com/pixelfed/pixelfed/commit/4c6a0719)) +- Update LikePipeline, dispatch to feed queue. Fixes ([#4723](https://github.com/pixelfed/pixelfed/issues/4723)) ([da510089](https://github.com/pixelfed/pixelfed/commit/da510089)) +- Update AccountImport ([5a2d7e3e](https://github.com/pixelfed/pixelfed/commit/5a2d7e3e)) +- Update ImportPostController, fix IG bug with missing spaces between hashtags ([9c24157a](https://github.com/pixelfed/pixelfed/commit/9c24157a)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9) diff --git a/app/Http/Controllers/ImportPostController.php b/app/Http/Controllers/ImportPostController.php index e814c2b3a..55f575a6e 100644 --- a/app/Http/Controllers/ImportPostController.php +++ b/app/Http/Controllers/ImportPostController.php @@ -83,6 +83,17 @@ class ImportPostController extends Controller ); } + public function formatHashtags($val = false) + { + if(!$val || !strlen($val)) { + return null; + } + + $groupedHashtagRegex = '/#\w+(?=#)/'; + + return preg_replace($groupedHashtagRegex, '$0 ', $val); + } + public function store(Request $request) { abort_unless(config('import.instagram.enabled'), 404); @@ -128,11 +139,11 @@ class ImportPostController extends Controller $ip->media = $c->map(function($m) { return [ 'uri' => $m['uri'], - 'title' => $m['title'], + 'title' => $this->formatHashtags($m['title']), 'creation_timestamp' => $m['creation_timestamp'] ]; })->toArray(); - $ip->caption = $c->count() > 1 ? $file['title'] : $ip->media[0]['title']; + $ip->caption = $c->count() > 1 ? $this->formatHashtags($file['title']) : $this->formatHashtags($ip->media[0]['title']); $ip->filename = last(explode('/', $ip->media[0]['uri'])); $ip->metadata = $c->map(function($m) { return [ diff --git a/app/Jobs/InboxPipeline/InboxValidator.php b/app/Jobs/InboxPipeline/InboxValidator.php index 4017d3acd..8d0f414c5 100644 --- a/app/Jobs/InboxPipeline/InboxValidator.php +++ b/app/Jobs/InboxPipeline/InboxValidator.php @@ -193,7 +193,7 @@ class InboxValidator implements ShouldQueue } try { - $res = Http::timeout(20)->withHeaders([ + $res = Http::withOptions(['allow_redirects' => false])->timeout(20)->withHeaders([ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'User-Agent' => 'PixelfedBot v0.1 - https://pixelfed.org', ])->get($actor->remote_url); diff --git a/app/Jobs/InboxPipeline/InboxWorker.php b/app/Jobs/InboxPipeline/InboxWorker.php index c8508c0fc..1bc88507d 100644 --- a/app/Jobs/InboxPipeline/InboxWorker.php +++ b/app/Jobs/InboxPipeline/InboxWorker.php @@ -173,7 +173,7 @@ class InboxWorker implements ShouldQueue } try { - $res = Http::timeout(20)->withHeaders([ + $res = Http::withOptions(['allow_redirects' => false])->timeout(20)->withHeaders([ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', 'User-Agent' => 'PixelfedBot v0.1 - https://pixelfed.org', ])->get($actor->remote_url); diff --git a/app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.php b/app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.php index 6cb11ddc6..23b8716c1 100644 --- a/app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.php +++ b/app/Jobs/StatusPipeline/StatusRemoteUpdatePipeline.php @@ -90,7 +90,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue ]); $nm->each(function($n, $key) use($status) { - $res = Http::retry(3, 100, throw: false)->head($n['url']); + $res = Http::withOptions(['allow_redirects' => false])->retry(3, 100, throw: false)->head($n['url']); if(!$res->successful()) { return; diff --git a/app/Services/ActivityPubFetchService.php b/app/Services/ActivityPubFetchService.php index 3d1980a11..cbf153ecb 100644 --- a/app/Services/ActivityPubFetchService.php +++ b/app/Services/ActivityPubFetchService.php @@ -28,7 +28,7 @@ class ActivityPubFetchService $headers['User-Agent'] = 'PixelFedBot/1.0.0 (Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')'; try { - $res = Http::withHeaders($headers) + $res = Http::withOptions(['allow_redirects' => false])->withHeaders($headers) ->timeout(30) ->connectTimeout(5) ->retry(3, 500) diff --git a/public/js/account-import.js b/public/js/account-import.js index 20ca89318..74d4d9e4d 100644 Binary files a/public/js/account-import.js and b/public/js/account-import.js differ diff --git a/public/js/collections.js b/public/js/collections.js index 73ebdde48..f59c88863 100644 Binary files a/public/js/collections.js and b/public/js/collections.js differ diff --git a/public/js/compose.chunk.10e7f993dcc726f9.js b/public/js/compose.chunk.10e7f993dcc726f9.js new file mode 100644 index 000000000..106a118f4 Binary files /dev/null and b/public/js/compose.chunk.10e7f993dcc726f9.js differ diff --git a/public/js/compose.chunk.965eab35620423e5.js b/public/js/compose.chunk.965eab35620423e5.js deleted file mode 100644 index 787f7dd6b..000000000 Binary files a/public/js/compose.chunk.965eab35620423e5.js and /dev/null differ diff --git a/public/js/compose.js b/public/js/compose.js index 242f07420..699a19dad 100644 Binary files a/public/js/compose.js and b/public/js/compose.js differ diff --git a/public/js/manifest.js b/public/js/manifest.js index 7ba9d795b..d6fe923ca 100644 Binary files a/public/js/manifest.js and b/public/js/manifest.js differ diff --git a/public/js/post.chunk.23fc9e82d4fadc83.js b/public/js/post.chunk.23fc9e82d4fadc83.js new file mode 100644 index 000000000..6e8aa73f4 Binary files /dev/null and b/public/js/post.chunk.23fc9e82d4fadc83.js differ diff --git a/public/js/post.chunk.74f8b1d1954f5d01.js.LICENSE.txt b/public/js/post.chunk.23fc9e82d4fadc83.js.LICENSE.txt similarity index 100% rename from public/js/post.chunk.74f8b1d1954f5d01.js.LICENSE.txt rename to public/js/post.chunk.23fc9e82d4fadc83.js.LICENSE.txt diff --git a/public/js/post.chunk.74f8b1d1954f5d01.js b/public/js/post.chunk.74f8b1d1954f5d01.js deleted file mode 100644 index 55d35a437..000000000 Binary files a/public/js/post.chunk.74f8b1d1954f5d01.js and /dev/null differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 787d3c4bb..29b3788c0 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/components/AccountImport.vue b/resources/assets/components/AccountImport.vue index b669345db..6e1fe9fcf 100644 --- a/resources/assets/components/AccountImport.vue +++ b/resources/assets/components/AccountImport.vue @@ -348,8 +348,18 @@ }, 500); }, - filterPostMeta(media) { - let json = JSON.parse(media); + async fixFacebookEncoding(string) { + // Facebook and Instagram are encoding UTF8 characters in a weird way in their json + // here is a good explanation what's going wrong https://sorashi.github.io/fix-facebook-json-archive-encoding + // See https://github.com/pixelfed/pixelfed/pull/4726 for more info + const replaced = string.replace(/\\u00([a-f0-9]{2})/g, (x) => String.fromCharCode(parseInt(x.slice(2), 16))); + const buffer = Array.from(replaced, (c) => c.charCodeAt(0)); + return new TextDecoder().decode(new Uint8Array(buffer)); + }, + + async filterPostMeta(media) { + let fbfix = await this.fixFacebookEncoding(media); + let json = JSON.parse(fbfix); let res = json.filter(j => { let ids = j.media.map(m => m.uri).filter(m => { if(this.config.allow_video_posts == true) { @@ -396,12 +406,14 @@ this.filterPostMeta(media); let imgs = await Promise.all(entries.filter(entry => { - return entry.filename.startsWith('media/posts/') && (entry.filename.endsWith('.png') || entry.filename.endsWith('.jpg') || entry.filename.endsWith('.mp4')); + return (entry.filename.startsWith('media/posts/') || entry.filename.startsWith('media/other/')) && (entry.filename.endsWith('.png') || entry.filename.endsWith('.jpg') || entry.filename.endsWith('.mp4')); }) .map(async entry => { if( - entry.filename.startsWith('media/posts/') && ( + entry.filename.startsWith('media/posts/') || + entry.filename.startsWith('media/other/') + ) && ( entry.filename.endsWith('.png') || entry.filename.endsWith('.jpg') || entry.filename.endsWith('.mp4') diff --git a/resources/assets/components/partials/post/PostReactions.vue b/resources/assets/components/partials/post/PostReactions.vue index 5456b7e63..da446e77e 100644 --- a/resources/assets/components/partials/post/PostReactions.vue +++ b/resources/assets/components/partials/post/PostReactions.vue @@ -5,7 +5,7 @@ Liked by me - @{{ status.liked_by.username}} + {{ status.liked_by.username}} and {{ count(status.favourites_count - 1) }} others diff --git a/resources/assets/components/partials/profile/ProfileHoverCard.vue b/resources/assets/components/partials/profile/ProfileHoverCard.vue index edafe3af7..c1bbff7a2 100644 --- a/resources/assets/components/partials/profile/ProfileHoverCard.vue +++ b/resources/assets/components/partials/profile/ProfileHoverCard.vue @@ -45,7 +45,6 @@ :href="profile.url" @click.prevent="goToProfile()" v-html="getDisplayName()"> - {{ profile.display_name ? profile.display_name : profile.username }}

diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index fd18b0fc9..9ca6e0419 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -29,7 +29,7 @@
- +
diff --git a/resources/assets/js/components/PortfolioSettings.vue b/resources/assets/js/components/PortfolioSettings.vue index 6b1fbde8a..cd36cd072 100644 --- a/resources/assets/js/components/PortfolioSettings.vue +++ b/resources/assets/js/components/PortfolioSettings.vue @@ -238,7 +238,7 @@ -
+

Portfolio URL

{{ settings.url }}

diff --git a/resources/assets/js/components/partials/CommentFeed.vue b/resources/assets/js/components/partials/CommentFeed.vue index ee29e7c69..f471228e8 100644 --- a/resources/assets/js/components/partials/CommentFeed.vue +++ b/resources/assets/js/components/partials/CommentFeed.vue @@ -18,8 +18,8 @@
-
- diff --git a/resources/assets/js/components/partials/StatusCard.vue b/resources/assets/js/components/partials/StatusCard.vue index 7bb2f6697..1efa6e2eb 100644 --- a/resources/assets/js/components/partials/StatusCard.vue +++ b/resources/assets/js/components/partials/StatusCard.vue @@ -8,7 +8,6 @@
- Loading... ยท @@ -61,7 +60,6 @@