mirror of
https://github.com/whyour/qinglong.git
synced 2026-02-13 14:35:40 +08:00
Add clarifying comments about Feishu signature algorithm
Co-authored-by: whyour <22700758+whyour@users.noreply.github.com>
This commit is contained in:
parent
6fd7eabcb6
commit
a3a556b625
|
|
@ -562,6 +562,8 @@ export default class NotificationService {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add signature if secret is provided
|
// Add signature if secret is provided
|
||||||
|
// Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
||||||
|
// and signs an empty message, which differs from typical HMAC usage
|
||||||
if (larkSecret) {
|
if (larkSecret) {
|
||||||
const timestamp = Math.floor(Date.now() / 1000).toString();
|
const timestamp = Math.floor(Date.now() / 1000).toString();
|
||||||
const stringToSign = `${timestamp}\n${larkSecret}`;
|
const stringToSign = `${timestamp}\n${larkSecret}`;
|
||||||
|
|
|
||||||
|
|
@ -995,6 +995,8 @@ function fsBotNotify(text, desp) {
|
||||||
const body = { msg_type: 'text', content: { text: `${text}\n\n${desp}` } };
|
const body = { msg_type: 'text', content: { text: `${text}\n\n${desp}` } };
|
||||||
|
|
||||||
// Add signature if secret is provided
|
// Add signature if secret is provided
|
||||||
|
// Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
||||||
|
// and signs an empty message, which differs from typical HMAC usage
|
||||||
if (FSSECRET) {
|
if (FSSECRET) {
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const timestamp = Math.floor(Date.now() / 1000).toString();
|
const timestamp = Math.floor(Date.now() / 1000).toString();
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,8 @@ def feishu_bot(title: str, content: str) -> None:
|
||||||
data = {"msg_type": "text", "content": {"text": f"{title}\n\n{content}"}}
|
data = {"msg_type": "text", "content": {"text": f"{title}\n\n{content}"}}
|
||||||
|
|
||||||
# Add signature if secret is provided
|
# Add signature if secret is provided
|
||||||
|
# Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
||||||
|
# and signs an empty message, which differs from typical HMAC usage
|
||||||
if push_config.get("FSSECRET"):
|
if push_config.get("FSSECRET"):
|
||||||
timestamp = str(int(time.time()))
|
timestamp = str(int(time.time()))
|
||||||
string_to_sign = f'{timestamp}\n{push_config.get("FSSECRET")}'
|
string_to_sign = f'{timestamp}\n{push_config.get("FSSECRET")}'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user