+9
-9
scanner.js
+9
-9
scanner.js
···
98
98
if (url.match(/^at:\/\/did:[^/]+\/app\.bsky\.feed\.post\/[\w]+$/)) {
99
99
atURI = url;
100
100
} else {
101
-
let match = url.match(/^https:\/\/bsky\.app\/profile\/([^/]+)\/?$/);
101
+
let match = url.match(/^https:\/\/(bsky\.app|main\.bsky\.dev)\/profile\/([^/]+)\/?$/);
102
102
103
-
if (match && match[1].startsWith('did:')) {
104
-
return await scanAccount(match[1]);
103
+
if (match && match[2].startsWith('did:')) {
104
+
return await scanAccount(match[2]);
105
105
} else if (match) {
106
-
return await scanHandle(match[1]);
106
+
return await scanHandle(match[2]);
107
107
} else {
108
-
let match = url.match(/^https:\/\/bsky\.app\/profile\/([^/]+)\/post\/([\w]+)\/?$/);
108
+
let match = url.match(/^https:\/\/(bsky\.app|main\.bsky\.dev)\/profile\/([^/]+)\/post\/([\w]+)\/?$/);
109
109
110
-
if (match && match[1].startsWith('did:')) {
111
-
atURI = `at://${match[1]}/app.bsky.feed.post/${match[2]}`;
110
+
if (match && match[2].startsWith('did:')) {
111
+
atURI = `at://${match[2]}/app.bsky.feed.post/${match[3]}`;
112
112
} else if (match) {
113
-
let json = await appView.getRequest('com.atproto.identity.resolveHandle', { handle: match[1] });
114
-
atURI = `at://${json.did}/app.bsky.feed.post/${match[2]}`;
113
+
let json = await appView.getRequest('com.atproto.identity.resolveHandle', { handle: match[2] });
114
+
atURI = `at://${json.did}/app.bsky.feed.post/${match[3]}`;
115
115
} else {
116
116
throw 'Invalid URL';
117
117
}