api/src/services/url: support for longer Loom URL variant containing content ID

This commit is contained in:
Satya Ananda 2024-10-11 01:42:01 +07:00 committed by jj
parent 07947882c4
commit ab52297613
No known key found for this signature in database

View File

@ -98,6 +98,15 @@ function aliasURL(url) {
if (url.hostname === 'xhslink.com' && parts.length === 3) {
url = new URL(`https://www.xiaohongshu.com/a/${parts[2]}`);
}
break;
case "loom":
const idPart = parts[parts.length - 1];
if(idPart.length > 32){
const actualIdPart = idPart.slice(-32);
url.pathname = `/share/${actualIdPart}`;
}
break;
}
return url;