-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable support for copy command as curl (#109)
feat: enable support for copy command as curl user can copy the es query as a curl command to action it in the terminal Refs: #104 --------- Signed-off-by: seven <[email protected]>
- Loading branch information
Showing
10 changed files
with
243 additions
and
124 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"name": "dockit", | ||
"private": true, | ||
"type": "module", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"description": "DocKit is a desktop client designed for NoSQL database, support Elasticsearch and OpenSearch across Mac, windows and Linux", | ||
"author": "geekfun <[email protected]>", | ||
"homepage": "ttps://dockit.geekfun.club", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { base64Encode } from './base64.ts'; | ||
|
||
export const buildAuthHeader = (username: string | undefined, password: string | undefined) => { | ||
const authorization = | ||
username || password ? `Basic ${base64Encode(`${username}:${password}`)}` : undefined; | ||
return authorization ? { authorization } : undefined; | ||
}; | ||
|
||
export const buildURL = ( | ||
host: string, | ||
port: number, | ||
index: string | undefined, | ||
path: string | undefined, | ||
queryParameters?: string, | ||
) => { | ||
const trimmedPath = path?.startsWith('/') ? path.slice(1) : path; | ||
const pathWithIndex = | ||
index && | ||
!['_nodes', '_cluster', '_cat', '_bulk', '_aliases', '_analyze'].includes( | ||
trimmedPath?.split('/')[0] ?? '', | ||
) | ||
? `${index}/${trimmedPath}` | ||
: `${trimmedPath}`; | ||
|
||
return `${host}:${port}/${pathWithIndex}${queryParameters ? `?${queryParameters}` : ''}`; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters