14 changed files with 616 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||
module fss |
|||
|
|||
go 1.22.1 |
|||
@ -0,0 +1,21 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"fmt" |
|||
"log" |
|||
"net/http" |
|||
) |
|||
|
|||
// 主函数
|
|||
func main() { |
|||
//创建一个文件服务器,会去www目录下找index.html
|
|||
fileServer := http.FileServer(http.Dir("./www")) |
|||
// 将 "/" 路径映射到文件服务器
|
|||
http.Handle("/", fileServer) |
|||
|
|||
fmt.Printf("Starting server at port 9090\n") |
|||
// 启动HTTP服务器并监听端口 80,如果出现错误,则打印错误信息并退出
|
|||
if err := http.ListenAndServe(":9090", nil); err != nil { |
|||
log.Fatal(err) |
|||
} |
|||
} |
|||
@ -0,0 +1,325 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
|
|||
<head> |
|||
<title>文件更新控制台</title> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|||
<link rel="stylesheet" href="./static/css/bootstrap.css"> |
|||
<link rel="icon" type="image/x-icon" href="/favicon.ico?v=2"> |
|||
<script type="text/javascript" src="./static/js/jquery.min.js"></script> |
|||
<script type="text/javascript" src="./static/js/bootstrap.min.js"></script> |
|||
<style> |
|||
.list-group>.list-group-item { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.optzone { |
|||
height: 60px; |
|||
} |
|||
|
|||
.stabox { |
|||
height: 260px; |
|||
overflow: scroll; |
|||
} |
|||
|
|||
.flist { |
|||
height: 360px; |
|||
overflow: auto; |
|||
} |
|||
|
|||
.icon { |
|||
display: inline-block; |
|||
width: 24px; |
|||
height: 24px; |
|||
} |
|||
|
|||
.icon:hover { |
|||
cursor: pointer; |
|||
background-color: #da1616; |
|||
} |
|||
|
|||
.folder-icon { |
|||
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbG5zOnhsaW5rPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rJyAgcHJlc2VydmVBc3BlY3RSYXRpbz0neE1pZFlNaWQgbWVldCcgIHZpZXdCb3g9IjAgMCAyNCAyNCIgPjxwYXRoIGQ9Ik0xMCA0SDRDMi45IDQgMiA0LjkgMiA2VjE4QzIgMTkuMSAyLjkgMjAgNCAyMEgyMEMyMS4xIDIwIDIyIDE5LjEgMjIgMThWOEMyMiA2LjkgMjEuMSA2IDIwIDZIMTJMMTAgNFoiIC8+PC9zdmc+"); |
|||
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbG5zOnhsaW5rPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rJyAgcHJlc2VydmVBc3BlY3RSYXRpbz0neE1pZFlNaWQgbWVldCcgIHZpZXdCb3g9IjAgMCAyNCAyNCIgPjxwYXRoIGQ9Ik0xMCA0SDRDMi45IDQgMiA0LjkgMiA2VjE4QzIgMTkuMSAyLjkgMjAgNCAyMEgyMEMyMS4xIDIwIDIyIDE5LjEgMjIgMThWOEMyMiA2LjkgMjEuMSA2IDIwIDZIMTJMMTAgNFoiIC8+PC9zdmc+"); |
|||
background-color: #c1972e; |
|||
|
|||
} |
|||
|
|||
.file-icon { |
|||
mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbG5zOnhsaW5rPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rJyAgcHJlc2VydmVBc3BlY3RSYXRpbz0neE1pZFlNaWQgbWVldCcgIHZpZXdCb3g9IjAgMCAyNCAyNCIgPjxwYXRoIGQ9Ik0xNCAySDZDNC45IDIgNCAyLjkgNCA0VjIwQzQgMjEuMSA0LjkgMjIgNiAyMkgxOEMxOS4xIDIyIDIwIDIxLjEgMjAgMjBWOEwxNCAyTTEzIDlWMy41TDE4LjUgOUgxM1oiIC8+IDwvc3ZnPg=="); |
|||
-webkit-mask-imagee: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbG5zOnhsaW5rPSdodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rJyAgcHJlc2VydmVBc3BlY3RSYXRpbz0neE1pZFlNaWQgbWVldCcgIHZpZXdCb3g9IjAgMCAyNCAyNCIgPjxwYXRoIGQ9Ik0xNCAySDZDNC45IDIgNCAyLjkgNCA0VjIwQzQgMjEuMSA0LjkgMjIgNiAyMkgxOEMxOS4xIDIyIDIwIDIxLjEgMjAgMjBWOEwxNCAyTTEzIDlWMy41TDE4LjUgOUgxM1oiIC8+IDwvc3ZnPg=="); |
|||
background-repeat: no-repeat; |
|||
background-color: #0e0b8b; |
|||
} |
|||
</style> |
|||
</head> |
|||
|
|||
<body> |
|||
|
|||
<div class="jumbotron"> |
|||
<div class="container"> |
|||
<p>文件更新控制台</p> |
|||
<p>ver:2.04</p> |
|||
</div> |
|||
</div> |
|||
|
|||
<!-- 输入服务器ip --> |
|||
<div class="container"> |
|||
|
|||
<div class="form-group col-md-6"> |
|||
<div class="input-group"> |
|||
<div class="input-group-addon">服务器ip</div> |
|||
<input type="text" class="form-control" name="sip" id="scip" placeholder="eg:192.168.66.99"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="input-group"> |
|||
<div class="input-group-addon">监视目录</div> |
|||
<input type="text" class="form-control" name="sdir" id="" placeholder="eg :/www/wwwroot/aa_com/" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group col-md-12"> |
|||
<button type="button" id="entsip" class="btn btn-primary">查看信息</button> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!-- 罗列文件的列表信息 --> |
|||
<div class="container"> |
|||
<!-- 源服务器 --> |
|||
<div class="col-md-12"> |
|||
<div class="panel panel-default"> |
|||
<!-- Default panel contents --> |
|||
<div class="panel-heading">源站(192.168.66.100)</div> |
|||
<div class="panel-body"> |
|||
<p>监听目录:/www</p> |
|||
<p>相对目录: /app/common </p> |
|||
</div> |
|||
|
|||
<!-- List group --> |
|||
<ul class="list-group"> |
|||
<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>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> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
</div> |
|||
|
|||
<!-- 目标服务器 --> |
|||
<div class="container"> |
|||
<!-- 目标的服务器信息 --> |
|||
<div class="form-group col-md-6"> |
|||
<div class="input-group"> |
|||
<div class="input-group-addon">服务器ip</div> |
|||
<input type="text" class="form-control" name="tsip" id="tcip" placeholder="eg:192.168.66.99"> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<div class="input-group"> |
|||
<div class="input-group-addon">监视目录</div> |
|||
<input type="text" class="form-control" name="tsdir" id="" placeholder="eg :/www/wwwroot/aa_com/" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="form-group col-md-12"> |
|||
<button type="button" id="entsip" class="btn btn-primary">查看信息</button> |
|||
</div> |
|||
<!-- 目标服务器 --> |
|||
<div class="col-md-12"> |
|||
<div class="panel panel-default"> |
|||
<!-- Default panel contents --> |
|||
<div class="panel-heading" id="mbip">目标服务器</div> |
|||
<div class="panel-body"> |
|||
<p>监听目录:<span id="sc01"></span></p> |
|||
<p>相对目录: <span id="sc02"></span> </p> |
|||
</div> |
|||
|
|||
<!-- List group --> |
|||
<ul class="list-group" id="tgsc"> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!-- 状态信息 --> |
|||
<div class="container"> |
|||
|
|||
<div class="panel"> |
|||
<div class="panel-heading">运行状态</div> |
|||
<div class="panel-body"> |
|||
<ul class="list-group" id="rstatus"> |
|||
<li class="list-group-item">1、获取远程服务器的文件信息</li> |
|||
<li class="list-group-item">2、校验hash值</li> |
|||
<li class="list-group-item">3、枚举出所有hash不同的文件</li> |
|||
<li class="list-group-item">4、勾选文件更新即可</li> |
|||
<li class="list-group-item">5、根据勾选的文件制作更新zip文件,发送到目标服务器</li> |
|||
<li class="list-group-item">文件的参考HASH值,如何同步到几个平台?</li> |
|||
|
|||
</ul> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
|
|||
|
|||
<script type="text/javascript"> |
|||
var chkall = true; |
|||
var chknum = 0; |
|||
var scip = ""; //目标服务器ip |
|||
var urlpath = ".";// 当前的操作目录 |
|||
|
|||
$(function () { |
|||
// read sessionStorage |
|||
var oscip = sessionStorage.getItem("scip"); |
|||
if (oscip != "") { |
|||
$("#scip").val(oscip); |
|||
scip = oscip; |
|||
$("input[name='serverip']").val(oscip); |
|||
} |
|||
|
|||
// click function |
|||
$("#entsip").on("click", function () { |
|||
tgfs(); |
|||
}) |
|||
|
|||
// 目标服务器的文件信息 |
|||
var tgfs = function () { |
|||
// |
|||
scip = $("#scip").val(); |
|||
// ip storage |
|||
sessionStorage.setItem("scip", scip); |
|||
|
|||
var html = "<li class=\"list-group-item\">输入目标服务器" + scip + "</li>"; |
|||
// 目标站 |
|||
$("#mbip").text("目标站(" + scip + ")"); |
|||
// 获取信息 |
|||
gescinfo(scip); |
|||
// |
|||
$("#rstatus").append(html); |
|||
} |
|||
|
|||
// 获取目标服务器的信息 |
|||
var gescinfo = function (scip) { |
|||
// 客户端的状态地址 |
|||
var url = "http://" + scip + ":9099/sc?p=" + urlpath.replace("/\\/g", "\/"); |
|||
// |
|||
var html = ""; |
|||
$.getJSON(url, function (res) { |
|||
// res.curdir |
|||
$.each(res.data.list, function (k, v) { |
|||
html += "<li class=\"list-group-item optzone\"><div class=\"col-md-10\">"; |
|||
if (v.dirflag) { |
|||
html += "<span class=\"icon folder-icon\"></span>" + v.fname + "</div>"; |
|||
} else { |
|||
html += "<span class=\"icon file-icon\"></span>" + v.fname + "</div>"; |
|||
} |
|||
|
|||
if (v.isbackup == 1) { |
|||
html += "<div class=\"col-md-2\"><a href=\"#\" class=\"btn btn-warning btn-sm\">恢复</a></div>"; |
|||
} else { |
|||
html += "<div class=\"col-md-2\"></div>"; |
|||
} |
|||
|
|||
html += "</li>"; |
|||
}) |
|||
// append to html |
|||
$("#tgsc").html(html) |
|||
writelog(scip + "获取数据:" + res.data.list.length + "条数据") |
|||
// 客户端监控目录 |
|||
$("#sc01").text(res.workdir); |
|||
$("#sc02").text(res.curdir); |
|||
}); |
|||
} |
|||
|
|||
// write log |
|||
var writelog = function (html) { |
|||
var hprex = "<li class=\"list-group-item\">" + html + "</li>"; |
|||
$("#rstatus").append(hprex); |
|||
} |
|||
|
|||
|
|||
//同步文件 |
|||
$(".gsbtn").on("click", function () { |
|||
var ff = $(this).attr("fid"); |
|||
var fpa = $(this).attr("fpa"); |
|||
// build post body |
|||
var param = { sip: scip, bfile: ff, bpath: fpa } |
|||
// do post |
|||
$.post("./sup", param, function (res) { |
|||
if (res.status == '200') { |
|||
alert("操作成功"); |
|||
} |
|||
}); |
|||
return false; |
|||
}) |
|||
|
|||
|
|||
|
|||
//全选按钮设置点击事件 |
|||
$("#slall").click(function () { |
|||
//1、循环设置其它多选框选中状态,跟标识用的变量一样 |
|||
$(".mfile").prop("checked", chkall); |
|||
// down button toggle |
|||
if (chkall || chknum > 2) { |
|||
$("#tropt").show() |
|||
chknum += 1 |
|||
} else { |
|||
$("#tropt").hide() |
|||
chknum -= 1 |
|||
} |
|||
//2、标识的变量取反 |
|||
chkall = !chkall; |
|||
}) |
|||
|
|||
//同步操作 |
|||
$("#sybtn").on("click", function () { |
|||
var ttsip = $("input[name='serverip']").val(); |
|||
if (ttsip == "") { |
|||
alert("老天鹅,你还没填写目标服务器地址。"); |
|||
} else { |
|||
$("#hscip").val(scip); |
|||
// 提交表单 |
|||
$(".form-inline").submit(); |
|||
} |
|||
|
|||
}); |
|||
|
|||
// 勾选是否同步的选项 |
|||
$("#sw_sybtn").on("click", function () { |
|||
let swval = $(this).has("checked").val(); |
|||
// 设置相反的值 |
|||
alert(swval); |
|||
}); |
|||
|
|||
}); |
|||
</script> |
|||
</body> |
|||
|
|||
</html> |
|||
File diff suppressed because one or more lines are too long
@ -0,0 +1,36 @@ |
|||
@charset "UTF-8"; |
|||
/* |
|||
* jQuery File Upload Plugin CSS 1.3.0 |
|||
* https://github.com/blueimp/jQuery-File-Upload |
|||
* |
|||
* Copyright 2013, Sebastian Tschan |
|||
* https://blueimp.net |
|||
* |
|||
* Licensed under the MIT license: |
|||
* http://www.opensource.org/licenses/MIT |
|||
*/ |
|||
|
|||
.fileinput-button { |
|||
position: relative; |
|||
overflow: hidden; |
|||
} |
|||
.fileinput-button input { |
|||
position: absolute; |
|||
top: 0; |
|||
right: 0; |
|||
margin: 0; |
|||
opacity: 0; |
|||
-ms-filter: 'alpha(opacity=0)'; |
|||
font-size: 200px; |
|||
direction: ltr; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
/* Fixes for IE < 8 */ |
|||
@media screen\9 { |
|||
.fileinput-button input { |
|||
filter: alpha(opacity=0); |
|||
font-size: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
.row-file { |
|||
height: 40px; |
|||
} |
|||
|
|||
.column-icon { |
|||
width: 40px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.column-name { |
|||
} |
|||
|
|||
.column-size { |
|||
width: 100px; |
|||
text-align: right; |
|||
} |
|||
|
|||
.column-move { |
|||
width: 40px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.column-delete { |
|||
width: 40px; |
|||
text-align: center; |
|||
} |
|||
|
|||
.column-path { |
|||
} |
|||
|
|||
.column-progress { |
|||
width: 200px; |
|||
} |
|||
|
|||
.footer { |
|||
color: #999; |
|||
text-align: center; |
|||
font-size: 0.9em; |
|||
} |
|||
|
|||
#reload { |
|||
float: right; |
|||
} |
|||
|
|||
#create-input { |
|||
width: 50%; |
|||
height: 20px; |
|||
} |
|||
|
|||
#move-input { |
|||
width: 80%; |
|||
height: 20px; |
|||
} |
|||
|
|||
/* Bootstrap overrides */ |
|||
|
|||
.btn:focus { |
|||
outline: none; |
|||
} |
|||
|
|||
.btn-toolbar { |
|||
margin-top: 30px; |
|||
margin-bottom: 20px; |
|||
} |
|||
|
|||
.table .progress { |
|||
margin-top: 0px; |
|||
margin-bottom: 0px; |
|||
height: 16px; |
|||
} |
|||
|
|||
.panel-default > .panel-heading { |
|||
color: #555; |
|||
} |
|||
|
|||
.breadcrumb { |
|||
background-color: transparent; |
|||
border-radius: 0px; |
|||
margin-bottom: 0px; |
|||
padding: 0px; |
|||
} |
|||
|
|||
.breadcrumb > .active { |
|||
color: #555; |
|||
} |
|||
|
|||
.breadcrumb > li + li:before { |
|||
color: #999; |
|||
} |
|||
|
|||
.table > tbody > tr > td { |
|||
vertical-align: middle; |
|||
} |
|||
|
|||
.table > tbody > tr > td > p { |
|||
margin: 0px; |
|||
} |
|||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in new issue