v1.7.0: refactor max_bot to flat structure, add VCF+UserModel+NLP history context, portal pages and proxy fixes
- Refactored max_bot from nested packages to flat module structure - Q2: Extended BotUser model (patronymic, email, org, address, vcf_raw, contact_hash, phone_verified, email_verified, last_interaction, total_conversations, total_tickets) - Q2: VCF parser (FN, N, TEL, EMAIL, ORG, ADR), upsert on re-contact, NLP history context (_get_user_history_context -> YandexGPT) - Q1: Broadcast preview modal with 10s confirmation timer - Q3: CSS var(--white)->var(--bg-card), var(--text)->var(--text-primary) - Q4: bot_settings showNotification(), editable max_bot_id - Q5: Webhook secret passthrough via X-Max-Bot-Api-Secret - Masking sensitive keys, dialog_cleared handler, migrate via _add_column_if_not_exists() - Rate limit (asyncio.sleep 0.5 per 10), dead code removed, conv.intent context in contact.py - Portal pages: bot_consent, bot_kb (edit), bot_settings, bot_test, bot_tickets, portal_settings - Tests: 21/21 passing, added test_yandex_gpt.py, test_email_sender.py - Deploy: deploy_full.sh, schema.sql, seed_knowledge_base.sql
This commit is contained in:
@@ -27,7 +27,7 @@ define('BRUTE_FORCE_MAX_ATTEMPTS', 3);
|
||||
|
||||
function auth_brute_force_check(string $login): bool {
|
||||
$pdo = getDB();
|
||||
$stmt = $pdo->prepare("SELECT COUNT(*) FROM login_attempts WHERE (login = ? OR ip_address = ?) AND attempt_time > DATE_SUB(NOW(), INTERVAL ? SECOND)");
|
||||
$stmt = $pdo->prepare("SELECT COUNT(*) FROM login_attempts WHERE (login = ? OR ip_address = ?) AND attempt_time > NOW() - CAST(? || ' seconds' AS INTERVAL)");
|
||||
$stmt->execute([$login, $_SERVER['REMOTE_ADDR'] ?? '', BRUTE_FORCE_WINDOW]);
|
||||
return $stmt->fetchColumn() >= BRUTE_FORCE_MAX_ATTEMPTS;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ function get_coefficient(string $key, float $default = 0): float {
|
||||
if ($cache === null) {
|
||||
try {
|
||||
$pdo = getDB();
|
||||
$stmt = $pdo->query("SELECT `key`, `value` FROM formula_coefficients WHERE is_active=1");
|
||||
$stmt = $pdo->query('SELECT "key", "value" FROM formula_coefficients WHERE is_active');
|
||||
$cache = [];
|
||||
while ($row = $stmt->fetch()) {
|
||||
$cache[$row['key']] = (float)$row['value'];
|
||||
|
||||
Reference in New Issue
Block a user