test antibot

This commit is contained in:
Jordan Blasenhauer 2024-01-31 15:23:55 +01:00
parent a8ed481ef7
commit 3d24862d2e
3 changed files with 13 additions and 11 deletions

View file

@ -1,3 +1,5 @@
# Spoofing an action file
import json
def antibot():
return {"message": "ok", "data": {"info": "test", "count": 24}}
return json.dumps({"message": "ok", "data": {"info": "test", "count": 24}})

View file

@ -66,13 +66,9 @@
data-fetch
class="bg-sky-500 p-4 mb-1 md:mb-3 md:mr-3 z-[1001] flex flex-col fixed bottom-0 right-0 w-full md:w-1/2 max-w-[300px] min-h-20 rounded-lg dark:brightness-110 hover:scale-102 transition shadow-md break-words dark:bg-slate-850 dark:shadow-dark-xl bg-clip-border"
>
<button
data-fetch-close
role="close alert message"
class="absolute right-7 top-1.5"
>
<button data-fetch-close class="absolute right-7 top-1.5">
<svg
class="cursor-pointer fill-gray-300 dark:opacity-80 absolute h-5 w-5"
class="cursor-pointer fill-white dark:fill-gray-300 dark:opacity-80 absolute h-5 w-5"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 320 512"
>
@ -127,15 +123,18 @@
this.updateDataDOM();
this.updateAlert("fetch");
fetch("/antibot", {
fetch(location.href, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRFToken": "{{ csrf_token() }}",
},
})
.then((response) => response.json())
.then((res) => res.json())
.then((res) => {
console.log(res);
console.log(res.data);
console.log(res.data.data);
// Update data and DOM
this.getFetchDataByKey(res.data);
this.updateDataDOM();
@ -149,6 +148,7 @@
this.updateAlert("success");
})
.catch((error) => {
console.log(error);
this.updateAlert("error");
});
});

File diff suppressed because one or more lines are too long