This commit is contained in:
Mark Nadal 2023-04-25 04:18:46 -07:00
parent c6b9fa8d13
commit 2afde8db4a

View File

@ -215,7 +215,7 @@ function start(root){
try{ (cmd[msg.try]||cmd.any)(msg, peer); }catch(err){ mesh.say({dam: '!', err: "service error: "+err}) }
}
cmd.https = function(msg, peer){ var run, log;
if(!(run = require('child_process').execSync)){ return }
if(!(run = require('child_process').exec)){ return }
if(!msg.email || !msg.domain){
mesh.say({dam: '!', err: 'Domain/email missing, use `location.hostname`!'});
return;
@ -227,11 +227,11 @@ function start(root){
var path = require('path').resolve(__dirname, '../examples');
//log = run("bash "+path+"/https.sh", {env: {'EMAIL': msg.email, 'WEB': path, 'DOMAIN': msg.domain}});//, (err, stdout, stderr) => {
require('fs').writeFileSync(path+'/../email', msg.email);
log = run("bash "+path+"/https.sh", {env:{'EMAIL': msg.email, 'WEB': path, 'DOMAIN': msg.domain}});//, function(e, out, err){
//log = JSON.stringify({e: e, out: out, err: err});
run("bash "+path+"/https.sh", {env:{'EMAIL': msg.email, 'WEB': path, 'DOMAIN': msg.domain}}, function(e, out, err){
log = e+"|"+out+"|"+err;
mesh.say({dam: '!', log: ''+log}, peer);
setTimeout(function(){ process.exit() },999);
//});
});
return;
// log = run('curl https://get.acme.sh | /bin/sh -s email='+msg.email);
// mesh.say({dam: '!', log: ''+log}, peer);
@ -255,7 +255,7 @@ function start(root){
if(!(run = require('child_process').exec)){ return }
var path = require('path').resolve(__dirname, '../examples');
run("bash "+path+"/install.sh", {env: {VERSION: msg.version||''}}, function(e, out, err){
log = JSON.stringify({e: e, out: out, err: err});
log = e+"|"+out+"|"+err;
mesh.say({dam: '!', log: ''+log}, peer);
setTimeout(function(){ process.exit() },999);
});