diff --git a/package.json b/package.json index e712cffd..297a9379 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "@kazvmoe-infra/pinch-zoom-element": "1.2.0", "@vuelidate/core": "^2.0.0", "@vuelidate/validators": "^2.0.0", + "blurhash": "^2.0.4", "body-scroll-lock": "2.7.1", "chromatism": "3.0.0", "click-outside-vue3": "4.0.1", diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 4dcacc7e..3155abf0 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -18,6 +18,7 @@ import { faPencilAlt, faAlignRight } from '@fortawesome/free-solid-svg-icons' +import Blurhash from '../blurhash/Blurhash.vue' library.add( faFile, @@ -63,7 +64,8 @@ const Attachment = { components: { Flash, StillImage, - VideoAttachment + VideoAttachment, + Blurhash }, computed: { classNames () { @@ -84,6 +86,9 @@ const Attachment = { useContainFit () { return this.$store.getters.mergedConfig.useContainFit }, + useBlurhash () { + return this.$store.getters.mergedConfig.useBlurhash + }, placeholderName () { if (this.attachment.description === '' || !this.attachment.description) { return this.type.toUpperCase() diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index 947b1bfc..f9c4f1c8 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -64,7 +64,15 @@ :title="attachment.description" @click.prevent.stop="toggleHidden" > + + + + + + + diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue index 2fa20742..5d135711 100644 --- a/src/components/settings_modal/tabs/general_tab.vue +++ b/src/components/settings_modal/tabs/general_tab.vue @@ -407,6 +407,15 @@ {{ $t('settings.preload_images') }} +
  • + + {{ $t('settings.use_blurhash') }} + +
  • { if (masto) { // Not exactly same... output.mimetype = data.pleroma ? data.pleroma.mime_type : data.type - output.meta = data.meta // not present in BE yet + output.meta = data.meta output.id = data.id } else { output.mimetype = data.mimetype // output.meta = ??? missing } + output.blurhash = data.blurhash output.url = data.url output.large_thumb_url = data.preview_url output.description = data.description diff --git a/static/blurhash-overlay.png b/static/blurhash-overlay.png new file mode 100755 index 00000000..209a9438 Binary files /dev/null and b/static/blurhash-overlay.png differ diff --git a/yarn.lock b/yarn.lock index bbceba0b..10533a18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2494,6 +2494,11 @@ binary-extensions@^2.0.0: resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz" integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== +blurhash@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/blurhash/-/blurhash-2.0.4.tgz#60642a823b50acaaf3732ddb6c7dfd721bdfef2a" + integrity sha512-r/As72u2FbucLoK5NTegM/GucxJc3d8GvHc4ngo13IO/nt2HU4gONxNLq1XPN6EM/V8Y9URIa7PcSz2RZu553A== + body-parser@1.19.2: version "1.19.2" resolved "https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz"