Fixed scenes breaking if no affiliate is available.

This commit is contained in:
DebaucheryLibrarian 2026-01-19 04:52:11 +01:00
parent 7702839b7a
commit 166f4ee7ce
1 changed files with 5 additions and 1 deletions

View File

@ -42,13 +42,17 @@ function getAffiliateUrl(scene) {
return null;
}
if (!scene.affiliate) {
return watchUrl;
}
if (scene.affiliate.url?.includes('/track')) { // nats redirect
const { pathname, search } = new URL(watchUrl);
return `${scene.affiliate.url}${pathname}${search}`;
}
if (scene.affiliate?.parameters) { // TODO: this is probably not getting tracked...
if (scene.affiliate.parameters) { // TODO: this is probably not getting tracked...
const newParams = new URLSearchParams({
...Object.fromEntries(new URL(watchUrl).searchParams),
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters)),