chore(config): centralize feature settings
This commit is contained in:
@@ -15,11 +15,13 @@ import {
|
||||
import { writeSubmission } from "@/lib/form/submission-write";
|
||||
import { submissionWebhookMessage } from "@/lib/form/submission-webhook";
|
||||
import { isFormAcceptingSubmissions } from "@/lib/form/form-availability";
|
||||
import { getCanonicalUrl } from "@/lib/config/server";
|
||||
|
||||
function getSubmissionResultLink(formId: string, submissionId: string) {
|
||||
const baseUrl = process.env.BASE_URL || process.env.NEXTAUTH_URL;
|
||||
if (!baseUrl) return `/admin/form/${formId}/result/${submissionId}`;
|
||||
return new URL(`/admin/form/${formId}/result/${submissionId}`, baseUrl).toString();
|
||||
return new URL(
|
||||
`/admin/form/${formId}/result/${submissionId}`,
|
||||
getCanonicalUrl(),
|
||||
).toString();
|
||||
}
|
||||
|
||||
export async function submitForm(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
export default function Page() {
|
||||
redirect('https://discord.com/invite/3cZQbvW6cF');
|
||||
redirect(config.site.discordInviteUrl);
|
||||
return <div>Redirecting...</div>;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Spinner } from "@/components/ui/spinner";
|
||||
import Background from "@/public/background/404.png";
|
||||
import Profile from "@/public/404-image.jpg";
|
||||
import { Activity, Home } from "lucide-react";
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
const MESSAGES = [
|
||||
"ฟอร์มนี้อาจจะถูก Erika กินไปแล้ว...",
|
||||
@@ -54,7 +55,7 @@ export default function NotFound() {
|
||||
กลับหน้าเลือก
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href="https://status.sudloh.com">
|
||||
<Link href={config.site.statusUrl}>
|
||||
<Button variant="link" className="text-secondary-foreground">
|
||||
<Activity />
|
||||
สถานะเว็บไซต์
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
|
||||
import { Inter, Anuphan } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
const inter = Inter({
|
||||
variable: "--font-inter",
|
||||
@@ -15,7 +16,7 @@ const anuphan = Anuphan({
|
||||
display: "swap",
|
||||
});
|
||||
|
||||
const siteUrl = "https://erika.sudloh.com";
|
||||
const siteUrl = config.site.url;
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Erika!",
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import { Spinner } from "@/components/ui/spinner";
|
||||
import Background from "@/public/background/404.png";
|
||||
import Profile from "@/public/404-image.jpg";
|
||||
import { Activity, Home } from "lucide-react";
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
const MESSAGES = [
|
||||
"Erika กินหน้านี้ไปแล้ว...",
|
||||
@@ -54,7 +55,7 @@ export default function NotFound() {
|
||||
กลับหน้าแรก
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href="https://status.sudloh.com">
|
||||
<Link href={config.site.statusUrl}>
|
||||
<Button variant="link" className="text-secondary-foreground">
|
||||
<Activity />
|
||||
สถานะเว็บไซต์
|
||||
|
||||
+2
-2
@@ -47,11 +47,11 @@ export default async function Home() {
|
||||
"@type": "ProfilePage",
|
||||
name: profileName,
|
||||
description: config.profile.desc,
|
||||
url: "https://erika.sudloh.com",
|
||||
url: config.site.url,
|
||||
mainEntity: {
|
||||
"@type": "Person",
|
||||
name: profileName,
|
||||
image: profileAvatar.startsWith("/") ? `https://erika.sudloh.com${profileAvatar}` : profileAvatar,
|
||||
image: profileAvatar.startsWith("/") ? `${config.site.url}${profileAvatar}` : profileAvatar,
|
||||
sameAs: links1.map((l) => l.link),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { config } from "@/lib/config";
|
||||
import Link from "next/link";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ArrowLeft } from "lucide-react";
|
||||
@@ -99,7 +100,7 @@ export default function PrivacyPolicyPage() {
|
||||
<CardContent className="text-sm text-muted-foreground leading-relaxed">
|
||||
หากมีคำถามเกี่ยวกับนโยบายความเป็นส่วนตัว สามารถติดต่อได้ผ่านทาง{" "}
|
||||
<a
|
||||
href="https://discord.com/invite/3cZQbvW6cF"
|
||||
href={config.site.discordInviteUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline text-foreground hover:text-primary"
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return {
|
||||
@@ -9,6 +10,6 @@ export default function robots(): MetadataRoute.Robots {
|
||||
disallow: ["/api/", "/admin/"],
|
||||
},
|
||||
],
|
||||
sitemap: "https://erika.sudloh.com/sitemap.xml",
|
||||
sitemap: `${config.site.url}/sitemap.xml`,
|
||||
};
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
import { config } from "@/lib/config";
|
||||
|
||||
export default function sitemap(): MetadataRoute.Sitemap {
|
||||
const baseUrl = "https://erika.sudloh.com";
|
||||
const baseUrl = config.site.url;
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user