Ylianst / MeshCentral

A complete web-based remote monitoring and management web site. Once setup you can install agents and perform remote desktop session to devices on the local network or over the Internet.
https://meshcentral.com
Apache License 2.0
4.29k stars 573 forks source link

Web-RDP issues / add reverse mouse wheel #4133

Closed energywave closed 10 months ago

energywave commented 2 years ago

Describe the bug Web-RDP is my favourite desktop access media (I truly LOVE it!!!) but it has some glitches.

  1. Mouse scroll wheel direction is inverted! It's annoying
  2. When focus change from a local window to meshcentral with web-rdp it happens a lot of time that some control key result pressed (CTRL or ALT or SHIFT). That results in weird actions when you click thinking to do something but happens to do damages... It would be wise to reset control keys status at got focut event to prevent that.
  3. It happened on a Windows Server 2019 server session that when I pasted something on the client PC the web rdp session closed. I cannot explain this myself
  4. I didn't manage to use automatic clipboard (but maybe that's because of Chrome, I'll try with Firefox...)

To Reproduce

  1. Use mouse wheel on web-rdp :)
  2. Try to switch between local windows with ALT+TAB
  3. I activated automatic clipboard and copied from local PC a INSERT SQL statement, when trying to paste it on the remote side it closed the rdp session. Done that 3-4 times in a row, systematically. Seems like something in the clipboard isn't liked by meshcentral ;)
  4. Turn on automatic clipboard. But well, maybe there are technical limitations to let it work (in that case it would be wise to write them in the dialog or somewhere so that I can expect it to not work because of something I have to change...)

Expected behavior Well, working as expected :)

Screenshots Not applicable

Server Software (please complete the following information):

Remote Device (please complete the following information):

Additional context I think that web-rdp issues are for the node-rdpjs repo but issues cannot be created there so my only chance to tell you is by opening here on meshcentral. PS: keep on the wonderful work you're doing... :)

silversword411 commented 2 years ago
  1. Mouse scroll wheel direction is inverted! It's annoying

You sure that's not os settings on remote machine?

4. automatic clipboard (but maybe that's because of Chrome, I'll try with Firefox...)

There's a video on the new rdp, ylian mentions ff has auto-clipboard issues because of extra firefox security stuff. You should watch: https://ylianst.github.io/MeshCentral/meshcentral/#desktop-control

energywave commented 2 years ago

You sure that's not os settings on remote machine?

Ok, a legit doubt but no. To test it I connected to a virtual server I have at office (Windows Server 2022).

Both client and server are Italian localized and the browser is latest version of Chrome. I will make some other test, if that could be useful to you.

  1. automatic clipboard (but maybe that's because of Chrome, I'll try with Firefox...)

There's a video on the new rdp, ylian mentions ff has auto-clipboard issues because of extra firefox security stuff. You should watch: https://ylianst.github.io/MeshCentral/meshcentral/#desktop-control

Ok, I've seen it. But that's not the case, I'm using Chrome, both icons (clipboard upload and download) are enabled. I did some further tests with the same Windows Server 2022 virtual machine here at my office and, after some trials, it worked! I don't know why... With automatic clipboard enabled clipboard buttons are not present.

I've been able, however, to reproduce point n.3. Web-RDP session (with or without automatic clipboard) to Windows Server 2022 or 2019 (but I don't think it's limited to those OS). Copy this exact text on the local PC:

USE [Industry40]
GO

/****** Object:  Table [dbo].[Machines]    Script Date: 17/06/2022 15:29:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Machines](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Code] [varchar](50) NOT NULL,
    [Name] [varchar](50) NOT NULL,
    [Enabled] [bit] NOT NULL,
    [TableName] [varchar](50) NULL,
    [Fields] [text] NULL,
    [ODLFieldName] [varchar](50) NULL,
    [Where] [text] NULL,
    [OrderBy] [text] NULL,
 CONSTRAINT [PK_Machines] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
 CONSTRAINT [IX_Machines_Code] UNIQUE NONCLUSTERED 
(
    [Code] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[Machines] ADD  CONSTRAINT [DF_Machines_Enabled]  DEFAULT ((1)) FOR [Enabled]
GO

Then if automatic clipboard is enabled you just have to paste it on the remote machine, otherwise you have to click on the upload clipboard button and then paste it on the remote machine (in something like notepad). As soon as you click on paste the RDP session closes. This happens only in web-rdp, not in Microsoft RDP client, just as a note. When I do it it's completely reproducible.

silversword411 commented 2 years ago

Seems like rdp on server is still going thru bug-squashing mode https://github.com/Ylianst/MeshCentral/issues/3938

Ylianst commented 2 years ago

I certainly got some work to do on RDP. It's not my code and so, i am discovering how RDP works as I go. The only code I really wrote is the NLA part.

I can't make the mouse wheel do the other way. I tested the real RDP, MeshCentral Web-RDP and MeshCentral Remote Desktop and they all seem to work the same. However, I can add a setting to reverse the mouse wheel. I think macOS and other OS's have this setting, so if you connect to a device where the user switched the mouse wheel direction, it can be annoying.

Ylianst commented 2 years ago

Just checked in a new option to reverse the mouse wheel when doing RDP from the web site. Will be in v1.0.39.

image

Ylianst commented 2 years ago

Just check it a check to add mouse wheel reversal to remote desktop and Intel AMT KVM in addition to RDP.

MC2-ReverseMouseWheel

energywave commented 2 years ago

Just checked in a new option to reverse the mouse wheel when doing RDP from the web site. Will be in v1.0.39.

I really appreciate your effort Ylian! I understand that web-rdp is a npm module you used, I wanted to open the issue there but their repo isn't open to issues so I have to open them to you :(

I just updated to test this feature but there must be something broken on the update as the service stopped working with this message in the meshcentral.err.log file in the winservice daemon folder:

Error: Cannot find module 'C:\Program Files\Open Source\MeshCentral\node_modules\node-windows\lib\wrapper.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

I've checked and I don't even have a folder node-windows in the node_modules folder! I'm not used to Node/NPM so I don't know how to fix it, if you can give me any clues... And be aware that this update may break every meshcentral install!

EDIT: I've made some tests. npm update in the node_modules folder. Updated some packages but no difference. npm install node-windows installed node-windows package but then another error is shown in the log and the service continue to not work:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '@author.io/args'
Require stack:
- C:\Program Files\Open Source\MeshCentral\node_modules\node-windows\lib\wrapper.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Program Files\Open Source\MeshCentral\node_modules\node-windows\lib\wrapper.js:3:12)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Program Files\\Open Source\\MeshCentral\\node_modules\\node-windows\\lib\\wrapper.js'
  ]
}

By searching it seems that this is known in the node-windows 1.0.0-beta.7 version: https://github.com/coreybutler/node-windows/issues/308 I'm now stuck :(

EDIT2: Ok, I managed to get meshcentral to run. This can be useful to someone. in the meshcentral node_modules folder:

npm uninstall node-windows
npm install node-windows@1.0.0-beta.6

Then npm warned about 3 vulnerabilities (2 moderate and 1 critical). If I'll try to fix them using npm audit fix --force that will update node-windows to the latest (and not working....) 1.0.0-beta.7 version.

So I'm leaving these vulnerabilities hoping that they're not dangerous... Sidenote. I noted that package.json in the meshcentral folder changed after that process to this content:

{
  "dependencies": {
    "loadavg-windows": "^1.1.1",
    "meshcentral": "^1.0.39",
    "node-windows": "^0.1.4",
    "nodemailer": "^6.7.5",
    "otplib": "^10.2.3"
  }
}

Before the node-windows version was 1.0.0-beta.7 and I was expecting to see 1.0.0-beta.6. I'm lost. But it works. I'll wait further info.

energywave commented 2 years ago

Just check it a check to add mouse wheel reversal to remote desktop and Intel AMT KVM in addition to RDP.

I've tested the reverse mouse wheel and it works very well. That's a good usability improvement! Thank you! Now you have the dependency problem about node-windows that seems to be a big problem :(

energywave commented 2 years ago

Ok, updated to 1.0.41 and the node-windows module missing problem seems solved as the update was completed correctly from web UI. Le'ts return to glitches. I've tested again with latest 1.0.41 version and the problems 2 and 3 remains. There is a workaround for n.2: when focusing Meshcentral with an open web-rdp returning from other window on PC, press and release all control keys (CTRL, ALT, SHIFT) so to reset the "pressed" status of some of them. But would be useful to reset it automatically on got focus event.

energywave commented 2 years ago

Just to tell you: I just tested against latest version 1.0.95 and issues 2 and 3 are still present in the same way. As a note to point n.3 I've tested to paste with CTRL+V and with context menu using mouse and the effect is the same: Web-RDP session closes.

sammyke007 commented 10 months ago

Still an issue. WebRDP copy paste is not working over here with Chrome

si458 commented 10 months ago

I will have a look when I get chance but as far as I'm aware the copy/paste feature isn't perfect and works with some browsers but not others and isn't a simple fix because of the way browsers work...

si458 commented 10 months ago

@sammyke007 clipboard all works here fine with chrome 120, Win server 2019, Meshcentral 1.1.18 just make sure you click Settings, then tick 'Automatic clipboard', then click ALLOW in the pop up when chrome asks for permission, then try copying and pasting something also note: this is using the RDP connect button option, rather than the full screen 'web-rdp' option as that is a seperate thing and would need investigating and a new github issue being opened if you have that issue

si458 commented 10 months ago

added PR to enable the GET remote clipboard which seems to work now, HOWEVER we cant SET the remote clipboard because firefox doesnt allow it but chrome allow its? AND the backend doesnt have the SET implemented anyways so it will take some time to work that out the Web-RDP mstsc.html is using an old project which hasnt been updated in 3 years

sammyke007 commented 10 months ago

Alright tnx! Normal RDP (RDP connect button option) is working perfectly fine indeed with Chrome, but web-rdp doesn't. Not very important, but I like the big full screen from web-rdp. It's better to avoid the "older" web-rdp then?

si458 commented 10 months ago

done commit! the code to set clipboard was already in there, just completely missing from the html page! the web-rdp isnt old as such as its perfect! its just based off an OLD project - https://github.com/citronneur/mstsc.js remember the get clipboard should work on any browser, the set clipboard will work on chrome/edge with permission enabled, firefox no chance wont work

si458 commented 10 months ago

im going to close this now as its an old issue and most of the stuff has now been fixed/improved/added please try again, any other issues, please open a new issue