mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
Merge pull request #1549 from PR0M3TH3AN/fix-video-link-params-14223048263665822746
Fix video link redirect clearing URL params
This commit is contained in:
2 files changed
+8
-3
No files matched your search
@@ -4355,8 +4355,11 @@ class Application {
|
||||
const currentView = getHashViewName();
|
||||
const normalizedView =
|
||||
typeof currentView === "string" ? currentView.toLowerCase() : "";
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const hasVideoParam = urlParams.has("v");
|
||||
|
||||
if (!normalizedView || normalizedView === "most-recent-videos") {
|
||||
setHashView("for-you");
|
||||
setHashView("for-you", { preserveVideoParam: hasVideoParam });
|
||||
}
|
||||
|
||||
const rawProviderId =
|
||||
|
||||
+4
-2
@@ -14,14 +14,16 @@ export function getHashViewName() {
|
||||
return viewName.trim();
|
||||
}
|
||||
|
||||
export function setHashView(viewName) {
|
||||
export function setHashView(viewName, options = {}) {
|
||||
if (typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.delete("modal");
|
||||
url.searchParams.delete("v");
|
||||
if (!options?.preserveVideoParam) {
|
||||
url.searchParams.delete("v");
|
||||
}
|
||||
const newUrl = url.pathname + url.search + `#view=${viewName}`;
|
||||
window.history.replaceState({}, "", newUrl);
|
||||
|
||||
|
||||
Reference in new issue
Block a user