mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Fix "overload resolution failed"
convertToBlob returns promise 🫣
This commit is contained in:
parent
036d3c8d83
commit
463ec48a8d
2 changed files with 39 additions and 33 deletions
|
@ -2641,9 +2641,9 @@ function Card({ card, selfReferential, instance }) {
|
|||
[hasIframeHTML],
|
||||
);
|
||||
|
||||
const [blurhashImage, setBlurhashImage] = useState(null);
|
||||
if (hasText && (image || (type === 'photo' && blurhash))) {
|
||||
const domain = getDomain(url);
|
||||
let blurhashImage;
|
||||
const rgbAverageColor =
|
||||
image && blurhash ? getBlurHashAverageColor(blurhash) : null;
|
||||
if (!image) {
|
||||
|
@ -2660,11 +2660,17 @@ function Card({ card, selfReferential, instance }) {
|
|||
const imageData = ctx.createImageData(w, h);
|
||||
imageData.data.set(blurhashPixels);
|
||||
ctx.putImageData(imageData, 0, 0);
|
||||
try {
|
||||
if (window.OffscreenCanvas) {
|
||||
const blob = canvas.convertToBlob();
|
||||
blurhashImage = URL.createObjectURL(blob);
|
||||
canvas.convertToBlob().then((blob) => {
|
||||
setBlurhashImage(URL.createObjectURL(blob));
|
||||
});
|
||||
} else {
|
||||
blurhashImage = canvas.toDataURL();
|
||||
setBlurhashImage(canvas.toDataURL());
|
||||
}
|
||||
} catch (e) {
|
||||
// Silently fail
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
54
src/locales/en.po
generated
54
src/locales/en.po
generated
|
@ -289,7 +289,7 @@ msgstr ""
|
|||
#: src/components/account-info.jsx:1308
|
||||
#: src/components/shortcuts-settings.jsx:1056
|
||||
#: src/components/status.jsx:1088
|
||||
#: src/components/status.jsx:3115
|
||||
#: src/components/status.jsx:3121
|
||||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
|
@ -417,9 +417,9 @@ msgstr ""
|
|||
#: src/components/shortcuts-settings.jsx:227
|
||||
#: src/components/shortcuts-settings.jsx:580
|
||||
#: src/components/shortcuts-settings.jsx:780
|
||||
#: src/components/status.jsx:2840
|
||||
#: src/components/status.jsx:3079
|
||||
#: src/components/status.jsx:3577
|
||||
#: src/components/status.jsx:2846
|
||||
#: src/components/status.jsx:3085
|
||||
#: src/components/status.jsx:3583
|
||||
#: src/pages/accounts.jsx:36
|
||||
#: src/pages/catchup.jsx:1564
|
||||
#: src/pages/filters.jsx:224
|
||||
|
@ -1207,9 +1207,9 @@ msgid "Filtered: {filterTitleStr}"
|
|||
msgstr ""
|
||||
|
||||
#: src/components/media-post.jsx:133
|
||||
#: src/components/status.jsx:3407
|
||||
#: src/components/status.jsx:3503
|
||||
#: src/components/status.jsx:3581
|
||||
#: src/components/status.jsx:3413
|
||||
#: src/components/status.jsx:3509
|
||||
#: src/components/status.jsx:3587
|
||||
#: src/components/timeline.jsx:971
|
||||
#: src/pages/catchup.jsx:75
|
||||
#: src/pages/catchup.jsx:1859
|
||||
|
@ -2094,7 +2094,7 @@ msgid "Edited: {editedDateText}"
|
|||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:1123
|
||||
#: src/components/status.jsx:3084
|
||||
#: src/components/status.jsx:3090
|
||||
msgid "Embed post"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2218,76 +2218,76 @@ msgstr ""
|
|||
msgid "Comments"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:2845
|
||||
#: src/components/status.jsx:2851
|
||||
msgid "Edit History"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:2849
|
||||
#: src/components/status.jsx:2855
|
||||
msgid "Failed to load history"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:2854
|
||||
#: src/components/status.jsx:2860
|
||||
msgid "Loading…"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3089
|
||||
#: src/components/status.jsx:3095
|
||||
msgid "HTML Code"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3106
|
||||
#: src/components/status.jsx:3112
|
||||
msgid "HTML code copied"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3109
|
||||
#: src/components/status.jsx:3115
|
||||
msgid "Unable to copy HTML code"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3121
|
||||
#: src/components/status.jsx:3127
|
||||
msgid "Media attachments:"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3143
|
||||
#: src/components/status.jsx:3149
|
||||
msgid "Account Emojis:"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3174
|
||||
#: src/components/status.jsx:3219
|
||||
#: src/components/status.jsx:3180
|
||||
#: src/components/status.jsx:3225
|
||||
msgid "static URL"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3188
|
||||
#: src/components/status.jsx:3194
|
||||
msgid "Emojis:"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3233
|
||||
#: src/components/status.jsx:3239
|
||||
msgid "Notes:"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3237
|
||||
#: src/components/status.jsx:3243
|
||||
msgid "This is static, unstyled and scriptless. You may need to apply your own styles and edit as needed."
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3243
|
||||
#: src/components/status.jsx:3249
|
||||
msgid "Polls are not interactive, becomes a list with vote counts."
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3248
|
||||
#: src/components/status.jsx:3254
|
||||
msgid "Media attachments can be images, videos, audios or any file types."
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3254
|
||||
#: src/components/status.jsx:3260
|
||||
msgid "Post could be edited or deleted later."
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3260
|
||||
#: src/components/status.jsx:3266
|
||||
msgid "Preview"
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3269
|
||||
#: src/components/status.jsx:3275
|
||||
msgid "Note: This preview is lightly styled."
|
||||
msgstr ""
|
||||
|
||||
#: src/components/status.jsx:3511
|
||||
#: src/components/status.jsx:3517
|
||||
msgid "<0/> <1/> boosted"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in a new issue