Commit 7d6adb02 authored by tywldx's avatar tywldx

fix

parent 64d1cfbe
......@@ -16,13 +16,10 @@ app.use(bodyParser.json())
admin.get('/get_node_command/:name', function (req, res) {
console.log(req.params.name)
res.setHeader("Content-Type","application/json");
var str = execSync(`node ./get_project_config.js -name ${req.params.name} -attr config_file/command/gitPathHead`)
var items = String(str).replace(/\n/g,"").split("|");
var config_file = items[0].replace(/\^/g," ");
console.log(items)
console.log(items);
var command = items[1].replace(/\^/g," ");
var gitGroup = items[2].replace(/\^/g," ");
res.send({configPath:config_file,buildCmd:command,gitGroup:gitGroup});
......@@ -30,7 +27,6 @@ admin.get('/get_node_command/:name', function (req, res) {
admin.post('/add_new_proxy', function (req, res) {
let request = req.body;
console.log(request)
var str = String(execSync(`cat ../ngrok/docker_env_name.sh`)).replace(/\n/,"");
var index = str.indexOf(request["namespace"])
let newstr = "",sourcestr;
......@@ -38,11 +34,7 @@ admin.post('/add_new_proxy', function (req, res) {
//存在这个配置,判断是否是原有的IP
var reg = new RegExp(request["namespace"] + "\\|\\d*\\.\\d*\\.\\d*\\.\\d*");
try{
console.log(str)
console.log(reg)
sourcestr = str.match(reg);
console.log(sourcestr)
sourcestr = sourcestr[0]
}catch(e){
res.send({msg:"错误,请检查 docket_env_name.sh 文件"})
......@@ -66,13 +58,30 @@ admin.post('/add_new_proxy', function (req, res) {
//文件添加到这里面
}
newstr = newstr.replace(/\n/,"");
console.log(newstr)
console.log("------------------------")
execSync(`echo "${newstr}" > ../ngrok/docker_env_name.sh`)
execSync("../ngrok/make_frp_ini.sh");
cproc.exec("../ngrok/make_frp_ini.sh");
res.send({msg:"执行完成"});
});
admin.get('/remove_proxy', function (req, res) {
var str = String(execSync(`cat ../ngrok/docker_env_name.sh`)).replace(/\n/,"");
var sourcestr;
var reg = new RegExp(request["namespace"] + "\\|\\d*\\.\\d*\\.\\d*\\.\\d*");
try{
sourcestr = str.replace(reg,"");
}catch(e){
res.send({msg:"错误,请检查 docket_env_name.sh 文件"})
return
}
execSync(`echo "${sourcestr}" > ../ngrok/docker_env_name.sh`);
cproc.exec("../ngrok/make_frp_ini.sh");
res.setHeader("Content-Type","application/json");
var str = execSync(`cat ../ngrok/docker_env_name.sh`)
res.send({namespace:String(str)});
});
admin.get('/get_proxy', function (req, res) {
res.setHeader("Content-Type","application/json");
var str = execSync(`cat ../ngrok/docker_env_name.sh`)
......
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