reverse-proxy
Steam Deck User 2 years ago
commit 92898e1653
  1. 60
      index.js

@ -0,0 +1,60 @@
// Load required modules
const http = require("http"); // http server core module
const path = require("path");
const express = require("express"); // web framework external module
const spawn = require('child_process').spawn;
// Get port or default to 8080
const port = process.env.PORT || 8082;
// Setup and configure Express http server.
const app = express();
app.use(express.static(path.resolve(__dirname, "..", "examples")));
const instructions = `
/home/deck/.ssh/
/home/deck/.ssh/authorized_keys
/home/deck/.ssh/id_rsa_steamdeck
/home/deck/.ssh/known_hosts
/home/deck/.ssh/config
/home/deck/.ssh/id_rsa_steamdeck.pub
/home/deck/.ssh/known_hosts.old
trusted context, i.e on closed WiFi, still. check on bearer
/home/deck/server.locatedb
/home/deck/desktop.plocate.db
should be queriable via http with json output
ssh remarkable2 to get draweiong previw
conversion should be done, if necessary, on device
util functions
modify WiFi parameters, including AP if available
shutdown/reboot
`
app.get('/spawn', (req, res) => {
res.json( spawn('ls') )
})
app.get('/services', (req, res) => {
res.json( [
{name:'kiwix', desc:'offline Wikipedia, Stackoverflow, etc', protocol:'http', port:8080, url:'http://192.168.4.3:8080'},
{name:'hmdlink', desc:'share URL between local devices', protocol:'http', port:8082, path: '/hmdlink', url:'http://192.168.4.3:8082/hmdlink'},
] )
})
app.get('/hmdlink', (req, res) => {
res.redirect( 'https://192.168.4.1/offline.html' )
})
app.get('/json', (req, res) => {
res.json( instructions.split('\n') )
})
app.get('/', (req, res) => {
res.send( instructions )
})
// Start Express http server
const webServer = http.createServer(app);
// Listen on port
webServer.listen(port, () => {
console.log("listening on http://localhost:" + port);
});
Loading…
Cancel
Save