fedimbed.bluesky: support did:web:

This commit is contained in:
Cynthia Foxwell 2025-02-26 10:57:57 -07:00
parent 0d78c16e69
commit cb503762a7
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -17,7 +17,8 @@ const FRIENDLY_USERAGENT = "HiddenPhox/fedimbed (https://gitdab.com/Cynosphere/H
const URLS_REGEX = /(?:\s|^|\]\()(\|\|\s*)?(https?:\/\/[^\s<]+[^<.,:;"'\]|)\s])(\s*\)?\|\||\s*[\S]*?\))?/g;
const SPOILER_REGEX = /(?:\s|^)\|\|([\s\S]+?)\|\|/;
const BSKY_POST_REGEX = /^\/profile\/(did:plc:[a-z0-9]+|[a-z0-9][a-z0-9.-]+[a-z0-9]*)\/post\/([a-z0-9]+)\/?$/i;
const BSKY_POST_REGEX =
/^\/profile\/(did:plc:[a-z0-9]+|(did:web:)?[a-z0-9][a-z0-9.-]+[a-z0-9]*)\/post\/([a-z0-9]+)\/?$/i;
const PATH_REGEX = {
mastodon: /^\/@(.+?)\/(\d+)\/?/,
@ -326,7 +327,7 @@ async function bluesky(msg, url, spoiler = false) {
const postMatch = urlObj.pathname.match(BSKY_POST_REGEX);
if (!postMatch) return {};
const [_, user, postId] = postMatch;
const [, user, , postId] = postMatch;
const postUri = `at://${user}/app.bsky.feed.post/${postId}`;
const res = await fetch(