From f097a491ae89868c8539ee2c3357277be867d011 Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Sun, 23 Nov 2025 14:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=9C=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=AB=AF=E9=85=8D=E7=BD=AE=E9=83=A8=E5=88=86=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E8=A1=8C=E4=B8=BA=20=E7=9B=AE=E5=89=8D=E5=8F=AA?= =?UTF-8?q?=E4=BD=9C=E4=BA=86=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/index.ts | 3 +++ server/config.ts | 6 +++++- server/main.ts | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/index.ts b/client/index.ts index 35ffd15..f77bf4d 100644 --- a/client/index.ts +++ b/client/index.ts @@ -48,3 +48,6 @@ if ("serviceWorker" in navigator) } catch (e) { console.error(e) } + +const config = await fetch('config.json').then((re) => re.json()) +config.title && (document.title = config.title) diff --git a/server/config.ts b/server/config.ts index c9656cb..4076efe 100644 --- a/server/config.ts +++ b/server/config.ts @@ -17,9 +17,10 @@ let config = { */ listen: { port: 3601, - host: "::", + host: null, /** * setting ipv6Only to true will disable dual-stack support, i.e., binding to host :: won't make 0.0.0.0 be bound. + * 然而这在 deno 上没什么用, 不如设定 host 为 null */ ipv6Only: false, }, @@ -31,6 +32,9 @@ let config = { cert: default_data_path + '/cert.pem', }, }, + client: { + title: '铃之椅', + }, } try { diff --git a/server/main.ts b/server/main.ts index d4bc8c9..ab66df6 100644 --- a/server/main.ts +++ b/server/main.ts @@ -21,6 +21,9 @@ import FileUploadMiddleware from "./fileupload-middleware.ts" const app = express() app.use('/', express.static(config.data_path + '/page_compiled')) app.use(cookieParser()) +app.get('/config.json', (req, res) => { + res.send(config.client || {}) +}) app.get('/uploaded_files/:hash', FileUploadMiddleware.checkAccessingUploadedFiles, (req, res) => { const file = FileManager.findByHash(req.params.hash as string)