瀏覽代碼

Merge pull request #5341 from pixelfed/staging

v0.12.4
daniel 8 月之前
父節點
當前提交
65dd601a02
共有 44 個文件被更改,包括 331 次插入511 次删除
  1. 4 1
      CHANGELOG.md
  2. 12 9
      Dockerfile
  3. 23 23
      composer.lock
  4. 1 1
      config/pixelfed.php
  5. 220 443
      package-lock.json
  6. 0 0
      public/js/changelog.bundle.7fc2ee6c4475458c.js
  7. 二進制
      public/js/compose.chunk.34ebded0861594ef.js
  8. 二進制
      public/js/compose.chunk.e1f297b242137d23.js
  9. 0 0
      public/js/compose.chunk.e1f297b242137d23.js.LICENSE.txt
  10. 二進制
      public/js/compose.js
  11. 0 0
      public/js/compose.js.LICENSE.txt
  12. 0 0
      public/js/daci.chunk.3ed914c15dec4ff4.js
  13. 0 0
      public/js/discover.chunk.2986d7e977f5188a.js
  14. 0 0
      public/js/discover~findfriends.chunk.84758c764668a02c.js
  15. 0 0
      public/js/discover~hashtag.bundle.db1d86f9e9dcb79a.js
  16. 0 0
      public/js/discover~memories.chunk.3b45432a80b08e9b.js
  17. 0 0
      public/js/discover~myhashtags.chunk.67fd16950ee21ad8.js
  18. 0 0
      public/js/discover~serverfeed.chunk.93bc564867eaa7c3.js
  19. 0 0
      public/js/discover~settings.chunk.950c11c918a541b0.js
  20. 0 0
      public/js/dms.chunk.b7e970fb49da0199.js
  21. 0 0
      public/js/dms~message.chunk.011f31232754f650.js
  22. 0 0
      public/js/error404.bundle.ad885ef6f9b2c101.js
  23. 0 0
      public/js/group.create.0d645a1de271e28d.js
  24. 0 0
      public/js/groups-page-about.06576420562628e3.js
  25. 0 0
      public/js/groups-page-media.f611a51e684c48ef.js
  26. 0 0
      public/js/groups-page-members.bfdefdd66058e838.js
  27. 0 0
      public/js/groups-page-topics.431ebaf843ca9b16.js
  28. 0 0
      public/js/groups-page.53eccead9512c61f.js
  29. 0 0
      public/js/groups-post.639cb121bdc6f4a7.js
  30. 0 0
      public/js/groups-profile.3b11ffa46ae76520.js
  31. 二進制
      public/js/home.chunk.c362371940daf318.js
  32. 1 0
      public/js/home.chunk.c362371940daf318.js.LICENSE.txt
  33. 0 0
      public/js/i18n.bundle.882da44b752e4e1a.js
  34. 二進制
      public/js/manifest.js
  35. 0 0
      public/js/notifications.chunk.8c41265737b2568a.js
  36. 二進制
      public/js/post.chunk.5f457aeaa4ae598c.js
  37. 1 0
      public/js/post.chunk.5f457aeaa4ae598c.js.LICENSE.txt
  38. 0 0
      public/js/profile.chunk.9e77e21e157a47c5.js
  39. 0 0
      public/js/profile~followers.bundle.f26ee6ed6ced9aa7.js
  40. 0 0
      public/js/profile~following.bundle.4ac5466dca6ca1c4.js
  41. 二進制
      public/js/vendor.js
  42. 二進制
      public/mix-manifest.json
  43. 68 33
      resources/assets/js/components/ComposeModal.vue
  44. 1 1
      resources/views/site/help/import.blade.php

+ 4 - 1
CHANGELOG.md

@@ -1,6 +1,9 @@
 # Release Notes
 
 ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.12.3...dev)
+-  ([](https://github.com/pixelfed/pixelfed/commit/))
+
+## [v0.12.4 (2024-11-08)](https://github.com/pixelfed/pixelfed/compare/v0.12.4...dev)
 
 ### Added
 - Implement Admin Domain Blocks API (Mastodon API Compatible) [ThisIsMissEm](https://github.com/ThisIsMissEm) ([#5021](https://github.com/pixelfed/pixelfed/pull/5021))
@@ -36,7 +39,7 @@
 - Update config, allow Beagle discover service to be disabled ([de4ce3c8](https://github.com/pixelfed/pixelfed/commit/de4ce3c8))
 - Update ApiV1Dot1Controller, allow upto 5 similar push tokens ([7820b506](https://github.com/pixelfed/pixelfed/commit/7820b506))
 - Update AdminReports, add missing click handler. Fixes #5332 ([fe48b8ad](https://github.com/pixelfed/pixelfed/commit/fe48b8ad))
--  ([](https://github.com/pixelfed/pixelfed/commit/))
+- Improve media filtering by using OffscreenCanvas, if supported ([aea5392](https://github.com/pixelfed/pixelfed/commit/aea5392))
 
 ## [v0.12.3 (2024-07-01)](https://github.com/pixelfed/pixelfed/compare/v0.12.2...v0.12.3)
 

+ 12 - 9
Dockerfile

@@ -194,6 +194,7 @@ FROM --platform=${BUILDARCH} node:lts AS frontend-build
 ARG BUILDARCH
 ARG BUILD_FRONTEND=0
 ARG RUNTIME_UID
+ARG RUNTIME_GID
 
 ARG NODE_ENV=production
 ENV NODE_ENV=$NODE_ENV
@@ -256,17 +257,26 @@ COPY --link --from=composer-image /usr/bin/composer /usr/bin/composer
 #! Changing user to runtime user
 USER ${RUNTIME_UID}:${RUNTIME_GID}
 
+
 # Install composer dependencies
 # NOTE: we skip the autoloader generation here since we don't have all files avaliable (yet)
-RUN --mount=type=cache,id=pixelfed-composer-${PHP_VERSION},sharing=locked,target=/cache/composer \
+RUN --mount=type=cache,id=pixelfed-composer-${PHP_VERSION},sharing=locked,uid=${RUNTIME_UID},gid=${RUNTIME_GID},target=/cache/composer \
     --mount=type=bind,source=composer.json,target=/var/www/composer.json \
     --mount=type=bind,source=composer.lock,target=/var/www/composer.lock \
     set -ex \
-    && composer install --prefer-dist --no-autoloader --ignore-platform-reqs
+    && composer install --prefer-dist --no-autoloader --ignore-platform-reqs --no-scripts
 
 # Copy all other files over
 COPY --chown=${RUNTIME_UID}:${RUNTIME_GID} . /var/www/
 
+# Generate optimized autoloader now that we have all files around
+RUN set -ex \
+    && ENABLE_CONFIG_CACHE=false composer dump-autoload --optimize
+
+# Now we can run the post-install scripts
+RUN set -ex \
+    && composer run-script post-update-cmd
+
 #######################################################
 # Runtime: base
 #######################################################
@@ -286,13 +296,6 @@ COPY --link --from=composer-image /usr/bin/composer /usr/bin/composer
 COPY --link --from=composer-and-src --chown=${RUNTIME_UID}:${RUNTIME_GID} /var/www /var/www
 COPY --link --from=frontend-build --chown=${RUNTIME_UID}:${RUNTIME_GID} /var/www/public /var/www/public
 
-#! Changing user to runtime user
-USER ${RUNTIME_UID}:${RUNTIME_GID}
-
-# Generate optimized autoloader now that we have all files around
-RUN set -ex \
-    && ENABLE_CONFIG_CACHE=false composer dump-autoload --optimize
-
 USER root
 
 # for detail why storage is copied this way, pls refer to https://github.com/pixelfed/pixelfed/pull/2137#discussion_r434468862

+ 23 - 23
composer.lock

@@ -62,16 +62,16 @@
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.325.3",
+            "version": "3.325.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "de0b289c7260fb19301ffa2eb724de2076daad74"
+                "reference": "195d003c902a741de53008c839cbcebddbe1f326"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/de0b289c7260fb19301ffa2eb724de2076daad74",
-                "reference": "de0b289c7260fb19301ffa2eb724de2076daad74",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/195d003c902a741de53008c839cbcebddbe1f326",
+                "reference": "195d003c902a741de53008c839cbcebddbe1f326",
                 "shasum": ""
             },
             "require": {
@@ -154,9 +154,9 @@
             "support": {
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.325.3"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.325.5"
             },
-            "time": "2024-11-06T19:05:22+00:00"
+            "time": "2024-11-08T19:12:57+00:00"
         },
         {
             "name": "bacon/bacon-qr-code",
@@ -3113,16 +3113,16 @@
         },
         {
             "name": "lcobucci/jwt",
-            "version": "5.4.1",
+            "version": "5.4.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/lcobucci/jwt.git",
-                "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7"
+                "reference": "ea1ce71cbf9741e445a5914e2f67cdbb484ff712"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/lcobucci/jwt/zipball/848815d2287abd5d3c285482f8e1f501b289a2e7",
-                "reference": "848815d2287abd5d3c285482f8e1f501b289a2e7",
+                "url": "https://api.github.com/repos/lcobucci/jwt/zipball/ea1ce71cbf9741e445a5914e2f67cdbb484ff712",
+                "reference": "ea1ce71cbf9741e445a5914e2f67cdbb484ff712",
                 "shasum": ""
             },
             "require": {
@@ -3170,7 +3170,7 @@
             ],
             "support": {
                 "issues": "https://github.com/lcobucci/jwt/issues",
-                "source": "https://github.com/lcobucci/jwt/tree/5.4.1"
+                "source": "https://github.com/lcobucci/jwt/tree/5.4.2"
             },
             "funding": [
                 {
@@ -3182,7 +3182,7 @@
                     "type": "patreon"
                 }
             ],
-            "time": "2024-11-06T06:16:04+00:00"
+            "time": "2024-11-07T12:54:35+00:00"
         },
         {
             "name": "league/commonmark",
@@ -4296,16 +4296,16 @@
         },
         {
             "name": "nesbot/carbon",
-            "version": "3.8.1",
+            "version": "3.8.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "10ac0aa86b8062219ce21e8189123d611ca3ecd9"
+                "reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/10ac0aa86b8062219ce21e8189123d611ca3ecd9",
-                "reference": "10ac0aa86b8062219ce21e8189123d611ca3ecd9",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
+                "reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
                 "shasum": ""
             },
             "require": {
@@ -4398,7 +4398,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-11-03T16:02:24+00:00"
+            "time": "2024-11-07T17:46:48+00:00"
         },
         {
             "name": "nette/schema",
@@ -10918,16 +10918,16 @@
         },
         {
             "name": "myclabs/deep-copy",
-            "version": "1.12.0",
+            "version": "1.12.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/myclabs/DeepCopy.git",
-                "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
+                "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
-                "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
+                "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845",
+                "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845",
                 "shasum": ""
             },
             "require": {
@@ -10966,7 +10966,7 @@
             ],
             "support": {
                 "issues": "https://github.com/myclabs/DeepCopy/issues",
-                "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
+                "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1"
             },
             "funding": [
                 {
@@ -10974,7 +10974,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-06-12T14:39:25+00:00"
+            "time": "2024-11-08T17:47:46+00:00"
         },
         {
             "name": "nunomaduro/collision",

+ 1 - 1
config/pixelfed.php

@@ -23,7 +23,7 @@ return [
 	| This value is the version of your Pixelfed instance.
 	|
 	*/
-	'version' => '0.12.3',
+	'version' => '0.12.4',
 
 	/*
 	|--------------------------------------------------------------------------

File diff suppressed because it is too large
+ 220 - 443
package-lock.json


+ 0 - 0
public/js/changelog.bundle.da47c74f7034447a.js → public/js/changelog.bundle.7fc2ee6c4475458c.js


二進制
public/js/compose.chunk.34ebded0861594ef.js


二進制
public/js/compose.chunk.e1f297b242137d23.js


+ 0 - 0
public/js/home.chunk.b4d8cc40a68920c1.js.LICENSE.txt → public/js/compose.chunk.e1f297b242137d23.js.LICENSE.txt


二進制
public/js/compose.js


+ 0 - 0
public/js/post.chunk.75dacb90af9d0e71.js.LICENSE.txt → public/js/compose.js.LICENSE.txt


+ 0 - 0
public/js/daci.chunk.54a46f9d3a646bd2.js → public/js/daci.chunk.3ed914c15dec4ff4.js


+ 0 - 0
public/js/discover.chunk.b5e4952e4d62342b.js → public/js/discover.chunk.2986d7e977f5188a.js


+ 0 - 0
public/js/discover~findfriends.chunk.e4652b4bbc15fb50.js → public/js/discover~findfriends.chunk.84758c764668a02c.js


+ 0 - 0
public/js/discover~hashtag.bundle.94de7a1013d118bf.js → public/js/discover~hashtag.bundle.db1d86f9e9dcb79a.js


+ 0 - 0
public/js/discover~memories.chunk.71f40101e955ab62.js → public/js/discover~memories.chunk.3b45432a80b08e9b.js


+ 0 - 0
public/js/discover~myhashtags.chunk.107f22c29aa04b5b.js → public/js/discover~myhashtags.chunk.67fd16950ee21ad8.js


+ 0 - 0
public/js/discover~serverfeed.chunk.d7c80d1f408ae4b8.js → public/js/discover~serverfeed.chunk.93bc564867eaa7c3.js


+ 0 - 0
public/js/discover~settings.chunk.7576e6cfccedc316.js → public/js/discover~settings.chunk.950c11c918a541b0.js


+ 0 - 0
public/js/dms.chunk.49ae3599d4dba309.js → public/js/dms.chunk.b7e970fb49da0199.js


+ 0 - 0
public/js/dms~message.chunk.61293d7251878a18.js → public/js/dms~message.chunk.011f31232754f650.js


+ 0 - 0
public/js/error404.bundle.9200c0b8734654fb.js → public/js/error404.bundle.ad885ef6f9b2c101.js


+ 0 - 0
public/js/group.create.e6f580f22769b687.js → public/js/group.create.0d645a1de271e28d.js


+ 0 - 0
public/js/groups-page-about.f104deafd36d2813.js → public/js/groups-page-about.06576420562628e3.js


+ 0 - 0
public/js/groups-page-media.660d310e20bb9451.js → public/js/groups-page-media.f611a51e684c48ef.js


+ 0 - 0
public/js/groups-page-members.9e6e807b47585ba8.js → public/js/groups-page-members.bfdefdd66058e838.js


+ 0 - 0
public/js/groups-page-topics.d51e24af2273e3c4.js → public/js/groups-page-topics.431ebaf843ca9b16.js


+ 0 - 0
public/js/groups-page.acb1312c8fa28603.js → public/js/groups-page.53eccead9512c61f.js


+ 0 - 0
public/js/groups-post.89ef401bc3e4338f.js → public/js/groups-post.639cb121bdc6f4a7.js


+ 0 - 0
public/js/groups-profile.2d5b53d784146dd1.js → public/js/groups-profile.3b11ffa46ae76520.js


二進制
public/js/home.chunk.b4d8cc40a68920c1.js → public/js/home.chunk.c362371940daf318.js


+ 1 - 0
public/js/home.chunk.c362371940daf318.js.LICENSE.txt

@@ -0,0 +1 @@
+/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

+ 0 - 0
public/js/i18n.bundle.873216ad86c80486.js → public/js/i18n.bundle.882da44b752e4e1a.js


二進制
public/js/manifest.js


+ 0 - 0
public/js/notifications.chunk.f04bf557f846d93a.js → public/js/notifications.chunk.8c41265737b2568a.js


二進制
public/js/post.chunk.75dacb90af9d0e71.js → public/js/post.chunk.5f457aeaa4ae598c.js


+ 1 - 0
public/js/post.chunk.5f457aeaa4ae598c.js.LICENSE.txt

@@ -0,0 +1 @@
+/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

+ 0 - 0
public/js/profile.chunk.5c727a8a961cd959.js → public/js/profile.chunk.9e77e21e157a47c5.js


+ 0 - 0
public/js/profile~followers.bundle.fa171ea239061d55.js → public/js/profile~followers.bundle.f26ee6ed6ced9aa7.js


+ 0 - 0
public/js/profile~following.bundle.7a592645bb9eb11f.js → public/js/profile~following.bundle.4ac5466dca6ca1c4.js


二進制
public/js/vendor.js


二進制
public/mix-manifest.json


+ 68 - 33
resources/assets/js/components/ComposeModal.vue

@@ -1095,11 +1095,12 @@ export default {
 		},
 
 		defineErrorMessage(errObject) {
+			let msg;
 			if (errObject.response) {
-				let msg = errObject.response.data.message ? errObject.response.data.message : 'An unexpected error occured.';
+				msg = errObject.response.data.message ? errObject.response.data.message : 'An unexpected error occured.';
 			}
 			else {
-				let msg = errObject.message;
+				msg = errObject.message;
 			}
 			return swal('Oops, something went wrong!', msg, 'error');
 		},
@@ -1765,57 +1766,91 @@ export default {
 
 		applyFilterToMedia() {
 			// this is where the magic happens
-			var ua = navigator.userAgent.toLowerCase();
-			if(ua.indexOf('firefox') == -1 && ua.indexOf('chrome') == -1) {
-                this.isPosting = false;
-			 	swal('Oops!', 'Your browser does not support the filter feature.', 'error');
-                this.page = 3;
-			 	return;
-			}
-
             let count = this.media.filter(m => m.filter_class).length;
             if(count) {
                 this.page = 'filteringMedia';
                 this.filteringRemainingCount = count;
                 this.$nextTick(() => {
                     this.isFilteringMedia = true;
-                    this.media.forEach((media, idx) => this.applyFilterToMediaSave(media, idx));
+                    Promise.all(this.media.map(media => {
+                        return this.applyFilterToMediaSave(media);
+                    })).catch(err => {
+                        console.error(err);
+                        swal('Oops!', 'An error occurred while applying filters to your media. Please refresh the page and try again. If the problem persist, please try a different web browser.', 'error');
+                    });
                 })
             } else {
                 this.page = 3;
             }
 		},
 
-        applyFilterToMediaSave(media, idx) {
+        async applyFilterToMediaSave(media) {
             if(!media.filter_class) {
                 return;
             }
 
-            let self = this;
-            let data = null;
-            const canvas = document.createElement('canvas');
-            const ctx = canvas.getContext('2d');
-            let image = document.createElement('img');
+            // Load image
+            const image = document.createElement('img');
             image.src = media.url;
-            image.addEventListener('load', e => {
+            await new Promise((resolve, reject) => {
+                image.addEventListener('load', () => resolve());
+                image.addEventListener('error', () => {
+                    reject(new Error('Failed to load image'));
+                });
+            });
+
+            // Create canvas
+            let canvas;
+            let usingOffscreenCanvas = false;
+            if('OffscreenCanvas' in window) {
+                canvas = new OffscreenCanvas(image.width, image.height);
+                usingOffscreenCanvas = true;
+            } else {
+                canvas = document.createElement('canvas');
                 canvas.width = image.width;
                 canvas.height = image.height;
-                ctx.filter = App.util.filterCss[media.filter_class];
-                ctx.drawImage(image, 0, 0, image.width, image.height);
-                ctx.save();
-                canvas.toBlob(function(blob) {
-                    data = new FormData();
-                    data.append('file', blob);
-                    data.append('id', media.id);
-                    axios.post('/api/compose/v0/media/update', data)
-                    .then(res => {
-                        self.media[idx].is_filtered = true;
-                        self.updateFilteringMedia();
-                    }).catch(err => {
-                    });
+            }
+
+            // Draw image with filter to canvas
+            const ctx = canvas.getContext('2d');
+            if (!ctx) {
+                throw new Error('Failed to get canvas context');
+            }
+            if (!('filter' in ctx)) {
+                throw new Error('Canvas filter not supported');
+            }
+            ctx.filter = App.util.filterCss[media.filter_class];
+            ctx.drawImage(image, 0, 0, image.width, image.height);
+            ctx.save();
+
+            // Convert canvas to blob
+            let blob;
+            if(usingOffscreenCanvas) {
+                blob = await canvas.convertToBlob({
+                    type: media.mime,
+                    quality: 1,
                 });
-            }, media.mime, 0.9);
-            ctx.clearRect(0, 0, image.width, image.height);
+            } else {
+                blob = await new Promise((resolve, reject) => {
+                    canvas.toBlob(blob => {
+                        if(blob) {
+                            resolve(blob);
+                        } else {
+                            reject(
+                                new Error('Failed to convert canvas to blob'),
+                            );
+                        }
+                    }, media.mime, 1);
+                });
+            }
+
+            // Upload blob / Update media
+            const data = new FormData();
+            data.append('file', blob);
+            data.append('id', media.id);
+            await axios.post('/api/compose/v0/media/update', data);
+            media.is_filtered = true;
+            this.updateFilteringMedia();
         },
 
         updateFilteringMedia() {

+ 1 - 1
resources/views/site/help/import.blade.php

@@ -13,7 +13,7 @@
     <p class="text-center font-weight-bold">How to get your export data from Instagram:</p>
     <ol class="pb-4">
         <li class="mb-2">
-            <span>Follow the Instagram instructions on <strong>Downloading a copy of your data on Instagram</strong> on <a href="https://help.instagram.com/181231772500920" class="font-weight-bold">this page</a>. <strong class="text-danger small font-weight-bold">Make sure you select the JSON format</strong></span>
+            <span><strong>Download your information in Instagram's Accounts Center</strong> on <a href="https://www.instagram.com/download/request" class="font-weight-bold">this page</a>. <strong class="text-danger small font-weight-bold">Make sure you select the JSON format</strong></span>
         </li>
         <li class="mb-2">
             <span>Wait for the email from Instagram with your download link</span>

Some files were not shown because too many files changed in this diff