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

@@ -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