Update config parameter base_url -> public_url

This commit is contained in:
Alice Gaudon 2021-01-26 14:27:55 +01:00
parent 42c49974ea
commit a8954fbf22
3 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ export default class LinkController extends Controller {
protected async domainFilter(req: Request, res: Response, next: NextFunction): Promise<void> {
if (req.hostname !== config.get('domain')) {
if (req.path === '/') return res.redirect(config.get<string>('base_url'));
if (req.path === '/') return res.redirect(config.get<string>('public_url'));
throw new NotFoundHttpError('Page', req.url);
}
next();

View File

@ -38,7 +38,7 @@ export default class FileModel extends Model {
this.setValidation('ttl').defined().min(0).max(4294967295);
}
public getURL(domain: string = config.get<string>('base_url')): string {
public getURL(domain: string = config.get<string>('public_url')): string {
return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-file', {
slug: this.getOrFail('slug'),
});

View File

@ -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<string>('base_url')): string {
public getURL(domain: string = config.get<string>('public_url')): string {
return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-url', {
slug: this.getOrFail('slug'),
});