Help desk: signed partner API for LinkSpin tickets (LS- refs on the one shared desk)

POST /api/partner/support/{create,list,view,reply,token,token-reply}, signed exactly
like the registry rows (LS_SYNC_SECRET, X-LS-Ts + X-LS-Sig, now one readLsSigned helper
shared with /api/partner/registry). Only platform 'linkspin' tickets are reachable there.

LinkSpin tickets: requester mail, links and footer say LinkSpin support and point at
LS_URL (/support/t/<token>, /help#t=<ref>); no InstantAdPay in-app notice is sent for
them. Telegram ping, admin mail and the support bot's thread/list views mark them
LinkSpin. The member Help pane here lists InstantAdPay tickets only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-16 18:04:52 -05:00
parent 80885705d2
commit 524ce843dc
3 changed files with 81 additions and 35 deletions
+4 -4
View File
@@ -1,8 +1,8 @@
// Help desk in Telegram (Marty, 2026-10-16): @CTBTickets_bot pings Marty's PRIVATE chat for every new ticket and member
// reply, with buttons (Close, Waiting, High, Open in admin), and takes his answers back: reply to a ticket message and
// the text goes to the requester exactly as an admin reply would; start it with /note to keep it internal. /tickets
// lists what is open, /t IAP-1042 shows a thread. Updates arrive on a webhook guarded by a secret header, and only
// the configured private chat is obeyed. Token: env SUPPORT_BOT_TOKEN; webhook secret: env SUPPORT_TG_SECRET.
// lists what is open, /t IAP-1042 shows a thread (LS- refs are LinkSpin tickets, marked 🔗). Updates arrive on a webhook
// guarded by a secret header, and only the configured private chat is obeyed. Token: env SUPPORT_BOT_TOKEN; webhook secret: env SUPPORT_TG_SECRET.
'use strict';
const https = require('https');
@@ -60,14 +60,14 @@ async function sendList(which) {
const { title, rows } = await fetchList(which);
if (!rows.length) return say(title + ': none right now.', { reply_markup: MENU });
const shown = rows.slice(0, 20);
const buttons = shown.map(t => [{ text: (t.priority === 'high' ? '🔥 ' : '') + t.ref + ' · ' + String(t.subject).slice(0, 40), callback_data: 'tv|' + t.ref }]);
const buttons = shown.map(t => [{ text: (t.priority === 'high' ? '🔥 ' : '') + (t.platform === 'linkspin' ? '🔗 ' : '') + t.ref + ' · ' + String(t.subject).slice(0, 40), callback_data: 'tv|' + t.ref }]);
return say('<b>' + title + '</b> (' + rows.length + ')' + (rows.length > shown.length ? ', newest 20 shown' : '') + '\nTap one to open it.', { reply_markup: { inline_keyboard: buttons } });
}
async function showThread(ref) {
const t = await deps.tickets.byRef(ref); if (!t) return say('No ticket ' + escH(ref) + '.');
const v = await deps.tickets.adminView(t.id);
const msgs = (v.messages || []).slice(-6).map(m => (m.internal ? '📝 note' : m.author === 'admin' ? '↩️ you' : '👤 ' + escH(t.name || t.email)) + ': ' + escH(String(m.body).slice(0, 500)));
return say('<b>' + t.ref + '</b> · ' + STATUS_WORD[t.status] + ' · ' + escH(t.platform) + ' · ' + escH(t.category) + '\n' + escH(t.email) + '\n<b>' + escH(t.subject) + '</b>\n\n' + msgs.join('\n\n'), { reply_markup: keyboard(t.ref) });
return say('<b>' + t.ref + '</b> · ' + STATUS_WORD[t.status] + ' · ' + (t.platform === 'linkspin' ? '🔗 <b>LinkSpin</b>' : escH((deps.tickets.PLATFORM_NAME || {})[t.platform] || t.platform)) + ' · ' + escH(t.category) + '\n' + escH(t.email) + '\n<b>' + escH(t.subject) + '</b>\n\n' + msgs.join('\n\n'), { reply_markup: keyboard(t.ref) });
}
// webhook: returns nothing; the caller always answers 200 so Telegram does not retry forever