diff --git a/app/config/schema.json b/app/config/schema.json index afb8f2eeb067..9235d9459862 100644 --- a/app/config/schema.json +++ b/app/config/schema.json @@ -253,11 +253,11 @@ "type": "string" }, "shell": { - "description": "the shell to run when spawning a new session (i.e. /usr/local/bin/fish)\nif left empty, your system's login shell will be used by default\n\nWindows\n- Make sure to use a full path if the binary name doesn't work\n- Remove `--login` in shellArgs\n\nWindows Subsystem for Linux (WSL) - previously Bash on Windows\n- Example: `C:\\\\Windows\\\\System32\\\\wsl.exe`\n\nGit-bash on Windows\n- Example: `C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe`\n\nPowerShell on Windows\n- Example: `C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`\n\nCygwin\n- Example: `C:\\\\cygwin64\\\\bin\\\\bash.exe`\n\nGit Bash\n- Example: `C:\\\\Program Files\\\\Git\\\\git-cmd.exe`\nThen Add `--command=usr/bin/bash.exe` to shellArgs", + "description": "the shell to run when spawning a new session (e.g. /usr/local/bin/fish)\nif left empty, your system's login shell will be used by default\n\nWindows\n- Make sure to use a full path if the binary name doesn't work\n- Remove `--login` in shellArgs\n\nWindows Subsystem for Linux (WSL) - previously Bash on Windows\n- Example: `C:\\\\Windows\\\\System32\\\\wsl.exe`\n\nGit-bash on Windows\n- Example: `C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe`\n\nPowerShell on Windows\n- Example: `C:\\\\WINDOWS\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`\n\nCygwin\n- Example: `C:\\\\cygwin64\\\\bin\\\\bash.exe`\n\nGit Bash\n- Example: `C:\\\\Program Files\\\\Git\\\\git-cmd.exe`\nThen Add `--command=usr/bin/bash.exe` to shellArgs", "type": "string" }, "shellArgs": { - "description": "for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)\nby default `['--login']` will be used", + "description": "for setting shell arguments (e.g. for using interactive shellArgs: `['-i']`)\nby default `['--login']` will be used", "items": { "type": "string" }, diff --git a/app/index.ts b/app/index.ts index 8537af8c9cdc..fc698bdcfcda 100644 --- a/app/index.ts +++ b/app/index.ts @@ -31,6 +31,7 @@ import {installCLI} from './utils/cli-install'; import * as AppMenu from './menus/menu'; import {newWindow} from './ui/window'; import * as windowUtils from './utils/window-utils'; +import parseUrl from 'parse-url'; const windowSet = new Set([]); @@ -234,6 +235,6 @@ app.on('open-file', (_event, path) => { app.on('open-url', (_event, sshUrl) => { GetWindow((win: BrowserWindow) => { - win.rpc.emit('open ssh', sshUrl); + win.rpc.emit('open ssh', parseUrl(sshUrl)); }); }); diff --git a/lib/actions/ui.ts b/lib/actions/ui.ts index a2fa6d7526d4..1005e2bec89b 100644 --- a/lib/actions/ui.ts +++ b/lib/actions/ui.ts @@ -292,12 +292,11 @@ export function leaveFullScreen(): HyperActions { }; } -export function openSSH(url: string) { +export function openSSH(parsedUrl: ReturnType) { return (dispatch: HyperDispatch) => { dispatch({ type: UI_OPEN_SSH_URL, effect() { - const parsedUrl = parseUrl(url, true); let command = `${parsedUrl.protocol} ${parsedUrl.user ? `${parsedUrl.user}@` : ''}${parsedUrl.resource}`; if (parsedUrl.port) command += ` -p ${parsedUrl.port}`; diff --git a/lib/ext-modules.d.ts b/lib/ext-modules.d.ts index 68a9a59c557a..d44b8a279f87 100644 --- a/lib/ext-modules.d.ts +++ b/lib/ext-modules.d.ts @@ -2,10 +2,6 @@ declare module 'php-escape-shell' { export function php_escapeshellcmd(path: string): string; } -declare module 'parse-url' { - export default function (...args: any[]): any; -} - declare module 'react-deep-force-update' { export default function (...args: any[]): any; } diff --git a/lib/index.tsx b/lib/index.tsx index 21578c5e439e..e19b57ae0b80 100644 --- a/lib/index.tsx +++ b/lib/index.tsx @@ -204,8 +204,8 @@ rpc.on('open file', ({path}) => { store_.dispatch(uiActions.openFile(path)); }); -rpc.on('open ssh', (url) => { - store_.dispatch(uiActions.openSSH(url)); +rpc.on('open ssh', (parsedUrl) => { + store_.dispatch(uiActions.openSSH(parsedUrl)); }); rpc.on('update available', ({releaseName, releaseNotes, releaseUrl, canInstall}) => { diff --git a/package.json b/package.json index 51503d0bacdd..ae39746edfb0 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "ms": "2.1.3", "open": "8.4.2", "ora": "5.4.1", - "parse-url": "8.1.0", "php-escape-shell": "1.0.0", "react": "17.0.2", "react-deep-force-update": "2.1.3", @@ -122,6 +121,7 @@ "node-addon-api": "6.1.0", "node-gyp": "9.3.1", "null-loader": "4.0.1", + "parse-url": "8.1.0", "playwright": "1.33.0", "plist": "3.0.6", "prettier": "2.8.8",