Containerization

This commit is contained in:
Philipp Traber
2024-10-17 11:02:05 +02:00
parent b81eebf6c3
commit 296046fc0e
10 changed files with 110 additions and 16 deletions
+2 -2
View File
@@ -68,7 +68,7 @@ export async function createLinkBlock(prevState: any, formData: FormData) {
};
}
revalidatePath("/dash");
revalidatePath("/~/dash");
revalidatePath(`/~/dash/${data.data.customPageUuid}/page`);
revalidatePath(`/${customPage.page.shortcode}`);
@@ -99,7 +99,7 @@ export async function deleteLinkBlock(prevState: any, formData: FormData) {
}
});
revalidatePath("/dash");
revalidatePath("/~/dash");
return {
message: "Link block deleted"
+6 -6
View File
@@ -3,7 +3,6 @@
import { z } from "zod";
import prisma from "../../prisma/prisma";
import { revalidatePath } from "next/cache";
import { error } from "console";
export async function createCustomPage(prevState: any, fromData: FormData) {
const schema = z.object({
@@ -49,12 +48,13 @@ export async function createCustomPage(prevState: any, fromData: FormData) {
return {
message: "Shortcode already exists",
error: {
shortcode: "Shortcode already exists"
shortcode: ["Shortcode already exists"]
}
};
}
revalidatePath("/dash");
revalidatePath("/~/dash");
return {
message: "Page created",
};
@@ -93,7 +93,7 @@ export async function createRedirectPage(prevState: any, fromData: FormData) {
}
});
revalidatePath("/dash");
revalidatePath("/~/dash");
return {
message: "URL created",
@@ -141,7 +141,7 @@ export async function deletePage(prevState: any, fromData: FormData) {
}
});
revalidatePath("/dash");
revalidatePath("/~/dash");
return {
message: "Page deleted",
@@ -178,7 +178,7 @@ export async function pinPageToRoot(prevState: any, fromData: FormData) {
}
});
revalidatePath("/dash");
revalidatePath("/~/dash");
revalidatePath("/");
return {
+3 -2
View File
@@ -3,8 +3,9 @@ import { headers } from "next/headers";
import { notFound, redirect, RedirectType } from "next/navigation";
import { sha256 } from "js-sha256";
import CustomPageComponent from "@/components/CustomPageComponent";
import { PageProps } from "../../../.next/types/app/layout";
export default async function RedirectToUrl({ params }: { params: { shortcode: string } }) {
export default async function RedirectToUrl({ params }: PageProps) {
const { shortcode } = await params;
@@ -21,7 +22,7 @@ export default async function RedirectToUrl({ params }: { params: { shortcode: s
return notFound()
}
// Logg the visit
// Log the visit
const requestHeaders = await headers();
const userAgent = requestHeaders.get('user-agent') || 'unknown';
const ip = requestHeaders.get('x-forwarded-for') || 'unknown';
+7 -1
View File
@@ -8,7 +8,13 @@ import LinkFavicon from "@/components/LinkFavicon";
import { hashToColor } from "@/utils";
import PinPageToRootForm from "@/components/forms/pinPageToRootForm";
export default async function DetailedStats({ params }: { params: { uuid: string } }) {
interface PageProps {
params: Promise<{
uuid: string
}>
}
export default async function DetailedStats({ params } : PageProps) {
const { uuid } = await params;
@@ -3,6 +3,7 @@ import { createCustomPage } from "@/actions/page_actions";
import { useActionState } from "react";
import SubmitButton from "../SubmitButton";
export default function CreateCustomPageForm() {
const initialState = {