mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 11:52:25 +00:00
Restore canonical watch history snapshot format
This commit is contained in:
1 parent
af7738b4d8
commit
ecd3f4026e
6 files changed
+122
-8
No files matched your search
@@ -109,9 +109,30 @@ function createDecryptClient(actorPubkey) {
|
||||
}
|
||||
|
||||
const ACTOR = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
const WATCH_HISTORY_CHUNK_PREFIX = WATCH_HISTORY_LIST_IDENTIFIER.replace(
|
||||
/[:/]index$/i,
|
||||
""
|
||||
function deriveChunkPrefix(identifier) {
|
||||
if (typeof identifier !== "string") {
|
||||
return "watch-history:v2";
|
||||
}
|
||||
|
||||
const trimmed = identifier.trim().replace(/\/+$/, "");
|
||||
if (!trimmed) {
|
||||
return "watch-history:v2";
|
||||
}
|
||||
|
||||
if (/[:/]index$/i.test(trimmed)) {
|
||||
const base = trimmed.replace(/[:/]index$/i, "").replace(/\/+$/, "");
|
||||
return base || "watch-history:v2";
|
||||
}
|
||||
|
||||
if (/:v\d+$/i.test(trimmed)) {
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
return `${trimmed}:v2`;
|
||||
}
|
||||
|
||||
const WATCH_HISTORY_CHUNK_PREFIX = deriveChunkPrefix(
|
||||
WATCH_HISTORY_LIST_IDENTIFIER
|
||||
);
|
||||
|
||||
const indexSchema = getNostrEventSchema(NOTE_TYPES.WATCH_HISTORY_INDEX);
|
||||
|
||||
Reference in new issue
Block a user