Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Satini_pvduc
/
daito-utils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
RESAZIP-PC\resaz
2026-02-23 16:20:24 +0700
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
26faf87305a462492a203f83cefb125eb1513850
26faf873
1 parent
be05377f
update daitogooglechat
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
5 deletions
README.md
src/DaitoGoogleChat/Middleware/DaitoGoogleChatRateLimitMiddleware.php
src/DaitoGoogleChat/Services/DaitoGoogleChatWebhookClient.php
src/DaitoGoogleChat/config/daito-google-chat.php
README.md
View file @
26faf87
...
...
@@ -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:
\w
amp64
\b
in
\p
hp
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**
...
...
src/DaitoGoogleChat/Middleware/DaitoGoogleChatRateLimitMiddleware.php
View file @
26faf87
...
...
@@ -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
);
}
}
...
...
src/DaitoGoogleChat/Services/DaitoGoogleChatWebhookClient.php
View file @
26faf87
...
...
@@ -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
)
...
...
src/DaitoGoogleChat/config/daito-google-chat.php
View file @
26faf87
...
...
@@ -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
),
...
...
Please
register
or
sign in
to post a comment