mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-22 01:05:34 +03:00
Handle elk links
This commit is contained in:
parent
da425b4a70
commit
9b0e63d289
1 changed files with 6 additions and 1 deletions
|
@ -1836,7 +1836,12 @@ function _unfurlMastodonLink(instance, url) {
|
|||
console.debug('🦦 Unfurling URL', url);
|
||||
|
||||
let remoteInstanceFetch;
|
||||
const urlObj = new URL(url);
|
||||
let theURL = url;
|
||||
if (/\/\/elk\.[^\/]+\/[^.]+\.[^.]+/i.test(theURL)) {
|
||||
// E.g. https://elk.zone/domain.com/@stest/123 -> https://domain.com/@stest/123
|
||||
theURL = theURL.replace(/elk\.[^\/]+\//i, '');
|
||||
}
|
||||
const urlObj = new URL(theURL);
|
||||
const domain = urlObj.hostname;
|
||||
const path = urlObj.pathname;
|
||||
// Regex /:username/:id, where username = @username or @username@domain, id = number
|
||||
|
|
Loading…
Reference in a new issue