Merge pull request #1663 from PR0M3TH3AN/fix-pushstate-origin-977125356888089584

fix: prevent SecurityError in pushState when playing video on local origin
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-24 21:39:21 -05:00
commit 7132a80709
1 file changed
+11 -1
+11 -1
View File
@@ -8713,11 +8713,21 @@ class Application {
// this.setShareButtonState(true); // Moved to after showModalWithPoster
const nevent = window.NostrTools.nip19.neventEncode({ id: eventId });
const pushUrl =
let pushUrl =
this.buildShareUrlFromNevent(nevent) ||
`${this.getShareUrlBase() || window.location.pathname}?v=${encodeURIComponent(
nevent
)}`;
try {
const targetUrl = new URL(pushUrl, window.location.origin);
if (targetUrl.origin !== window.location.origin) {
pushUrl = `${window.location.pathname}${targetUrl.search}${targetUrl.hash}`;
}
} catch (err) {
devLogger.warn("[Application] Failed to normalize pushState URL:", err);
}
window.history.pushState({}, "", pushUrl);
this.zapController?.resetState();