Explicitly set max-age (#3330)
This commit is contained in:
		
							parent
							
								
									ca0cb6fd42
								
							
						
					
					
						commit
						e332e3c248
					
				
					 3 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -189,6 +189,8 @@ router.get('/*/api/endpoints/*', async ctx => {
 | 
			
		|||
	};
 | 
			
		||||
 | 
			
		||||
	await ctx.render('../../../../src/docs/api/endpoints/view', Object.assign(await genVars(lang), vars));
 | 
			
		||||
 | 
			
		||||
	ctx.set('Cache-Control', 'public, max-age=300');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
router.get('/*/api/entities/*', async ctx => {
 | 
			
		||||
| 
						 | 
				
			
			@ -204,6 +206,8 @@ router.get('/*/api/entities/*', async ctx => {
 | 
			
		|||
		props: sortParams(Object.entries(x.props).map(([k, v]) => parsePropDefinition(k, v))),
 | 
			
		||||
		propDefs: extractPropDefRef(x.props)
 | 
			
		||||
	}));
 | 
			
		||||
 | 
			
		||||
	ctx.set('Cache-Control', 'public, max-age=300');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
router.get('/*/*', async ctx => {
 | 
			
		||||
| 
						 | 
				
			
			@ -240,6 +244,8 @@ router.get('/*/*', async ctx => {
 | 
			
		|||
		title: md.match(/^# (.+?)\r?\n/)[1],
 | 
			
		||||
		src: `https://github.com/syuilo/misskey/tree/master/src/docs/${doc}.${lang}.md`
 | 
			
		||||
	}, await genVars(lang)));
 | 
			
		||||
 | 
			
		||||
	ctx.set('Cache-Control', 'public, max-age=300');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default router;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,6 +94,7 @@ router.get('/@:user', async (ctx, next) => {
 | 
			
		|||
 | 
			
		||||
	if (user != null) {
 | 
			
		||||
		await ctx.render('user', { user });
 | 
			
		||||
		ctx.set('Cache-Control', 'public, max-age=180');
 | 
			
		||||
	} else {
 | 
			
		||||
		// リモートユーザーなので
 | 
			
		||||
		await next();
 | 
			
		||||
| 
						 | 
				
			
			@ -110,6 +111,7 @@ router.get('/notes/:note', async ctx => {
 | 
			
		|||
			note: _note,
 | 
			
		||||
			summary: getNoteSummary(_note)
 | 
			
		||||
		});
 | 
			
		||||
		ctx.set('Cache-Control', 'public, max-age=180');
 | 
			
		||||
	} else {
 | 
			
		||||
		ctx.status = 404;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,6 +68,8 @@ router.get('/.well-known/webfinger', async ctx => {
 | 
			
		|||
			template: `${config.url}/authorize-follow?acct={uri}`
 | 
			
		||||
		}]
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	ctx.set('Cache-Control', 'public, max-age=180');
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
export default router;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue