AI ad writer on LinkSpin (Marty 2026-11-17: "do it on the other sites too"): "Write my ad from my link" on the Ads screen text ads (60/140) and "Write my headline from my link" in the page builder (headline 90 + subhead 200), both asking the network hub (hubadwriter.js, POST /v1/adwriter) through GET/POST /api/my/adwriter; shown only when the hub says on; chatbot fact, KNOWLEDGE_DATE 2026-11-17; ads-screen.js/pages-screen.js ?v=20261117aiw. Plus the PolHunter embed on the home page (3 tiles) with polhunter.com in script-src and connect-src (punch list L2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,7 @@ const registry = require('./registry'); // network registry: who is who ac
|
||||
const iapsync = require('./iapsync'); // reverse registry sync: LinkSpin-first members reach InstantAdPay (2026-10-15)
|
||||
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 ads + page headlines
|
||||
const hubsync = require('./hubsync'); // network hub link, inert unless HUB_ENABLED=1 (2026-11-12)
|
||||
const SF = require('./sponsorfollow'); // deliberate sponsor changes follow to InstantAdPay until chain-bound + one network tank (2026-10-22)
|
||||
let follow = null, followStore = null;
|
||||
@@ -904,7 +905,7 @@ const MIME = { '.html': 'text/html; charset=utf-8', '.css': 'text/css', '.js': '
|
||||
'.png': 'image/png', '.jpg': 'image/jpeg', '.svg': 'image/svg+xml', '.webp': 'image/webp',
|
||||
'.ico': 'image/x-icon', '.json': 'application/json', '.mp4': 'video/mp4', '.woff2': 'font/woff2',
|
||||
'.gif': 'image/gif', '.webm': 'video/webm', '.txt': 'text/plain; charset=utf-8', '.xml': 'application/xml; charset=utf-8' };
|
||||
const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ=' " + themehead.CSP_HASH + "; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:";
|
||||
const CSP = "default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://polhunter.com 'sha256-NzvNrqk5jB9YZATwo5BF4JoRlJ02HsnFikbKXgEPdaQ=' " + themehead.CSP_HASH + "; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https:; media-src 'self' https: blob:; connect-src 'self' https://polhunter.com https://*.walletconnect.com wss://*.walletconnect.com https://*.walletconnect.org wss://*.walletconnect.org https://*.reown.com wss://*.reown.com https://*.reown.org wss://*.reown.org https://*.web3modal.org https://*.drpc.org https://*.publicnode.com https://*.coinbase.com; font-src 'self' data: https://fonts.gstatic.com https://fonts.reown.com; form-action 'self'; frame-src https: http:";
|
||||
function baseHeaders(extra) {
|
||||
return Object.assign({ 'Content-Security-Policy': CSP, 'X-Content-Type-Options': 'nosniff',
|
||||
'Referrer-Policy': 'strict-origin-when-cross-origin' }, extra || {});
|
||||
@@ -4061,6 +4062,21 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = b.remove ? audiences.remove(s.email, b.id) : b.id ? audiences.rename(s.email, b.id, b.name) : audiences.create(s.email, b.name);
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
// the AI ad writer (Marty 2026-11-17: "do it on the other sites too"): the hub reads the member's page and suggests 3 options written
|
||||
// only from it. kind 'text' = a text ad (headline 60, one line 140); kind 'page' = a page builder headline (90) + subhead (200).
|
||||
// Nothing is saved here: the member picks one, edits it and launches or saves it themselves.
|
||||
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 it 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 it yourself.' });
|
||||
const b = await readBody(req);
|
||||
const limits = b && b.kind === 'page' ? { headline: 90, line: 200 } : { headline: 60, line: 140 };
|
||||
const r = await adwriter.write(s.email, String((b && b.url) || '').trim().slice(0, 600), limits);
|
||||
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 === 'GET') {
|
||||
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