Ad editing: fix the link, image, text or name of a running ad; first edit free, then campaignEditFee credits
Orlando (#30) could only pause, resume or top up a banner or login ad with a wrong link. - POST /api/my/campaigns/<id>/edit (owner) and /api/admin/campaigns/<id>/edit (any ad, free, never uses the member's free edit). Banner: link, image, name. Text: link, headline, line, name. Login and the rest: link, name. Type, size, budget, geo, schedule, audience are refused. - Create and edit share one path: checkName/checkTarget/checkBannerImage/checkTextCopy in ads.js (validate() now calls them) and adChecks() in server.js (frame check + a new banner image check: loads, is a real PNG/JPG/GIF/WebP, up to 3 MB; own uploads read off the volume). - Fee: campaigns.edits counts member edits; the first is free, each later one costs the site setting campaignEditFee (default 100, admin Settings). Charged from the engine pool via spendEarned (earned first, then credited purchased); with neither, a burn row on the best-funded position (the normal burn queue). Guarded claim so two saves cannot both be free; a failed save refunds exactly what was taken. - History: campaigns.edit_log (ts, by, fields, old/new values, fee), last 50. - NAS: clicks already route through /api/ads/click/<id>, so a new link needs no write; a new image or text goes to the NAS row via nas.updateCreative. Failures never block the edit and retry on the next reconcile pass. Open ad-viewer tokens get the new link. - UI: Edit button on the Ads screen (CR.dialog editor, real-size preview, upload, free/fee note and confirm), /ads#edit=<id> deep link from the /tools list, admin Member content shows edit count + history with an Edit action. Chatbot canned answer + FACTS. - qa/adedit.mjs: 51 checks against a throwaway DATA_DIR, Playwright screenshots in D:/tmp/ad-edit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -135,6 +135,8 @@ async function bootstrap() {
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`); // on-site serves per viewer country
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN day_spent INT NOT NULL DEFAULT 0');
|
||||
await alterSafe("ALTER TABLE campaigns ADD COLUMN day_key CHAR(10) NULL");
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN edits INT NOT NULL DEFAULT 0'); // member edits so far (the first is free), 2026-10-18
|
||||
await alterSafe('ALTER TABLE campaigns ADD COLUMN edit_log MEDIUMTEXT NULL'); // JSON [{ts, by, fields, from, to, fee, paidFrom}], last 50
|
||||
// linked positions: extra wallets owned by one email account (Qualified Start).
|
||||
// Each is its own on-chain member sponsored by the account's main member.
|
||||
await q(`CREATE TABLE IF NOT EXISTS positions (
|
||||
|
||||
Reference in New Issue
Block a user