|
|
|
@ -3,7 +3,6 @@ package handler |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fssc/config" |
|
|
|
"fssc/internal/db" |
|
|
|
"fssc/internal/util" |
|
|
|
"fssc/web" |
|
|
|
"html/template" |
|
|
|
@ -19,7 +18,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) { |
|
|
|
// 路径
|
|
|
|
urlpath := r.URL.Query().Get("p") |
|
|
|
if urlpath == "Li4=" { |
|
|
|
urlpath = "" |
|
|
|
urlpath = "." |
|
|
|
} |
|
|
|
|
|
|
|
//文件名
|
|
|
|
@ -43,7 +42,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) { |
|
|
|
realFilePath := filepath.Join(config.G.FilePath, abupath) |
|
|
|
downloadPath := filepath.Join(filepath.Base(config.G.FilePath), abupath) |
|
|
|
// 相对路径
|
|
|
|
relpath := filepath.Join(abupath, "../") |
|
|
|
relpath := filepath.Join(abupath, ".") |
|
|
|
fmt.Printf("relpath is %s\n", relpath) |
|
|
|
//
|
|
|
|
fileInfo, err := os.Stat(realFilePath) |
|
|
|
@ -81,21 +80,6 @@ func WebConsole(w http.ResponseWriter, r *http.Request) { |
|
|
|
return |
|
|
|
} |
|
|
|
data.Files = files |
|
|
|
// 计算文件的hash和其他信息
|
|
|
|
for _, f := range files { |
|
|
|
// 结构体信息
|
|
|
|
tf := db.StFileInfo{} |
|
|
|
tf.Fname = f.Name() |
|
|
|
tf.Fpath = filepath.Join(relpath, f.Name()) |
|
|
|
// 文件的hash
|
|
|
|
tf.Fhash = util.CalacHash(f.Name()) |
|
|
|
//add
|
|
|
|
ret := db.Sqlite_add(tf) |
|
|
|
fmt.Printf("add ST-FileInfo is:%d\n", ret) |
|
|
|
//log.Fatalln("add ST-FileInfo is:%d\n",ret)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
data.FileName = filepath.Base(realFilePath) |
|
|
|
} |
|
|
|
|