From bff32b2d6802333fd671f1f177a0f2142d311dd4 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun <cheeaun@gmail.com>
Date: Sat, 31 Aug 2024 20:12:37 +0800
Subject: [PATCH] Fix toDataURL is not a function

---
 src/components/status.jsx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/components/status.jsx b/src/components/status.jsx
index 92fc28e7..8201f7d6 100644
--- a/src/components/status.jsx
+++ b/src/components/status.jsx
@@ -2659,7 +2659,12 @@ function Card({ card, selfReferential, instance }) {
       const imageData = ctx.createImageData(w, h);
       imageData.data.set(blurhashPixels);
       ctx.putImageData(imageData, 0, 0);
-      blurhashImage = canvas.toDataURL();
+      if (window.OffscreenCanvas) {
+        const blob = canvas.convertToBlob();
+        blurhashImage = URL.createObjectURL(blob);
+      } else {
+        blurhashImage = canvas.toDataURL();
+      }
     }
 
     const isPost = isCardPost(domain);