Site invite: kind 'promo' for a site's own ready-made video. The email then reads "Here's a short video that shows how it works" and the subject "<sponsor> sent you a video", never that the sender made it; every other word unchanged (Marty 2026-11-21)
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
+7
-5
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// POST /api/partner/invite/eligible { site, sender: { email?, wallet? } }
|
||||
// -> { ok, sender: username, directs: [{ username, state: 'ok' | 'sent' | 'no' }], left: { sender, network }, paused }
|
||||
// POST /api/partner/invite/send { rid, site, sender, items: [{ username, link }], note? }
|
||||
// POST /api/partner/invite/send { rid, site, sender, items: [{ username, link }], note?, kind? } kind 'promo' = the link is one of the site's own ready-made videos, not one the sender made
|
||||
// -> { ok, results: [{ username, status: 'sent' | <refusal code> }], sent, left }
|
||||
// POST /api/partner/invite/code { site, email, code } -> { ok } | { error, code } (2026-11-21)
|
||||
// the email-check code for the site's network gate: the SITE makes and checks the 6-digit code, this app only mails it
|
||||
@@ -117,7 +117,9 @@ async function refusal(a, sender) {
|
||||
async function left(sender) { const c = cfg(), since = dayStart(clock()); return { sender: Math.max(0, c.perSender - await S().count(since, lc(sender.email))), network: Math.max(0, c.perDay - await S().count(since)) }; }
|
||||
|
||||
// ---- the email (Marty approved the wording 2026-11-20). Plain text first; the HTML is the same words. ----
|
||||
function compose(site, sponsor, user, link, note) {
|
||||
// kind 'promo' (Marty 2026-11-21): the video is one of the site's own ready-made ones, so the email must not say the sender made it.
|
||||
function compose(site, sponsor, user, link, note, kind) {
|
||||
const promo = kind === 'promo';
|
||||
const P = [
|
||||
'Hi ' + user + ',',
|
||||
"It's " + sponsor + ', your sponsor on InstantAdPay. I\'ve started using a new app in our network called ' + site.name + ', and I wanted you to hear about it from me.',
|
||||
@@ -126,13 +128,13 @@ function compose(site, sponsor, user, link, note) {
|
||||
P.push('It makes short promo videos from your phone. You paste a link to whatever you promote, and about a minute and a half later you have a finished video with a voice, captions and music. No camera, no editing. Each video gets its own page that shows you who opened it and who tapped your button.',
|
||||
"Your first video is free, so you can see if it's useful before spending anything. After that, videos cost credits, and a $10 pack makes 10 videos.",
|
||||
"I'll be straight with you: I earn a share if you buy credits. That's how the app works for everyone, and you'd earn the same way from people you bring in. Nothing is promised, and plenty of people will just use it for the videos.",
|
||||
"Here's one I made: " + link,
|
||||
(promo ? "Here's a short video that shows how it works: " : "Here's one I made: ") + link,
|
||||
"You're already on my team, so if you join you'll be placed with me automatically. No link needed.",
|
||||
sponsor,
|
||||
"You're getting this because " + sponsor + ' is your sponsor in the Crypto Team Build Network. This is a one-time note sent through the network on their behalf.');
|
||||
const esc = t => String(t).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
const html = '<div style="font-family:Arial,Helvetica,sans-serif;font-size:15px;line-height:1.55;color:#222;max-width:560px">' + P.map((p, i) => i === P.length - 1 ? '<p style="font-size:12px;color:#888;margin-top:24px">' + esc(p) + '</p>' : '<p>' + esc(p).replace(esc(link), '<a href="' + esc(link) + '">' + esc(link) + '</a>') + '</p>').join('') + '</div>';
|
||||
return { subject: sponsor + ' made you a video', text: P.join('\n\n'), html };
|
||||
return { subject: sponsor + (promo ? ' sent you a video' : ' made you a video'), text: P.join('\n\n'), html };
|
||||
}
|
||||
function cleanNote(n) {
|
||||
const note = String(n || '').replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
|
||||
@@ -177,7 +179,7 @@ async function send(b) {
|
||||
const row = { site: siteId, recipient: lc(a.email), username: a.username, sender: lc(sender.email), senderName: sender.username, link: String(it.link), rid, ts: clock(), status: 'sending' };
|
||||
if (!(await S().claim(row))) { res.status = 'sent before'; continue; }
|
||||
try {
|
||||
const m = compose(site, sender.username, a.username, row.link, cn.note);
|
||||
const m = compose(site, sender.username, a.username, row.link, cn.note, b.kind === 'promo' ? 'promo' : '');
|
||||
const okSent = await R.mailer.send(a.email, m.subject, m.text, m.html);
|
||||
if (okSent === false) { await S().unclaim(siteId, row.recipient); res.status = 'no'; continue; } // unsubscribed between the check and the send
|
||||
await S().mark(siteId, row.recipient, 'sent'); res.status = 'sent'; sentN++;
|
||||
|
||||
Reference in New Issue
Block a user