Is comment out in terminal.contribution.ts the right way to forbid terminal? #6138
-
Hi, I must say that coder is really cool! The code is very well structure. I somehow need to forbid the terminal menu in the browser, and I found that comment out the following in // setupTerminalCommands();
// setupTerminalMenus(); Just wondering if it's the appropriate way to do so? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
If you just want to remove the menu item that looks good to me. There are other ways to spawn a terminal that are not covered by commenting those two lines out though like Technically an advanced user could load their own client-side JavaScript to get around this; to completely block the terminal you could comment out the terminal channel on the server side: https://github.com/microsoft/vscode/blob/ae11805eecd3958dda5cbc1b3b1f96138816d1e1/src/vs/server/node/serverServices.ts#L219 Completely disabling the terminal will probably break things like debugging though. Also keep in mind that as long as users can install extensions or if they can write files to the extension directory or to code-server itself then they will be able to work around the restriction. There might be some other holes too. |
Beta Was this translation helpful? Give feedback.
-
Could someone please tell me which file I need to change to block the terminal? I'm talking post-install, not pre-install. I want to know where to find it on the file system. My organization works with students, and we need them to use the code editor without access to the terminal. |
Beta Was this translation helpful? Give feedback.
-
I found /usr/lib/code-server, which has the minified code. Is there no way to make the change without rebuilding everything from scratch? |
Beta Was this translation helpful? Give feedback.
If you just want to remove the menu item that looks good to me.
There are other ways to spawn a terminal that are not covered by commenting those two lines out though like
workbench.action.terminal.toggleTerminal
(default keybinding isCtrl+backquote
) or by opening the panel and navigating to the terminal tab or going through the welcome screen so if you want to remove every way to get to the terminal you will have to comment out a bunch more.Technically an advanced user could load their own client-side JavaScript to get around this; to completely block the terminal you could comment out the terminal channel on the server side: https://github.com/microsoft/vscode/blob/ae11805eecd3958dda5…