mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
18 lines
431 B
TypeScript
18 lines
431 B
TypeScript
import UriTemplate from 'uri-templates';
|
|
|
|
export function proxyUrl(template: string, url: string | URL): string {
|
|
const u = new URL(url);
|
|
return UriTemplate(template).fill({
|
|
href: u.href,
|
|
origin: u.origin,
|
|
protocol: u.protocol,
|
|
username: u.username,
|
|
password: u.password,
|
|
host: u.host,
|
|
hostname: u.hostname,
|
|
port: u.port,
|
|
pathname: u.pathname,
|
|
hash: u.hash,
|
|
search: u.search,
|
|
});
|
|
} |