Add catpcha, callback

This commit is contained in:
2025-09-20 12:56:21 +08:00
parent bd78e3f600
commit 5d283165d8
3 changed files with 91 additions and 0 deletions

19
app/layouts/minimal.vue Normal file
View File

@@ -0,0 +1,19 @@
<template>
<v-app :theme="isDark ? 'dark' : 'light'">
<v-app-bar flat height="48">
<v-container class="mx-auto d-flex align-center justify-center">
<p class="text-sm">Solar Network</p>
</v-container>
</v-app-bar>
<v-main>
<slot />
</v-main>
</v-app>
</template>
<script lang="ts" setup>
import { useCustomTheme } from "~/composables/useCustomTheme"
const { isDark } = useCustomTheme()
</script>

View File

@@ -0,0 +1,17 @@
<template>
<div class="d-flex align-center justify-center fill-height">
<v-card class="pa-6 text-center" max-width="400">
<v-card-text>
<v-icon size="64" color="success" class="mb-4">mdi-check-circle</v-icon>
<h2 class="text-xl font-bold">Auth completed</h2>
<p class="opacity-80">Now you can close this tab</p>
</v-card-text>
</v-card>
</div>
</template>
<script lang="ts" setup>
definePageMeta({
layout: "minimal"
})
</script>

View File

@@ -0,0 +1,55 @@
<template>
<div class="d-flex align-center justify-center fill-height">
<v-card
class="pa-6 text-center"
max-width="600"
title="Captcha Verification"
>
<v-card-text>
<div class="mb-8 mt-4">
<client-only>
<captcha-widget @verified="onCaptchaVerified" />
</client-only>
</div>
<div>
<div class="text-sm font-bold mb-1">Solar Network Anti-Robot</div>
<div class="opacity-80 text-xs">
Hosted by
<a
href="https://github.com/Solsynth/DysonNetwork"
class="text-primary"
target="_blank"
rel="noopener noreferrer"
>
DysonNetwork.Sphere
</a>
</div>
</div>
</v-card-text>
</v-card>
</div>
</template>
<script setup lang="ts">
import { useRoute } from "vue-router"
import CaptchaWidget from "@/components/CaptchaWidget.vue"
const route = useRoute()
const onCaptchaVerified = (token: string) => {
if (window.parent !== window) {
window.parent.postMessage(`captcha_tk=${token}`, "*")
}
const redirectUri = route.query.redirect_uri as string
if (redirectUri) {
window.location.href = `${redirectUri}?captcha_tk=${encodeURIComponent(
token
)}`
}
}
definePageMeta({
layout: "minimal"
})
</script>