Browse Source

增加运行目录的操作

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

2
xgfs/internal/handler/handler.go

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

47
xgfs/web/download.tmpl

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

Loading…
Cancel
Save