mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-01 02:12:26 +00:00
Add shared hex normalization for comment flows
This commit is contained in:
1 parent
af8a5828dd
commit
735d67313c
6 files changed
+102
-89
No files matched your search
@@ -0,0 +1,11 @@
|
||||
export function normalizeHexString(value) {
|
||||
if (typeof value !== "string") {
|
||||
return "";
|
||||
}
|
||||
|
||||
const trimmed = value.trim();
|
||||
return trimmed ? trimmed.toLowerCase() : "";
|
||||
}
|
||||
|
||||
export const normalizeHexId = normalizeHexString;
|
||||
export const normalizeHexPubkey = normalizeHexString;
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { pointerArrayToKey } from "./pointer.js";
|
||||
import { devLogger } from "./logger.js";
|
||||
import { normalizeHexPubkey } from "./hex.js";
|
||||
|
||||
const DEFAULT_VIDEO_KIND = 30078;
|
||||
|
||||
@@ -84,7 +85,7 @@ export function buildVideoAddressPointer(
|
||||
return "";
|
||||
}
|
||||
|
||||
const pubkey = typeof video.pubkey === "string" ? video.pubkey.trim() : "";
|
||||
const pubkey = normalizeHexPubkey(video.pubkey);
|
||||
if (!pubkey) {
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user