RM * 2 + 2
这个提交包含在:
34
WebUI.html
34
WebUI.html
@ -1,7 +1,7 @@
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="viewport" content="width=device-width,height=device-height, initial-scale=1.0">
|
||||
<title>OnlineAi Core WebUI</title>
|
||||
<style>
|
||||
*{
|
||||
@ -21,7 +21,22 @@
|
||||
if(new String(sec).length==1){
|
||||
sec = `0${sec}`;
|
||||
}
|
||||
document.getElementById("Timer").innerText = `${new Date().getHours()}:${min}:${sec}`
|
||||
document.getElementById("Timer").innerText = `${new Date().getHours()}:${min}:${sec}`;
|
||||
var ajax = new XMLHttpRequest();
|
||||
ajax.open("GET","OAC_GETCOUNT");
|
||||
ajax.send();
|
||||
var t = false;
|
||||
ajax.onreadystatechange = (()=>{
|
||||
var data_obj = ajax.responseText;
|
||||
if(data_obj == undefined||data_obj==""){
|
||||
return;
|
||||
}
|
||||
if(t){
|
||||
return;
|
||||
}
|
||||
t = !t;
|
||||
document.getElementById("Count").innerText = data_obj;
|
||||
})
|
||||
}),500);
|
||||
window.GetMsg = (()=>{
|
||||
document.getElementById("message").innerText = "";
|
||||
@ -69,15 +84,20 @@
|
||||
</script>
|
||||
</head>
|
||||
<body style="text-align: center;">
|
||||
<div style="float:right;width:10%;height:5%;"><a>欢迎您,<a id="UserName"></a></a><br><a id="Timer">00:00:00</a></div>
|
||||
<div style="float: right;width:2px;background: #000000;height: 100%;;"></div>
|
||||
<div style="width:90%">
|
||||
<div style="float:right;width:10%;height:5%;">
|
||||
<a>欢迎您,<a id="UserName"></a></a><br><a id="Timer">00:00:00</a>
|
||||
<hr>
|
||||
<a>实时消息数:</a><a id="Count">0</a>
|
||||
</div>
|
||||
<div style="float: right;width:2px;background: #000000;height: 90%;;"></div>
|
||||
<div style="width:90%;height:100%;">
|
||||
<h1>OnlineAi Core调度管理中心</h1>
|
||||
<hr>
|
||||
<div>
|
||||
<div style="width: 2%;height: 100%;float: left;"></div>
|
||||
<div style="width:100%;height:90%;">
|
||||
<div style="width: 2%;height: 90%;float: left;"></div>
|
||||
<div id="message" style="background:#999999;width:96%;float: left;text-align: left;"></div>
|
||||
<hr>
|
||||
<hr>
|
||||
<div id="MessageSettings" style="float: left;text-align: left;">
|
||||
Ai权限码:<input id="WebPassword" class="SET"/><br />
|
||||
消息名称:<input id="MRMessageName" class="SET"/><br />
|
||||
|
||||
19
WebUI.js
19
WebUI.js
@ -8,7 +8,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var net = __importStar(require("net"));
|
||||
var Core = __importStar(require("./Core"));
|
||||
var fs = __importStar(require("fs"));
|
||||
var MainConnect;
|
||||
var MainGroup;
|
||||
@ -55,6 +54,9 @@ ServerWeb.on("listening", function () {
|
||||
UserSock.write(ret.valueOf());
|
||||
UserSock.end();
|
||||
}
|
||||
else if (Do == "RESTART") {
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
var data2 = "404";
|
||||
@ -75,23 +77,10 @@ ServerWeb.on("listening", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
ServerWeb.listen(8081, "0.0.0.0");
|
||||
exports.add = {
|
||||
Interfaces: {},
|
||||
Control: (function (connect, Info) {
|
||||
MessageCount = MessageCount.valueOf() + 1;
|
||||
if (Info.message.substr(0, 4) == "获取监听") {
|
||||
var temp;
|
||||
if (ServerWeb.address() == null) {
|
||||
temp = -1;
|
||||
}
|
||||
else {
|
||||
temp = ServerWeb.address().port;
|
||||
}
|
||||
Core.frame.SendMsg(connect, Info, "0.0.0.0:" + temp);
|
||||
}
|
||||
if (Info.message.substr(0, 4) == "开始监听") {
|
||||
ServerWeb.listen(Math.floor(65535 * Math.random()), "0.0.0.0");
|
||||
Core.frame.SendMsg(connect, Info, "\u76D1\u542C\u8BBE\u7F6E\u5B8C\u6BD5\uFF0C\u4F7F\u7528\u201C\u83B7\u53D6\u76D1\u542C\u201D\u6765\u83B7\u53D6\u7AEF\u53E3\u53F7");
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
19
WebUI.ts
19
WebUI.ts
@ -1,7 +1,6 @@
|
||||
import * as net from "net";
|
||||
import * as Core from "./Core";
|
||||
import * as fs from "fs";
|
||||
import * as cp from "child_process";
|
||||
|
||||
var MainConnect:net.Socket;
|
||||
var MainGroup:Core.InfoType;
|
||||
@ -44,7 +43,9 @@ ServerWeb.on("listening",()=>{
|
||||
UserSock.write(`HTTP/1.1 200 OK\r\nContent-Length: ${new String(ret).length}\r\n\r\n`)
|
||||
UserSock.write(ret.valueOf());
|
||||
UserSock.end();
|
||||
}
|
||||
}else if(Do == "RESTART"){
|
||||
process.exit();
|
||||
}
|
||||
}else{
|
||||
var data2:String ="404";
|
||||
UserSock.write(`HTTP/1.1 404\r\nContent-Length: ${data2.length}\r\n\r\n`);
|
||||
@ -63,24 +64,12 @@ ServerWeb.on("listening",()=>{
|
||||
})
|
||||
});
|
||||
});
|
||||
ServerWeb.listen(8081,"0.0.0.0");
|
||||
exports.add = {
|
||||
Interfaces:{
|
||||
|
||||
},
|
||||
Control:((connect:net.Socket,Info:Core.InfoType)=>{
|
||||
MessageCount = MessageCount.valueOf() + 1;
|
||||
if(Info.message.substr(0,4)=="获取监听"){
|
||||
var temp;
|
||||
if(ServerWeb.address() == null){
|
||||
temp = -1;
|
||||
}else{
|
||||
temp = (ServerWeb.address() as net.AddressInfo).port;
|
||||
}
|
||||
Core.frame.SendMsg(connect,Info,`0.0.0.0:${temp}`);
|
||||
}
|
||||
if(Info.message.substr(0,4)=="开始监听"){
|
||||
ServerWeb.listen(Math.floor(65535 * Math.random()),"0.0.0.0");
|
||||
Core.frame.SendMsg(connect,Info,`监听设置完毕,使用“获取监听”来获取端口号`);
|
||||
}
|
||||
})
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户