nuxt-bluesky-comments 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as AtProtoAPI from "@atproto/api";
|
|
2
2
|
import type { FlattenedComment } from "../types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Parse a Bluesky web URL into handle/DID and rkey.
|
|
@@ -23,4 +23,4 @@ export type ProcessRepliesOptions = {
|
|
|
23
23
|
*/
|
|
24
24
|
flattenSameAuthorThreads?: boolean;
|
|
25
25
|
};
|
|
26
|
-
export declare function processReplies(replies: AppBskyFeedDefs.ThreadViewPost["replies"], parentAuthorDid?: string, depth?: number, options?: ProcessRepliesOptions): FlattenedComment[];
|
|
26
|
+
export declare function processReplies(replies: AtProtoAPI.AppBskyFeedDefs.ThreadViewPost["replies"], parentAuthorDid?: string, depth?: number, options?: ProcessRepliesOptions): FlattenedComment[];
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as AtProtoAPI from "@atproto/api";
|
|
2
2
|
export function parseBlueskyUrl(url) {
|
|
3
3
|
const match = url.match(/https?:\/\/bsky\.app\/profile\/([^/]+)\/post\/([^/?#]+)/);
|
|
4
4
|
if (!match) return null;
|
|
5
|
-
const
|
|
5
|
+
const identifier = match[1];
|
|
6
|
+
const rkey = match[2];
|
|
7
|
+
if (!identifier || !rkey) return null;
|
|
6
8
|
return { identifier, rkey };
|
|
7
9
|
}
|
|
8
10
|
export function uriToUrl(uri, handle) {
|
|
@@ -17,7 +19,7 @@ export function processReplies(replies, parentAuthorDid, depth = 0, options = {}
|
|
|
17
19
|
const flattenSameAuthorThreads = options.flattenSameAuthorThreads ?? true;
|
|
18
20
|
const groups = [];
|
|
19
21
|
for (const reply of replies) {
|
|
20
|
-
if (!AppBskyFeedDefs.isThreadViewPost(reply)) continue;
|
|
22
|
+
if (!AtProtoAPI.AppBskyFeedDefs.isThreadViewPost(reply)) continue;
|
|
21
23
|
const post = reply.post;
|
|
22
24
|
const author = post.author;
|
|
23
25
|
const record = post.record;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ref, computed } from "vue";
|
|
2
|
-
import
|
|
2
|
+
import * as AtProtoAPI from "@atproto/api";
|
|
3
3
|
import {
|
|
4
4
|
parseBlueskyUrl,
|
|
5
5
|
processReplies,
|
|
6
6
|
uriToUrl
|
|
7
7
|
} from "./blueskyComments.logic.js";
|
|
8
|
-
const agent = new AtpAgent({
|
|
8
|
+
const agent = new AtProtoAPI.AtpAgent({
|
|
9
9
|
service: "https://public.api.bsky.app"
|
|
10
10
|
});
|
|
11
11
|
export function useBlueskyComments(uriOrUrl, options = {}) {
|
|
@@ -51,11 +51,11 @@ export function useBlueskyComments(uriOrUrl, options = {}) {
|
|
|
51
51
|
throw new Error(`Failed to fetch post: ${uri}`);
|
|
52
52
|
}
|
|
53
53
|
const { data } = response;
|
|
54
|
-
if (!AppBskyFeedDefs.isThreadViewPost(data.thread)) {
|
|
55
|
-
if (AppBskyFeedDefs.isBlockedPost(data.thread)) {
|
|
54
|
+
if (!AtProtoAPI.AppBskyFeedDefs.isThreadViewPost(data.thread)) {
|
|
55
|
+
if (AtProtoAPI.AppBskyFeedDefs.isBlockedPost(data.thread)) {
|
|
56
56
|
throw new Error("This post is from a blocked account");
|
|
57
57
|
}
|
|
58
|
-
if (AppBskyFeedDefs.isNotFoundPost(data.thread)) {
|
|
58
|
+
if (AtProtoAPI.AppBskyFeedDefs.isNotFoundPost(data.thread)) {
|
|
59
59
|
throw new Error(`Post not found: ${uri}`);
|
|
60
60
|
}
|
|
61
61
|
throw new Error("Post not found or not accessible");
|