This commit is contained in:
2020-01-23 18:40:49 +08:00
parent 33a4ea74af
commit e2075110f2
3 changed files with 6 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "dingtalk"
version = "1.2.0"
version = "1.2.1"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
description = "DingTalk Robot Util, Send text/markdown/link messages using DingTalk robot, 钉钉机器人"
@@ -16,7 +16,6 @@ urlencoding = "1.0.0"
futures = "0.3.1"
hmac = "0.7.1"
sha2 = "0.8.1"
maplit = "1.0.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View File

@@ -89,6 +89,8 @@ dt.send_message(&DingTalkMessage::new_action_card("action card 002", "action car
#### Changelog
* v1.2.1
* Remove `maplit` crate
* v1.2.0
* Use `serde` and `serde_json` crates, replace `json` crate
* v1.1.2

View File

@@ -383,16 +383,16 @@ impl <'a> DingTalk<'a> {
// Just Ok
} else if self.default_webhook_url.contains('?') {
if !self.default_webhook_url.ends_with('&') {
signed_url.push_str("&");
signed_url.push('&');
}
} else {
signed_url.push_str("?");
signed_url.push('?');
}
signed_url.push_str("access_token=");
signed_url.push_str(&urlencoding::encode(self.access_token));
if self.sec_token != "" {
if !self.sec_token.is_empty() {
let timestamp = &format!("{}", SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis());
let timestamp_and_secret = &format!("{}\n{}", timestamp, self.sec_token);
let hmac_sha256 = base64::encode(&calc_hmac_sha256(self.sec_token.as_bytes(), timestamp_and_secret.as_bytes())?[..]);