AI ad writer on text-ad campaigns (Marty 2026-11-17: "do it on the other sites too"): "Write my ad from my link" under the text ad fields asks the network hub (hubadwriter.js, POST /v1/adwriter, headline 60 / ad text 140) for 3 ads from the Target URL; GET/POST /api/my/adwriter; shown only when the hub says on; chatbot fact, KNOWLEDGE_DATE 2026-11-17; my.js?v=20261117aiw. iap-qa member 0 bugs, kb green
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -50,7 +50,7 @@ function key() {
|
||||
function enabled() { return !!key(); }
|
||||
|
||||
// ---- canned answers: instant, free, always in voice ----
|
||||
const KNOWLEDGE_DATE = '2026-11-15'; // bump whenever the canned answers / prompt are brought up to date
|
||||
const KNOWLEDGE_DATE = '2026-11-17'; // bump whenever the canned answers / prompt are brought up to date
|
||||
const SUPPORT_RE = /(contact|reach|email|e-mail|message|talk to|speak (to|with)|get hold of) (the )?(support|admin|administrator|owner|marty|staff|team at instantadpay|someone|a (human|person|real person))|support (email|address|ticket|team|desk)|help ?desk|(open|send|file|submit|raise) (a )?(support )?ticket|\b(human|real person|live (agent|person|chat|support))\b|customer (service|support)|support@|how (do|can) i get (help|support)/i;
|
||||
const CANNED = [
|
||||
// network sign-in (2026-11-12): signed in on one of InstantAdPay / LinkSpin = signed in on the other, no code (networksso.js)
|
||||
@@ -395,6 +395,7 @@ ${WEEKEND ? (() => { try { return WEEKEND.fact() || ''; } catch (e) { return '';
|
||||
- WALL OWNERSHIP LADDER: the public wall has 3 positions. Position 1 = the member's line banner. Positions 2 and 3 show upline banners (then house ads) UNTIL the member earns them: 2 qualifying buyers ($20+) unlock position 2, 5 unlock position 3; a fully qualified member's wall is 100% their own links/offers (set in Profile > Your wall: label, https link, optional banner image). Empty unlocked slots fall back to upline banners, then house ads.
|
||||
- LINE BANNER (free, set in Profile): every member can set a destination URL (must allow framing) plus an optional banner image. It is shown to their next THREE levels of new members during welcome tours (position 1 for directs, 2, 3 below), and on their public BANNER WALL at /wall/<username> — a shareable page showing their line ladder with their join link. Free viral traffic that compounds as the team grows; no credits spent.
|
||||
- Ad packages: Micro $5/500 credits, Starter $10/1,000, Activation $20/2,000, Builder $50/5,500, Growth $100/12,000, Leader $250/32,500, Elite $500/70,000. Dollar-priced, settled in POL (Polygon) at the live Chainlink rate. 1 credit = 1 cent of ad delivery.
|
||||
- AI AD WRITER (LIVE 2026-11-17): on Advertise > create a campaign, pick Text ad, put your link in Target URL and tap "Write my ad from my link": the network ad writer reads that page and suggests 3 text ads (headline up to 60, ad text up to 140) using only what the page says (no made-up claims, numbers or income promises); tapping one fills the headline and ad text to edit; nothing is created until you create the campaign. 5 writes a day per member (reset at midnight Central); the same page again within 24 hours is free. The same writer is on ViralAdSource, ViralAdBlitz and LinkSpin.
|
||||
- Live formats: display banners (per impression), text ads (per impression), full-screen LOGIN ADS (per day: right after a member signs in they land on a sponsor interstitial — they click "Open Ad", the advertiser's page opens in a NEW tab, a countdown runs on the interstitial, and at zero a "Go to dashboard" button appears. Just a CTA link is enough; an optional banner image can be the clickable creative. No framing requirement since it opens in its own tab), WATCH-TO-EARN VIDEO ADS (advertiser uploads an MP4/WebM or gives a direct https .mp4/.webm link and picks a required watch length — 10s/30s/60s — which sets the per-view price; viewers watch in an escape-proof player under Earn credits > Watch videos, the watch time is enforced on the server clock, and they earn credits per completed watch; you never see your own videos), and solo ads. Banner ads also require a size (standard IAB sizes like 728x90, 300x250). Video watching is capped at 8 a day per member and pays 1, 2 or 4 credits for a 10, 30 or 60 second watch. FEATURED LINKS (live): a headline + link in the Featured strip at the top of every member's Overview, booked for 1, 2 or 7 days at 40 credits a day, up to 7 days ahead, at most 10 links sharing any day; flat buy paid when booked; the row shows days left and 'runs through <date>', counts views (one per viewer per hour) and clicks, and offers Extend run. VERIFIED-VISIT PACKS (live): 3 credits per visit, minimum 20 visits, paid up front; each visit is a distinct member who opens the site in a new tab, stays 8 seconds and passes a check, at most 20 visits per member per day; the row shows 'N of M visits delivered' and Buy more visits adds to the pack; the visitor earns 1 credit.
|
||||
- WALLETS + BUYING POL (Training > Wallets and buying POL, /wallets, members only): say "SafePal or any other crypto wallet" and never recommend MetaMask by name (Marty 2026-11-13; a wallet app with several accounts serves Qualified Start), Phantom (PHANTOM GOTCHA: Polygon is OFF by default; Settings > Active Networks > turn on Polygon, otherwise connect/buy fails or shows the wrong network; seen with Jim Watts' EB team 2026-09-13), SafePal, Coinbase Wallet; Trust works but blocks buys spending most of its POL (keep ~2x). MoonPay flow: connect wallet, Buy packages > "Buy POL with a card" opens MoonPay with POL on Polygon + the member's address prefilled; card/Apple Pay/Google Pay; first-time ID check; minimum order ~$30; buy package cost + 2-3 POL for fees; POL arrives in minutes; then buy. Exchanges: withdraw POL on the Polygon network. Never MATIC on Ethereum, never share the recovery phrase.
|
||||
- PROHIBITED CONTENT (2026-10-30, Terms section 8, /terms#prohibited): gambling, casinos, betting, lotteries, sweepstakes; adult or sexual content; drugs and prescription pharmaceuticals; weapons; hate or harassment; malware, phishing, counterfeit goods; misleading financial promises. Refused at save time in bios, social links, line banners, wall offers and every campaign field. A bio may not contain a URL or a domain (links go in the social fields). Profile text, avatar and social links appear on the public wall ONLY for members who have bought a package; a free account's wall shows the name, the line's ads and the join button. Link-farm accounts (created to plant links in profile fields) are removed without notice with their profile text.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
// The network AI ad writer, asked through the hub (Marty 2026-11-17: "the AI generation of the ads worked really well. Let's go
|
||||
// ahead and do it on the other sites too."). The hub reads the member's page, asks the model and filters the copy
|
||||
// (network-hub lib/adwriter.js); this file only signs the call for this site's signed-in member and passes the answer on.
|
||||
// status(member?) -> {on, daily, left?} (cached 60 s; on: false when the hub is unset, unreachable or switched off)
|
||||
// write(member, url, limits) -> {ok, options: [{headline, line?}], url, cached, left} | {error (member-friendly), code, status, left?}
|
||||
// Signed as HUB_SITE with HUB_SECRET: X-Hub-Site, X-Hub-Ts, X-Hub-Sig = hex HMAC-SHA256(ts + newline + raw body), like every /v1 call.
|
||||
// AI_WRITER=0 hides the button on this site. Nothing is posted: the member picks an option, edits it and saves it themselves.
|
||||
'use strict';
|
||||
const crypto = require('crypto');
|
||||
|
||||
const DEFAULT_SITE = 'iap';
|
||||
const hubUrl = () => String(process.env.HUB_URL || '').trim().replace(/\/+$/, '');
|
||||
const secret = () => String(process.env.HUB_SECRET || '').trim();
|
||||
const site = () => String(process.env.HUB_SITE || DEFAULT_SITE).trim();
|
||||
const configured = () => !/^(0|false|no|off)$/i.test(String(process.env.AI_WRITER || '').trim()) && !!hubUrl() && secret().length >= 32;
|
||||
|
||||
async function call(route, body, timeoutMs) {
|
||||
const raw = JSON.stringify(body); const ts = String(Date.now());
|
||||
const sig = crypto.createHmac('sha256', secret()).update(ts + '\n' + raw).digest('hex');
|
||||
const r = await fetch(hubUrl() + route, { method: 'POST', body: raw, signal: AbortSignal.timeout(timeoutMs),
|
||||
headers: { 'Content-Type': 'application/json', 'X-Hub-Site': site(), 'X-Hub-Ts': ts, 'X-Hub-Sig': sig } });
|
||||
let j = null; try { j = await r.json(); } catch (e) { j = null; }
|
||||
return { status: r.status, body: j || {} };
|
||||
}
|
||||
|
||||
let st = { at: 0, v: { on: false, daily: 0 } };
|
||||
async function status(member) {
|
||||
if (!configured()) return { on: false, daily: 0 };
|
||||
if (!member && Date.now() - st.at < 60000) return st.v;
|
||||
try {
|
||||
const r = await call('/v1/adwriter/status', member ? { member: String(member) } : {}, 3000);
|
||||
const v = r.status === 200 && r.body && typeof r.body.on === 'boolean' ? r.body : { on: false, daily: 0 };
|
||||
if (!member) st = { at: Date.now(), v: { on: v.on, daily: v.daily || 0 } };
|
||||
return v;
|
||||
} catch (e) { if (!member) st = { at: Date.now() - 45000, v: { on: false, daily: 0 } }; return { on: false, daily: 0 }; } // a down hub is asked again in 15 s
|
||||
}
|
||||
// the button shows only when the hub says the writer is on (60 s cache, never waits on a slow hub for long)
|
||||
async function enabled() { return (await status()).on === true; }
|
||||
|
||||
async function write(member, url, limits) {
|
||||
if (!configured()) return { error: 'The ad writer is switched off right now. You can still write your ad yourself.', code: 'off', status: 503 };
|
||||
try {
|
||||
const r = await call('/v1/adwriter', { member: String(member), url: String(url || '').trim().slice(0, 600), limits }, 75000);
|
||||
const b = r.body || {};
|
||||
if (r.status === 200 && b.ok && Array.isArray(b.options)) return { ok: true, options: b.options, url: b.url, cached: !!b.cached, left: b.left };
|
||||
if (r.status === 401 || r.status === 403 || !b.message) { console.error('hubadwriter: hub answered ' + r.status + ' ' + String(b.error || '')); return { error: 'The ad writer is busy right now. Try again in a minute, or write your ad yourself.', code: 'hub', status: 502 }; }
|
||||
return { error: String(b.message), code: b.error || b.code || 'error', status: r.status >= 400 && r.status < 600 ? r.status : 502, left: b.left };
|
||||
} catch (e) {
|
||||
console.error('hubadwriter: ' + (e.name === 'TimeoutError' || e.name === 'AbortError' ? 'timeout' : String(e.message).slice(0, 120)));
|
||||
return { error: 'The ad writer did not answer in time. Try again in a minute, or write your ad yourself.', code: 'hub', status: 504 };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { status, enabled, write, configured, _reset: () => { st = { at: 0, v: { on: false, daily: 0 } }; } };
|
||||
@@ -1543,6 +1543,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
|
||||
$('cSizeRow').hidden = t !== 'banner';
|
||||
$('cTitleRow').hidden = t !== 'text' && t !== 'solo';
|
||||
$('cBodyRow').hidden = t !== 'text';
|
||||
if ($('cAiRow')) $('cAiRow').hidden = t !== 'text' || !aiWriterOn;
|
||||
$('cSoloRow').hidden = t !== 'solo';
|
||||
$('cSoloHint').hidden = t !== 'solo';
|
||||
$('cVideoRow').hidden = t !== 'video';
|
||||
@@ -1563,6 +1564,28 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
|
||||
if (t === 'featured') featHint();
|
||||
}
|
||||
$('cType').addEventListener('change', applyType);
|
||||
// the AI ad writer (Marty 2026-11-17): 3 text ads the network hub writes only from the member's own Target URL; picking one fills
|
||||
// the headline and ad text to edit. Shown only when the hub answers it is on.
|
||||
var aiWriterOn = false;
|
||||
(async () => {
|
||||
if (!$('cAiRow')) return;
|
||||
try { const w = await (await fetch('/api/my/adwriter')).json(); aiWriterOn = !!(w && w.on); } catch (e) { aiWriterOn = false; }
|
||||
applyType();
|
||||
const box = $('cAiList'); let opts = [];
|
||||
const escA = s => String(s == null ? '' : s).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||
$('cAiWrite').onclick = async () => {
|
||||
const url = $('cTarget').value.trim(); box.hidden = false;
|
||||
if (!/^https?:\/\/\S+\.\S+/i.test(url)) { box.innerHTML = '<p class="small" style="margin:0">Put your link in the Target URL box first (starting with https://), then tap the button again.</p>'; $('cTarget').focus(); return; }
|
||||
$('cAiWrite').disabled = true; box.innerHTML = '<p class="small muted" style="margin:0">Reading your page and writing 3 ads. This takes a few seconds...</p>';
|
||||
let r; try { r = await api('/api/my/adwriter', { url }); } catch (e) { r = { error: e.message || 'The ad writer did not answer. Try again in a minute.' }; }
|
||||
$('cAiWrite').disabled = false;
|
||||
if (r.error) { box.innerHTML = '<p class="small" style="margin:0">' + escA(r.error) + '</p>'; return; }
|
||||
opts = r.options || [];
|
||||
box.innerHTML = '<p class="small muted" style="margin:0 0 6px">Tap one to use it. Check every word is true for your offer before you create the campaign.' + (typeof r.left === 'number' ? ' Ad writes left today: ' + r.left + '.' : '') + '</p>'
|
||||
+ opts.map((o, i) => '<button type="button" class="btn sec small" data-ai="' + i + '" style="display:block;width:100%;text-align:left;margin:0 0 6px;white-space:normal"><b>' + escA(o.headline) + '</b><br><span class="small">' + escA(o.line || '') + '</span></button>').join('');
|
||||
box.querySelectorAll('button[data-ai]').forEach(b => { b.onclick = () => { const o = opts[Number(b.dataset.ai)]; $('cTitle').value = o.headline; $('cBody').value = o.line || ''; box.hidden = true; IAP.status('Filled in. Edit it as you like, then create your campaign.', 'ok'); }; });
|
||||
};
|
||||
})();
|
||||
let featStartDay = 0; // selected start-day offset (0 = today)
|
||||
async function featHint() {
|
||||
if (!lastRates || !lastRates.featuredDurations) return;
|
||||
|
||||
+2
-1
@@ -577,6 +577,7 @@
|
||||
<p id="cSizeRow" hidden><select id="cSize" style="width:100%"></select></p>
|
||||
<p id="cTitleRow" hidden><input id="cTitle" placeholder="Headline (max 60)" style="width:100%"></p>
|
||||
<p id="cBodyRow" hidden><input id="cBody" placeholder="Ad text (max 140)" style="width:100%"></p>
|
||||
<div id="cAiRow" hidden style="margin:-4px 0 12px"><button type="button" class="btn sec small" id="cAiWrite">Write my ad from my link</button> <span class="small muted">Put your Target URL in first. We read that page and suggest 3 text ads using only what it says. Nothing is created until you create the campaign.</span><div id="cAiList" hidden style="margin-top:8px"></div></div>
|
||||
<div id="cSoloRow" hidden>
|
||||
<div class="ed-bar" aria-label="Formatting">
|
||||
<button type="button" data-cmd="bold" title="Bold"><b>B</b></button>
|
||||
@@ -1312,7 +1313,7 @@
|
||||
<script src="/assets/promo.js?v=20261103gp"></script>
|
||||
<script src="/assets/support.js?v=20261116sg"></script>
|
||||
<script src="/assets/netkits.js?v=20261117vas"></script>
|
||||
<script src="/assets/my.js?v=20261117back"></script>
|
||||
<script src="/assets/my.js?v=20261117aiw"></script>
|
||||
<script src="/assets/fuel.js?v=20261113sso"></script><script src="/assets/tankfeed.js?v=20261115tb"></script>
|
||||
<script src="/assets/engine-room.js?v=20261113sso"></script>
|
||||
<script src="/assets/netsso.js?v=20261113sso"></script>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// The network ad writer client (2026-11-17): node qa/hubadwriter.test.mjs
|
||||
// A stand-in hub checks the signature and answers like network-hub lib/adwriter.js; no real hub, no model, no member.
|
||||
import http from 'node:http';
|
||||
import crypto from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
import { createRequire } from 'node:module';
|
||||
const require = createRequire(import.meta.url);
|
||||
const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), '..');
|
||||
let pass = 0, fail = 0;
|
||||
const ok = (c, m, extra) => { if (c) pass++; else { fail++; console.log('FAIL', m, extra !== undefined ? JSON.stringify(extra).slice(0, 300) : ''); } };
|
||||
|
||||
const SECRET = 's'.repeat(40); let seen = [], mode = 'good';
|
||||
const hub = http.createServer((q, r) => { let b = ''; q.on('data', c => { b += c; }); q.on('end', () => {
|
||||
const sig = crypto.createHmac('sha256', SECRET).update(q.headers['x-hub-ts'] + '\n' + b).digest('hex');
|
||||
r.setHeader('Content-Type', 'application/json');
|
||||
if (sig !== q.headers['x-hub-sig']) { r.statusCode = 401; return r.end('{"error":"unauthorized"}'); }
|
||||
const j = JSON.parse(b); seen.push({ path: q.url, site: q.headers['x-hub-site'], body: j });
|
||||
if (q.url === '/v1/adwriter/status') return r.end(JSON.stringify(mode === 'off' ? { on: false, daily: 5 } : { on: true, daily: 5, left: j.member ? 3 : undefined }));
|
||||
if (mode === 'limit') { r.statusCode = 429; return r.end(JSON.stringify({ ok: false, error: 'member_limit', code: 'member_limit', message: 'You have used your 5 ad writes for today.', left: 0 })); }
|
||||
if (mode === 'slow') return;
|
||||
r.end(JSON.stringify({ ok: true, options: [{ headline: 'One link for all your pages', line: 'Share one link that rotates your pages.' }], url: 'https://linkspin.app/', cached: false, left: 4 }));
|
||||
}); });
|
||||
await new Promise(r => hub.listen(0, '127.0.0.1', r));
|
||||
process.env.HUB_URL = 'http://127.0.0.1:' + hub.address().port; process.env.HUB_SECRET = SECRET; delete process.env.HUB_SITE; delete process.env.AI_WRITER;
|
||||
const aw = require(path.join(ROOT, 'hubadwriter.js'));
|
||||
|
||||
ok(await aw.enabled(), 'on when the hub says on');
|
||||
ok(seen[0].path === '/v1/adwriter/status' && seen[0].site && seen[0].site !== '__SITE__', 'signed as this site', seen[0]);
|
||||
let r = await aw.write('member-1', 'https://linkspin.app', { headline: 60, line: 90 });
|
||||
ok(r.ok && r.options.length === 1 && r.left === 4, 'options passed on', r);
|
||||
ok(seen[1].body.member === 'member-1' && seen[1].body.limits.headline === 60 && seen[1].body.limits.line === 90 && seen[1].body.url === 'https://linkspin.app', 'member, url and this site\'s limits sent', seen[1].body);
|
||||
mode = 'limit'; r = await aw.write('member-1', 'https://linkspin.app', { headline: 60, line: 90 });
|
||||
ok(r.error === 'You have used your 5 ad writes for today.' && r.status === 429 && r.left === 0, 'the hub message is shown as is', r);
|
||||
const st = await aw.status('member-1'); ok(st.on && st.left === 3, 'status for a member (left today)', st);
|
||||
mode = 'off'; aw._reset(); ok(!(await aw.enabled()), 'off when the hub says off');
|
||||
process.env.HUB_SECRET = 'w'.repeat(40); mode = 'good'; r = await aw.write('member-1', 'https://linkspin.app', { headline: 60, line: 90 });
|
||||
ok(r.code === 'hub' && /busy/.test(r.error), 'a refused signature: a friendly busy message', r);
|
||||
aw._reset(); ok(!(await aw.enabled()), 'a refused signature hides the button');
|
||||
process.env.HUB_SECRET = SECRET; process.env.AI_WRITER = '0'; aw._reset(); const n0 = seen.length; ok(!(await aw.enabled()) && seen.length === n0, 'AI_WRITER=0 hides it without asking the hub', seen.length);
|
||||
delete process.env.AI_WRITER; process.env.HUB_URL = 'http://127.0.0.1:1'; aw._reset(); ok(!(await aw.enabled()), 'an unreachable hub hides the button');
|
||||
hub.close();
|
||||
console.log('hubadwriter: ' + pass + ' passed, ' + fail + ' failed');
|
||||
process.exit(fail ? 1 : 0);
|
||||
@@ -60,6 +60,7 @@ const tankbatch = require('./tankbatch'); // holding tank batches (2026-11-15):
|
||||
const draftpartner = require('./draftpartner'); // 5xYourTeam The Draft: signed pool / adopt / release / status on the network tank (2026-11-15, needs DRAFT_PARTNER_SECRET)
|
||||
const loginClock = require('./loginadclock'); // login ads on a clock, not only at sign-in (Marty 2026-11-15): see loginadclock.js
|
||||
const erase = require('./erase'); // member erase (2026-11-15, LS-1021): POST /api/admin/erase + the hub's member.erased event
|
||||
const adwriter = require('./hubadwriter'); // the network AI ad writer, asked through the hub (2026-11-17): text-ad campaigns
|
||||
const hubsync = require('./hubsync'); // network hub: members from other doors arrive as waiting accounts, ours are reported (2026-11-12, only with HUB_ENABLED)
|
||||
const SF = require('./sponsorfollow'); // deliberate sponsor changes follow to LinkSpin until chain-bound + one network tank (2026-10-22)
|
||||
const bixpay = require('./bixpay'); // BixPay Visa card: partner-link field, sponsor-follows resolver, tracked clicks (2026-10-29, gated by site config bixpayLive)
|
||||
@@ -5748,6 +5749,19 @@ const server = http.createServer(async (req, res) => {
|
||||
out.loginLine = await ads.loginQueueView(s.email); // login-ad slots: open now, the paid line, this member's places + estimated starts
|
||||
return json(res, 200, out);
|
||||
}
|
||||
// the AI ad writer (Marty 2026-11-17: "do it on the other sites too"): the hub reads the member's target page and suggests 3
|
||||
// text ads (headline 60, ad text 140) written only from it. Nothing is created here: the member picks one, edits it, creates the campaign.
|
||||
if (p === '/api/my/adwriter' && (req.method === 'GET' || req.method === 'POST')) {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
if (req.method === 'GET') { const w = await adwriter.status(s.email); return json(res, 200, { on: !!w.on, daily: w.daily || 0, left: w.left }); }
|
||||
if (!(await adwriter.enabled())) return json(res, 503, { error: 'The ad writer is switched off right now. You can still write your ad yourself.' });
|
||||
if (supportFlood('aiw:' + clientIp(req), 12, 3600000)) return json(res, 429, { error: 'Too many ad writes from this connection this hour. Try again later, or write your ad yourself.' });
|
||||
const b = await readBody(req);
|
||||
const r = await adwriter.write(s.email, String((b && b.url) || '').trim().slice(0, 600), { headline: 60, line: 140 });
|
||||
if (r.error) return json(res, r.status || 400, { error: r.error, code: r.code, left: r.left });
|
||||
return json(res, 200, { ok: true, options: r.options, url: r.url, cached: r.cached, left: r.left });
|
||||
}
|
||||
if (p === '/api/my/campaigns' && req.method === 'POST') {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
|
||||
Reference in New Issue
Block a user