fix: ip
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Hooks;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Tokenview\TokenviewMonitorService;
|
||||
use App\Support\SafeLog;
|
||||
use App\Support\VisitorIp;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Throwable;
|
||||
@@ -19,7 +20,7 @@ class TokenviewWebhookController extends Controller
|
||||
$payload = $this->decodePayload($request, $raw);
|
||||
|
||||
$this->tvLog('info', 'tokenview webhook received', [
|
||||
'ip' => $request->ip(),
|
||||
'ip' => VisitorIp::fromRequest($request),
|
||||
'method' => $request->method(),
|
||||
'has_signature' => is_string($signature) && $signature !== '',
|
||||
'body_bytes' => strlen($raw),
|
||||
@@ -31,7 +32,7 @@ class TokenviewWebhookController extends Controller
|
||||
$signed = $monitor->verifySignature($raw, $signature);
|
||||
if (! $signed) {
|
||||
$this->tvLog('warning', 'tokenview webhook bad signature (acked 200, skipped ingest)', [
|
||||
'ip' => $request->ip(),
|
||||
'ip' => VisitorIp::fromRequest($request),
|
||||
'body_bytes' => strlen($raw),
|
||||
]);
|
||||
} elseif ($payload !== []) {
|
||||
|
||||
Reference in New Issue
Block a user