From 9af1b244d3b10224ca0bc87e05d270b49ae38479 Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 8 Aug 2022 17:39:50 -0700 Subject: [PATCH] code ing --- package.json | 2 +- .../client/src/components/media-caption.vue | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index efe9d478e..26caf7a80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "12.118.1-calc.rc.4.6", + "version": "12.118.1-calc.rc.4.7", "codename": "aqua", "repository": { "type": "git", diff --git a/packages/client/src/components/media-caption.vue b/packages/client/src/components/media-caption.vue index 738ae166b..469cb2c83 100644 --- a/packages/client/src/components/media-caption.vue +++ b/packages/client/src/components/media-caption.vue @@ -146,16 +146,21 @@ export default defineComponent({ caption: async () => { const img = document.getElementById('imgtocaption') as HTMLImageElement; - const imgurl = img.src; - await worker.load(); - await worker.loadLanguage('eng'); - await worker.initialize('eng'); - const { data: { text } } = await worker.recognize(imgurl); - console.log(text); - // document.getElementById('recognized-text').innerText = text; - // const allowedLength = 512 - this.inputValue.length; - // this.inputValue += text.slice(0, allowedLength); - await worker.terminate(); + fetch(img.src) + .then((response) => { + return response.blob(); + }) + .then((blob) => { + worker.load(); + worker.loadLanguage('eng'); + worker.initialize('eng'); + const { data: { text } } = worker.recognize(blob); + console.log(text); + // document.getElementById('recognized-text').innerText = text; + // const allowedLength = 512 - this.inputValue.length; + // this.inputValue += text.slice(0, allowedLength); + worker.terminate(); + }); }, }, });