|
@@ -13,7 +13,11 @@ namespace ET.Server
|
|
|
{
|
|
|
public async ETTask Handle(Entity domain, HttpListenerContext context)
|
|
|
{
|
|
|
+ string xnoncestr = context.Request.Headers["x-nonce-str"];
|
|
|
+ string xtimestamp = context.Request.Headers["x-timestamp"];
|
|
|
+ string xsignature = context.Request.Headers["x-signature"];
|
|
|
string xroomId = context.Request.Headers["x-roomid"];
|
|
|
+ string msgType = context.Request.Headers["x-msg-type"];
|
|
|
|
|
|
if (string.IsNullOrEmpty(xroomId))
|
|
|
{
|
|
@@ -21,10 +25,6 @@ namespace ET.Server
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- string msgType = context.Request.Headers["x-msg-type"];
|
|
|
-
|
|
|
- Log.Debug($"抖音推送数据http回调 - msgType={msgType}");
|
|
|
-
|
|
|
if (string.IsNullOrEmpty(msgType))
|
|
|
{
|
|
|
Log.Error($"抖音推送数据http回调 找不到请求头:x-msg-type");
|
|
@@ -39,6 +39,21 @@ namespace ET.Server
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // 验签
|
|
|
+ Dictionary<string, string> header = new Dictionary<string, string>();
|
|
|
+ header.Add("x-nonce-str", xnoncestr);
|
|
|
+ header.Add("x-timestamp", (string.IsNullOrEmpty(xtimestamp)? 0 : long.Parse(xtimestamp)).ToString());
|
|
|
+ header.Add("x-roomid", xroomId);
|
|
|
+ header.Add("x-msg-type", msgType);
|
|
|
+
|
|
|
+ string res = HttpHelper.Signature(header, bodyStr, DouyinConst.SignatureSecret);
|
|
|
+
|
|
|
+ if (!xsignature.Equals(res))
|
|
|
+ {
|
|
|
+ Log.Warning($"抖音推送数据http回调 验签数据不合法 xsignature={xsignature}, res={res}");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
long roomId = long.Parse(xroomId);
|
|
|
|
|
|
switch (msgType)
|