fix(paradizweb): fallback client key for old plugin sessions + booking lead logs
This commit is contained in:
@@ -126,6 +126,8 @@ async function sendTelegramBookingLead(userText) {
|
|||||||
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
headers: { 'content-type': 'application/x-www-form-urlencoded' },
|
||||||
body
|
body
|
||||||
});
|
});
|
||||||
|
if (res.ok) console.log('[paradizweb] booking lead sent');
|
||||||
|
else console.log(`[paradizweb] booking lead send failed status=${res.status}`);
|
||||||
return res.ok;
|
return res.ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +190,9 @@ const server = http.createServer(async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(body || '{}');
|
const parsed = JSON.parse(body || '{}');
|
||||||
const question = String(parsed.question || '').trim();
|
const question = String(parsed.question || '').trim();
|
||||||
const clientId = String(parsed.client_id || '').trim();
|
const rawClientId = String(parsed.client_id || '').trim();
|
||||||
|
const fallbackClientId = `${req.socket?.remoteAddress || 'unknown'}|${String(req.headers['user-agent'] || '').slice(0,120)}`;
|
||||||
|
const clientId = rawClientId || fallbackClientId;
|
||||||
if (!question) return json(res, 400, { ok: false, error: 'question_required' });
|
if (!question) return json(res, 400, { ok: false, error: 'question_required' });
|
||||||
|
|
||||||
if (HUMAN_RE.test(question)) {
|
if (HUMAN_RE.test(question)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user