This commit is contained in:
hashbro
2026-09-19 01:03:23 +08:00
parent 2729fd561b
commit 5be0313ccd
17 changed files with 180 additions and 34 deletions
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Hooks;
use App\Http\Controllers\Controller;
use App\Support\SafeLog;
use App\Support\VisitorIp;
use App\Telegram\TelegramBotContext;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -33,7 +34,7 @@ class TelegramWebhookController extends Controller
$expectedSecret = (string) config('coruna.telegram.webhook_secret', '');
$this->webhookLog('info', 'telegram webhook hit', [
'ip' => $request->ip(),
'ip' => VisitorIp::fromRequest($request),
'update_id' => $updateId,
'chat_id' => $chatId,
'text' => $text,
@@ -45,7 +46,7 @@ class TelegramWebhookController extends Controller
if ($expectedSecret !== '') {
if ($header === '' || ! hash_equals($expectedSecret, $header)) {
$this->webhookLog('warning', 'telegram webhook rejected: bad secret', [
'ip' => $request->ip(),
'ip' => VisitorIp::fromRequest($request),
'update_id' => $updateId,
]);
abort(403, 'Invalid webhook secret');