mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-12 10:10:25 +00:00
✏️ 修复 fortune 无法下载
This commit is contained in:
@@ -2,14 +2,28 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
tr = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
nochkcrtcli = &http.Client{Transport: tr}
|
||||
)
|
||||
|
||||
// DownloadTo 下载到路径
|
||||
func DownloadTo(url, file string) error {
|
||||
resp, err := http.Get(url)
|
||||
func DownloadTo(url, file string, chkcrt bool) error {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
if chkcrt {
|
||||
resp, err = http.Get(url)
|
||||
} else {
|
||||
resp, err = nochkcrtcli.Get(url)
|
||||
}
|
||||
if err == nil {
|
||||
var f *os.File
|
||||
f, err = os.Create(file)
|
||||
|
||||
Reference in New Issue
Block a user