RESAZIP-PC\resaz

update daitogooglechat

......@@ -126,6 +126,7 @@ This creates `config/daito-google-chat.php`.
```dotenv
DAITO_GOOGLE_CHAT_ENABLED=true
DAITO_GOOGLE_CHAT_WEBHOOK_URL=https://chat.googleapis.com/v1/spaces/.../messages?key=...&token=...
DAITO_GOOGLE_CHAT_VERIFY_SSL=true
DAITO_GOOGLE_CHAT_QUEUE_NAME=google-chat
DAITO_GOOGLE_CHAT_RATE_LIMIT_ENABLED=true
DAITO_GOOGLE_CHAT_RATE_LIMIT_MAX_JOBS=20
......@@ -234,6 +235,28 @@ redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-google-chat-worker.log
```
### 10) Local WAMP + self-signed SSL (for webhook calls)
If your local machine uses a self-signed certificate, keep `DAITO_GOOGLE_CHAT_VERIFY_SSL=true` and trust your local CA/cert in Windows.
1. Download https://curl.se/ca/cacert.pem
2. Put cacert.pem into C:\wamp64\bin\php
3. Open php.ini and Edit as:
```
curl.cainfo = "C:\php\extras\ssl\cacert.pem"
openssl.cafile = "C:\php\extras\ssl\cacert.pem"
```
4. Restart apache
Quick local-only fallback (not recommended long-term):
```dotenv
DAITO_GOOGLE_CHAT_VERIFY_SSL=false
```
Use this only for temporary debugging on local environment. Never disable SSL verification on production.
## QueryLog (Laravel shared package)
> **Provider registration note**
......
......@@ -6,18 +6,18 @@ use Illuminate\Support\Facades\RateLimiter;
class DaitoGoogleChatRateLimitMiddleware
{
public function handle($job, $next): void
public function handle($job, $next)
{
$rateLimitKey = (string) config('daito-google-chat.rate_limit_key', 'daito-google-chat:webhook');
$maxJobs = max(1, (int) config('daito-google-chat.rate_limit_max_jobs', 20));
$decaySeconds = max(1, (int) config('daito-google-chat.rate_limit_decay_seconds', 60));
if (RateLimiter::tooManyAttempts($rateLimitKey, $maxJobs)) {
$job->release(max(1, RateLimiter::availableIn($rateLimitKey)));
$job->release($decaySeconds);
return;
}
RateLimiter::hit($rateLimitKey, $decaySeconds);
$next($job);
return $next($job);
}
}
......
......@@ -21,10 +21,19 @@ class DaitoGoogleChatWebhookClient
$resolvedWebhookUrl = $this->resolveWebhookUrl($webhookUrl);
$this->assertWebhookUrlIsAllowed($resolvedWebhookUrl);
$response = Http::acceptJson()
$response = Http::withHeaders(
array(
'Accept' => 'application/json',
)
)
->asJson()
->withOptions(
array(
'connect_timeout' => (int) config('daito-google-chat.connect_timeout_seconds', 3),
'verify' => (bool) config('daito-google-chat.verify_ssl', true),
)
)
->timeout((int) config('daito-google-chat.timeout_seconds', 5))
->connectTimeout((int) config('daito-google-chat.connect_timeout_seconds', 3))
->retry(
(int) config('daito-google-chat.retry_times', 1),
(int) config('daito-google-chat.retry_sleep_ms', 200)
......
......@@ -9,6 +9,7 @@ return array(
),
'timeout_seconds' => env('DAITO_GOOGLE_CHAT_TIMEOUT', 5),
'connect_timeout_seconds' => env('DAITO_GOOGLE_CHAT_CONNECT_TIMEOUT', 3),
'verify_ssl' => env('DAITO_GOOGLE_CHAT_VERIFY_SSL', true),
'retry_times' => env('DAITO_GOOGLE_CHAT_RETRY_TIMES', 1),
'retry_sleep_ms' => env('DAITO_GOOGLE_CHAT_RETRY_SLEEP_MS', 200),
'queue_connection' => env('DAITO_GOOGLE_CHAT_QUEUE_CONNECTION', null),
......