Web: Allow navigating to a page on launch with URL argument

This commit is contained in:
Skylar Ittner 2022-05-25 22:57:16 -06:00
parent ebe76f23c0
commit e49e841543

View File

@ -204,6 +204,28 @@ if (getStorage("analytics") !== "false") {
} }
document.title = SETTINGS.branding.apptitle;
/**
* Open the page set in the startpage URL parameter.
* @returns {Boolean} true if navigated to a set page, false if app should open something else.
*/
function openStartpageURLArg() {
try {
var urlParams = new URLSearchParams(window.location.search);
if (urlParams.has("startpage")) {
var startpage = urlParams.get("startpage");
if (startpage == "") {
return false;
}
router.navigate("/" + startpage);
return true;
}
} catch (ex) {
}
return false;
}
if (setup) { if (setup) {
router.navigate("/home"); router.navigate("/home");
} else { } else {
@ -212,4 +234,5 @@ if (setup) {
pushState: false pushState: false
}); });
} }
document.title = SETTINGS.branding.apptitle;
openStartpageURLArg();