ipload
这个提交包含在:
4
CGI.js
4
CGI.js
@ -84,7 +84,7 @@ request.post({
|
|||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
group:info.group_id,
|
group:info.group_id,
|
||||||
messageChain:[{"type":"Plain","text":`${p}`},{
|
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
url:p
|
url:p
|
||||||
}]
|
}]
|
||||||
@ -93,7 +93,7 @@ request.post({
|
|||||||
var Kdata = JSON.stringify({
|
var Kdata = JSON.stringify({
|
||||||
sessionKey:Session,
|
sessionKey:Session,
|
||||||
qq:info.user_id,
|
qq:info.user_id,
|
||||||
messageChain:[{"type":"Plain","text":`${p}`},{
|
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||||
type:"Image",
|
type:"Image",
|
||||||
url:p
|
url:p
|
||||||
}]
|
}]
|
||||||
|
|||||||
11
GeoGeBra.js
11
GeoGeBra.js
@ -38,15 +38,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
var Core = require("./Core");
|
var Core = require("./Core");
|
||||||
var GGB = require("node-geogebra");
|
var GGB = require("node-geogebra");
|
||||||
|
var fs = require("fs");
|
||||||
var Pool = new GGB.GGBPool({ plotters: 1, ggb: 'local' });
|
var Pool = new GGB.GGBPool({ plotters: 1, ggb: 'local' });
|
||||||
var PoolReady = false;
|
var PoolReady = false;
|
||||||
var Plotter;
|
var Plotter;
|
||||||
Pool.ready().then(function () { return __awaiter(void 0, void 0, void 0, function () {
|
Pool.ready().then(function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
|
console.log('GGBReady');
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0:
|
case 0:
|
||||||
PoolReady = true;
|
PoolReady = true;
|
||||||
return [4 /*yield*/, Pool.getGGBPlotter];
|
return [4 /*yield*/, Pool.getGGBPlotter()];
|
||||||
case 1:
|
case 1:
|
||||||
Plotter = _a.sent();
|
Plotter = _a.sent();
|
||||||
return [2 /*return*/];
|
return [2 /*return*/];
|
||||||
@ -58,11 +60,14 @@ Core.AddListener(function (c, i) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
console.log(Plotter);
|
||||||
|
console.log(GGB);
|
||||||
|
console.log(Pool);
|
||||||
var Command = i.message.replace("绘图", "");
|
var Command = i.message.replace("绘图", "");
|
||||||
Plotter.evalGGBScript([Command]);
|
Plotter.evalGGBScript([Command]);
|
||||||
Core.frame.SendMsg(c, i, "[GeoGeBra]执行完成,正在渲染。");
|
Core.frame.SendMsg(c, i, "[GeoGeBra]执行完成,正在渲染。");
|
||||||
Core.frame.SendImg(c, i, "");
|
Core.frame.SendImg(c, i, "");
|
||||||
Plotter.export64("png").then(function (v) {
|
Plotter.export("png").then(function (v) {
|
||||||
Core.frame.SendImg(c, i, "dara:image/png;".concat(v));
|
fs.writeFile("/home/pi/AI/temp/img.png",v,()=>{ Core.frame.SendImg(c, i, "/home/pi/AI/temp/img.png");});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
12
WebUI.js
12
WebUI.js
@ -36,9 +36,11 @@ ServerWeb.on("listening", () => {
|
|||||||
if (data.toString().indexOf(" ") != 0) {
|
if (data.toString().indexOf(" ") != 0) {
|
||||||
var path = data.toString().split(" ");
|
var path = data.toString().split(" ");
|
||||||
if (path == undefined) {
|
if (path == undefined) {
|
||||||
return;
|
UserSock.end("F**k");return;
|
||||||
}
|
}
|
||||||
console.log(path)
|
console.log(UserSock);
|
||||||
|
console.log(data.toString());
|
||||||
|
if (!path[1]){UserSock.end("F**k");return}
|
||||||
if (path[1] == "/") {
|
if (path[1] == "/") {
|
||||||
fs.readFile("./WebUI.html", (err, data) => {
|
fs.readFile("./WebUI.html", (err, data) => {
|
||||||
UserSock.write(`HTTP/1.1 200 OK\r\nContent-Length: ${data.length}\r\n\r\n`);
|
UserSock.write(`HTTP/1.1 200 OK\r\nContent-Length: ${data.length}\r\n\r\n`);
|
||||||
@ -105,9 +107,9 @@ ServerWeb.on("listening", () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UserSock.end("HTTP/1.1 404");
|
UserSock.end("HTTP/1.1 300\r\nContext-Length:21 \r\nThere happened a bug.");
|
||||||
}
|
}
|
||||||
}catch(err){console.log(err)};
|
}catch(err){console.log(err);UserSock.end("F**k");};
|
||||||
});
|
});
|
||||||
UserSock.on("close", () => {
|
UserSock.on("close", () => {
|
||||||
UserSock.end();
|
UserSock.end();
|
||||||
@ -117,7 +119,7 @@ ServerWeb.on("listening", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ServerWeb.listen(8081, "0.0.0.0");
|
ServerWeb.listen(8081, "127.0.0.1");
|
||||||
Core.AddListener((connect, Info) => {
|
Core.AddListener((connect, Info) => {
|
||||||
MessageCount = MessageCount.valueOf() + 1;
|
MessageCount = MessageCount.valueOf() + 1;
|
||||||
});
|
});
|
||||||
|
|||||||
二进制
temp/img.png
普通文件
二进制
temp/img.png
普通文件
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 25 KiB |
在新工单中引用
屏蔽一个用户