This commit is contained in:
@ -1,7 +1,11 @@
|
||||
import * as Router from "koa-router";
|
||||
import AdminRoute from "./admin";
|
||||
import { DatabaseManager } from "../../database/database";
|
||||
import { NotFoundError, NoPermissionError, BadRequestError } from "../helper/errors";
|
||||
import {
|
||||
NotFoundError,
|
||||
NoPermissionError,
|
||||
BadRequestError
|
||||
} from "../helper/errors";
|
||||
import Logging from "@hibas123/nodelogging";
|
||||
import Session from "../../database/session";
|
||||
import nanoid = require("nanoid");
|
||||
@ -28,7 +32,7 @@ V1.post("/db/:database/query", async ctx => {
|
||||
|
||||
if (db.accesskey) {
|
||||
if (!accesskey || accesskey !== db.accesskey) {
|
||||
throw new NoPermissionError("");
|
||||
throw new NoPermissionError("Invalid Access Key");
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +40,6 @@ V1.post("/db/:database/query", async ctx => {
|
||||
let res = await verifyJWT(authkey, db.publickey);
|
||||
if (!res || !res.uid) {
|
||||
throw new BadRequestError("Invalid JWT");
|
||||
return;
|
||||
} else {
|
||||
session.uid = res.uid;
|
||||
}
|
||||
@ -54,6 +57,6 @@ V1.post("/db/:database/query", async ctx => {
|
||||
throw new BadRequestError(err.message);
|
||||
}
|
||||
throw err;
|
||||
})
|
||||
})
|
||||
export default V1;
|
||||
});
|
||||
});
|
||||
export default V1;
|
||||
|
Reference in New Issue
Block a user