Spooky Doors house ads: an empty street serves one of Marty's programs instead of "Nobody's home"

When a door finds no visit pack and no video, /api/door/open serves a house ad from rates.doorHouseAds
(RM Circle, Drip Runner, Gem Kingdom, PolHunter by default; ref templates carry the player's IAP username
where the program takes a share link). Rotation: never the same program twice in a row, else the one least
recently shown to that member today. Same dwell + Halloween icon check. No advertiser charge and no campaign
imps, but it counts toward doorCapPerDay (visit_repeat row with campaign 0). Callback and receipt add
house: true and program, with credits 0, host null, campaignId 0. doorHouseAds = [] restores none=1.
Admin rates table keeps text columns as text so the list survives a save. qa/door.mjs covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-02 15:06:53 -05:00
parent dbbce34202
commit 9809953ae0
7 changed files with 69 additions and 18 deletions
+3 -2
View File
@@ -39,7 +39,7 @@
if (r.cap && r.ret) return msg('That is tonight’s doors', 'You have knocked on every door for today. Your candy is safe, and the doors open again at midnight Central.', r.ret, true);
$('sdHint').textContent = r.error; $('sdCheck').hidden = true; var bb = $('sdBack'); bb.hidden = false; bb.onclick = function () { location.href = gameHome; }; return;
}
$('sdCheck').hidden = true; $('sdHint').textContent = r.host ? 'Visit counted. @' + r.host + ' has a treat for you.' : 'Visit counted. Someone has a treat for you.';
$('sdCheck').hidden = true; $('sdHint').textContent = r.house ? 'Visit counted. A smaller treat from ' + (r.program || 'the house') + ' is on its way.' : r.host ? 'Visit counted. @' + r.host + ' has a treat for you.' : 'Visit counted. Someone has a treat for you.';
var b = $('sdDone'); b.disabled = false; b.textContent = 'Back to the street'; b.onclick = function () { location.href = r.ret; };
setTimeout(function () { location.href = r.ret; }, 1200);
});
@@ -53,7 +53,7 @@
: msg('Nobody’s home', 'The lights are out at this house: there are no member pages or videos left for you right now. No candy here, and this door does not count. Head back and try the next house.', r.ret, true);
dwell = r.dwell || 8; left = Math.max(1, dwell - (r.elapsed || 0));
if (r.doors && r.doors.cap) { var ch = $('sdDoors'); ch.textContent = 'Door ' + Math.min(r.doors.cap, (r.doors.used || 0) + 1) + ' of ' + r.doors.cap; ch.hidden = false; }
var who = r.host ? '@' + r.host + '’s door' : 'A member’s door';
var who = r.house ? 'House ad' : r.host ? '@' + r.host + '’s door' : 'A member’s door';
if (r.mode === 'video') { // no member pages left: a member video ad instead
$('sdTitle').textContent = who + ': ' + (r.title || 'member video'); $('sdUrl').textContent = 'video ad';
$('sdHint').textContent = 'You have visited every member page running right now, so this door is a short member video. Keep it playing.';
@@ -66,6 +66,7 @@
ring(); timer = setInterval(tick, 1000); return;
}
$('sdTitle').textContent = who + ': ' + (r.title || 'member site'); try { $('sdUrl').textContent = new URL(r.target).hostname; } catch (e) {}
if (r.house) $('sdHint').textContent = 'A house ad: a smaller treat while the street’s ads are resting. Stay on this page.';
var f = document.createElement('iframe'); f.src = r.target; f.setAttribute('referrerpolicy', 'no-referrer'); f.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups'); $('sdFrame').innerHTML = ''; $('sdFrame').appendChild(f);
var o = $('sdOpen'); o.href = r.target; o.hidden = false;
ring(); timer = setInterval(tick, 1000);