|
|
|
@ -4,6 +4,8 @@ const https = require("https"); |
|
|
|
|
const path = require("path"); |
|
|
|
|
const {execSync} = require('child_process'); |
|
|
|
|
const express = require("express"); // could be good to replace with code, no dep
|
|
|
|
|
// express does not seem architecture dependant thus copying node_modules sufficed for now
|
|
|
|
|
// (worked at least on RPi, Deck, Quest and x64 machines)
|
|
|
|
|
|
|
|
|
|
// Get port or default to 8082
|
|
|
|
|
const port = process.env.PORT || 8082; |
|
|
|
@ -34,9 +36,10 @@ if (fs.existsSync( configFilePath ) ){ |
|
|
|
|
console.log(localServices) |
|
|
|
|
|
|
|
|
|
const utilsCmd = { // security risk but for now not accepting user input so safer
|
|
|
|
|
'update' : { desc: 'note that will lose the state, e.g foundpeers', |
|
|
|
|
cmd: 'killall '+process.title+' && ' }, |
|
|
|
|
//'update' : { desc: 'note that will lose the state, e.g foundpeers', cmd: 'killall '+process.title+' && ' },
|
|
|
|
|
// should first download the new version and proceed only if new
|
|
|
|
|
// e.g git clone deck@localhost:~/Prototypes/offline-octopus/
|
|
|
|
|
// should see /sshconfig
|
|
|
|
|
// ideally all handles within node
|
|
|
|
|
'shutdown' : { cmd: 'shutdown -h now' }, // not available everywhere, e.g unrooted Quest
|
|
|
|
|
'listprototypes': { cmd: 'ls', context: {cwd: propath}, |
|
|
|
|