kopia lustrzana https://github.com/cloudflare/wildebeest
11 wiersze
341 B
TypeScript
11 wiersze
341 B
TypeScript
// Naive way of transforming an Actor ObjectID into a handle like WebFinger uses
|
|
export function urlToHandle(input: URL): string {
|
|
const { pathname, host } = input
|
|
const parts = pathname.split('/')
|
|
if (parts.length === 0) {
|
|
throw new Error('malformed URL')
|
|
}
|
|
const localPart = parts[parts.length - 1]
|
|
return `${localPart}@${host}`
|
|
}
|