diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2b6cb1..02ae77b6 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 e814c2b3..55f575a6 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/public/js/account-import.js b/public/js/account-import.js index 20ca8931..74d4d9e4 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 73ebdde4..f59c8886 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 00000000..106a118f 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 787f7dd6..00000000 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 242f0742..699a19da 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 7ba9d795..d6fe923c 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 00000000..6e8aa73f 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 55d35a43..00000000 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 787d3c4b..29b3788c 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 b669345d..6e1fe9fc 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')