Browse Source

增加运行目录的操作

master
453530270@qq.com 2 years ago
parent
commit
bc98ff750b
  1. 2
      xgfs/internal/handler/handler.go
  2. 51
      xgfs/web/download.tmpl

2
xgfs/internal/handler/handler.go

@ -317,6 +317,7 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
data := struct {
DeviceName string
Rundir string
IsDir bool
FileName string
DownloadPath string
@ -324,6 +325,7 @@ func SendHandler(w http.ResponseWriter, r *http.Request) {
Files []os.DirEntry
}{
DeviceName: config.G.DeviceName,
Rundir: config.G.FilePath,
DownloadPath: downloadPath,
UrlPath: strings.TrimSuffix(r.URL.Path, "/"),
}

51
xgfs/web/download.tmpl

@ -69,22 +69,24 @@
.tips{
display:block;
text-align:right;
font-size:0.6rem;
color:#ddd;
line-height:1.8;
margin-left:32px;
font-size:14px;
}
.folder-icon {
width: 24px;
height: 24px;
margin-right: 10px;
color:#ce911e;
}
.file-icon {
width: 24px;
height: 24px;
margin-right: 10px;
color:#a29c8d;
}
@media (max-width: 600px) {
@ -93,6 +95,7 @@
}
}
</style>
<link rel="stylesheet" href="/static/static/css/bootstrap.css">
<script type="text/javascript" src="/static/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/static/js/bootstrap.min.js"></script>
</head>
@ -102,24 +105,40 @@
<hr>
{{ if .IsDir }}
<h2>{{ .DownloadPath }}</h2>
<form action="/sendZip" method="post">
<div class="">
</div>
<form action="/sendZip" method="post" class="form-inline">
<div class="row">
<div class="mb-3">
<input id="all" type="checkbox"> 全选
<div class="col-md-12">运行目录:{{.Rundir}}</div>
</div>
<div class="row">
<div class="col-md-2">
<div class="form-group">
<input id="all" class="form-control" type="checkbox"> 全选
</div>
</div>
<div class="mb-8">
<div class="input-group mb-3">
<input placeholder="目标服务器ip,端口:9099" type="input" name="serverip" class="form-control"></input>
<input type="hidden" name="curpath" value="{{ .UrlPath }}"/>
<!--button class="btn btn-primary" type="submit">下载zip</button-->
<button class="btn btn-primary" type="submit">同步选中的文件压缩包</button>
<div class="col-md-5">
<div class="form-group">
<label for="serverip">服务器ip</label>
<input type="email" class="form-control" id="serverip" placeholder="eg:192.168.66.100:9099">
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<input type="text" class="form-control" disabled="disabled" name="curpath" value="{{ .UrlPath }}"/>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<button class="btn btn-primary" type="submit">以压缩包模式发送文件</button>
</div>
</div>
<div class="row">
<ul>
{{ range .Files }}
@ -134,15 +153,13 @@
<svg class="file-icon" viewBox="0 0 24 24">
<path fill="currentColor" d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2M13 9V3.5L18.5 9H13Z" />
</svg>
{{ .Name }} <span class="tips">{{.Info.Size}} {{.Info.ModTime.Format "2006-01-02 15:04:05"}} </span><a href="/download/{{ $.DownloadPath }}/{{ .Name }}" class="btn btn-primary" download>同步</a>
{{ .Name }} <span class="tips">{{.Info.Size}}</span><span class="tips"> {{.Info.ModTime.Format "2006-01-02 15:04:05"}} </span>
{{ end }}
</li>
{{ end }}
</ul>
{{ else }}
<h2>{{ .FileName }}</h2>
<div class="center"><a href="/download/{{ .FileName }}" class="btn" download>Download</a></div>
{{ end }}
</form>
</div>

Loading…
Cancel
Save