Handle /notes/ url too
This commit is contained in:
parent
3b100ad30f
commit
04b4101e55
|
@ -955,14 +955,19 @@ function SubComments({
|
|||
);
|
||||
}
|
||||
|
||||
const statusRegex = /\/@([^@\/]+)@?([^\/]+)?\/([^\/]+)\/?$/i;
|
||||
const statusNoteRegex = /\/notes\/([^\/]+)\/?$/i;
|
||||
function getInstanceStatusURL(url) {
|
||||
// Regex /:username/:id, where username = @username or @username@domain, id = anything
|
||||
const statusRegex = /\/@([^@\/]+)@?([^\/]+)?\/([^\/]+)\/?$/i;
|
||||
const { hostname, pathname } = new URL(url);
|
||||
const [, username, domain, id] = pathname.match(statusRegex) || [];
|
||||
if (id) {
|
||||
return `/${hostname}/s/${id}`;
|
||||
}
|
||||
const [, noteId] = pathname.match(statusNoteRegex) || [];
|
||||
if (noteId) {
|
||||
return `/${hostname}/s/${noteId}`;
|
||||
}
|
||||
}
|
||||
|
||||
export default StatusPage;
|
||||
|
|
Loading…
Reference in a new issue