From dfc1aa4872388e8b0823d89d868f015efe71a935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Fri, 11 Aug 2023 18:05:54 +0200 Subject: [PATCH] Do not use a CDN for the QR code scanner's wasm code --- src/views/AddAccountView.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/views/AddAccountView.vue b/src/views/AddAccountView.vue index 897e7c3..e308e5f 100644 --- a/src/views/AddAccountView.vue +++ b/src/views/AddAccountView.vue @@ -2,10 +2,11 @@ import { ref, computed } from 'vue'; import { useRouter } from 'vue-router'; import { useStorage } from '@vueuse/core' -import { QrcodeStream } from 'vue-qrcode-reader' +import { QrcodeStream, setZXingModuleOverrides } from 'vue-qrcode-reader'; import { sha256 } from '@noble/hashes/sha256'; import base32Encode from 'base32-encode'; import LayoutComponent from '../components/LayoutComponent.vue'; +import wasmFile from "../../node_modules/@sec-ant/zxing-wasm/dist/reader/zxing_reader.wasm?url"; const accounts = useStorage('sake-accounts', []); const router = useRouter(); @@ -63,6 +64,14 @@ const addAccount = () => { }; // QR code reader +setZXingModuleOverrides({ + locateFile: (path, prefix) => { + if (path.endsWith(".wasm")) { + return wasmFile; + } + return prefix + path; + }, +}); const scanQrCode = ref(false); const showQrCodeScanner = (data) => { scanQrCode.value = true;