From 07e982113c71fbaec85469594a0212ca69f4f421 Mon Sep 17 00:00:00 2001 From: sudoskys Date: Tue, 14 May 2024 00:55:06 +0800 Subject: [PATCH] try cfturnstile-vue3 --- frontend/package-lock.json | 18 ++++++++++++++++++ frontend/package.json | 2 ++ frontend/src/App.vue | 24 +++++++++--------------- frontend/tsconfig.json | 21 ++++++++++++++++----- frontend/tsconfig.node.json | 4 +++- 5 files changed, 48 insertions(+), 21 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ce099fa..96c03b5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -8,8 +8,10 @@ "name": "my-vue-app", "version": "0.0.0", "dependencies": { + "@astrianz/cfturnstile-vue3": "^0.0.6", "@mcaptcha/core-glue": "^0.1.0-alpha-5", "axios": "^1.6.8", + "cfturnstile-vue3": "^1.0.0", "vue": "^3.4.21", "vue-router": "^4.3.2", "vue-tg": "^0.6.1", @@ -60,6 +62,14 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@astrianz/cfturnstile-vue3": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@astrianz/cfturnstile-vue3/-/cfturnstile-vue3-0.0.6.tgz", + "integrity": "sha512-A1kbcqVWd9Jt5b/Q+RQrMRTi4ivJZILj/u9GqDgD5Dii5o0p5FVUyC/3dT/lRgYO0dctoAGcuESSNMkAuF1BxQ==", + "dependencies": { + "vue": "^3.2.38" + } + }, "node_modules/@babel/code-frame": { "version": "7.24.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", @@ -1960,6 +1970,14 @@ } ] }, + "node_modules/cfturnstile-vue3": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cfturnstile-vue3/-/cfturnstile-vue3-1.0.0.tgz", + "integrity": "sha512-R0cJ2OnnxeCIkihxEkb5KSbEncrqU2UchYGhtsXHiJTluS1C9oLMB54I9qQUd6puk/8zlhor5udO1ACgDOMAUA==", + "dependencies": { + "vue": "^3.2.38" + } + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index ba879b3..23568b2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,8 +9,10 @@ "preview": "vite preview" }, "dependencies": { + "@astrianz/cfturnstile-vue3": "^0.0.6", "@mcaptcha/core-glue": "^0.1.0-alpha-5", "axios": "^1.6.8", + "cfturnstile-vue3": "^1.0.0", "vue": "^3.4.21", "vue-router": "^4.3.2", "vue-tg": "^0.6.1", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 91bb216..85383db 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -2,7 +2,7 @@ import {computed, reactive, ref, watch} from "vue"; import {useRoute} from 'vue-router'; import axios from 'axios'; -import VueTurnstile from 'vue-turnstile'; +import Turnstile from 'cfturnstile-vue3'; import Puzzles from "./components/Puzzles.vue"; import {useWebApp, useWebAppBiometricManager, useWebAppPopup} from "vue-tg"; import {useGyroscopeExists} from "./hook/useGyroscopeExists.ts"; @@ -240,6 +240,10 @@ const initBiometric = () => { ) } +const verify_cloudflare = (token: string) => { + turnstile_token.value = token +} + // 逻辑区域 WebAppBiometricManager.onBiometricManagerUpdated(() => { console.log('Biometric manager updated') @@ -331,20 +335,10 @@ const imageSrc = `https://avatars.githubusercontent.com/u/${user}?s=300&v=4` - + {{ isCloudflareFailed.message }} diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 9e03e60..51fda0e 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -3,9 +3,12 @@ "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": [ + "ES2020", + "DOM", + "DOM.Iterable" + ], "skipLibCheck": true, - /* Bundler mode */ "moduleResolution": "bundler", "allowImportingTsExtensions": true, @@ -13,13 +16,21 @@ "isolatedModules": true, "noEmit": true, "jsx": "preserve", - + "noImplicitAny": false, /* Linting */ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], - "references": [{ "path": "./tsconfig.node.json" }] + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.vue" + ], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] } diff --git a/frontend/tsconfig.node.json b/frontend/tsconfig.node.json index 97ede7e..c7a071e 100644 --- a/frontend/tsconfig.node.json +++ b/frontend/tsconfig.node.json @@ -7,5 +7,7 @@ "allowSyntheticDefaultImports": true, "strict": true }, - "include": ["vite.config.ts"] + "include": [ + "vite.config.ts" + ] }