style: enter

This commit is contained in:
monoid 2022-06-29 17:03:25 +09:00
parent 15bbad7dfe
commit 8758e78f88
3 changed files with 5 additions and 4 deletions

View File

@ -35,7 +35,7 @@ export class ComicReferrer extends createDefaultClass("comic"){
const data = (await readAllFromZip(zip,entry)).toString('utf-8'); const data = (await readAllFromZip(zip,entry)).toString('utf-8');
this.desc = JSON.parse(data); this.desc = JSON.parse(data);
if(this.desc === undefined) if(this.desc === undefined)
throw new Error(`??? JSON.parse is returning undefined. ${this.path} desc.json format error`); throw new Error(`JSON.parse is returning undefined. ${this.path} desc.json format error`);
} }
async createDocumentBody(): Promise<DocumentBody>{ async createDocumentBody(): Promise<DocumentBody>{

View File

@ -35,7 +35,8 @@ export enum Permission{
modifyTagDesc = 'ModifyTagDesc', modifyTagDesc = 'ModifyTagDesc',
} }
export const createPermissionCheckMiddleware = (...permissions:string[]) => async (ctx: Koa.ParameterizedContext<UserState>,next:Koa.Next)=>{ export const createPermissionCheckMiddleware = (...permissions:string[]) =>
async (ctx: Koa.ParameterizedContext<UserState>,next:Koa.Next) => {
const user = ctx.state['user']; const user = ctx.state['user'];
if(user.username === "admin"){ if(user.username === "admin"){
return await next(); return await next();

View File

@ -153,7 +153,7 @@ export const getContentRouter = (controller: DocumentAccessor)=>{
ret.del("/:num(\\d+)/tags/:tag",PerCheck(Per.ModifyTag),DelTagHandler(controller)); ret.del("/:num(\\d+)/tags/:tag",PerCheck(Per.ModifyTag),DelTagHandler(controller));
ret.del("/:num(\\d+)",AdminOnly,DeleteContentHandler(controller)); ret.del("/:num(\\d+)",AdminOnly,DeleteContentHandler(controller));
ret.all("/:num(\\d+)/(.*)",PerCheck(Per.QueryContent),ContentHandler(controller)); ret.all("/:num(\\d+)/(.*)",PerCheck(Per.QueryContent),ContentHandler(controller));
ret.use("/:num",PerCheck(Per.QueryContent),(new AllContentRouter).routes()); ret.use("/:num(\\d+)",PerCheck(Per.QueryContent),(new AllContentRouter).routes());
return ret; return ret;
} }