@@ -0,0 +1,2 @@
|
||||
export { metadata } from "../root/layout";
|
||||
export { default } from "../root/layout";
|
||||
@@ -0,0 +1,2 @@
|
||||
export { dynamic } from "../../root/maintenance/page";
|
||||
export { default } from "../../root/maintenance/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../root/marquee/page";
|
||||
@@ -0,0 +1,2 @@
|
||||
export { dynamic } from "../../root/media/page";
|
||||
export { default } from "../../root/media/page";
|
||||
@@ -0,0 +1,2 @@
|
||||
export { dynamic } from "../root/page";
|
||||
export { default } from "../root/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../root/portfolio/categories/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../root/portfolio/media/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../root/portfolio/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../../root/portfolio/projects/[id]/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../../root/portfolio/projects/new/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../root/portfolio/projects/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../root/site-settings/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../../root/smtp/contact-protection/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../root/smtp/page";
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "../../root/ui-kit/page";
|
||||
+1
-1
@@ -7,7 +7,7 @@ export default function robots(): MetadataRoute.Robots {
|
||||
rules: [
|
||||
{
|
||||
userAgent: "*",
|
||||
disallow: ["/root"],
|
||||
disallow: ["/_admin"],
|
||||
},
|
||||
],
|
||||
sitemap: new URL("/sitemap.xml", siteUrl).toString(),
|
||||
|
||||
@@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { routing } from "@/i18n/routing";
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { getLocalizedPath } from "@/lib/locale";
|
||||
import { setMaintenanceMode } from "@/lib/app-config";
|
||||
@@ -11,7 +12,7 @@ import { setMaintenanceMode } from "@/lib/app-config";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +20,7 @@ export async function updateMaintenanceModeAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
|
||||
const nextValue = formData.get("enabled") === "true";
|
||||
const redirectPath = String(formData.get("redirectPath") ?? "/root");
|
||||
const redirectPath = String(formData.get("redirectPath") ?? "/");
|
||||
const redirectUrl = new URL(redirectPath, "http://localhost");
|
||||
redirectUrl.searchParams.set(
|
||||
"success",
|
||||
@@ -29,9 +30,9 @@ export async function updateMaintenanceModeAction(formData: FormData) {
|
||||
await setMaintenanceMode(nextValue);
|
||||
revalidatePath("/", "layout");
|
||||
revalidatePath("/coming-soon");
|
||||
revalidatePath("/root");
|
||||
revalidatePath("/root/maintenance");
|
||||
revalidatePath(redirectPath);
|
||||
revalidatePath(toInternalAdminPath("/"));
|
||||
revalidatePath(toInternalAdminPath("/maintenance"));
|
||||
revalidatePath(toInternalAdminPath(redirectUrl.pathname));
|
||||
|
||||
for (const appLocale of routing.locales) {
|
||||
revalidatePath(getLocalizedPath(appLocale), "layout");
|
||||
|
||||
@@ -31,7 +31,7 @@ export default async function RootMaintenancePage() {
|
||||
const authenticated = isAdminAuthenticated();
|
||||
|
||||
if (!authenticated) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const maintenanceEnabled = await getMaintenanceMode();
|
||||
@@ -39,7 +39,7 @@ export default async function RootMaintenancePage() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { updateMarqueeSettings } from "@/lib/app-config";
|
||||
import { routing } from "@/i18n/routing";
|
||||
@@ -12,7 +13,7 @@ import { getLocalizedPath } from "@/lib/locale";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +25,8 @@ function withMessage(pathname: string, type: "success" | "error", message: strin
|
||||
}
|
||||
|
||||
async function revalidateMarqueePages() {
|
||||
revalidatePath("/root");
|
||||
revalidatePath("/root/marquee");
|
||||
revalidatePath(toInternalAdminPath("/"));
|
||||
revalidatePath(toInternalAdminPath("/marquee"));
|
||||
|
||||
for (const locale of routing.locales) {
|
||||
revalidatePath(getLocalizedPath(locale), "layout");
|
||||
@@ -71,13 +72,13 @@ export async function saveMarqueeSettingsAction(formData: FormData) {
|
||||
await updateMarqueeSettings(settings);
|
||||
await revalidateMarqueePages();
|
||||
|
||||
redirect(withMessage("/root/marquee", "success", "Marquee gespeichert."));
|
||||
redirect(withMessage("/marquee", "success", "Marquee gespeichert."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : "Marquee konnte nicht gespeichert werden.";
|
||||
redirect(withMessage("/root/marquee", "error", message));
|
||||
redirect(withMessage("/marquee", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ const copy = {
|
||||
|
||||
export default async function RootMarqueePage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const marqueeSettings = await getMarqueeSettings();
|
||||
|
||||
+12
-11
@@ -5,6 +5,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { countMediaUsageReferences, getMediaAssetById } from "@/lib/media";
|
||||
import { createStandaloneMediaAsset, deleteMediaAssetAndFile } from "@/lib/media-service";
|
||||
@@ -14,7 +15,7 @@ import { prisma } from "@/lib/prisma";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,10 +27,10 @@ function withMessage(pathname: string, type: "success" | "error", message: strin
|
||||
}
|
||||
|
||||
function revalidateMediaPages() {
|
||||
revalidatePath("/root");
|
||||
revalidatePath("/root/media");
|
||||
revalidatePath("/root/portfolio");
|
||||
revalidatePath("/root/portfolio/projects");
|
||||
revalidatePath(toInternalAdminPath("/"));
|
||||
revalidatePath(toInternalAdminPath("/media"));
|
||||
revalidatePath(toInternalAdminPath("/portfolio"));
|
||||
revalidatePath(toInternalAdminPath("/portfolio/projects"));
|
||||
}
|
||||
|
||||
export async function createMediaAssetAction(formData: FormData) {
|
||||
@@ -46,14 +47,14 @@ export async function createMediaAssetAction(formData: FormData) {
|
||||
});
|
||||
|
||||
revalidateMediaPages();
|
||||
redirect(withMessage("/root/media", "success", "Datei gespeichert."));
|
||||
redirect(withMessage("/media", "success", "Datei gespeichert."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : "Datei konnte nicht gespeichert werden.";
|
||||
redirect(withMessage("/root/media", "error", message));
|
||||
redirect(withMessage("/media", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,13 +67,13 @@ export async function deleteMediaAssetAction(formData: FormData) {
|
||||
const asset = await getMediaAssetById(assetId);
|
||||
|
||||
if (!asset) {
|
||||
redirect(withMessage("/root/media", "error", "Datei nicht gefunden."));
|
||||
redirect(withMessage("/media", "error", "Datei nicht gefunden."));
|
||||
}
|
||||
|
||||
const usageCount = await countMediaUsageReferences(asset.id);
|
||||
|
||||
if (usageCount > 0) {
|
||||
redirect(withMessage("/root/media", "error", "Datei wird noch verwendet."));
|
||||
redirect(withMessage("/media", "error", "Datei wird noch verwendet."));
|
||||
}
|
||||
|
||||
await prisma.mediaAsset.delete({
|
||||
@@ -89,13 +90,13 @@ export async function deleteMediaAssetAction(formData: FormData) {
|
||||
}
|
||||
|
||||
revalidateMediaPages();
|
||||
redirect(withMessage("/root/media", "success", "Datei geloescht."));
|
||||
redirect(withMessage("/media", "success", "Datei geloescht."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
const message = error instanceof Error ? error.message : "Datei konnte nicht geloescht werden.";
|
||||
redirect(withMessage("/root/media", "error", message));
|
||||
redirect(withMessage("/media", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,14 @@ const copy = {
|
||||
|
||||
export default async function RootMediaPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const mediaAssets = await getAdminMediaAssets();
|
||||
|
||||
+5
-5
@@ -75,28 +75,28 @@ export default async function RootPage({ searchParams }: RootPageProps) {
|
||||
const currentLockState = getAdminLockState();
|
||||
|
||||
if (currentLockState.locked) {
|
||||
redirect("/root?error=locked");
|
||||
redirect("/?error=locked");
|
||||
}
|
||||
|
||||
if (!isAdminAuthConfigured() || !isPasswordValid(password)) {
|
||||
const failState = registerFailedAdminAttempt();
|
||||
if (failState.locked) {
|
||||
redirect("/root?error=locked");
|
||||
redirect("/?error=locked");
|
||||
}
|
||||
|
||||
redirect("/root?error=invalid");
|
||||
redirect("/?error=invalid");
|
||||
}
|
||||
|
||||
resetAdminFailedAttempts();
|
||||
setAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
if (!authenticated) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
import { ZodError } from "zod";
|
||||
|
||||
import { routing } from "@/i18n/routing";
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { deleteEntityMediaUsages, replaceEntityMediaUsages } from "@/lib/media";
|
||||
import { resolveMediaSelection } from "@/lib/media-service";
|
||||
@@ -25,7 +26,7 @@ import {
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,11 +86,11 @@ function parseZodError(error: ZodError) {
|
||||
}
|
||||
|
||||
async function revalidatePortfolioPages() {
|
||||
revalidatePath("/root");
|
||||
revalidatePath("/root/media");
|
||||
revalidatePath("/root/portfolio");
|
||||
revalidatePath("/root/portfolio/categories");
|
||||
revalidatePath("/root/portfolio/projects");
|
||||
revalidatePath(toInternalAdminPath("/"));
|
||||
revalidatePath(toInternalAdminPath("/media"));
|
||||
revalidatePath(toInternalAdminPath("/portfolio"));
|
||||
revalidatePath(toInternalAdminPath("/portfolio/categories"));
|
||||
revalidatePath(toInternalAdminPath("/portfolio/projects"));
|
||||
revalidatePath("/portfolio");
|
||||
|
||||
for (const locale of routing.locales) {
|
||||
@@ -106,7 +107,7 @@ async function removeManagedPaths(paths: string[]) {
|
||||
export async function upsertCategoryAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
|
||||
const redirectPath = getRedirectPath(formData, "/root/portfolio/categories");
|
||||
const redirectPath = getRedirectPath(formData, "/portfolio/categories");
|
||||
|
||||
try {
|
||||
const parsed = categoryInputSchema.parse({
|
||||
@@ -156,7 +157,7 @@ export async function upsertCategoryAction(formData: FormData) {
|
||||
export async function deleteCategoryAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
|
||||
const redirectPath = getRedirectPath(formData, "/root/portfolio/categories");
|
||||
const redirectPath = getRedirectPath(formData, "/portfolio/categories");
|
||||
const id = String(formData.get("id") ?? "");
|
||||
|
||||
try {
|
||||
@@ -191,8 +192,8 @@ export async function saveProjectAction(formData: FormData) {
|
||||
ensureAdmin();
|
||||
|
||||
const fallbackRedirect = String(formData.get("id") ?? "").trim()
|
||||
? `/root/portfolio/projects/${String(formData.get("id") ?? "").trim()}`
|
||||
: "/root/portfolio/projects/new";
|
||||
? `/portfolio/projects/${String(formData.get("id") ?? "").trim()}`
|
||||
: "/portfolio/projects/new";
|
||||
const redirectPath = getRedirectPath(formData, fallbackRedirect);
|
||||
const uploadedPaths: string[] = [];
|
||||
const createdMediaAssetIds: string[] = [];
|
||||
@@ -517,7 +518,7 @@ export async function saveProjectAction(formData: FormData) {
|
||||
});
|
||||
|
||||
await revalidatePortfolioPages();
|
||||
revalidatePath(`/root/portfolio/projects/${projectResult.project.id}`);
|
||||
revalidatePath(toInternalAdminPath(`/portfolio/projects/${projectResult.project.id}`));
|
||||
revalidatePath(`/portfolio/${projectResult.project.slug}`);
|
||||
|
||||
for (const locale of routing.locales) {
|
||||
@@ -525,7 +526,7 @@ export async function saveProjectAction(formData: FormData) {
|
||||
}
|
||||
|
||||
redirect(
|
||||
withMessage(`/root/portfolio/projects/${projectResult.project.id}`, "success", "Projekt gespeichert."),
|
||||
withMessage(`/portfolio/projects/${projectResult.project.id}`, "success", "Projekt gespeichert."),
|
||||
);
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
@@ -578,7 +579,7 @@ export async function deleteProjectAction(formData: FormData) {
|
||||
});
|
||||
|
||||
if (!project) {
|
||||
redirect(withMessage("/root/portfolio", "error", "Project not found."));
|
||||
redirect(withMessage("/portfolio", "error", "Project not found."));
|
||||
}
|
||||
|
||||
await prisma.portfolioProject.delete({
|
||||
@@ -595,12 +596,12 @@ export async function deleteProjectAction(formData: FormData) {
|
||||
revalidatePath(getLocalizedPath(locale, `/portfolio/${project.slug}`));
|
||||
}
|
||||
|
||||
redirect(withMessage("/root/portfolio", "success", "Project deleted."));
|
||||
redirect(withMessage("/portfolio", "success", "Project deleted."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
redirect(withMessage("/root/portfolio", "error", "Unable to delete project."));
|
||||
redirect(withMessage("/portfolio", "error", "Unable to delete project."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ const copy = {
|
||||
|
||||
export default async function RootPortfolioCategoriesPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const categories = await getAdminPortfolioCategories();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export default function RootPortfolioMediaRedirectPage() {
|
||||
redirect("/root/media");
|
||||
redirect("/media");
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ type RootPortfolioPageProps = {
|
||||
|
||||
export default async function RootPortfolioPage({ searchParams }: RootPortfolioPageProps) {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const selectedCategory = searchParams?.category && searchParams.category !== "__all__"
|
||||
|
||||
@@ -53,14 +53,14 @@ export default async function RootPortfolioProjectPage({
|
||||
params,
|
||||
}: RootPortfolioProjectPageProps) {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const [categories, mediaOptions, project] = await Promise.all([
|
||||
@@ -70,7 +70,7 @@ export default async function RootPortfolioProjectPage({
|
||||
]);
|
||||
|
||||
if (!project) {
|
||||
redirect("/root/portfolio?error=Project+not+found.");
|
||||
redirect("/portfolio?error=Project+not+found.");
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -90,7 +90,7 @@ export default async function RootPortfolioProjectPage({
|
||||
mediaOptions={mediaOptions}
|
||||
project={project}
|
||||
formId="portfolio-project-form"
|
||||
redirectPath={`/root/portfolio/projects/${project.id}`}
|
||||
redirectPath={`/portfolio/projects/${project.id}`}
|
||||
/>
|
||||
</MotionFade>
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ const copy = {
|
||||
|
||||
export default async function RootNewPortfolioProjectPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const [categories, mediaOptions] = await Promise.all([
|
||||
@@ -57,7 +57,7 @@ export default async function RootNewPortfolioProjectPage() {
|
||||
categories={categories}
|
||||
mediaOptions={mediaOptions}
|
||||
formId="portfolio-project-form"
|
||||
redirectPath="/root/portfolio/projects/new"
|
||||
redirectPath="/portfolio/projects/new"
|
||||
/>
|
||||
</MotionFade>
|
||||
</div>
|
||||
|
||||
@@ -31,14 +31,14 @@ export default async function RootPortfolioProjectsPage({
|
||||
searchParams,
|
||||
}: RootPortfolioProjectsPageProps) {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const selectedCategory = searchParams?.category && searchParams.category !== "__all__"
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
SITE_SETTINGS_LOGO_LIGHT_FIELD_KEY,
|
||||
updateSiteSettings,
|
||||
} from "@/lib/app-config";
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { PAGE_TITLE_TOKEN, type SiteSettings } from "@/lib/site-settings";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { replaceEntityMediaUsages } from "@/lib/media";
|
||||
@@ -27,7 +28,7 @@ import { prisma } from "@/lib/prisma";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +75,8 @@ async function cleanupCreatedMedia(assetIds: string[], uploadedPaths: string[])
|
||||
|
||||
async function revalidateSiteSettingsPages() {
|
||||
revalidatePath("/", "layout");
|
||||
revalidatePath("/root");
|
||||
revalidatePath("/root/site-settings");
|
||||
revalidatePath(toInternalAdminPath("/"));
|
||||
revalidatePath(toInternalAdminPath("/site-settings"));
|
||||
revalidatePath("/coming-soon");
|
||||
|
||||
const publicPaths = ["/", "/about", "/portfolio", "/contact", "/success", "/coming-soon"];
|
||||
@@ -277,7 +278,7 @@ export async function saveSiteSettingsAction(formData: FormData) {
|
||||
});
|
||||
|
||||
await revalidateSiteSettingsPages();
|
||||
redirect(withMessage("/root/site-settings", "success", "Einstellungen gespeichert."));
|
||||
redirect(withMessage("/site-settings", "success", "Einstellungen gespeichert."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
@@ -290,6 +291,6 @@ export async function saveSiteSettingsAction(formData: FormData) {
|
||||
? error.message
|
||||
: "Einstellungen konnten nicht gespeichert werden.";
|
||||
|
||||
redirect(withMessage("/root/site-settings", "error", message));
|
||||
redirect(withMessage("/site-settings", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,14 +31,14 @@ const copy = {
|
||||
|
||||
export default async function RootSiteSettingsPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const [siteSettings, mediaBindings, mediaOptions] = await Promise.all([
|
||||
|
||||
@@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { isCheckedFormValue } from "@/lib/form-data";
|
||||
import {
|
||||
@@ -16,7 +17,7 @@ import type { MailSettings } from "@/lib/mail-settings";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +78,8 @@ export async function saveMailSettingsAction(formData: FormData) {
|
||||
const nextMailSettings = parseMailSettingsFormData(formData, existingMailSettings);
|
||||
|
||||
await updateMailSettings(nextMailSettings);
|
||||
revalidatePath("/root/smtp");
|
||||
redirect(withMessage("/root/smtp", "success", "SMTP Einstellungen gespeichert."));
|
||||
revalidatePath(toInternalAdminPath("/smtp"));
|
||||
redirect(withMessage("/smtp", "success", "SMTP Einstellungen gespeichert."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
@@ -89,7 +90,7 @@ export async function saveMailSettingsAction(formData: FormData) {
|
||||
? error.message
|
||||
: "SMTP Einstellungen konnten nicht gespeichert werden.";
|
||||
|
||||
redirect(withMessage("/root/smtp", "error", message));
|
||||
redirect(withMessage("/smtp", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +99,7 @@ export async function sendTestEmailAction() {
|
||||
|
||||
try {
|
||||
await sendTestEmail();
|
||||
redirect(withMessage("/root/smtp", "success", "Test-E-Mail gesendet."));
|
||||
redirect(withMessage("/smtp", "success", "Test-E-Mail gesendet."));
|
||||
} catch (error) {
|
||||
if (isRedirectError(error)) {
|
||||
throw error;
|
||||
@@ -109,6 +110,6 @@ export async function sendTestEmailAction() {
|
||||
? error.message
|
||||
: "Test-E-Mail konnte nicht gesendet werden.";
|
||||
|
||||
redirect(withMessage("/root/smtp", "error", message));
|
||||
redirect(withMessage("/smtp", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
import { isRedirectError } from "next/dist/client/components/redirect";
|
||||
|
||||
import { toInternalAdminPath } from "@/lib/admin-routing";
|
||||
import { clearAdminSessionCookie, isAdminAuthenticated } from "@/lib/admin-auth";
|
||||
import { isCheckedFormValue } from "@/lib/form-data";
|
||||
import {
|
||||
@@ -15,7 +16,7 @@ import type { ContactProtectionSettings } from "@/lib/contact-protection";
|
||||
function ensureAdmin() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,13 +86,13 @@ export async function saveContactProtectionSettingsAction(formData: FormData) {
|
||||
const nextSettings = parseContactProtectionFormData(formData, existingSettings);
|
||||
|
||||
await updateContactProtectionSettings(nextSettings);
|
||||
revalidatePath("/root/smtp/contact-protection");
|
||||
revalidatePath(toInternalAdminPath("/smtp/contact-protection"));
|
||||
revalidatePath("/contact");
|
||||
revalidatePath("/ar/contact");
|
||||
revalidatePath("/en/contact");
|
||||
redirect(
|
||||
withMessage(
|
||||
"/root/smtp/contact-protection",
|
||||
"/smtp/contact-protection",
|
||||
"success",
|
||||
"Contact Protection gespeichert.",
|
||||
),
|
||||
@@ -106,6 +107,6 @@ export async function saveContactProtectionSettingsAction(formData: FormData) {
|
||||
? error.message
|
||||
: "Contact Protection konnte nicht gespeichert werden.";
|
||||
|
||||
redirect(withMessage("/root/smtp/contact-protection", "error", message));
|
||||
redirect(withMessage("/smtp/contact-protection", "error", message));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,14 +27,14 @@ const copy = {
|
||||
|
||||
export default async function RootSMTPProtectionPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const settings = await getContactProtectionFormValues();
|
||||
|
||||
@@ -28,14 +28,14 @@ const copy = {
|
||||
|
||||
export default async function RootSMTPPage() {
|
||||
if (!isAdminAuthenticated()) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
const mailSettings = await getMailSettingsFormValues();
|
||||
|
||||
@@ -24,14 +24,14 @@ export default async function RootUiKitPage() {
|
||||
const authenticated = isAdminAuthenticated();
|
||||
|
||||
if (!authenticated) {
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
async function logoutAction() {
|
||||
"use server";
|
||||
|
||||
clearAdminSessionCookie();
|
||||
redirect("/root");
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user