mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-27 20:49:03 +08:00
fix: 解决应用安装失败的问题 (#5319)
This commit is contained in:
parent
37de6aae66
commit
0e74acbec0
@ -840,11 +840,7 @@ func (a AppService) SyncAppListFromRemote() (err error) {
|
|||||||
oldAppIds = append(oldAppIds, old.ID)
|
oldAppIds = append(oldAppIds, old.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
var transport *http.Transport
|
transport := xpack.LoadRequestTransport()
|
||||||
ok, transportItem := xpack.LoadRequestTransport()
|
|
||||||
if ok {
|
|
||||||
transport = transportItem
|
|
||||||
}
|
|
||||||
baseRemoteUrl := fmt.Sprintf("%s/%s/1panel", global.CONF.System.AppRepo, global.CONF.System.Mode)
|
baseRemoteUrl := fmt.Sprintf("%s/%s/1panel", global.CONF.System.AppRepo, global.CONF.System.Mode)
|
||||||
appsMap := getApps(oldApps, list.Apps)
|
appsMap := getApps(oldApps, list.Apps)
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@ package http
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -17,22 +15,8 @@ func GetHttpRes(url string) (*http.Response, error) {
|
|||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Timeout: time.Second * 300,
|
Timeout: time.Second * 300,
|
||||||
}
|
}
|
||||||
transportItem := &http.Transport{
|
transport := xpack.LoadRequestTransport()
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
client.Transport = transport
|
||||||
DialContext: (&net.Dialer{
|
|
||||||
Timeout: 60 * time.Second,
|
|
||||||
KeepAlive: 60 * time.Second,
|
|
||||||
}).DialContext,
|
|
||||||
TLSHandshakeTimeout: 5 * time.Second,
|
|
||||||
ResponseHeaderTimeout: 10 * time.Second,
|
|
||||||
IdleConnTimeout: 15 * time.Second,
|
|
||||||
}
|
|
||||||
ok, transport := xpack.LoadRequestTransport()
|
|
||||||
if ok {
|
|
||||||
transportItem.DialContext = transport.DialContext
|
|
||||||
transportItem.Proxy = transport.Proxy
|
|
||||||
}
|
|
||||||
client.Transport = transportItem
|
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(context.Background(), "GET", url, nil)
|
req, err := http.NewRequestWithContext(context.Background(), "GET", url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -11,11 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func HandleGet(url, method string) (int, []byte, error) {
|
func HandleGet(url, method string) (int, []byte, error) {
|
||||||
var transport *http.Transport
|
transport := xpack.LoadRequestTransport()
|
||||||
ok, transportItem := xpack.LoadRequestTransport()
|
|
||||||
if ok {
|
|
||||||
transport = transportItem
|
|
||||||
}
|
|
||||||
return HandleGetWithTransport(url, method, transport)
|
return HandleGetWithTransport(url, method, transport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,26 @@
|
|||||||
|
|
||||||
package xpack
|
package xpack
|
||||||
|
|
||||||
import "net/http"
|
import (
|
||||||
|
"crypto/tls"
|
||||||
|
"net"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
func RemoveTamper(website string) {}
|
func RemoveTamper(website string) {}
|
||||||
|
|
||||||
func LoadRequestTransport() (bool, *http.Transport) {
|
func LoadRequestTransport() *http.Transport {
|
||||||
return false, nil
|
return &http.Transport{
|
||||||
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||||
|
DialContext: (&net.Dialer{
|
||||||
|
Timeout: 60 * time.Second,
|
||||||
|
KeepAlive: 60 * time.Second,
|
||||||
|
}).DialContext,
|
||||||
|
TLSHandshakeTimeout: 5 * time.Second,
|
||||||
|
ResponseHeaderTimeout: 10 * time.Second,
|
||||||
|
IdleConnTimeout: 15 * time.Second,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func LoadGpuInfo() []interface{} {
|
func LoadGpuInfo() []interface{} {
|
||||||
|
Loading…
Reference in New Issue
Block a user