Fix typescript errors and update depencies
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
05bef4fd49
commit
7c0d5949ab
2897
package-lock.json
generated
2897
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
22
package.json
22
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "open_auth_service",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.2",
|
||||
"main": "lib/index.js",
|
||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||
"license": "MIT",
|
||||
@ -20,7 +20,7 @@
|
||||
"install-views_repo": "git submodule init && git submodule update && cd views_repo && npm install ",
|
||||
"build-views_repo": "cd views_repo && npm run build",
|
||||
"watch-views_repo": "cd views_repo && npm run dev",
|
||||
"format": "prettier --write ."
|
||||
"format": "prettier --write \"src/**\""
|
||||
},
|
||||
"pipelines": {
|
||||
"install": [
|
||||
@ -36,23 +36,23 @@
|
||||
"@types/cookie-parser": "^1.4.2",
|
||||
"@types/dotenv": "^8.2.0",
|
||||
"@types/express": "^4.17.3",
|
||||
"@types/i18n": "^0.8.6",
|
||||
"@types/i18n": "^0.12.0",
|
||||
"@types/ini": "^1.3.30",
|
||||
"@types/jsonwebtoken": "^8.3.8",
|
||||
"@types/mongodb": "^3.5.2",
|
||||
"@types/node": "^13.9.0",
|
||||
"@types/node": "^14.14.14",
|
||||
"@types/node-rsa": "^1.0.0",
|
||||
"@types/qrcode": "^1.3.4",
|
||||
"@types/speakeasy": "^2.0.5",
|
||||
"@types/uuid": "^7.0.0",
|
||||
"apidoc": "^0.20.0",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"apidoc": "^0.25.0",
|
||||
"concurrently": "^5.1.0",
|
||||
"nodemon": "^2.0.2",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.8.3"
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hibas123/config": "^1.1.0",
|
||||
"@hibas123/config": "^1.1.1",
|
||||
"@hibas123/nodelogging": "^2.1.4",
|
||||
"@hibas123/nodeloggingserver_client": "^1.1.2",
|
||||
"@hibas123/safe_mongo": "^1.6.1",
|
||||
@ -63,8 +63,8 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"express": "^4.17.1",
|
||||
"handlebars": "^4.7.3",
|
||||
"i18n": "^0.8.5",
|
||||
"ini": "^1.3.5",
|
||||
"i18n": "^0.13.2",
|
||||
"ini": "^2.0.0",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"moment": "^2.24.0",
|
||||
"mongodb": "^3.5.4",
|
||||
@ -74,6 +74,6 @@
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"speakeasy": "^2.0.0",
|
||||
"u2f": "^0.1.3",
|
||||
"uuid": "^7.0.2"
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ ClientRouter.route("/:id")
|
||||
true
|
||||
),
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let { id } = req.query;
|
||||
let { id } = req.query as { [key: string]: string };
|
||||
let client = await Client.findById(id);
|
||||
if (!client)
|
||||
throw new RequestError(
|
||||
|
@ -28,7 +28,7 @@ PermissionRoute.route("/")
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let query = {};
|
||||
if (req.query.client) {
|
||||
query = { client: new ObjectID(req.query.client) };
|
||||
query = { client: new ObjectID(req.query.client as string) };
|
||||
}
|
||||
let permissions = await Permission.find(query);
|
||||
res.json(permissions);
|
||||
@ -102,7 +102,7 @@ PermissionRoute.route("/")
|
||||
*/
|
||||
.delete(
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let { id } = req.query;
|
||||
let { id } = req.query as { [key: string]: string };
|
||||
await Permission.delete(id);
|
||||
res.json({ success: true });
|
||||
})
|
||||
|
@ -40,7 +40,7 @@ RegCodeRoute.route("/")
|
||||
*/
|
||||
.delete(
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let { id } = req.query;
|
||||
let { id } = req.query as { [key: string]: string };
|
||||
await RegCode.delete(id);
|
||||
res.json({ success: true });
|
||||
})
|
||||
|
@ -51,7 +51,7 @@ UserRoute.route("/")
|
||||
*/
|
||||
.delete(
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let { id } = req.query;
|
||||
let { id } = req.query as { [key: string]: string };
|
||||
let user = await User.findById(id);
|
||||
|
||||
await Promise.all([
|
||||
@ -83,7 +83,7 @@ UserRoute.route("/")
|
||||
*/
|
||||
.put(
|
||||
promiseMiddleware(async (req, res) => {
|
||||
let { id } = req.query;
|
||||
let { id } = req.query as { [key: string]: string };
|
||||
let user = await User.findById(id);
|
||||
user.admin = !user.admin;
|
||||
await User.save(user);
|
||||
|
@ -14,7 +14,7 @@ import { ObjectID } from "mongodb";
|
||||
export const GetPermissions = Stacker(
|
||||
GetClientAuthMiddleware(true),
|
||||
async (req: Request, res: Response) => {
|
||||
const { user, permission } = req.query;
|
||||
const { user, permission } = req.query as { [key: string]: string };
|
||||
|
||||
let permissions: { id: string; name: string; description: string }[];
|
||||
let users: string[];
|
||||
@ -22,7 +22,7 @@ export const GetPermissions = Stacker(
|
||||
if (user) {
|
||||
const grant = await Grant.findOne({
|
||||
client: req.client._id,
|
||||
user: user,
|
||||
user: new ObjectID(user),
|
||||
});
|
||||
|
||||
permissions = await Promise.all(
|
||||
|
@ -10,7 +10,7 @@ export const OAuthInternalApp = Stacker(
|
||||
GetClientAuthMiddleware(false, true),
|
||||
UserMiddleware,
|
||||
async (req: Request, res: Response) => {
|
||||
let { redirect_uri, state } = req.query;
|
||||
let { redirect_uri, state } = req.query as { [key: string]: string };
|
||||
if (!redirect_uri) {
|
||||
throw new RequestError(
|
||||
"No redirect url set!",
|
||||
|
@ -70,8 +70,9 @@ export function GetClientApiAuthMiddleware(permissions?: string[]) {
|
||||
req.__("You are not logged in or your login is expired"),
|
||||
HttpStatusCode.UNAUTHORIZED
|
||||
);
|
||||
let token: string =
|
||||
req.query.access_token || req.headers.authorization;
|
||||
let token =
|
||||
(req.query.access_token as string) ||
|
||||
(req.headers.authorization as string);
|
||||
if (!token) throw invalid_err;
|
||||
|
||||
if (token.toLowerCase().startsWith("bearer "))
|
||||
|
@ -31,7 +31,7 @@ export function GetUserMiddleware(
|
||||
throw new Invalid(req.__(message));
|
||||
};
|
||||
try {
|
||||
let { login, special } = req.query;
|
||||
let { login, special } = req.query as { [key: string]: string };
|
||||
if (!login) {
|
||||
login = req.cookies.login;
|
||||
special = req.cookies.special;
|
||||
|
@ -94,7 +94,7 @@ const GetAuthRoute = (view = false) =>
|
||||
scope = "",
|
||||
state,
|
||||
nored,
|
||||
} = req.query;
|
||||
} = req.query as { [key: string]: string };
|
||||
const sendError = (type) => {
|
||||
if (redirect_uri === "$local") redirect_uri = "/code";
|
||||
res.redirect(
|
||||
@ -178,8 +178,10 @@ const GetAuthRoute = (view = false) =>
|
||||
|
||||
if (!grant && missing_permissions.length > 0) {
|
||||
await new Promise<void>((yes, no) =>
|
||||
GetUserMiddleware(false, true)(req, res, (err?: Error) =>
|
||||
err ? no(err) : yes()
|
||||
GetUserMiddleware(false, true)(
|
||||
req,
|
||||
res,
|
||||
(err?: Error | string) => (err ? no(err) : yes())
|
||||
)
|
||||
); // Maybe unresolved when redirect is happening
|
||||
|
||||
|
@ -7,7 +7,7 @@ import Client from "../../models/client";
|
||||
import { getAccessTokenJWT } from "../../helper/jwt";
|
||||
|
||||
const JWTRoute = promiseMiddleware(async (req: Request, res: Response) => {
|
||||
let { refreshtoken } = req.query;
|
||||
let { refreshtoken } = req.query as { [key: string]: string };
|
||||
if (!refreshtoken)
|
||||
throw new RequestError(
|
||||
req.__("Refresh token not set"),
|
||||
|
@ -9,9 +9,9 @@ import * as crypto from "crypto";
|
||||
import Logging from "@hibas123/nodelogging";
|
||||
|
||||
const Login = promiseMiddleware(async (req: Request, res: Response) => {
|
||||
let type = req.query.type;
|
||||
let type = req.query.type as string;
|
||||
if (type === "username") {
|
||||
let { username, uid } = req.query;
|
||||
let { username, uid } = req.query as { [key: string]: string };
|
||||
let user = await User.findOne(
|
||||
username ? { username: username.toLowerCase() } : { uid: uid }
|
||||
);
|
||||
|
@ -7,5 +7,7 @@ if (Config.database) {
|
||||
if (Config.database.host) host = Config.database.host;
|
||||
}
|
||||
if (Config.core.dev) dbname += "_dev";
|
||||
const DB = new SafeMongo("mongodb://" + host, dbname);
|
||||
const DB = new SafeMongo("mongodb://" + host, dbname, {
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
export default DB;
|
||||
|
Loading…
Reference in New Issue
Block a user