From a8954fbf226b046ab8176b0c1fb9293dc113b770 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 26 Jan 2021 14:27:55 +0100 Subject: [PATCH] Update config parameter base_url -> public_url --- src/controllers/LinkController.ts | 2 +- src/models/FileModel.ts | 2 +- src/models/URLRedirect.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/LinkController.ts b/src/controllers/LinkController.ts index 6c4d335..ef1057d 100644 --- a/src/controllers/LinkController.ts +++ b/src/controllers/LinkController.ts @@ -108,7 +108,7 @@ export default class LinkController extends Controller { protected async domainFilter(req: Request, res: Response, next: NextFunction): Promise { if (req.hostname !== config.get('domain')) { - if (req.path === '/') return res.redirect(config.get('base_url')); + if (req.path === '/') return res.redirect(config.get('public_url')); throw new NotFoundHttpError('Page', req.url); } next(); diff --git a/src/models/FileModel.ts b/src/models/FileModel.ts index e7a19ea..328acf0 100644 --- a/src/models/FileModel.ts +++ b/src/models/FileModel.ts @@ -38,7 +38,7 @@ export default class FileModel extends Model { this.setValidation('ttl').defined().min(0).max(4294967295); } - public getURL(domain: string = config.get('base_url')): string { + public getURL(domain: string = config.get('public_url')): string { return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-file', { slug: this.getOrFail('slug'), }); diff --git a/src/models/URLRedirect.ts b/src/models/URLRedirect.ts index a9a1626..93d2deb 100644 --- a/src/models/URLRedirect.ts +++ b/src/models/URLRedirect.ts @@ -30,7 +30,7 @@ export default class URLRedirect extends Model { this.setValidation('target_url').defined().maxLength(1745).regexp(/^https?:\/\/.{3,259}?\/?/i); } - public getURL(domain: string = config.get('base_url')): string { + public getURL(domain: string = config.get('public_url')): string { return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-url', { slug: this.getOrFail('slug'), });