mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
fix: generate link for companion
This commit is contained in:
committed by
Alex Christoffer Rasmussen
parent
6ff06b21a8
commit
763080cd4d
@@ -64,18 +64,21 @@ export function generateShareUrl(
|
||||
): URL {
|
||||
const url = new URL(baseUrl);
|
||||
|
||||
// if the config is locked and we are in a preset, we hide the canonical path
|
||||
const shouldMaskPath = Boolean(preset) && (canonicalPath === OntimeView.Cuesheet || lockConfig);
|
||||
const maybePresetPath = shouldMaskPath ? `preset/${preset}` : preset || canonicalPath;
|
||||
url.pathname = prefix ? `${prefix}/${maybePresetPath}` : maybePresetPath;
|
||||
// companion links point to the root
|
||||
if (canonicalPath !== '<<companion>>') {
|
||||
// if the config is locked and we are in a preset, we hide the canonical path
|
||||
const shouldMaskPath = Boolean(preset) && (canonicalPath === OntimeView.Cuesheet || lockConfig);
|
||||
const maybePresetPath = shouldMaskPath ? `preset/${preset}` : preset || canonicalPath;
|
||||
url.pathname = prefix ? `${prefix}/${maybePresetPath}` : maybePresetPath;
|
||||
|
||||
if (lockNav) {
|
||||
url.searchParams.append('n', '1');
|
||||
}
|
||||
}
|
||||
|
||||
if (authenticate && hash) {
|
||||
url.searchParams.append('token', hash);
|
||||
}
|
||||
|
||||
if (lockNav) {
|
||||
url.searchParams.append('n', '1');
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user