style: enter
This commit is contained in:
parent
15bbad7dfe
commit
8758e78f88
@ -34,8 +34,8 @@ export class ComicReferrer extends createDefaultClass("comic"){
|
||||
}
|
||||
const data = (await readAllFromZip(zip,entry)).toString('utf-8');
|
||||
this.desc = JSON.parse(data);
|
||||
if(this.desc === undefined)
|
||||
throw new Error(`??? JSON.parse is returning undefined. ${this.path} desc.json format error`);
|
||||
if(this.desc === undefined)
|
||||
throw new Error(`JSON.parse is returning undefined. ${this.path} desc.json format error`);
|
||||
}
|
||||
|
||||
async createDocumentBody(): Promise<DocumentBody>{
|
||||
|
@ -35,7 +35,8 @@ export enum Permission{
|
||||
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'];
|
||||
if(user.username === "admin"){
|
||||
return await next();
|
||||
|
@ -153,7 +153,7 @@ export const getContentRouter = (controller: DocumentAccessor)=>{
|
||||
ret.del("/:num(\\d+)/tags/:tag",PerCheck(Per.ModifyTag),DelTagHandler(controller));
|
||||
ret.del("/:num(\\d+)",AdminOnly,DeleteContentHandler(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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user