parent
							
								
									00e2ce9489
								
							
						
					
					
						commit
						4662641feb
					
				
					 1 changed files with 15 additions and 10 deletions
				
			
		| 
						 | 
					@ -8,6 +8,7 @@ import * as Router from 'koa-router';
 | 
				
			||||||
import * as send from 'koa-send';
 | 
					import * as send from 'koa-send';
 | 
				
			||||||
import * as favicon from 'koa-favicon';
 | 
					import * as favicon from 'koa-favicon';
 | 
				
			||||||
import * as views from 'koa-views';
 | 
					import * as views from 'koa-views';
 | 
				
			||||||
 | 
					import { ObjectID } from 'mongodb';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import docs from './docs';
 | 
					import docs from './docs';
 | 
				
			||||||
import packFeed from './feed';
 | 
					import packFeed from './feed';
 | 
				
			||||||
| 
						 | 
					@ -149,18 +150,22 @@ router.get('/@:user', async (ctx, next) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Note
 | 
					// Note
 | 
				
			||||||
router.get('/notes/:note', async ctx => {
 | 
					router.get('/notes/:note', async ctx => {
 | 
				
			||||||
	const note = await Note.findOne({ _id: ctx.params.note });
 | 
						if (ObjectID.isValid(ctx.params.note)) {
 | 
				
			||||||
 | 
							const note = await Note.findOne({ _id: ctx.params.note });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (note != null) {
 | 
							if (note) {
 | 
				
			||||||
		const _note = await packNote(note);
 | 
								const _note = await packNote(note);
 | 
				
			||||||
		await ctx.render('note', {
 | 
								await ctx.render('note', {
 | 
				
			||||||
			note: _note,
 | 
									note: _note,
 | 
				
			||||||
			summary: getNoteSummary(_note)
 | 
									summary: getNoteSummary(_note)
 | 
				
			||||||
		});
 | 
								});
 | 
				
			||||||
		ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
 | 
								ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
 | 
				
			||||||
	} else {
 | 
								
 | 
				
			||||||
		ctx.status = 404;
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ctx.status = 404;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
//#endregion
 | 
					//#endregion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue