Skip to content

Commit

Permalink
set requestedExecutionLevel to skip admin priv in wins. fix stopserve…
Browse files Browse the repository at this point in the history
…r in wins. fix additional mounted path.
  • Loading branch information
iishiishii committed Oct 29, 2024
1 parent 819e526 commit 241b287
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 26 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
]
},
"win": {
"requestedExecutionLevel": "highestAvailable",
"target": [
"nsis"
],
Expand Down
44 changes: 20 additions & 24 deletions src/main/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,8 @@ function createLaunchScript(
let volumeCreate = `${isPodman ? `${volumeCheck}` : ''}`;

let machineCmd = '';
if (isPodman && process.platform != 'linux' && serverInfo.serverArgs) {
let machineInitArgs = [
'podman machine init --volume neurodesk-home:/home/jovyan'
];
machineInitArgs.push(
`${
isWin
? '-v C:/neurodesktop-storage:/neurodesktop-storage -v "${serverInfo.serverArgs}"'
: '-v ~/neurodesktop-storage:/neurodesktop-storage -v "${serverInfo.serverArgs}"'
}`
);

machineCmd = machineInitArgs.join(' ') + ` && ${engineCmd} machine start`;
if (isPodman && process.platform == 'darwin' && serverInfo.workingDirectory) {
machineCmd = `podman machine init --rootful --now --volume neurodesk-home:/home/jovyan -v ~/neurodesktop-storage:/neurodesktop-storage -v ${serverInfo.workingDirectory} -v $HOME:$HOME podman-machine-default`;
}

let launchArgs = [
Expand All @@ -116,8 +105,8 @@ function createLaunchScript(
const config = Config.loadConfig(path.join(__dirname, '..'));
const tag = config.ConfigToml.jupyter_neurodesk_version;

if (serverInfo.serverArgs) {
launchArgs.push(` -v "${serverInfo.serverArgs}"`);
if (serverInfo.workingDirectory) {
launchArgs.push(` -v ${serverInfo.workingDirectory}:/data`);
}

for (const arg of serverLaunchArgsFixed) {
Expand Down Expand Up @@ -157,7 +146,6 @@ function createLaunchScript(
) else (
echo "Image does not exist"
${stopCmd}
${machineCmd}
${volumeCreate}
${engineCmd} pull docker.io/vnmd/neurodesktop:${tag}
${launchCmd}
Expand Down Expand Up @@ -459,11 +447,13 @@ export class JupyterServer {
execFile(`${engineCmd} rm -f neurodeskapp-${this._info.port}`, {
shell: 'cmd.exe'
});
if (this._info.engine === EngineType.Podman) {
execFile(`${engineCmd} machine stop`, {
execFile(
'taskkill',
['/PID', String(this._nbServer.pid), '/T', '/F'],
{
shell: 'cmd.exe'
});
}
}
);
this._shutdownServer()
.then(() => {
this._stopping = false;
Expand All @@ -474,10 +464,16 @@ export class JupyterServer {
execFile(`${engineCmd} rm -f neurodeskapp-${this._info.port}`, {
shell: '/bin/bash'
});
if (this._info.engine === EngineType.Podman) {
execFile(`${engineCmd} machine stop`, {
shell: '/bin/bash'
});
if (
process.platform === 'darwin' &&
this._info.engine === EngineType.Podman
) {
execFile(
`${engineCmd} machine stop podman-machine-default && ${engineCmd} machine rm podman-machine-default`,
{
shell: '/bin/bash'
}
);
}
this._shutdownServer()
.then(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/main/sessionwindow/sessionwindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ export class SessionWindow implements IDisposable {
let installEngineURL =
this._engineType === 'docker'
? '<div class="message-row"><a href="https://docs.docker.com/engine/install/">Install Docker</a></div>'
: '<div class="message-row"><a href="https://podman.io/docs/installation">Install Podman</a></br>If you are on Linux, please follow additional steps to setup <a href="https://www.neurodesk.org/docs/getting-started/neurodesktop/linux/">Podman client as in this documentation</a></div>';
: '<div class="message-row"><a href="https://podman.io/docs/installation">Install Podman</a></div>';
let engineName =
this._engineType.charAt(0).toUpperCase() + this._engineType.slice(1);

Expand Down
2 changes: 1 addition & 1 deletion src/main/settingsdialog/settingsdialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class SettingsDialog {
window.electronAPI.setInstallUpdatesAutomatically(autoInstallCheckbox.checked);
window.electronAPI.setDefaultWorkingDirectory(workingDirectoryInput.value);
if (workingDirectoryInput.value !== '') {
window.electronAPI.setServerLaunchArgs(workingDirectoryInput.value + ':/data');
window.electronAPI.setServerLaunchArgs(workingDirectoryInput.value);
}
const ctrlWBehavior = document.querySelector('jp-radio[name="ctrl-w-behavior"].checked').value;
Expand Down

0 comments on commit 241b287

Please sign in to comment.