Compare commits

...

2 Commits

Author SHA1 Message Date
ada81340ef 0.45.7 2026-01-30 22:39:35 +01:00
5ae3b5d91c Ensuring affiliate URL is valid. 2026-01-30 22:39:34 +01:00
4 changed files with 25 additions and 13 deletions

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{
"name": "traxxx-web",
"version": "0.45.6",
"version": "0.45.7",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.45.6",
"version": "0.45.7",
"dependencies": {
"@brillout/json-serializer": "^0.5.8",
"@dicebear/collection": "^7.0.5",

View File

@@ -89,7 +89,7 @@
"overrides": {
"vite": "$vite"
},
"version": "0.45.6",
"version": "0.45.7",
"imports": {
"#/*": "./*.js"
}

View File

@@ -1,16 +1,20 @@
import format from 'template-format';
function getWatchUrl(scene) {
if (scene.url) {
return scene.url;
}
try {
if (scene.url) {
return new URL(scene.url).href;
}
if (scene.channel && (scene.channel.isIndependent || scene.channel.type === 'network')) {
return scene.channel.url;
}
if (scene.channel && (scene.channel.isIndependent || scene.channel.type === 'network')) {
return new URL(scene.channel.url).href;
}
if (scene.network) {
return scene.network.url;
if (scene.network) {
return new URL(scene.network.url).href;
}
} catch (_error) {
// invalid URL
}
return null;
@@ -73,8 +77,16 @@ export function getAffiliateSceneUrl(scene) {
return watchUrl;
}
function getEntityUrl(entity) {
try {
return new URL(entity.url || entity.parent?.url).href;
} catch (_error) {
return null;
}
}
export function getAffiliateEntityUrl(entity) {
const entityUrl = entity.url || entity.parent?.url;
const entityUrl = getEntityUrl(entity);
if (!entityUrl) {
return null;

View File

@@ -39,7 +39,7 @@ export function curateEntity(entity, context) {
},
};
curatedEntity.affiliateUrl = getAffiliateEntityUrl(curatedEntity, curatedEntity);
curatedEntity.affiliateUrl = getAffiliateEntityUrl(curatedEntity);
return curatedEntity;
}