From 49cc9f37e4e0a02a484bae304912a1ed67a2c316 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 6 Jul 2020 16:11:02 +0200 Subject: [PATCH 1/2] Fix auth tokens table display --- src/controllers/FileController.ts | 5 ++--- src/controllers/URLRedirectController.ts | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/FileController.ts b/src/controllers/FileController.ts index 3fd9e7d..0bed7a7 100644 --- a/src/controllers/FileController.ts +++ b/src/controllers/FileController.ts @@ -1,5 +1,5 @@ import Controller from "wms-core/Controller"; -import {REQUIRE_AUTH_MIDDLEWARE, REQUIRE_REQUEST_AUTH_MIDDLEWARE} from "wms-core/auth/AuthComponent"; +import {REQUIRE_AUTH_MIDDLEWARE} from "wms-core/auth/AuthComponent"; import {NextFunction, Request, Response} from "express"; import {BadRequestError, ForbiddenHttpError, ServerError} from "wms-core/HttpError"; import FileModel from "../models/FileModel"; @@ -8,7 +8,6 @@ import * as fs from "fs"; import AuthToken from "../models/AuthToken"; import {IncomingForm} from "formidable"; import {FILE_UPLOAD_MIDDLEWARE} from "wms-core/components/ExpressAppComponent"; -import Logger from "wms-core/Logger"; import generateSlug from "../SlugGenerator"; @@ -25,7 +24,7 @@ export default class FileController extends Controller { const allowedDomains = config.get('allowed_url_domains'); res.render('file-upload', { max_upload_size: config.get('max_upload_size'), - auth_tokens: await AuthToken.select().where('user_id', req.models.user!.id!), + auth_tokens: await AuthToken.select().where('user_id', req.models.user!.id!).get(), allowed_domains: allowedDomains, default_domain: allowedDomains[config.get('default_url_domain_for_files')], }); diff --git a/src/controllers/URLRedirectController.ts b/src/controllers/URLRedirectController.ts index 4eb2eca..1b37f81 100644 --- a/src/controllers/URLRedirectController.ts +++ b/src/controllers/URLRedirectController.ts @@ -4,6 +4,7 @@ import URLRedirect from "../models/URLRedirect"; import {REQUIRE_AUTH_MIDDLEWARE} from "wms-core/auth/AuthComponent"; import generateSlug from "../SlugGenerator"; import config from "config"; +import AuthToken from "../models/AuthToken"; export default class URLRedirectController extends Controller { routes(): void { @@ -16,6 +17,7 @@ export default class URLRedirectController extends Controller { protected async getURLShrinker(req: Request, res: Response): Promise { const allowedDomains = config.get('allowed_url_domains'); res.render('url-shrinker', { + auth_tokens: await AuthToken.select().where('user_id', req.models.user!.id!).get(), allowed_domains: allowedDomains, default_domain: allowedDomains[config.get('default_url_domain_for_urls')], }); From d15a4172abcbe55e1fa828f720960dce4a23d425 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Mon, 6 Jul 2020 16:11:36 +0200 Subject: [PATCH 2/2] Version 0.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 850a826..f708f9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ily.li", - "version": "0.4.0", + "version": "0.4.1", "description": "Self-hosted file pusher", "repository": "git@gitlab.com:ArisuOngaku/ily.li.git", "author": "Alice Gaudon ",