fix: keepAlive, ,add some cache time to "static" img

This commit is contained in:
lesion 2024-05-16 18:13:52 +02:00
parent ecab6d4821
commit 63086de9f0
No known key found for this signature in database
GPG key ID: 352918250B012177
4 changed files with 18 additions and 6 deletions

View file

@ -104,6 +104,12 @@ module.exports = {
skipSettingLocaleOnNavigate: true,
},
render: {
static: {
maxAge: "6000000"
}
},
serverMiddleware: ['server/routes'],
/*
@ -147,6 +153,12 @@ module.exports = {
defaultAssets: false,
optionsPath: './vuetify.options.js'
},
hooks: {
listen(server) {
server.keepAliveTimeout = 35000;
server.headersTimeout = 36000;
}
},
build: {
extend(config, { isDev, isClient }) {
// ..

View file

@ -219,7 +219,7 @@ const instancesController = {
// search for actor url
const actorURL = webfinger?.links.find(l => l.rel === 'self').href
// retrieve the AP actor and flat it as trusted
// retrieve the AP actor and flag it as trusted
const actor = await getActor(actorURL, instance)
await actor.update({ trusted: true })
return res.json(actor)

View file

@ -35,7 +35,7 @@ const resourceController = {
hidden: r.hidden,
created: r.createdAt,
data: {
content: r.data.content
content: r.data?.content
},
event: {
id: r.event.id,

View file

@ -126,22 +126,22 @@ module.exports = {
router.use('/fallbackimage.png', (req, res, next) => {
const fallbackImagePath = settingsController.settings.fallback_image || './static/noimg.svg'
return express.static(fallbackImagePath)(req, res, next)
return express.static(fallbackImagePath, { maxAge: '10m' })(req, res, next)
})
router.use('/headerimage.png', (req, res, next) => {
const headerImagePath = settingsController.settings.header_image || './static/noimg.svg'
return express.static(headerImagePath)(req, res, next)
return express.static(headerImagePath, { maxAge: '10m' })(req, res, next)
})
router.use('/logo.png', (req, res, next) => {
const logoPath = settingsController.settings.logo || './static/gancio'
return express.static(logoPath + '.png')(req, res, next)
return express.static(logoPath + '.png', { maxAge: '10m' } )(req, res, next)
})
router.use('/favicon.ico', (req, res, next) => {
const faviconPath = res.locals.settings.logo ? res.locals.settings.logo + '.png' : './assets/favicon.ico'
return express.static(faviconPath)(req, res, next)
return express.static(faviconPath, { maxAge: '10m' })(req, res, next)
})
return router