Enabling rules
Some checks failed
continuous-integration/drone/tag Build is failing

This commit is contained in:
Fabian Stamm
2020-03-24 15:16:21 +01:00
parent 88b0cb68d8
commit 1434036b42
6 changed files with 565 additions and 603 deletions

View File

@ -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;