Browse Source

Update config parameter base_url -> public_url

develop
Alice Gaudon 1 month ago
parent
commit
a8954fbf22
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      src/controllers/LinkController.ts
  2. +1
    -1
      src/models/FileModel.ts
  3. +1
    -1
      src/models/URLRedirect.ts

+ 1
- 1
src/controllers/LinkController.ts 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();


+ 1
- 1
src/models/FileModel.ts 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'),
});


+ 1
- 1
src/models/URLRedirect.ts 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'),
});


Loading…
Cancel
Save