CHKZL / DDTV

可对阿B进行直播多窗口观看、开播提醒、自动录制、合并、转码的跨平台工具
GNU General Public License v2.0
1.32k stars 87 forks source link

Doc/docs/API/API.md 中的疑问 #146

Closed EldersJavas closed 2 years ago

EldersJavas commented 2 years ago
accesskeyid int 用于加密字符串的验证KeyId,存在于配置文件中需要和accesskeysecret成对的使用

我的 accesskeyid 和 accesskeysecret 都是字符串形式,这里int是笔误吗?

EldersJavas commented 2 years ago

而且sig每次都是错误的 https://github.com/EldersJavas/ddtvgo

//这是获取时间戳方法,已转为UTC和秒级
timenow := time.Now().UTC().Unix()

//这是生成sig,使用go原生库
func SHA1(s string) string {
    t := sha1.New()
    _, err := io.WriteString(t, s)
    if err != nil {
        log.Fatalln("SHA1 Error")
    }
    return fmt.Sprintf("%x", t.Sum(nil))
}

//这是sig原始字符串
accesskeyid=fe4d50***6c***08b******18818b2e6;accesskeysecret=*****818def64*****b35be4834*****;cmd=system_info;time=1661656053

//这是post内容
accesskeyid=fe4d50***6c***08b******18818b2e6&cmd=System_Info&sig=04d753f0552c7758646d227235b4ab09b38fcb65&time=1661656053

//这是返回报错json
{"code":6002,"cmd":"AuthenticationFailed","massage":"sig校验失败","data":"sig校验失败"} 
EldersJavas commented 2 years ago

我发现DDTV_Client的sig原始字符串后面带";",而文档中没有";"

https://github.com/FishMagic/DDTV_Client/blob/d3946c0168f2217b1a7970f8caa1ac6967e13335/common/src/commonMain/kotlin/me/ftmc/common/Utils.kt#L23

然而事实上加了";"sig也是错误的.

EldersJavas commented 2 years ago

然而...

我发现必须要把sig大写才行,

终于成功了

(阿米,快修改下文档吧)

EldersJavas commented 2 years ago

147 尝试修改API.md以防止更多人踩坑

诶,还有int没改

CHKZL commented 2 years ago

好= =

CHKZL commented 2 years ago

PR已合并 645ce5cb18833aa4dce5076a16de5c9e0e182739 ,官网已更新