Update config parameter base_url -> public_url
This commit is contained in:
parent
42c49974ea
commit
a8954fbf22
@ -108,7 +108,7 @@ export default class LinkController extends Controller {
|
|||||||
|
|
||||||
protected async domainFilter(req: Request, res: Response, next: NextFunction): Promise<void> {
|
protected async domainFilter(req: Request, res: Response, next: NextFunction): Promise<void> {
|
||||||
if (req.hostname !== config.get('domain')) {
|
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);
|
throw new NotFoundHttpError('Page', req.url);
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
@ -38,7 +38,7 @@ export default class FileModel extends Model {
|
|||||||
this.setValidation('ttl').defined().min(0).max(4294967295);
|
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', {
|
return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-file', {
|
||||||
slug: this.getOrFail('slug'),
|
slug: this.getOrFail('slug'),
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,7 @@ export default class URLRedirect extends Model {
|
|||||||
this.setValidation('target_url').defined().maxLength(1745).regexp(/^https?:\/\/.{3,259}?\/?/i);
|
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', {
|
return (/^https?:\/\//.test(domain) ? '' : 'https://') + domain + Controller.route('get-url', {
|
||||||
slug: this.getOrFail('slug'),
|
slug: this.getOrFail('slug'),
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user