Compare commits

...

2 Commits

Author SHA1 Message Date
CrescentLeaf
f097a491ae 可以在服务端配置部分客户端行为 目前只作了标题 2025-11-23 14:16:48 +08:00
CrescentLeaf
e90e1911e8 断章取义 2025-11-23 14:16:26 +08:00
4 changed files with 12 additions and 1 deletions

View File

@@ -48,3 +48,6 @@ if ("serviceWorker" in navigator)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} }
const config = await fetch('config.json').then((re) => re.json())
config.title && (document.title = config.title)

View File

@@ -181,6 +181,7 @@ export default function Message({ userId, rawData, renderHTML, message, openUser
id="msg" id="msg"
style={{ style={{
fontSize: "94%", fontSize: "94%",
wordBreak: 'break-word',
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
}} }}

View File

@@ -17,9 +17,10 @@ let config = {
*/ */
listen: { listen: {
port: 3601, 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. * 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, ipv6Only: false,
}, },
@@ -31,6 +32,9 @@ let config = {
cert: default_data_path + '/cert.pem', cert: default_data_path + '/cert.pem',
}, },
}, },
client: {
title: '铃之椅',
},
} }
try { try {

View File

@@ -21,6 +21,9 @@ import FileUploadMiddleware from "./fileupload-middleware.ts"
const app = express() const app = express()
app.use('/', express.static(config.data_path + '/page_compiled')) app.use('/', express.static(config.data_path + '/page_compiled'))
app.use(cookieParser()) app.use(cookieParser())
app.get('/config.json', (req, res) => {
res.send(config.client || {})
})
app.get('/uploaded_files/:hash', FileUploadMiddleware.checkAccessingUploadedFiles, (req, res) => { app.get('/uploaded_files/:hash', FileUploadMiddleware.checkAccessingUploadedFiles, (req, res) => {
const file = FileManager.findByHash(req.params.hash as string) const file = FileManager.findByHash(req.params.hash as string)