Do not use a CDN for the QR code scanner's wasm code
This commit is contained in:
parent
aa19c501b1
commit
dfc1aa4872
1 changed files with 10 additions and 1 deletions
|
@ -2,10 +2,11 @@
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { useStorage } from '@vueuse/core'
|
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 { sha256 } from '@noble/hashes/sha256';
|
||||||
import base32Encode from 'base32-encode';
|
import base32Encode from 'base32-encode';
|
||||||
import LayoutComponent from '../components/LayoutComponent.vue';
|
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 accounts = useStorage('sake-accounts', []);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
@ -63,6 +64,14 @@ const addAccount = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
// QR code reader
|
// QR code reader
|
||||||
|
setZXingModuleOverrides({
|
||||||
|
locateFile: (path, prefix) => {
|
||||||
|
if (path.endsWith(".wasm")) {
|
||||||
|
return wasmFile;
|
||||||
|
}
|
||||||
|
return prefix + path;
|
||||||
|
},
|
||||||
|
});
|
||||||
const scanQrCode = ref(false);
|
const scanQrCode = ref(false);
|
||||||
const showQrCodeScanner = (data) => {
|
const showQrCodeScanner = (data) => {
|
||||||
scanQrCode.value = true;
|
scanQrCode.value = true;
|
||||||
|
|
Loading…
Reference in a new issue