Using new object affiliate parameters.
This commit is contained in:
parent
327c7ab1db
commit
ad7f1ce1fa
|
|
@ -46,16 +46,18 @@ function getAffiliateUrl(scene) {
|
|||
return watchUrl;
|
||||
}
|
||||
|
||||
if (scene.affiliate.url?.includes('/track') && (!scene.channel.isIndependent || scene.channel.id === scene.affiliate.entityId)) { // standard NATS redirect
|
||||
if (scene.affiliate.url?.includes('/track')
|
||||
&& scene.affiliate.parameters.scene !== false
|
||||
&& (!scene.channel.isIndependent || scene.channel.id === scene.affiliate.entityId)) { // standard NATS redirect
|
||||
const { pathname, search } = new URL(watchUrl);
|
||||
|
||||
return `${scene.affiliate.url}${pathname.replace(/^\/trial/, '')}${search}`; // replace needed for Jules Jordan, verify behavior on other sites
|
||||
}
|
||||
|
||||
if (scene.affiliate.parameters) { // used by e.g. Bang
|
||||
if (scene.affiliate.parameters.query) { // used by e.g. Bang
|
||||
const newParams = new URLSearchParams({
|
||||
...Object.fromEntries(new URL(watchUrl).searchParams),
|
||||
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters)),
|
||||
...Object.fromEntries(new URLSearchParams(scene.affiliate.parameters.query)),
|
||||
});
|
||||
|
||||
return `${watchUrl}?${newParams.toString()}`;
|
||||
|
|
@ -107,7 +109,7 @@ function curateScene(rawScene, assets) {
|
|||
affiliate: assets.channel.affiliate ? {
|
||||
id: assets.channel.affiliate.id,
|
||||
url: assets.channel.affiliate.url,
|
||||
parameters: assets.channel.affiliate.parameters,
|
||||
parameters: assets.channel.affiliate.parameters || {},
|
||||
entityId: assets.channel.affiliate.entity_id,
|
||||
} : null,
|
||||
actors: sortActorsByGender(assets.actors.map((actor) => curateActor(actor, {
|
||||
|
|
|
|||
2
static
2
static
|
|
@ -1 +1 @@
|
|||
Subproject commit 2d30a16b0752c38ab5079b6c4690eaf149dde7c2
|
||||
Subproject commit 323fb4c9220637d48a1f7516bbfbfafdfdb45ccc
|
||||
Loading…
Reference in New Issue