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)