Commit 1440075e authored by mercury233's avatar mercury233

add update dashboard

parent e4e66c9f
......@@ -17,6 +17,7 @@
<p><a href="pre-dashboard.html">Pre-Release Dashboard (先行卡更新)</a></p>
<p><a href="deck-dashboard.html">Deck Dashboard (竞赛模式卡组管理)</a></p>
<p><a href="replay-dashboard.html">Replay Dashboard (竞赛模式录像管理)</a></p>
<p><a href="update-dashboard.html">Update Dashboard (更新管理)</a></p>
</div>
</div>
</div>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SRVPro Update Dashboard</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link href="/static/style.css" rel="stylesheet">
</head>
<body>
<header class="container">
<h1 class="title">SRVPro 更新控制台</h1>
</header>
<div class="container">
<div class="row grid">
<div class="col-lg-2">
<input type="text" class="form-control" id="ip" value="" placeholder="IP">
</div>
<div class="col-lg-2">
<input type="text" class="form-control" id="port" value="" placeholder="Port">
</div>
<div class="col-lg-2">
<input type="password" class="form-control" id="password" value="" placeholder="Password">
</div>
<div class="col-lg-2">
<button class="btn btn-default" id="login_button">登陆</button>
<button class="btn btn-default" id="clear_button">清屏</button>
</div>
</div>
<!--div class="row grid buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">复制临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">更新临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">编译临时服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">替换主要服务端</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" disabled title="暂未实装" action="">更新主要服务端数据库和脚本</button>
</div>
</div-->
<div class="row grid buttons hidden">
<div class="col-lg-2">
<button class="btn btn-default" action="fetch_datas">下载最新网页</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="load_db">读取数据库</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="make_changelog">生成更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="make_more_changelog">更多更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="update_changelog">写入更新记录</button>
</div>
<div class="col-lg-2">
<button class="btn btn-default" action="push_datas">上传到网页</button>
</div>
</div>
<div class="row buttons hidden">
<div class="col-lg-12">
<textarea class="form-control" rows="20" id="message" value="" placeholder="update message"></textarea>
<textarea class="hidden" id="message-head" value="" placeholder="update message">服务器升级,与官方版同步,修复一些BUG。
绝大部分修改来自于YGOPro官方开发者和爱好者的贡献。你可以在[GitHub](https://github.com/moecube/ygopro/tree/server)查看修改详情。
</textarea>
<textarea class="hidden" id="message-body" value="" placeholder="update message">新增卡片:
- 无
卡片更改:
- 无
</textarea>
<textarea class="hidden" id="message-other" value="" placeholder="update message">其他更改:
- 无</textarea>
</div>
</div>
</div>
<div class="container">
<hr>
<div class="row">
<div class="col-lg-12">
<ul id="output" class="list-unstyled">
</ul>
</div>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script>
var ip, port, password;
$(function(){
$("body").tooltip({selector: "[data-toggle='tooltip']"});
$("#login_button").click(login);
$("#clear_button").click(clear);
$(".buttons button").click(function(){openapi($(this).attr("action"))});
var params=parseQueryString();
$("#ip").val(params["ip"]);
$("#port").val(params["port"]);
$("#password").val(params["password"]);
$("#message").val($("#message-head").val()+$("#message-body").val()+$("#message-other").val());
});
function parseQueryString() {
//http://stackoverflow.com/questions/523266/how-can-i-get-a-specific-parameter-from-location-search
var str = window.location.search;
var objURL = {};
str.replace(
new RegExp( "([^?=&]+)(=([^&]*))?", "g" ),
function( $0, $1, $2, $3 ){
objURL[ $1 ] = $3;
}
);
return objURL;
}
function login() {
ip=$("#ip").val();
port=$("#port").val();
password=$("#password").val();
var es = new EventSource("http://"+ip+":"+port+"/api/msg?password="+password);
es.onmessage = function(e) {
var data_li = $('<li>'+ e.data +'</li>');
data_li.appendTo($("#output"));
if (e.data=="已连接。") {
$(".row.buttons").removeClass("hidden");
}
else {
try {
var resJSON = JSON.parse(e.data);
if (resJSON.type=="changelog") {
$("#message").val($("#message-head").val()+ resJSON.changelog.join("\n") +$("#message-other").val());
}
}
catch (e) {
}
}
};
es.onerror = function(e) {
$(".row.buttons").addClass("hidden");
data_li = $('<li>已断开。</li>');
data_li.appendTo($("#output"));
//alert("连接断开!");
es.close();
};
}
function clear() {
$("#output").html(" ");
}
function openapi(api) {
$.getJSON("http://"+ip+":"+port+"/api/"+ api +"?password="+password+"&message="+$("#message").val().replace(/\n/g,"!换行符!")+"&callback=?", function(data) {
var data_li = $('<li>'+ data.message +'</li>');
data_li.appendTo($("#output"));
});
}
</script>
<script src="http://s4.cnzz.com/z_stat.php?id=1255875151&web_id=1255875151"></script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment