feat: make internal app URLs permalinks (#329)

This commit is contained in:
Daniel Roe 2022-12-04 19:56:33 +00:00 committed by GitHub
parent 4f8f2ed1f1
commit eb022c92e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 99 additions and 51 deletions

View file

@ -18,15 +18,14 @@ function handleMention(el: Element) {
const matchUser = href.value.match(UserLinkRE)
if (matchUser) {
const [, server, username] = matchUser
// Handles need to ignore server subdomains
const handle = `@${username}@${server.replace(/(.+\.)(.+\..+)/, '$2')}`
href.value = `/${handle}`
href.value = `/${server}/@${username}`
return h(AccountHoverWrapper, { handle, class: 'inline-block' }, () => nodeToVNode(el))
}
const matchTag = href.value.match(TagLinkRE)
if (matchTag) {
const [, , name] = matchTag
href.value = `/tags/${name}`
href.value = `/${currentServer.value}/tags/${name}`
}
}
}