autorun 추가
This commit is contained in:
@ -3,6 +3,8 @@ package client
|
||||
import (
|
||||
"archive/tar"
|
||||
"archive/zip"
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -58,6 +60,7 @@ func download(dir string, urlpath string, accessToken string, cb func(int64, int
|
||||
|
||||
req, _ := http.NewRequest("GET", urlpath, nil)
|
||||
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.51")
|
||||
req.Header.Add("As-X-UrlHash", accessToken)
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -328,7 +331,10 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.Deplo
|
||||
}
|
||||
|
||||
// verpath에 배포 시작
|
||||
fname, err := download(root, hc.makeDownloadUrl(req.Url), req.AccessToken, func(written int64, total int64) {
|
||||
h := md5.New()
|
||||
h.Write([]byte(strings.Trim(req.Url, "/")))
|
||||
at := hex.EncodeToString(h.Sum(nil))
|
||||
fname, err := download(root, hc.makeDownloadUrl(req.Url), at, func(written int64, total int64) {
|
||||
prog := protos.DeployingProgress{
|
||||
State: "download",
|
||||
Progress: written,
|
||||
@ -356,7 +362,11 @@ func (hc *houstonClient) deploy(req *shared.DeployRequest, cb func(*protos.Deplo
|
||||
|
||||
if err == nil && len(req.Config) > 0 {
|
||||
// config.json도 다운로드
|
||||
_, err = download(root, hc.makeDownloadUrl(req.Config), req.AccessToken, nil)
|
||||
h := md5.New()
|
||||
h.Write([]byte(strings.Trim(req.Config, "/")))
|
||||
at = hex.EncodeToString(h.Sum(nil))
|
||||
|
||||
_, err = download(root, hc.makeDownloadUrl(req.Config), at, nil)
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user