Merge branch 'develop'

This commit is contained in:
Alice Gaudon 2020-07-06 16:11:42 +02:00
commit 705a18ce2d
3 changed files with 5 additions and 4 deletions

View File

@ -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 <alice@gaudon.pro>",

View File

@ -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<string[]>('allowed_url_domains');
res.render('file-upload', {
max_upload_size: config.get<string>('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<number>('default_url_domain_for_files')],
});

View File

@ -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<void> {
const allowedDomains = config.get<string[]>('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<number>('default_url_domain_for_urls')],
});