AI ad writer on the text-ad form (Marty 2026-11-17: "do it on the other sites too"): "Write my ad from my link" asks the network hub (hubadwriter.js, POST /v1/adwriter, 60/90 limits) for 3 ads from the member's own page; shown only when the hub says on; chatbot fact; my.js?v=9
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ const shop = require('./shop');
|
||||
const promokit = require('./promokit');
|
||||
const hubreport = require('./hubreport');
|
||||
const hubpeople = require('./hubpeople');
|
||||
const adwriter = require('./hubadwriter'); // the network AI ad writer, asked through the hub (2026-11-17)
|
||||
const hubevents = require('./hubevents'); // network hub hook (2026-11-16): sign-out-everywhere, block and erase end sessions here
|
||||
const hubline = require('./hubline');
|
||||
const proof = require('./proof');
|
||||
@@ -269,7 +270,8 @@ const server = http.createServer(async (req, res) => {
|
||||
if (p === '/api/config' && req.method === 'GET') {
|
||||
return json(res, 200, { site: C.site, siteName: C.siteName, chainId: C.chainId, chainName: C.chainName, rpc: C.publicRpc, walletConnectProjectId: C.walletConnectProjectId,
|
||||
boost: C.boost, split: C.split, deliverDays: C.deliverDays, levels: C.levels, visitSeconds: C.visitSeconds, ad: C.ad, sso: networksso.enabled(),
|
||||
shop: { live: shop.watching(), contract: shop.watching() ? C.contractAddress : null }, explorer: C.explorer, joinUrl: joinUrl('') });
|
||||
shop: { live: shop.watching(), contract: shop.watching() ? C.contractAddress : null }, explorer: C.explorer, joinUrl: joinUrl(''),
|
||||
aiWriter: await adwriter.status().then(w => (w.on ? { daily: w.daily } : null)) });
|
||||
}
|
||||
// everything a page shows, with its visit ticket. page=front|member|other, u=<username> for member pages
|
||||
if (p === '/api/wire' && req.method === 'GET') {
|
||||
@@ -394,6 +396,17 @@ const server = http.createServer(async (req, res) => {
|
||||
const r = await lstrack.spins(m.username); if (r.error) return json(res, 502, { error: r.error });
|
||||
return json(res, 200, { account: r.account !== false, spins: r.spins || [] });
|
||||
}
|
||||
// the AI ad writer (Marty 2026-11-17): 3 suggested ads written by the hub only from the member's own page; nothing is posted
|
||||
if (p === '/api/my/adwriter' && req.method === 'POST') {
|
||||
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 (limited(req, 'adwriter', 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 m = store.member(me); await verifyNet(me).catch(() => {});
|
||||
if (!netVerified(m)) return json(res, 403, { error: 'The ad writer is for network members. Join InstantAdPay or LinkSpin free, then sign in here through them.', join: joinUrl('') });
|
||||
const b = await readBody(req);
|
||||
const r = await adwriter.write(me, String(b.url || '').trim().slice(0, 600), { headline: C.ad.headline, line: C.ad.line });
|
||||
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 });
|
||||
}
|
||||
// the member's one text ad: create, or edit (a Boost follows the ad, so editing keeps it)
|
||||
if (p === '/api/my/ad' && req.method === 'POST') {
|
||||
if (limited(req, 'ad', 30, 3600000)) return json(res, 429, { error: 'Too many changes this hour.' });
|
||||
|
||||
Reference in New Issue
Block a user