diff --git a/index.js b/index.js index ec2fbe2..1e6f189 100644 --- a/index.js +++ b/index.js @@ -74,6 +74,17 @@ app.get('/services/register', (req, res) => { res.json( {msg: 'not yet implemented'}) // example {name:'hmdlink', desc:'share URL between local devices', protocol:'http', port:8082, path: '/hmdlink', url:'http://192.168.4.3:8082/hmdlink'}, }) +app.get('/updates', (req, res) => { + // could rely on a git reachable by all peers + // this might be feasible from this very https server as read-only + res.json( {msg: 'not yet implemented'}) +}) +app.get('/recentfiles', (req, res) => { + // e.g lsof | grep home | grep vim | grep -v firefox + // or history | grep vi + // should be available after (ideally local) conversion if needed, e.g rm -> .svg on reMarkable + res.json( {msg: 'not yet implemented'}) +}) app.get('/services', (req, res) => { // could be probbed first to check for availability // should be updated also via register/unregister @@ -138,6 +149,17 @@ app.get('/editor/recover', (req, res) => { fs.copyFileSync(minfileSaveFullPath, fileSaveFullPath ) res.json( {msg: 'copied'} ) }) +/* + * example of finding past local solution, here shiki for syntax highlighting + * +(deck@steamdeck serverhome)$ find . -iname shiki +./fabien/web/future_of_text_demo/content/shiki +(deck@steamdeck serverhome)$ ls ./fabien/web/future_of_text_demo/content/shiki/dist/ +onig.wasm + +see syntax-highlighting branch in SpaSca git repository + in /home/deck/serverhome/fabien/web/future_of_text_demo/engine/ +*/ let filename = 'editor.html' let fileSaveFullPath = path.join(__dirname,'examples', filename) let minfilename = 'editor.html.minimal' @@ -168,6 +190,21 @@ const webServer = https.createServer(credentials, app); webServer.listen(port, () => { console.log("listening on http://localhost:" + port); }); + +// returns connections string for e.g sshfs +function loadSshConfig(){ + // here assume user deck + let txt = f.readFileSync('/home/deck/.ssh/config').toString() + return txt.split('Host ') + .filter( m => m.match('192.168.4.') ) + .map( c => { + p = c.replaceAll(' ','') + .split('\n') + .filter(i=>i.match(/^[a-zA-Z]/)); + return p.filter(pm=>pm.match('User '))[0].replace('User ','')+ + p.filter(pm=>pm.match('HostName'))[0].replace('HostName ','@') + }) +} /* e.g AFTER mounting f.readdirSync('./sshfsmounts/').map( d=>f.readdirSync('./sshfsmounts/'+d) )