Browse Source

调用cli参数

master
453530270@qq.com 2 years ago
parent
commit
6c196a5019
  1. 9
      fss/core/serverinfo.go
  2. 30
      fss/www/index.html

9
fss/core/serverinfo.go

@ -5,6 +5,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
"fss/config"
"io"
"net/http"
"os"
@ -38,12 +39,6 @@ var Gpath string
// 遍历监视目录,发送到json中
func SerInfo(w http.ResponseWriter, r *http.Request) {
//取到运行的目录
Gpath, err := os.Getwd()
if err != nil {
return
}
// 监听的目录通过?p=的方式传入
urlpath := r.URL.Query().Get("p")
// 防止逃逸,造成漏洞
@ -54,7 +49,7 @@ func SerInfo(w http.ResponseWriter, r *http.Request) {
// urlpath 进行base64 解码
dsrpath := base64dec(urlpath)
// 监听的根目录
realFilePath := filepath.Join(Gpath, dsrpath)
realFilePath := filepath.Join(config.G.FilePath, dsrpath)
// 时间目录的情况
fileInfo, err := os.Stat(realFilePath)
if err != nil {

30
fss/www/index.html

@ -108,32 +108,7 @@
</div>
<!-- List group -->
<ul class="list-group" id="scsc">
<li class="list-group-item optzone">
<div class="col-md-10">
<input type="checkbox" name="sfiles" />
<span class="icon folder-icon"></span>
<a href="#">涨涨</a>
</div>
<div class="col-md-2">
<a href="#" class="btn btn-primary btn-sm">同步</a>
<a href="#" class="btn btn-success btn-sm">复制</a></a>
</div>
</li>
<li class="list-group-item optzone">
<div class="col-md-10">
<input type="checkbox" name="sfiles" />
<span class="icon file-icon"></span>
<a href="#">fa.php</a>
<span class="hsval">HASh:98986</span>
</div>
<div class="col-md-2">
<a href="#" class="btn btn-primary btn-sm">同步</a>
<a href="#" class="btn btn-success btn-sm">复制</a></a>
</div>
</li>
</ul>
<ul class="list-group" id="scsc"></ul>
</div>
</div>
@ -274,7 +249,8 @@
if (v.dirflag) {
html += "<span class=\"icon folder-icon\"></span>" + v.fname + "</div>";
} else {
html += "<span class=\"icon file-icon\"></span>" + v.fname +
html += "<span class=\"icon file-icon\"></span>" +
"<a hsval='"+v.hash+"'>"+v.fname + "</a>"+
"<span class=\"hsval\">HASH:" + v.hash + "</span></div>";
}

Loading…
Cancel
Save