mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 04:12:25 +00:00
Fix watch history sync when logged in
This commit is contained in:
1 parent
c3ed4bc6ea
commit
762dbe5dcc
3 files changed
+146
-4
No files matched your search
@@ -53,7 +53,43 @@ function resolveFlagEnabled() {
|
||||
}
|
||||
|
||||
function getLoggedInActorKey() {
|
||||
return normalizeActorKey(nostrClient?.pubkey);
|
||||
const direct = normalizeActorKey(nostrClient?.pubkey);
|
||||
if (direct) {
|
||||
return direct;
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
const appCandidate =
|
||||
(window.bitvid && window.bitvid.app) || window.app || null;
|
||||
if (appCandidate && typeof appCandidate === "object") {
|
||||
if (typeof appCandidate.normalizeHexPubkey === "function") {
|
||||
try {
|
||||
const normalized = appCandidate.normalizeHexPubkey(
|
||||
appCandidate.pubkey
|
||||
);
|
||||
if (normalized) {
|
||||
return normalizeActorKey(normalized);
|
||||
}
|
||||
} catch (error) {
|
||||
if (isDevMode) {
|
||||
console.warn(
|
||||
"[watchHistoryService] Failed to normalize app login pubkey:",
|
||||
error
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof appCandidate.pubkey === "string" && appCandidate.pubkey) {
|
||||
const fallback = normalizeActorKey(appCandidate.pubkey);
|
||||
if (fallback) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function getSessionActorKey() {
|
||||
|
||||
Reference in new issue
Block a user