Compare commits

..

2 Commits

Author SHA1 Message Date
1c982124b0 0.46.5 2026-02-06 23:55:08 +01:00
6aaa3ad30c Allowing campaigns to be marked as non-global. 2026-02-06 23:55:06 +01:00
4 changed files with 13 additions and 4 deletions

4
package-lock.json generated
View File

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

View File

@@ -92,7 +92,7 @@
"overrides": {
"vite": "$vite"
},
"version": "0.46.4",
"version": "0.46.5",
"imports": {
"#/*": "./*.js"
}

View File

@@ -82,18 +82,27 @@ export async function getRandomCampaign(options = {}, context = {}, pass = 0) {
const validCampaigns = campaigns.filter((campaign) => {
if (options.minRatio && (!campaign.banner || campaign.banner.ratio < options.minRatio)) {
// too small
return false;
}
if (options.maxRatio && (!campaign.banner || campaign.banner.ratio > options.maxRatio)) {
// too big
return false;
}
if (options.entityIds && !options.entityIds.some((entityId) => campaign.entity.id === entityId || campaign.entity.parent?.id === entityId)) {
// this is an entity page, this campaign does not belong to this entity
return false;
}
if (campaign.affiliate?.parameters?.global === false && !options.entityIds) {
// this campaign should only show on entity page
return false;
}
if (context.tagFilter && campaign.banner && campaign.banner.tags.some((tag) => context.tagFilter.includes(tag) && !options.tagSlugs?.includes(tag))) {
// wrong tag
return false;
}

2
static

Submodule static updated: 4e5c91df28...13a0a44985