diff --git a/fssc/internal/util/util.go b/fssc/internal/util/util.go index d04a71a..312413d 100644 --- a/fssc/internal/util/util.go +++ b/fssc/internal/util/util.go @@ -76,25 +76,23 @@ func CompressToZip(dest string, currentPath string, paths []string) error { if err != nil { return err } - // 将压缩方法设置为deflate - header.Method = zip.Deflate // 监听的工作目录作为文件的结尾,然后取相对路径 - header.Name, err = filepath.Rel(filepath.Dir(config.G.FilePath), path) - // 在zip存档中设置文件的相对路径 - //header.Name, err = filepath.Rel(filepath.Dir(src), path) + header.Name, err = filepath.Rel(filepath.Dir(config.G.FilePath), path) if err != nil { return err } + // 转换为Unix风格的路径分隔符 + header.Name = filepath.ToSlash(header.Name) + // 目录需要拼上一个 "/" ,否则会出现一个和目录一样的文件在压缩包中 if info.IsDir() { - // header.Name += string(os.PathSeparator) header.Name += "/" } else { - // 替换一下分隔符,zip不支持 "\\" - header.Name = strings.ReplaceAll(header.Name, "\\", "/") + // 将压缩方法设置为deflate + header.Method = zip.Deflate } // fmt.Printf("zip header:%v\n", header.Name) // 创建写入头的writer diff --git a/fssc/web/wbconsole.tmpl b/fssc/web/wbconsole.tmpl index a2a341c..55c1cb9 100644 --- a/fssc/web/wbconsole.tmpl +++ b/fssc/web/wbconsole.tmpl @@ -158,6 +158,7 @@ var chkall = true; var chknum=0; var scip=""; //目标服务器ip + var urlpath="{{$.UrlPath}}";// 当前的操作目录 $(function(){ // read sessionStorage @@ -170,6 +171,11 @@ // click function $("#entsip").on("click",function(){ + tgfs() + }) + + // 目标服务器的文件信息 + var tgfs=function(){ // scip = $("#scip").val(); // ip storage @@ -182,11 +188,13 @@ gescinfo(scip) // $("#rstatus").append(html) - }) + } // 获取目标服务器的信息 var gescinfo=function(scip){ - var url="http://"+scip+":9099/sc?callback" + // 客户端的状态地址 + var url="http://"+scip+":9099/sc?p="+urlpath + // var html=""; $.getJSON(url,function(res){ // res.curdir @@ -209,7 +217,9 @@ // append to html $("#tgsc").html(html) writelog(scip+"获取数据:"+res.data.list.length+"条数据" ) - $("#sc01").text(res.curdir); + // 客户端监控目录 + $("#sc01").text(res.workdir); + $("#sc02").text(res.curdir); }); }