mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 02:42:28 +00:00
Merge branch 'unstable' into refactor/remove-execCommand-9205199539301717530
This commit is contained in:
7 files changed
+209
-77
No files matched your search
@@ -25,8 +25,6 @@ import {
|
||||
DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD,
|
||||
FEED_TYPES,
|
||||
} from "./constants.js";
|
||||
import { attachHealthBadges } from "./gridHealth.js";
|
||||
import { attachUrlHealthBadges } from "./urlHealthObserver.js";
|
||||
import { updateVideoCardSourceVisibility } from "./utils/cardSourceVisibility.js";
|
||||
import { collectVideoTags } from "./utils/videoTags.js";
|
||||
import { normalizeHashtag } from "./utils/hashtagNormalization.js";
|
||||
|
||||
+69
-67
@@ -2889,80 +2889,82 @@ export class NostrClient {
|
||||
const revertSummaries = [];
|
||||
const revertEvents = [];
|
||||
|
||||
for (const vid of matchingEvents.values()) {
|
||||
const baseRoot =
|
||||
(typeof vid.videoRootId === "string" && vid.videoRootId) ||
|
||||
inferredRoot ||
|
||||
(targetVideo && typeof targetVideo.videoRootId === "string"
|
||||
? targetVideo.videoRootId
|
||||
: "") ||
|
||||
(targetVideo ? targetVideo.id : "") ||
|
||||
vid.id;
|
||||
await Promise.all(
|
||||
Array.from(matchingEvents.values()).map(async (vid) => {
|
||||
const baseRoot =
|
||||
(typeof vid.videoRootId === "string" && vid.videoRootId) ||
|
||||
inferredRoot ||
|
||||
(targetVideo && typeof targetVideo.videoRootId === "string"
|
||||
? targetVideo.videoRootId
|
||||
: "") ||
|
||||
(targetVideo ? targetVideo.id : "") ||
|
||||
vid.id;
|
||||
|
||||
const contentPayload = {
|
||||
version: Number.isFinite(vid.version) ? vid.version : 3,
|
||||
deleted: true,
|
||||
isPrivate: vid.isPrivate === true,
|
||||
isNsfw: vid.isNsfw === true,
|
||||
isForKids: vid.isForKids === true && vid.isNsfw !== true,
|
||||
title: typeof vid.title === "string" ? vid.title : "",
|
||||
url: typeof vid.url === "string" ? vid.url : "",
|
||||
magnet: typeof vid.magnet === "string" ? vid.magnet : "",
|
||||
thumbnail: typeof vid.thumbnail === "string" ? vid.thumbnail : "",
|
||||
description: typeof vid.description === "string" ? vid.description : "",
|
||||
mode: typeof vid.mode === "string" ? vid.mode : "live",
|
||||
videoRootId: baseRoot,
|
||||
};
|
||||
const contentPayload = {
|
||||
version: Number.isFinite(vid.version) ? vid.version : 3,
|
||||
deleted: true,
|
||||
isPrivate: vid.isPrivate === true,
|
||||
isNsfw: vid.isNsfw === true,
|
||||
isForKids: vid.isForKids === true && vid.isNsfw !== true,
|
||||
title: typeof vid.title === "string" ? vid.title : "",
|
||||
url: typeof vid.url === "string" ? vid.url : "",
|
||||
magnet: typeof vid.magnet === "string" ? vid.magnet : "",
|
||||
thumbnail: typeof vid.thumbnail === "string" ? vid.thumbnail : "",
|
||||
description: typeof vid.description === "string" ? vid.description : "",
|
||||
mode: typeof vid.mode === "string" ? vid.mode : "live",
|
||||
videoRootId: baseRoot,
|
||||
};
|
||||
|
||||
const revertResult = await this.revertVideo(
|
||||
{
|
||||
id: vid.id,
|
||||
pubkey: vid.pubkey,
|
||||
content: JSON.stringify(contentPayload),
|
||||
tags: Array.isArray(vid.tags) ? vid.tags : [],
|
||||
},
|
||||
pubkey
|
||||
);
|
||||
const revertResult = await this.revertVideo(
|
||||
{
|
||||
id: vid.id,
|
||||
pubkey: vid.pubkey,
|
||||
content: JSON.stringify(contentPayload),
|
||||
tags: Array.isArray(vid.tags) ? vid.tags : [],
|
||||
},
|
||||
pubkey
|
||||
);
|
||||
|
||||
const revertEvent = revertResult?.event || null;
|
||||
const revertSummary =
|
||||
revertResult?.summary ||
|
||||
summarizePublishResults(revertResult?.publishResults || []);
|
||||
const revertPublishResults = Array.isArray(revertResult?.publishResults)
|
||||
? revertResult.publishResults
|
||||
: [];
|
||||
const revertEvent = revertResult?.event || null;
|
||||
const revertSummary =
|
||||
revertResult?.summary ||
|
||||
summarizePublishResults(revertResult?.publishResults || []);
|
||||
const revertPublishResults = Array.isArray(revertResult?.publishResults)
|
||||
? revertResult.publishResults
|
||||
: [];
|
||||
|
||||
revertSummaries.push({
|
||||
targetId: vid.id || "",
|
||||
event: revertEvent,
|
||||
publishResults: revertPublishResults,
|
||||
summary: revertSummary,
|
||||
});
|
||||
revertSummaries.push({
|
||||
targetId: vid.id || "",
|
||||
event: revertEvent,
|
||||
publishResults: revertPublishResults,
|
||||
summary: revertSummary,
|
||||
});
|
||||
|
||||
if (revertEvent?.id) {
|
||||
revertEvents.push(revertEvent);
|
||||
this.rawEvents.set(revertEvent.id, revertEvent);
|
||||
}
|
||||
if (revertEvent?.id) {
|
||||
revertEvents.push(revertEvent);
|
||||
this.rawEvents.set(revertEvent.id, revertEvent);
|
||||
}
|
||||
|
||||
const cached = this.allEvents.get(vid.id) || vid;
|
||||
cached.deleted = true;
|
||||
cached.url = "";
|
||||
cached.magnet = "";
|
||||
cached.thumbnail = "";
|
||||
cached.description = "This version was deleted by the creator.";
|
||||
cached.videoRootId = baseRoot;
|
||||
this.allEvents.set(vid.id, cached);
|
||||
this.dirtyEventIds.add(vid.id);
|
||||
const cached = this.allEvents.get(vid.id) || vid;
|
||||
cached.deleted = true;
|
||||
cached.url = "";
|
||||
cached.magnet = "";
|
||||
cached.thumbnail = "";
|
||||
cached.description = "This version was deleted by the creator.";
|
||||
cached.videoRootId = baseRoot;
|
||||
this.allEvents.set(vid.id, cached);
|
||||
this.dirtyEventIds.add(vid.id);
|
||||
|
||||
const activeKey = getActiveKey(cached);
|
||||
if (activeKey) {
|
||||
this.activeMap.delete(activeKey);
|
||||
const revertCreatedAt = Number.isFinite(revertEvent?.created_at)
|
||||
? Math.floor(revertEvent.created_at)
|
||||
: Math.floor(Date.now() / 1000);
|
||||
this.recordTombstone(activeKey, revertCreatedAt);
|
||||
}
|
||||
}
|
||||
const activeKey = getActiveKey(cached);
|
||||
if (activeKey) {
|
||||
this.activeMap.delete(activeKey);
|
||||
const revertCreatedAt = Number.isFinite(revertEvent?.created_at)
|
||||
? Math.floor(revertEvent.created_at)
|
||||
: Math.floor(Date.now() / 1000);
|
||||
this.recordTombstone(activeKey, revertCreatedAt);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
return { revertSummaries, revertEvents };
|
||||
}
|
||||
|
||||
+1
-2
@@ -5,8 +5,7 @@ import {
|
||||
requestDefaultExtensionPermissions,
|
||||
} from "./nostrClientFacade.js";
|
||||
import { getActiveSigner } from "./nostr/index.js";
|
||||
import { buildRelayListEvent, NOTE_TYPES } from "./nostrEventSchemas.js";
|
||||
import { CACHE_POLICIES, STORAGE_TIERS } from "./nostr/cachePolicies.js";
|
||||
import { buildRelayListEvent } from "./nostrEventSchemas.js";
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
import {
|
||||
publishEventToRelays,
|
||||
|
||||
@@ -5,14 +5,12 @@ import {
|
||||
} from "./nostrClientFacade.js";
|
||||
import { getActiveSigner } from "./nostr/index.js";
|
||||
import { isSessionActor } from "./nostr/sessionActor.js";
|
||||
import { normalizeNostrPubkey } from "./nostr/nip46Client.js";
|
||||
import {
|
||||
buildBlockListEvent,
|
||||
buildMuteListEvent,
|
||||
BLOCK_LIST_IDENTIFIER,
|
||||
KIND_MUTE_LIST,
|
||||
} from "./nostrEventSchemas.js";
|
||||
import { CACHE_POLICIES, STORAGE_TIERS } from "./nostr/cachePolicies.js";
|
||||
import { devLogger, userLogger } from "./utils/logger.js";
|
||||
import { STANDARD_TIMEOUT_MS, MAX_BLOCKLIST_ENTRIES } from "./constants.js";
|
||||
import {
|
||||
|
||||
Reference in new issue
Block a user