From 6772097d74ce00aefa94953fe74e0bd470486ca2 Mon Sep 17 00:00:00 2001 From: thelamer Date: Sat, 24 Apr 2021 13:21:00 -0700 Subject: [PATCH] move the browser to an iframe in a modal and drop socket.io dep, just simple file management --- app.js | 7 +++---- package.json | 3 +-- public/js/rdp.js | 14 ++++++++++++++ rdp.ejs | 21 ++++++++++++++++----- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/app.js b/app.js index ef9108a..aa86f18 100644 --- a/app.js +++ b/app.js @@ -7,7 +7,6 @@ var express = require('express'); var app = require('express')(); var http = require('http').Server(app); var cloudcmd = require('cloudcmd'); -var io = require('socket.io'); var bodyParser = require('body-parser'); var { pamAuthenticate, pamErrors } = require('node-linux-pam'); var CUSTOM_PORT = process.env.CUSTOM_PORT || 3000; @@ -76,7 +75,6 @@ app.get("/", function (req, res) { }); //// Web File Browser //// app.use(bodyParser.urlencoded({ extended: true })); -var socket = io(http, {path: 'files/socket.io'}); app.get('/files', function (req, res) { res.send('Unauthorized'); res.end(); @@ -97,9 +95,8 @@ app.post('/files', function(req, res, next){ }); }); app.use('/files', cloudcmd({ - socket, config: { - root: '/config', + root: '/', prefix: '/files', terminal: false, console: false, @@ -108,6 +105,8 @@ app.use('/files', cloudcmd({ auth: false, name: 'Files', log: false, + keysPanel: false, + oneFilePanel: true, } })) diff --git a/package.json b/package.json index 44113bb..b3d187e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "ejs": "^2.7.1", "express": "^4.17.1", "guacamole-lite": "^0.6.3", - "node-linux-pam": "0.0.1", - "socket.io": "^4.0.1" + "node-linux-pam": "0.0.1" } } diff --git a/public/js/rdp.js b/public/js/rdp.js index e1ea27c..b51de13 100644 --- a/public/js/rdp.js +++ b/public/js/rdp.js @@ -152,10 +152,24 @@ function poposk(){ }; $('#osk').empty(); $('#osk').append(osk.getElement()); + // Launch Modal + $('#Keyboard').appendTo('body').modal('show'); // Resize keyboard to the width of the screen osk.resize($(window).width()); } +// When file browser is launched open modal +$('#filesform').on('submit', function() { + if ($('#nav-trigger').prop('checked') == true){ + $('#nav-trigger').prop('checked', false); + $('#sidebaricon').empty(); + side_close(); + $('#sidebaricon').append(''); + } + $('#files').appendTo('body').modal('show'); + $("#files_frame").width(100 + '%'); + $("#files_frame").height(90 + '%'); +}); // RDP Resize window logic var resizeId; diff --git a/rdp.ejs b/rdp.ejs index cf24b2f..8626a95 100644 --- a/rdp.ejs +++ b/rdp.ejs @@ -32,15 +32,15 @@ @@ -53,6 +53,17 @@ + +