mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
update
This commit is contained in:
1 parent
0c011f14b3
commit
f60aae282b
2 files changed
+112
-105
No files matched your search
@@ -71,21 +71,23 @@ export default class CommentThreadService {
|
||||
logger = devLogger,
|
||||
} = {}) {
|
||||
this.nostrClient = nostrClient;
|
||||
this.app = app;
|
||||
this.fetchVideoComments =
|
||||
typeof fetchVideoComments === "function"
|
||||
? fetchVideoComments
|
||||
: this.nostrClient &&
|
||||
typeof this.nostrClient.fetchVideoComments === "function"
|
||||
? (...args) => this.nostrClient.fetchVideoComments(...args)
|
||||
: null;
|
||||
this.subscribeVideoComments =
|
||||
typeof subscribeVideoComments === "function"
|
||||
? subscribeVideoComments
|
||||
: this.nostrClient &&
|
||||
typeof this.nostrClient.subscribeVideoComments === "function"
|
||||
? (...args) => this.nostrClient.subscribeVideoComments(...args)
|
||||
: null;
|
||||
this.fetchVideoComments = fetchVideoComments;
|
||||
this.subscribeVideoComments = subscribeVideoComments;
|
||||
|
||||
if (!this.fetchVideoComments && this.nostrClient) {
|
||||
const clientFetcher = this.nostrClient.fetchVideoComments;
|
||||
if (typeof clientFetcher === "function") {
|
||||
this.fetchVideoComments = (...args) => clientFetcher.apply(this.nostrClient, args);
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.subscribeVideoComments && this.nostrClient) {
|
||||
const clientSubscriber = this.nostrClient.subscribeVideoComments;
|
||||
if (typeof clientSubscriber === "function") {
|
||||
this.subscribeVideoComments = (...args) => clientSubscriber.apply(this.nostrClient, args);
|
||||
}
|
||||
}
|
||||
|
||||
this.getProfileCacheEntry =
|
||||
typeof getProfileCacheEntry === "function"
|
||||
? getProfileCacheEntry
|
||||
@@ -156,6 +158,17 @@ export default class CommentThreadService {
|
||||
} = {}) {
|
||||
this.teardown();
|
||||
|
||||
if (typeof this.nostrClient?.ensurePool === "function") {
|
||||
try {
|
||||
await this.nostrClient.ensurePool();
|
||||
} catch (error) {
|
||||
this.emitError(
|
||||
new Error("Unable to initialize Nostr pool before loading comments."),
|
||||
);
|
||||
return { success: false, error };
|
||||
}
|
||||
}
|
||||
|
||||
const rawVideoAuthorPubkey = normalizeString(video?.pubkey);
|
||||
|
||||
this.videoEventId = normalizeString(video?.id);
|
||||
|
||||
Reference in new issue
Block a user