Files
impost/example-app/app/pages/index.vue
Zoe 570531fe32 Implement kCTF strategy
This implementation is pretty scuffed, but its more exploratory than anything else.
2025-11-21 16:20:07 +00:00

37 lines
1.1 KiB
Vue

<script setup lang="ts">
const { data: challengeData } = await useFetch('/api/pow/challenge');
if (!challengeData) {
throw createError({
statusCode: 500,
message: 'Failed to fetch challenge',
});
}
function solved(ev: CustomEvent) {
console.log("Solved:", ev.detail.solution);
// $fetch('/api/pow/challenge', {
// method: 'POST',
// body: JSON.stringify({
// challenge: ev.detail.challenge,
// solution: ev.detail.solution,
// }),
// });
}
function formsubmit(ev: Event) {
console.log("Submitted form");
}
</script>
<template>
<div class="flex justify-center items-center h-screen w-screen ">
<form @submit.prevent="formsubmit"
class="p-5 rounded-2xl bg-dark-9 border-coolGray-600 border flex flex-col gap-2">
<pow-captcha challengeUrl="/api/pow" auto="onsubmit"
:challengejson="JSON.stringify(challengeData!.challenge)" @impost:solved="solved" />
<input class="bg-blue-7 text-white font-semibold px-4 py-2.5 border-0 rounded-md" type="submit"
value="Submit" />
</form>
</div>
</template>