From dfca6df62948bec7658c2905c4781b49186dbef7 Mon Sep 17 00:00:00 2001 From: Bashy Date: Wed, 27 May 2026 19:29:23 +0300 Subject: [PATCH 1/2] Send Discord snowflake IDs as strings to prevent JS precision loss channel_id and role_id are 64-bit integers that exceed Number.MAX_SAFE_INTEGER, causing silent rounding in the browser. Cast to string in the GET response; PHP stores them back as integers on save (64-bit PHP handles them correctly). Co-Authored-By: Claude Sonnet 4.6 --- web/api/botconfig.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/api/botconfig.php b/web/api/botconfig.php index 4496972..b4339d5 100644 --- a/web/api/botconfig.php +++ b/web/api/botconfig.php @@ -39,6 +39,13 @@ if ($method === 'GET') { $safe = $config; if (isset($safe['linkedin']['access_token'])) $safe['linkedin']['access_token'] = $safe['linkedin']['access_token'] ? '***' : null; if (isset($safe['linkedin']['refresh_token'])) $safe['linkedin']['refresh_token'] = $safe['linkedin']['refresh_token'] ? '***' : null; + // Discord snowflake IDs exceed JS Number.MAX_SAFE_INTEGER — send as strings + foreach (['twitch', 'rss'] as $section) { + foreach ($safe[$section] ?? [] as $key => $item) { + if (isset($item['channel_id'])) $safe[$section][$key]['channel_id'] = (string)$item['channel_id']; + if (isset($item['role_id']) && $item['role_id'] !== null) $safe[$section][$key]['role_id'] = (string)$item['role_id']; + } + } echo json_encode(['config' => $safe]); exit; } From f6e768c246f23afab15956784a9b6e9932597a3a Mon Sep 17 00:00:00 2001 From: Bashy Date: Wed, 27 May 2026 19:29:29 +0300 Subject: [PATCH 2/2] Expand bot/automated-tool filter in site log importer Add empty UA early return and a comprehensive list of bot signals covering HTTP libraries, SEO platforms, uptime monitors, security scanners, AI crawlers, and generic scanner vocabulary. Co-Authored-By: Claude Sonnet 4.6 --- bin/import-site-logs.php | 52 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/bin/import-site-logs.php b/bin/import-site-logs.php index 5a95392..c6325ae 100644 --- a/bin/import-site-logs.php +++ b/bin/import-site-logs.php @@ -280,9 +280,57 @@ function isInteresting(array $row, string $pathPrefix): bool { 'mp3','wav','ogg','pdf','zip','tar','gz','xml','txt']; if (in_array($ext, $asset, true)) return false; - // Skip obvious bots + // Empty UA — almost certainly automated $ua = strtolower((string)$row['ua']); - foreach (['bot','crawl','spider','curl','wget','headless','scrapy','go-http','python-requests','okhttp'] as $needle) { + if ($ua === '') return false; + + // Comprehensive bot / automated-tool filter + static $botSignals = [ + // Generic signals — catches most search engines + named bots + 'bot', 'crawl', 'spider', 'headless', 'scrapy', 'slurp', + + // HTTP tools and libraries + 'curl', 'wget', + 'python-requests', 'python-urllib', 'python-httpx', + 'go-http', 'okhttp', + 'libwww-perl', 'lwp/', + 'guzzlehttp', 'guzzle/', + 'java/', 'apache-httpclient', + 'node-fetch', 'undici/', 'got/', 'axios/', + 'aiohttp/', 'httpx/', + 'mechanize', 'faraday/', 'httpie', 'ruby', + + // SEO / link-analysis platforms + 'ahrefs', 'semrush', 'moz.com', 'sitechecker', 'similarweb', + 'screaming frog', 'dataforseo', 'serpstat', 'seokicks', 'babbar', + 'dotbot', 'duckduckgo-favicons', + + // Uptime / monitoring services + 'uptimerobot', 'pingdom', 'statuscake', 'site24x7', 'freshping', + 'betteruptime', 'hetrixtools', 'nodeping', 'hyperping', + 'updown.io', 'check_http', 'healthcheck', + + // Security / vulnerability scanners + 'nikto', 'nessus', 'masscan', 'zgrab', 'nuclei', + 'sqlmap', 'whatweb', 'wfuzz', 'dirbuster', 'gobuster', + 'feroxbuster', 'burp', + + // Social link-preview fetchers (not caught by "bot") + 'whatsapp', 'skypeuripreview', 'slack-imgproxy', 'vkshare', + + // Archive / site copiers + 'ia_archiver', 'httrack', + + // APM / observability agents + 'datadog', 'newrelic', 'dynatrace', + + // AI crawlers not containing "bot" + 'cohere-ai', 'anthropic-ai', 'meta-externalagent', + + // Generic scanner vocabulary + 'scanner', 'checker', 'prober', 'monitor', + ]; + foreach ($botSignals as $needle) { if (str_contains($ua, $needle)) return false; } return true;