mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 12:22:28 +00:00
Refactor watch history to use month-centric context
- Rename `WATCH_HISTORY_CHUNK` schema to "Watch history monthly payload" in `js/nostrEventSchemas.js`. - Update `js/nostr/watchHistory.js` to replace `snapshotId` with `recordId` and `monthIdentifier` in logging and error tracking context. - Ensure `fetch` logic uses `recordId` and `month` in chunk decryption context for clarity. - Fix indentation for added fields in logging objects.
This commit is contained in:
1 parent
79a983b3f4
commit
a3c7536543
2 files changed
+6
-3
No files matched your search
@@ -1486,6 +1486,7 @@ class WatchHistoryManager {
|
||||
devLogger.warn("[nostr] Unable to build watch history payload for month.", {
|
||||
actor: actorKey,
|
||||
monthIdentifier,
|
||||
recordId: snapshotId,
|
||||
});
|
||||
return { ok: false, error: "invalid-month", retryable: false };
|
||||
}
|
||||
@@ -1516,7 +1517,7 @@ class WatchHistoryManager {
|
||||
}
|
||||
devLogger.info("[nostr] Preparing to publish watch history snapshot.", {
|
||||
actor: actorKey,
|
||||
snapshotId,
|
||||
recordId: snapshotId,
|
||||
monthIdentifier,
|
||||
itemCount: canonicalItems.length,
|
||||
payloadCount: Array.isArray(payload.items) ? payload.items.length : 0,
|
||||
@@ -1619,7 +1620,7 @@ class WatchHistoryManager {
|
||||
const tryEncryptWithCandidate = async (candidate, plaintext, context = {}) => {
|
||||
const details = {
|
||||
actor: actorKey,
|
||||
snapshotId,
|
||||
recordId: snapshotId,
|
||||
monthIdentifier,
|
||||
payloadSize: plaintext.length,
|
||||
scheme: candidate.scheme,
|
||||
@@ -2401,6 +2402,8 @@ class WatchHistoryManager {
|
||||
const ciphertext = typeof event.content === "string" ? event.content : "";
|
||||
const ciphertextPreview = ciphertext.slice(0, 32);
|
||||
const chunkContext = {
|
||||
recordId: snapshotId,
|
||||
month: snapshotId,
|
||||
eventId: event.id ?? null,
|
||||
};
|
||||
const availableSchemes = Array.from(decryptorCandidates.keys());
|
||||
|
||||
@@ -370,7 +370,7 @@ const BASE_SCHEMAS = {
|
||||
},
|
||||
[NOTE_TYPES.WATCH_HISTORY_CHUNK]: {
|
||||
type: NOTE_TYPES.WATCH_HISTORY_CHUNK,
|
||||
label: "Watch history month payload",
|
||||
label: "Watch history monthly payload",
|
||||
kind: WATCH_HISTORY_KIND,
|
||||
identifierTag: {
|
||||
name: "d",
|
||||
|
||||
Reference in new issue
Block a user