Add allow root setting for Ubuntu and Web Mode users (#16027)

* add allow root setting for Ubuntu and Web Mode users
This commit is contained in:
Vasu Bhog
2021-07-07 14:02:12 -04:00
committed by GitHub
parent 073f9e052b
commit 14ce88023e
4 changed files with 12 additions and 1 deletions

View File

@@ -54,6 +54,11 @@
"default": true,
"description": "%notebook.overrideEditorTheming.description%"
},
"notebook.allowRoot": {
"type": "boolean",
"default": false,
"description": "%notebook.allowRoot.description%"
},
"notebook.maxTableRows": {
"type": "number",
"default": 5000,

View File

@@ -13,6 +13,7 @@
"notebook.collapseBookItems.description": "Collapse Book items at root level in the Notebooks Viewlet",
"notebook.remoteBookDownloadTimeout.description": "Download timeout in milliseconds for GitHub books",
"notebook.pinnedNotebooks.description": "Notebooks that are pinned by the user for the current workspace",
"notebook.allowRoot.description": "Allow Jupyter server to run as root user",
"notebook.command.new": "New Notebook",
"notebook.command.open": "Open Notebook",
"notebook.analyzeJupyterNotebook": "Analyze in Notebook",

View File

@@ -24,6 +24,7 @@ export const pinnedBooksConfigKey = 'pinnedNotebooks';
export const maxBookSearchDepth = 'maxBookSearchDepth';
export const remoteBookDownloadTimeout = 'remoteBookDownloadTimeout';
export const collapseBookItems = 'collapseBookItems';
export const allowRoot = 'allowRoot';
export const winPlatform = 'win32';
export const macPlatform = 'darwin';

View File

@@ -204,12 +204,16 @@ export class PerFolderServerInstance implements IServerInstance {
* started when the log message with URL to connect to is emitted.
*/
protected async startInternal(): Promise<void> {
let startCommand: string;
let notebookConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration(constants.notebookConfigKey);
let allowRoot: boolean = notebookConfig.get(constants.allowRoot);
if (this.isStarted) {
return;
}
let notebookDirectory = this.getNotebookDirectory();
this._token = await utils.getRandomToken();
let startCommand = `"${this.options.install.pythonExecutable}" "${this.notebookScriptPath}" --no-browser --ip=127.0.0.1 --allow-root --no-mathjax --notebook-dir "${notebookDirectory}" --NotebookApp.token=${this._token}`;
const allowRootParam = allowRoot ? '--allow-root' : '';
startCommand = `"${this.options.install.pythonExecutable}" "${this.notebookScriptPath}" --no-browser --ip=127.0.0.1 ${allowRootParam} --no-mathjax --notebook-dir "${notebookDirectory}" --NotebookApp.token=${this._token}`;
this.notifyStarting(this.options.install, startCommand);
// Execute the command