mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
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:
1 file changed
+11
-1
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user