1
0
mirror of https://github.com/XFox111/my-website.git synced 2026-04-22 07:28:01 +03:00

chore(deps): dependency bumps + related refactoring (fixes #19)

This commit is contained in:
2025-01-26 21:50:56 +00:00
parent 9d369ad4d2
commit 457fbf33e5
44 changed files with 657 additions and 601 deletions
-32
View File
@@ -1,32 +0,0 @@
"use client";
import React, { useEffect } from "react";
import { useFormStatus } from "react-dom";
// Since useFormStatus requires to be inside of the form, I moved it to a separate helper component.
// Could it be done better? Probably.
// Did I do it? No.
/** Renders a React component that tracks the form status and calls the provided callback function when the form status changes. */
const FormStatusTracker: React.FC<FormStatusTrackerProps> = ({ onPendingChanged }) =>
{
const { pending } = useFormStatus();
useEffect(() =>
{
onPendingChanged(pending);
}, [pending, onPendingChanged]);
return null;
};
export default FormStatusTracker;
/** Props for the `FormStatusTracker` component. */
export type FormStatusTrackerProps =
{
/** The callback function that is called when the form status changes. */
// For some reason ESLint shows a warning for "unused" "pending" parameter.
// eslint-disable-next-line no-unused-vars
onPendingChanged: (pending: boolean) => void;
};
-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable no-unused-vars */
declare global
{
interface Window
+3 -3
View File
@@ -35,9 +35,9 @@ function setCookie(name: string, value: string | number, maxAge: number): void
function getCookie(name: string): string | undefined
{
let cookieName = name + "=";
let rawCookies = decodeURIComponent(window.document.cookie);
let cookies = rawCookies.split(";");
const cookieName = name + "=";
const rawCookies = decodeURIComponent(window.document.cookie);
const cookies = rawCookies.split(";");
for (const cookie of cookies)
if (cookie.trim().startsWith(cookieName))
-2
View File
@@ -43,8 +43,6 @@ export default async function sendInquiry(_: FormStatus, formData: FormData): Pr
message: "Challenge has expired. Try again"
};
console.error(error);
return {
status: "error",
message: "Something went wrong"
+2 -3
View File
@@ -13,12 +13,11 @@ export async function verifyTurnstile(token: string): Promise<[false, TurnstileE
return [true];
const formData = new FormData();
console.log(headers().get("CF-Connecting-IP"));
const headerList = await headers();
formData.append("secret", process.env.CF_SECRET);
formData.append("response", token);
formData.append("remoteip", headers().get("CF-Connecting-IP") ?? "");
formData.append("remoteip", headerList.get("CF-Connecting-IP") ?? "");
const response = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify",
{