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 ", 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')], });