From be09b557659a90fe66337cc086b605fdf3042222 Mon Sep 17 00:00:00 2001 From: nyne Date: Sun, 18 May 2025 11:04:59 +0800 Subject: [PATCH] Add site information management with Markdown support --- frontend/index.html | 1 + frontend/src/app.ts | 4 +++ frontend/src/components/input.tsx | 18 +++++++++++++ frontend/src/i18n.ts | 3 +++ frontend/src/network/models.ts | 1 + frontend/src/pages/home_page.tsx | 25 +++++++++++++++++-- .../src/pages/manage_server_config_page.tsx | 5 +++- server/config/config.go | 14 ++++++++--- server/middleware/frontend_middleware.go | 4 ++- 9 files changed, 67 insertions(+), 8 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index 2fdecbf..f5541b9 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -35,6 +35,7 @@
diff --git a/frontend/src/app.ts b/frontend/src/app.ts index 577ccb7..f9ef0b0 100644 --- a/frontend/src/app.ts +++ b/frontend/src/app.ts @@ -3,6 +3,7 @@ import {User} from "./network/models.ts"; interface MyWindow extends Window { serverName?: string; cloudflareTurnstileSiteKey?: string; + siteInfo?: string; } class App { @@ -14,6 +15,8 @@ class App { cloudflareTurnstileSiteKey: string | null = null; + siteInfo = "" + constructor() { this.init(); } @@ -29,6 +32,7 @@ class App { } this.appName = (window as MyWindow).serverName || this.appName; this.cloudflareTurnstileSiteKey = (window as MyWindow).cloudflareTurnstileSiteKey || null; + this.siteInfo = (window as MyWindow).siteInfo || ""; } saveData() { diff --git a/frontend/src/components/input.tsx b/frontend/src/components/input.tsx index 45079d8..7f8364e 100644 --- a/frontend/src/components/input.tsx +++ b/frontend/src/components/input.tsx @@ -1,3 +1,5 @@ +import React from "react"; + interface InputProps { type?: string; placeholder?: string; @@ -19,4 +21,20 @@ export default function Input(props: InputProps) { } +} + +interface TextAreaProps { + value: string; + onChange: (e: React.ChangeEvent) => void; + label: string; + height?: string | number; +} + +export function TextArea(props: TextAreaProps) { + return
+ {props.label} +