Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
fix ws_rev
Browse files Browse the repository at this point in the history
same as gocq 4.15
  • Loading branch information
super1207 committed Dec 28, 2023
1 parent dcdc8f9 commit deecea9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/onebot_ws_rev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ async fn onebot_rev_ws(ws_url:String) {

// 无论如何,都添加Authorization头
if access_token != "" {
request.headers_mut().insert("Authorization", HeaderValue::from_str(&format!("Bearer {}",access_token)).unwrap());
request.headers_mut().insert("Authorization", HeaderValue::from_str(&format!("Token {}",access_token)).unwrap());
}

let self_id = G_SELF_ID.read().await.clone();
request.headers_mut().append(HeaderName::from_str("X-Self-ID").unwrap(), HeaderValue::from_str(&self_id.to_string()).unwrap());
request.headers_mut().append(HeaderName::from_str("X-Client-Role").unwrap(), HeaderValue::from_str("Universal").unwrap());
request.headers_mut().append(HeaderName::from_str("user-agent").unwrap(), HeaderValue::from_str("CQHttp/4.15.0").unwrap());
let rst;
if ws_url.starts_with("wss://") {
let port_opt = request.uri().port();
Expand Down Expand Up @@ -176,4 +177,4 @@ pub async fn deal_ws_rev() {
onebot_rev_ws(ws_url).await;
});
}
}
}

0 comments on commit deecea9

Please sign in to comment.