Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix warframeapi #663

Merged
merged 2 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions plugin/warframeapi/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package warframeapi

import (
"crypto/tls"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -30,7 +31,11 @@ func newwfapi() (w wfapi, err error) {
// 获取Warframe市场的售价表,并进行排序,cn_name为物品中文名称,onlyMaxRank表示只取最高等级的物品,返回物品售价表,物品信息,物品英文
func getitemsorder(cnName string, onlyMaxRank bool) (od orders, it *itemsInSet, n string, err error) {
var wfapiio wfAPIItemsOrders
data, err := web.RequestDataWithHeaders(&http.Client{}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error {
data, err := web.RequestDataWithHeaders(&http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error {
request.Header.Add("Accept", "application/json")
request.Header.Add("Platform", "pc")
return nil
Expand Down Expand Up @@ -87,7 +92,11 @@ var (
func newwm() (*wmdata, error) {
var itemapi wfAPIItem // WarFrame市场的数据实例
var wd wmdata
data, err := web.RequestDataWithHeaders(&http.Client{}, wfitemurl, "GET", func(request *http.Request) error {
data, err := web.RequestDataWithHeaders(&http.Client{Transport: &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}}, wfitemurl, "GET", func(request *http.Request) error {
request.Header.Add("Accept", "application/json")
request.Header.Add("Language", "zh-hans")
return nil
Expand Down
3 changes: 3 additions & 0 deletions plugin/warframeapi/world.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func (w *world) refresh(api *wfapi) {

w.w[2].NextTime = api.CambionCycle.Expiry.Local()
w.w[2].IsDay = api.CambionCycle.Active == "fass"
for _, t := range w.w {
t.Unlock()
}
}

// 游戏时间更新
Expand Down