2022-10-05 17:08:17 +00:00
|
|
|
import {Redirect} from './base.js';
|
|
|
|
|
|
|
|
export type HostnameParameters = {
|
|
|
|
hostname: string;
|
|
|
|
type: 'hostname';
|
|
|
|
};
|
|
|
|
|
|
|
|
export class HostnameRedirect extends Redirect<HostnameParameters> {
|
|
|
|
public redirect(url: URL | string): URL {
|
|
|
|
const redirected = new URL(url);
|
|
|
|
redirected.hostname = this.parameters.hostname;
|
|
|
|
return redirected;
|
|
|
|
}
|
2022-10-18 20:00:42 +00:00
|
|
|
|
|
|
|
public get redirectValue(): string {
|
|
|
|
return this.parameters.hostname;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set redirectValue(value: string) {
|
|
|
|
this.parameters.hostname = value;
|
|
|
|
}
|
2022-10-05 17:08:17 +00:00
|
|
|
}
|