From 98c53cf44315e468de6930f4c76b5ae65502e3d3 Mon Sep 17 00:00:00 2001 From: lohit Date: Mon, 29 Jul 2024 11:04:29 +0530 Subject: [PATCH 01/49] update natural to sequential (#2717) --- packages/bruno-electron/src/ipc/network/index.js | 6 +++--- packages/bruno-electron/src/ipc/network/prepare-request.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index c384ba71e..9659f45b4 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -408,7 +408,7 @@ const registerNetworkIpc = (mainWindow) => { } // run post-response script - const responseScript = compact(scriptingConfig.flow === 'natural' ? [ + const responseScript = compact(scriptingConfig.flow === 'sequential' ? [ get(collectionRoot, 'request.script.res'), get(request, 'script.res') ] : [ get(request, 'script.res'), get(collectionRoot, 'request.script.res') @@ -596,7 +596,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testScript = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - const testFile = compact(scriptingConfig.flow === 'natural' ? [ + const testFile = compact(scriptingConfig.flow === 'sequential' ? [ get(collectionRoot, 'request.tests'), testScript, ] : [ testScript, get(collectionRoot, 'request.tests') @@ -1036,7 +1036,7 @@ const registerNetworkIpc = (mainWindow) => { // run tests const testScript = item.draft ? get(item.draft, 'request.tests') : get(item, 'request.tests'); - const testFile = compact(scriptingConfig.flow === 'natural' ? [ + const testFile = compact(scriptingConfig.flow === 'sequential' ? [ get(collectionRoot, 'request.tests'), testScript ] : [ testScript, get(collectionRoot, 'request.tests') diff --git a/packages/bruno-electron/src/ipc/network/prepare-request.js b/packages/bruno-electron/src/ipc/network/prepare-request.js index bada3f9b0..7777253a7 100644 --- a/packages/bruno-electron/src/ipc/network/prepare-request.js +++ b/packages/bruno-electron/src/ipc/network/prepare-request.js @@ -147,7 +147,7 @@ const mergeFolderLevelScripts = (request, requestTreePath, scriptFlow) => { } if (folderCombinedPostResScript.length) { - if (scriptFlow === 'natural') { + if (scriptFlow === 'sequential') { request.script.res = compact([...folderCombinedPostResScript, request?.script?.res || '']).join(os.EOL); } else { request.script.res = compact([request?.script?.res || '', ...folderCombinedPostResScript.reverse()]).join(os.EOL); @@ -155,7 +155,7 @@ const mergeFolderLevelScripts = (request, requestTreePath, scriptFlow) => { } if (folderCombinedTests.length) { - if (scriptFlow === 'natural') { + if (scriptFlow === 'sequential') { request.tests = compact([...folderCombinedTests, request?.tests || '']).join(os.EOL); } else { request.tests = compact([request?.tests || '', ...folderCombinedTests.reverse()]).join(os.EOL); @@ -309,7 +309,7 @@ const prepareRequest = (item, collection) => { } }); - // scriptFlow is either "sandwich" or "natural" + // scriptFlow is either "sandwich" or "sequential" const scriptFlow = collection.brunoConfig?.scripts?.flow ?? 'sandwich'; const requestTreePath = getTreePathFromCollectionToItem(collection, item); if (requestTreePath && requestTreePath.length > 0) { From 37bec70fe6df435837e0ea19f5f9c408844ca818 Mon Sep 17 00:00:00 2001 From: lohit Date: Wed, 31 Jul 2024 16:13:55 +0530 Subject: [PATCH 02/49] fix: removed unused code (#2729) --- .../src/providers/ReduxStore/slices/collections/actions.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index 6082f7d72..b2ed73a94 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -192,10 +192,7 @@ export const sendCollectionOauth2Request = (collectionUid, itemUid) => (dispatch const environment = findEnvironmentInCollection(collectionCopy, collection.activeEnvironmentUid); - const externalSecrets = getExternalCollectionSecretsForActiveEnvironment({ collection }); - const secretVariables = getFormattedCollectionSecretVariables({ externalSecrets }); - - _sendCollectionOauth2Request(collection, environment, collectionCopy.runtimeVariables, itemUid, secretVariables) + _sendCollectionOauth2Request(collection, environment, collectionCopy.runtimeVariables) .then((response) => { if (response?.data?.error) { toast.error(response?.data?.error); From 640623b39ad0951b9b21eb547203e7bcecf387e1 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Wed, 31 Jul 2024 17:57:39 +0530 Subject: [PATCH 03/49] chore: version bumped to v1.23.0 --- packages/bruno-app/src/components/Sidebar/index.js | 2 +- packages/bruno-app/src/providers/App/useTelemetry.js | 2 +- packages/bruno-electron/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js index c813a379f..981838ddc 100644 --- a/packages/bruno-app/src/components/Sidebar/index.js +++ b/packages/bruno-app/src/components/Sidebar/index.js @@ -129,7 +129,7 @@ const Sidebar = () => { Star */} -
v1.22.0
+
v1.23.0
diff --git a/packages/bruno-app/src/providers/App/useTelemetry.js b/packages/bruno-app/src/providers/App/useTelemetry.js index ae379e91e..a2ec63c85 100644 --- a/packages/bruno-app/src/providers/App/useTelemetry.js +++ b/packages/bruno-app/src/providers/App/useTelemetry.js @@ -60,7 +60,7 @@ const trackStart = () => { event: 'start', properties: { os: platformLib.os.family, - version: '1.22.0' + version: '1.23.0' } }); }; diff --git a/packages/bruno-electron/package.json b/packages/bruno-electron/package.json index f1a992e47..c938f312d 100644 --- a/packages/bruno-electron/package.json +++ b/packages/bruno-electron/package.json @@ -1,5 +1,5 @@ { - "version": "v1.22.0", + "version": "v1.23.0", "name": "bruno", "description": "Opensource API Client for Exploring and Testing APIs", "homepage": "https://www.usebruno.com", From 8f920a90c7c54ae516db1dbc007b9334f6504bcb Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Thu, 1 Aug 2024 18:16:54 +0530 Subject: [PATCH 04/49] chore: bumped version --- packages/bruno-app/src/components/Sidebar/index.js | 2 +- packages/bruno-app/src/providers/App/useTelemetry.js | 2 +- packages/bruno-electron/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js index 981838ddc..c973f3891 100644 --- a/packages/bruno-app/src/components/Sidebar/index.js +++ b/packages/bruno-app/src/components/Sidebar/index.js @@ -129,7 +129,7 @@ const Sidebar = () => { Star */} -
v1.23.0
+
v1.23.1
diff --git a/packages/bruno-app/src/providers/App/useTelemetry.js b/packages/bruno-app/src/providers/App/useTelemetry.js index a2ec63c85..d8d4920a3 100644 --- a/packages/bruno-app/src/providers/App/useTelemetry.js +++ b/packages/bruno-app/src/providers/App/useTelemetry.js @@ -60,7 +60,7 @@ const trackStart = () => { event: 'start', properties: { os: platformLib.os.family, - version: '1.23.0' + version: '1.23.1' } }); }; diff --git a/packages/bruno-electron/package.json b/packages/bruno-electron/package.json index c938f312d..57e33b5f0 100644 --- a/packages/bruno-electron/package.json +++ b/packages/bruno-electron/package.json @@ -1,5 +1,5 @@ { - "version": "v1.23.0", + "version": "v1.23.1", "name": "bruno", "description": "Opensource API Client for Exploring and Testing APIs", "homepage": "https://www.usebruno.com", From 7c33fd413e232188ac026c47c5a9ad2685807873 Mon Sep 17 00:00:00 2001 From: Natalie Carey Date: Fri, 2 Aug 2024 07:40:04 +0100 Subject: [PATCH 05/49] Refactored handlers into reusable functions for readability. (#2744) --- .../src/components/SingleLineEditor/index.js | 52 +++++++------------ 1 file changed, 20 insertions(+), 32 deletions(-) diff --git a/packages/bruno-app/src/components/SingleLineEditor/index.js b/packages/bruno-app/src/components/SingleLineEditor/index.js index dbb46191b..a817da782 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/index.js +++ b/packages/bruno-app/src/components/SingleLineEditor/index.js @@ -26,6 +26,18 @@ class SingleLineEditor extends Component { /** @type {import("codemirror").Editor} */ const variables = getAllVariables(this.props.collection, this.props.item); + const runHandler = () => { + if (this.props.onRun) { + this.props.onRun(); + } + }; + const saveHandler = () => { + if (this.props.onSave) { + this.props.onSave(); + } + }; + const noopHandler = () => {}; + this.editor = CodeMirror(this.editorRef.current, { lineWrapping: false, lineNumbers: false, @@ -37,21 +49,9 @@ class SingleLineEditor extends Component { scrollbarStyle: null, tabindex: 0, extraKeys: { - Enter: () => { - if (this.props.onRun) { - this.props.onRun(); - } - }, - 'Ctrl-Enter': () => { - if (this.props.onRun) { - this.props.onRun(); - } - }, - 'Cmd-Enter': () => { - if (this.props.onRun) { - this.props.onRun(); - } - }, + Enter: runHandler, + 'Ctrl-Enter': runHandler, + 'Cmd-Enter': runHandler, 'Alt-Enter': () => { if (this.props.allowNewlines) { this.editor.setValue(this.editor.getValue() + '\n'); @@ -60,23 +60,11 @@ class SingleLineEditor extends Component { this.props.onRun(); } }, - 'Shift-Enter': () => { - if (this.props.onRun) { - this.props.onRun(); - } - }, - 'Cmd-S': () => { - if (this.props.onSave) { - this.props.onSave(); - } - }, - 'Ctrl-S': () => { - if (this.props.onSave) { - this.props.onSave(); - } - }, - 'Cmd-F': () => {}, - 'Ctrl-F': () => {}, + 'Shift-Enter': runHandler, + 'Cmd-S': saveHandler, + 'Ctrl-S': saveHandler, + 'Cmd-F': noopHandler, + 'Ctrl-F': noopHandler, // Tabbing disabled to make tabindex work Tab: false, 'Shift-Tab': false From 741250068fc484691a696b168a05fff823e25426 Mon Sep 17 00:00:00 2001 From: Max Bauer Date: Mon, 5 Aug 2024 08:16:06 +0200 Subject: [PATCH 06/49] feat: masking support for SingleLineEditor (#2240) * mask support for SingleLineEditor * add secret visibility toggle button * move visibility toggle into SingleLineComponent Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com> * fix eye button focus state * center enabled and secret toggle * fix input field scales to 100% width --------- Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com> --- .../EnvironmentVariables/index.js | 20 +++---- .../src/components/SingleLineEditor/index.js | 58 ++++++++++++++++++- .../bruno-app/src/utils/common/codemirror.js | 58 +++++++++++++++++++ 3 files changed, 123 insertions(+), 13 deletions(-) diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js index 1f36d05ea..45a43a6a9 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/EnvironmentDetails/EnvironmentVariables/index.js @@ -5,7 +5,6 @@ import { useDispatch } from 'react-redux'; import SingleLineEditor from 'components/SingleLineEditor'; import StyledWrapper from './StyledWrapper'; import { uuid } from 'utils/common'; -import { maskInputValue } from 'utils/collections'; import { useFormik } from 'formik'; import * as Yup from 'yup'; import { variableNameRegex } from 'utils/common/regex'; @@ -96,10 +95,10 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original - + - + @@ -109,7 +108,7 @@ const EnvironmentVariables = ({ environment, collection, setIsModified, original - -
EnabledEnabled Name ValueSecretSecret
- {variable.secret ? ( -
{maskInputValue(variable.value)}
- ) : ( +
+
formik.setFieldValue(`${index}.value`, newValue, true)} /> - )} +
+ { + if (typeof enabled !== 'boolean') return; + + console.log('Enabling masked editor: ' + enabled); + if (enabled == true) { + if (!this.maskedEditor) this.maskedEditor = new MaskedEditor(this.editor, '*'); + this.maskedEditor.enable(); + } else { + this.maskedEditor?.disable(); + this.maskedEditor = null; + } + }; + _onEdit = () => { if (!this.ignoreChangeEvent && this.editor) { this.cachedValue = this.editor.getValue(); @@ -110,6 +131,12 @@ class SingleLineEditor extends Component { this.cachedValue = String(this.props.value); this.editor.setValue(String(this.props.value) || ''); } + if (!isEqual(this.props.isSecret, prevProps.isSecret)) { + // If the secret flag has changed, update the editor to reflect the change + this._enableMaskedEditor(this.props.isSecret); + // also set the maskInput flag to the new value + this.setState({ maskInput: this.props.isSecret }); + } this.ignoreChangeEvent = false; } @@ -123,8 +150,35 @@ class SingleLineEditor extends Component { this.editor.setOption('mode', 'brunovariables'); }; + toggleVisibleSecret = () => { + const isVisible = !this.state.maskInput; + this.setState({ maskInput: isVisible }); + this._enableMaskedEditor(isVisible); + }; + + /** + * @brief Eye icon to show/hide the secret value + * @returns ReactComponent The eye icon + */ + secretEye = (isSecret) => { + return isSecret === true ? ( + + ) : null; + }; + render() { - return ; + return ( +
+ + {this.secretEye(this.props.isSecret)} +
+ ); } } export default SingleLineEditor; diff --git a/packages/bruno-app/src/utils/common/codemirror.js b/packages/bruno-app/src/utils/common/codemirror.js index f4013a366..cbb1a2b3a 100644 --- a/packages/bruno-app/src/utils/common/codemirror.js +++ b/packages/bruno-app/src/utils/common/codemirror.js @@ -12,6 +12,64 @@ const pathFoundInVariables = (path, obj) => { return value !== undefined; }; +/** + * Changes the render behaviour for a given CodeMirror editor. + * Replaces all **rendered** characters, not the actual value, with the provided character. + */ +export class MaskedEditor { + /** + * @param {import('codemirror').Editor} editor CodeMirror editor instance + * @param {string} maskChar Target character being applied to all content + */ + constructor(editor, maskChar) { + this.editor = editor; + this.maskChar = maskChar; + this.enabled = false; + } + + /** + * Set and apply new masking character + */ + enable = () => { + this.enabled = true; + this.editor.setValue(this.editor.getValue()); + this.editor.on('inputRead', this.maskContent); + this.update(); + }; + + /** Disables masking of the editor field. */ + disable = () => { + this.enabled = false; + this.editor.off('inputRead', this.maskContent); + this.editor.setValue(this.editor.getValue()); + }; + + /** Updates the rendered content if enabled. */ + update = () => { + if (this.enabled) this.maskContent(); + }; + + /** Replaces all rendered characters, with the provided character. */ + maskContent = () => { + const content = this.editor.getValue(); + this.editor.operation(() => { + // Clear previous masked text + this.editor.getAllMarks().forEach((mark) => mark.clear()); + // Apply new masked text + for (let i = 0; i < content.length; i++) { + if (content[i] !== '\n') { + const maskedNode = document.createTextNode(this.maskChar); + this.editor.markText( + { line: this.editor.posFromIndex(i).line, ch: this.editor.posFromIndex(i).ch }, + { line: this.editor.posFromIndex(i + 1).line, ch: this.editor.posFromIndex(i + 1).ch }, + { replacedWith: maskedNode, handleMouseEvents: true } + ); + } + } + }); + }; +} + export const defineCodeMirrorBrunoVariablesMode = (_variables, mode, highlightPathParams) => { CodeMirror.defineMode('brunovariables', function (config, parserConfig) { const { pathParams = {}, ...variables } = _variables || {}; From c5ec7eea349b1f3fff8ee4db1bed4964e5736b6b Mon Sep 17 00:00:00 2001 From: Natalie Carey Date: Mon, 5 Aug 2024 07:21:01 +0100 Subject: [PATCH 07/49] Feature: Add a show/hide privacy toggle to passwords and secrets in Auth options (#2750) * mask support for SingleLineEditor * add secret visibility toggle button * move visibility toggle into SingleLineComponent Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com> * fix eye button focus state * center enabled and secret toggle * fix input field scales to 100% width * Using a prvacy toggle for all sensitive auth details. * Applied privacy toggle to Collection Auth settings. --------- Co-authored-by: Max Bauer Co-authored-by: Liz MacLean <18120837+lizziemac@users.noreply.github.com> --- .../components/CollectionSettings/Auth/AwsV4Auth/index.js | 1 + .../components/CollectionSettings/Auth/BasicAuth/index.js | 1 + .../components/CollectionSettings/Auth/BearerAuth/index.js | 1 + .../components/CollectionSettings/Auth/DigestAuth/index.js | 1 + .../Auth/OAuth2/AuthorizationCode/index.js | 3 ++- .../Auth/OAuth2/AuthorizationCode/inputsConfig.js | 3 ++- .../Auth/OAuth2/ClientCredentials/index.js | 3 ++- .../Auth/OAuth2/ClientCredentials/inputsConfig.js | 3 ++- .../Auth/OAuth2/PasswordCredentials/index.js | 3 ++- .../Auth/OAuth2/PasswordCredentials/inputsConfig.js | 3 ++- .../src/components/RequestPane/Auth/AwsV4Auth/index.js | 1 + .../src/components/RequestPane/Auth/BasicAuth/index.js | 1 + .../src/components/RequestPane/Auth/BearerAuth/index.js | 1 + .../src/components/RequestPane/Auth/DigestAuth/index.js | 1 + .../RequestPane/Auth/OAuth2/AuthorizationCode/index.js | 3 ++- .../Auth/OAuth2/AuthorizationCode/inputsConfig.js | 3 ++- .../RequestPane/Auth/OAuth2/ClientCredentials/index.js | 3 ++- .../Auth/OAuth2/ClientCredentials/inputsConfig.js | 3 ++- .../RequestPane/Auth/OAuth2/PasswordCredentials/index.js | 3 ++- .../Auth/OAuth2/PasswordCredentials/inputsConfig.js | 6 ++++-- 20 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js index bc9cb67b5..38fae3447 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/AwsV4Auth/index.js @@ -138,6 +138,7 @@ const AwsV4Auth = ({ collection }) => { onSave={handleSave} onChange={(val) => handleSecretAccessKeyChange(val)} collection={collection} + isSecret={true} /> diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js index b09cf1175..3c29895ed 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/BasicAuth/index.js @@ -62,6 +62,7 @@ const BasicAuth = ({ collection }) => { onSave={handleSave} onChange={(val) => handlePasswordChange(val)} collection={collection} + isSecret={true} /> diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js index a8b341a8c..82f8be12c 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/BearerAuth/index.js @@ -37,6 +37,7 @@ const BearerAuth = ({ collection }) => { onSave={handleSave} onChange={(val) => handleTokenChange(val)} collection={collection} + isSecret={true} /> diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js index 3e084c06d..5ac6b1e26 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/DigestAuth/index.js @@ -62,6 +62,7 @@ const DigestAuth = ({ collection }) => { onSave={handleSave} onChange={(val) => handlePasswordChange(val)} collection={collection} + isSecret={true} /> diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/index.js index 8ec71a69a..8f3dc1601 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/index.js @@ -78,7 +78,7 @@ const OAuth2AuthorizationCode = ({ collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -90,6 +90,7 @@ const OAuth2AuthorizationCode = ({ collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/inputsConfig.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/inputsConfig.js index 67bc277aa..a100ce8e5 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/inputsConfig.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/AuthorizationCode/inputsConfig.js @@ -17,7 +17,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/index.js index 5be4fde1d..d69122b48 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/index.js @@ -42,7 +42,7 @@ const OAuth2ClientCredentials = ({ collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -54,6 +54,7 @@ const OAuth2ClientCredentials = ({ collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/inputsConfig.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/inputsConfig.js index 164dcaab4..f2cd88ae3 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/inputsConfig.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/ClientCredentials/inputsConfig.js @@ -9,7 +9,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/index.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/index.js index 44598da1a..d2d9eed1f 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/index.js @@ -44,7 +44,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -56,6 +56,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { onChange={(val) => handleChange(key, val)} onRun={handleRun} collection={collection} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/inputsConfig.js b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/inputsConfig.js index 6366bb5e7..ec9efb1a8 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/inputsConfig.js +++ b/packages/bruno-app/src/components/CollectionSettings/Auth/OAuth2/PasswordCredentials/inputsConfig.js @@ -17,7 +17,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', diff --git a/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js index 41820a0c8..a44cecc1b 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/AwsV4Auth/index.js @@ -150,6 +150,7 @@ const AwsV4Auth = ({ onTokenChange, item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={true} /> diff --git a/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js index bbe16ec70..8582a53cd 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/BasicAuth/index.js @@ -69,6 +69,7 @@ const BasicAuth = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={true} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js index 1dfa42b15..bef4d062a 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/BearerAuth/index.js @@ -43,6 +43,7 @@ const BearerAuth = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={true} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js index 24f4610f0..e91ed8d1f 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/DigestAuth/index.js @@ -69,6 +69,7 @@ const DigestAuth = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={true} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js index 793be57f0..2bb5dcc35 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/index.js @@ -80,7 +80,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -93,6 +93,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/inputsConfig.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/inputsConfig.js index 67bc277aa..a100ce8e5 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/inputsConfig.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/AuthorizationCode/inputsConfig.js @@ -17,7 +17,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js index df08475e8..a43c8f0ad 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/index.js @@ -43,7 +43,7 @@ const OAuth2ClientCredentials = ({ item, collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -56,6 +56,7 @@ const OAuth2ClientCredentials = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/inputsConfig.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/inputsConfig.js index 164dcaab4..f2cd88ae3 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/inputsConfig.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/ClientCredentials/inputsConfig.js @@ -9,7 +9,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js index cfcff9784..4ec8c1faa 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/index.js @@ -45,7 +45,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { return ( {inputsConfig.map((input) => { - const { key, label } = input; + const { key, label, isSecret } = input; return (
@@ -58,6 +58,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => { onRun={handleRun} collection={collection} item={item} + isSecret={isSecret} />
diff --git a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/inputsConfig.js b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/inputsConfig.js index 6366bb5e7..32f2c999c 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/inputsConfig.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/OAuth2/PasswordCredentials/inputsConfig.js @@ -9,7 +9,8 @@ const inputsConfig = [ }, { key: 'password', - label: 'Password' + label: 'Password', + isSecret: true }, { key: 'clientId', @@ -17,7 +18,8 @@ const inputsConfig = [ }, { key: 'clientSecret', - label: 'Client Secret' + label: 'Client Secret', + isSecret: true }, { key: 'scope', From 2b0d55ce6b52c8f96f1654a2761888a305076867 Mon Sep 17 00:00:00 2001 From: Bruno Grasselli <67680+brunograsselli@users.noreply.github.com> Date: Mon, 5 Aug 2024 08:54:04 +0200 Subject: [PATCH 08/49] Update missing sponsor in readme_pt_br.md (#2754) --- docs/readme/readme_pt_br.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/readme/readme_pt_br.md b/docs/readme/readme_pt_br.md index 577ff1d42..0d390dbd4 100644 --- a/docs/readme/readme_pt_br.md +++ b/docs/readme/readme_pt_br.md @@ -103,6 +103,12 @@ Ou qualquer sistema de controle de versão de sua escolha. +#### Apoiadores Bronze + + + + + ### Links Importantes 📌 - [Nossa Visão de Longo Prazo](https://github.com/usebruno/bruno/discussions/269) From adb843faa709605854cf7ed7c2ff2edb9c0f8b43 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Mon, 5 Aug 2024 01:57:00 -0500 Subject: [PATCH 09/49] don't exclude cookies from request headers when importing from curl (#2748) --- packages/bruno-app/src/utils/curl/parse-curl.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/bruno-app/src/utils/curl/parse-curl.js b/packages/bruno-app/src/utils/curl/parse-curl.js index 810d1af8a..30db1a868 100644 --- a/packages/bruno-app/src/utils/curl/parse-curl.js +++ b/packages/bruno-app/src/utils/curl/parse-curl.js @@ -72,11 +72,10 @@ const parseCurlCommand = (curlCommand) => { parsedArguments.header.forEach((header) => { if (header.indexOf('Cookie') !== -1) { cookieString = header; - } else { - const components = header.split(/:(.*)/); - if (components[1]) { - headers[components[0]] = components[1].trim(); - } + } + const components = header.split(/:(.*)/); + if (components[1]) { + headers[components[0]] = components[1].trim(); } }); } From 4598bb1bdd5db485fa69a40aa20189a3f5b81c33 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Mon, 5 Aug 2024 17:49:04 +0530 Subject: [PATCH 10/49] fix(#2605): fix editor view height (#2758) * fix(#2605): fix editor view height * chore: disabled prettier on github actions --- .github/workflows/tests.yml | 12 ------------ package-lock.json | 2 +- .../src/components/CodeEditor/StyledWrapper.js | 1 + .../bruno-app/src/components/CodeEditor/index.js | 2 +- .../src/components/Documentation/StyledWrapper.js | 8 -------- .../bruno-app/src/components/Documentation/index.js | 4 ++-- .../src/components/MarkDown/StyledWrapper.js | 1 - .../components/RequestPane/HttpRequestPane/index.js | 2 +- .../RequestPane/QueryEditor/StyledWrapper.js | 1 + .../RequestPane/RequestBody/StyledWrapper.js | 4 ---- .../src/components/RequestPane/Script/index.js | 8 ++++---- .../src/components/RequestPane/Vars/index.js | 4 ++-- .../src/components/RequestTabPanel/index.js | 5 ++--- .../src/components/RequestTabs/StyledWrapper.js | 2 ++ packages/bruno-app/src/styles/globals.css | 6 ++++++ 15 files changed, 23 insertions(+), 39 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6eb759301..1abee37cf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -71,15 +71,3 @@ jobs: with: files: packages/bruno-tests/collection/junit.xml comment_mode: always - prettier: - name: Prettier - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: '.nvmrc' - - name: Install dependencies - run: npm ci --legacy-peer-deps - - name: Run Prettier - run: npm run test:prettier:web diff --git a/package-lock.json b/package-lock.json index 6792725f9..e021bf38f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19668,7 +19668,7 @@ }, "packages/bruno-electron": { "name": "bruno", - "version": "v1.21.0", + "version": "v1.23.1", "dependencies": { "@aws-sdk/credential-providers": "3.525.0", "@usebruno/common": "0.1.0", diff --git a/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js b/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js index 3623d406d..232f964ae 100644 --- a/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js +++ b/packages/bruno-app/src/components/CodeEditor/StyledWrapper.js @@ -6,6 +6,7 @@ const StyledWrapper = styled.div` border: solid 1px ${(props) => props.theme.codemirror.border}; font-family: ${(props) => (props.font ? props.font : 'default')}; line-break: anywhere; + flex: 1 1 0; } .CodeMirror-overlayscroll-horizontal div, diff --git a/packages/bruno-app/src/components/CodeEditor/index.js b/packages/bruno-app/src/components/CodeEditor/index.js index ddc38aff8..c67b22668 100644 --- a/packages/bruno-app/src/components/CodeEditor/index.js +++ b/packages/bruno-app/src/components/CodeEditor/index.js @@ -289,7 +289,7 @@ export default class CodeEditor extends React.Component { } return ( { diff --git a/packages/bruno-app/src/components/Documentation/StyledWrapper.js b/packages/bruno-app/src/components/Documentation/StyledWrapper.js index f0ffee808..f159d94dc 100644 --- a/packages/bruno-app/src/components/Documentation/StyledWrapper.js +++ b/packages/bruno-app/src/components/Documentation/StyledWrapper.js @@ -1,14 +1,6 @@ import styled from 'styled-components'; const StyledWrapper = styled.div` - div.CodeMirror { - /* todo: find a better way */ - height: calc(100vh - 240px); - - .CodeMirror-scroll { - padding-bottom: 0px; - } - } .editing-mode { cursor: pointer; color: ${(props) => props.theme.colors.text.yellow}; diff --git a/packages/bruno-app/src/components/Documentation/index.js b/packages/bruno-app/src/components/Documentation/index.js index d4b790965..5a391db8a 100644 --- a/packages/bruno-app/src/components/Documentation/index.js +++ b/packages/bruno-app/src/components/Documentation/index.js @@ -37,8 +37,8 @@ const Documentation = ({ item, collection }) => { } return ( - -
+ +
{isEditing ? 'Preview' : 'Edit'}
diff --git a/packages/bruno-app/src/components/MarkDown/StyledWrapper.js b/packages/bruno-app/src/components/MarkDown/StyledWrapper.js index 65cb9c23b..f834fdaba 100644 --- a/packages/bruno-app/src/components/MarkDown/StyledWrapper.js +++ b/packages/bruno-app/src/components/MarkDown/StyledWrapper.js @@ -2,7 +2,6 @@ import styled from 'styled-components'; const StyledMarkdownBodyWrapper = styled.div` background: transparent; - height: inherit; .markdown-body { background: transparent; overflow-y: auto; diff --git a/packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js b/packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js index df90082c6..c7d66aadb 100644 --- a/packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js +++ b/packages/bruno-app/src/components/RequestPane/HttpRequestPane/index.js @@ -137,7 +137,7 @@ const HttpRequestPane = ({ item, collection, leftPaneWidth }) => { ) : null}
diff --git a/packages/bruno-app/src/components/RequestPane/QueryEditor/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/QueryEditor/StyledWrapper.js index 06f9e4b78..3832f60c0 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryEditor/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/QueryEditor/StyledWrapper.js @@ -4,6 +4,7 @@ const StyledWrapper = styled.div` div.CodeMirror { background: ${(props) => props.theme.codemirror.bg}; border: solid 1px ${(props) => props.theme.codemirror.border}; + flex: 1 1 0; } textarea.cm-editor { diff --git a/packages/bruno-app/src/components/RequestPane/RequestBody/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/RequestBody/StyledWrapper.js index 83ebd8140..42da81d61 100644 --- a/packages/bruno-app/src/components/RequestPane/RequestBody/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/RequestBody/StyledWrapper.js @@ -1,10 +1,6 @@ import styled from 'styled-components'; const Wrapper = styled.div` - div.CodeMirror { - /* todo: find a better way */ - height: calc(100vh - 220px); - } `; export default Wrapper; diff --git a/packages/bruno-app/src/components/RequestPane/Script/index.js b/packages/bruno-app/src/components/RequestPane/Script/index.js index 935b52ede..acd674ee0 100644 --- a/packages/bruno-app/src/components/RequestPane/Script/index.js +++ b/packages/bruno-app/src/components/RequestPane/Script/index.js @@ -40,8 +40,8 @@ const Script = ({ item, collection }) => { return ( -
-
Pre Request
+
+
Pre Request
{ onSave={onSave} />
-
-
Post Response
+
+
Post Response
{ return ( -
+
Pre Request
-
+
Post Response
diff --git a/packages/bruno-app/src/components/RequestTabPanel/index.js b/packages/bruno-app/src/components/RequestTabPanel/index.js index 2fd253f4b..ecec4bc9d 100644 --- a/packages/bruno-app/src/components/RequestTabPanel/index.js +++ b/packages/bruno-app/src/components/RequestTabPanel/index.js @@ -158,10 +158,9 @@ const RequestTabPanel = () => {
{item.type === 'graphql-request' ? ( diff --git a/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js b/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js index ec76ec5b5..26399d975 100644 --- a/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js @@ -14,6 +14,8 @@ const Wrapper = styled.div` display: none; } + scrollbar-width: none; + li { display: inline-flex; max-width: 150px; diff --git a/packages/bruno-app/src/styles/globals.css b/packages/bruno-app/src/styles/globals.css index 29e9196ea..79c2a962c 100644 --- a/packages/bruno-app/src/styles/globals.css +++ b/packages/bruno-app/src/styles/globals.css @@ -58,6 +58,12 @@ body::-webkit-scrollbar-thumb, border-radius: 5rem; } +* { + /* This ensures that scrollbars are only visible when the user starts to scroll, + providing a cleaner and more minimalistic appearance. */ + scrollbar-width: thin; +} + /* * todo: this will be supported in the future to be changed via applying a theme * making all the checkboxes and radios bigger From 7ca59656f24e50ae15dc6719aabfadcc5f37f498 Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:55:06 +0530 Subject: [PATCH 11/49] set inital window-show: false (#2713) --- packages/bruno-electron/src/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bruno-electron/src/index.js b/packages/bruno-electron/src/index.js index 7f4e58422..f527e7ea3 100644 --- a/packages/bruno-electron/src/index.js +++ b/packages/bruno-electron/src/index.js @@ -50,6 +50,7 @@ app.on('ready', async () => { height, minWidth: 1000, minHeight: 640, + show: false, webPreferences: { nodeIntegration: true, contextIsolation: true, From 60a8647e7c5ddbdbc54547c08af15468ce2da3b4 Mon Sep 17 00:00:00 2001 From: Rinku Chaudhari <76877078+therealrinku@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:12:19 +0545 Subject: [PATCH 12/49] fix: enter key not submitting new request form (#2630) --- .../src/components/Sidebar/NewRequest/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js index 8d8125e94..36d1f2193 100644 --- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js @@ -161,7 +161,16 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { return ( -
+ { + if (e.key === 'Enter') { + e.preventDefault(); + formik.handleSubmit(); + } + }} + >
-
v1.23.1
+
v1.24.0
diff --git a/packages/bruno-app/src/providers/App/useTelemetry.js b/packages/bruno-app/src/providers/App/useTelemetry.js index d8d4920a3..7cd73e8f7 100644 --- a/packages/bruno-app/src/providers/App/useTelemetry.js +++ b/packages/bruno-app/src/providers/App/useTelemetry.js @@ -60,7 +60,7 @@ const trackStart = () => { event: 'start', properties: { os: platformLib.os.family, - version: '1.23.1' + version: '1.24.0' } }); }; diff --git a/packages/bruno-electron/package.json b/packages/bruno-electron/package.json index 57e33b5f0..3fd713d86 100644 --- a/packages/bruno-electron/package.json +++ b/packages/bruno-electron/package.json @@ -1,5 +1,5 @@ { - "version": "v1.23.1", + "version": "v1.24.0", "name": "bruno", "description": "Opensource API Client for Exploring and Testing APIs", "homepage": "https://www.usebruno.com", From 9fdfee0083906c4128e578ffa1d1d872fca61dfe Mon Sep 17 00:00:00 2001 From: lohit Date: Wed, 7 Aug 2024 17:32:27 +0530 Subject: [PATCH 27/49] fix: generate oced modal height style (#2772) --- .../CollectionItem/GenerateCodeItem/CodeView/StyledWrapper.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/CodeView/StyledWrapper.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/CodeView/StyledWrapper.js index 418658f03..ff06f4f31 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/CodeView/StyledWrapper.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/CodeView/StyledWrapper.js @@ -2,6 +2,7 @@ import styled from 'styled-components'; const StyledWrapper = styled.div` position: relative; + height: 100%; .copy-to-clipboard { position: absolute; From edb8708dde91054098f3f0be3b10de09810aec1f Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Thu, 8 Aug 2024 15:48:54 +0530 Subject: [PATCH 28/49] UX - improvements Input Placeholders (#2780) * add placeholders * placeholders for clone collection * placeholders for inputs, placeholder-global-opacity, change cursor type for clickables * revert placeholders for collection creation and collection cloning * revert c-placeholder * revert: cliert cert placeholder --- .../src/components/CollectionSettings/Presets/index.js | 1 + .../Collection/CollectionItem/CloneCollectionItem/index.js | 1 + .../bruno-app/src/components/Sidebar/Collections/index.js | 2 +- .../src/components/Sidebar/ImportCollectionLocation/index.js | 2 +- .../bruno-app/src/components/Sidebar/NewRequest/index.js | 2 ++ packages/bruno-app/src/styles/globals.css | 5 +++++ 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/components/CollectionSettings/Presets/index.js b/packages/bruno-app/src/components/CollectionSettings/Presets/index.js index 734bd90ef..1569a5174 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Presets/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Presets/index.js @@ -74,6 +74,7 @@ const PresetsSettings = ({ collection }) => { id="request-url" type="text" name="requestUrl" + placeholder='Enter Request URL' className="block textbox" autoComplete="off" autoCorrect="off" diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js index 55c2b86dd..0dd96e197 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js @@ -58,6 +58,7 @@ const CloneCollectionItem = ({ collection, item, onClose }) => { id="collection-item-name" type="text" name="name" + placeholder='Enter Item name' ref={inputRef} className="block textbox mt-2 w-full" autoComplete="off" diff --git a/packages/bruno-app/src/components/Sidebar/Collections/index.js b/packages/bruno-app/src/components/Sidebar/Collections/index.js index e5a657ef9..6553be58f 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/index.js @@ -91,13 +91,13 @@ const Collections = () => { setSearchText(e.target.value.toLowerCase())} /> diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js index 4211e8ff1..ff8db4eaa 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js @@ -160,7 +160,7 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName, trans type="text" name="collectionLocation" readOnly={true} - className="block textbox mt-2 w-full" + className="block textbox mt-2 w-full cursor-pointer" autoComplete="off" autoCorrect="off" autoCapitalize="off" diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js index 36d1f2193..5fc1074c7 100644 --- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js @@ -229,6 +229,7 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { id="request-name" type="text" name="requestName" + placeholder="Enter Request Name" ref={inputRef} className="block textbox mt-2 w-full" autoComplete="off" @@ -261,6 +262,7 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { id="request-url" type="text" name="requestUrl" + placeholder="Enter Request URL" className="px-3 w-full " autoComplete="off" autoCorrect="off" diff --git a/packages/bruno-app/src/styles/globals.css b/packages/bruno-app/src/styles/globals.css index 8396c48b5..5ad8e8ef9 100644 --- a/packages/bruno-app/src/styles/globals.css +++ b/packages/bruno-app/src/styles/globals.css @@ -38,6 +38,11 @@ body { overflow-x: hidden; } +input::placeholder { + color: #a2a2a2; + opacity: 50%; +} + body { font-size: 0.875rem; } From 29db85a91606f14320eaebf73d39f98709c94cc2 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Thu, 8 Aug 2024 16:00:56 +0530 Subject: [PATCH 29/49] chore: placeholder ux improvements --- .../src/components/CollectionSettings/Presets/index.js | 2 +- .../bruno-app/src/components/Sidebar/NewRequest/index.js | 4 ++-- packages/bruno-app/src/globalStyles.js | 5 +++++ packages/bruno-app/src/styles/globals.css | 5 ----- packages/bruno-app/src/themes/dark.js | 6 +++++- packages/bruno-app/src/themes/light.js | 6 +++++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/bruno-app/src/components/CollectionSettings/Presets/index.js b/packages/bruno-app/src/components/CollectionSettings/Presets/index.js index 1569a5174..e16884e16 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Presets/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Presets/index.js @@ -74,7 +74,7 @@ const PresetsSettings = ({ collection }) => { id="request-url" type="text" name="requestUrl" - placeholder='Enter Request URL' + placeholder='Request URL' className="block textbox" autoComplete="off" autoCorrect="off" diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js index 5fc1074c7..3cf2214db 100644 --- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js @@ -229,7 +229,7 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { id="request-name" type="text" name="requestName" - placeholder="Enter Request Name" + placeholder="Request Name" ref={inputRef} className="block textbox mt-2 w-full" autoComplete="off" @@ -262,7 +262,7 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { id="request-url" type="text" name="requestUrl" - placeholder="Enter Request URL" + placeholder="Request URL" className="px-3 w-full " autoComplete="off" autoCorrect="off" diff --git a/packages/bruno-app/src/globalStyles.js b/packages/bruno-app/src/globalStyles.js index 25a6d15bc..7839a55ac 100644 --- a/packages/bruno-app/src/globalStyles.js +++ b/packages/bruno-app/src/globalStyles.js @@ -100,6 +100,11 @@ const GlobalStyle = createGlobalStyle` } } + input::placeholder { + color: ${(props) => props.theme.input.placeholder.color}; + opacity: ${(props) => props.theme.input.placeholder.opacity}; + } + @keyframes fade-in { from { opacity: 0; diff --git a/packages/bruno-app/src/styles/globals.css b/packages/bruno-app/src/styles/globals.css index 5ad8e8ef9..8396c48b5 100644 --- a/packages/bruno-app/src/styles/globals.css +++ b/packages/bruno-app/src/styles/globals.css @@ -38,11 +38,6 @@ body { overflow-x: hidden; } -input::placeholder { - color: #a2a2a2; - opacity: 50%; -} - body { font-size: 0.875rem; } diff --git a/packages/bruno-app/src/themes/dark.js b/packages/bruno-app/src/themes/dark.js index bb1001f31..12d61e571 100644 --- a/packages/bruno-app/src/themes/dark.js +++ b/packages/bruno-app/src/themes/dark.js @@ -20,7 +20,11 @@ const darkTheme = { input: { bg: 'rgb(65, 65, 65)', border: 'rgb(65, 65, 65)', - focusBorder: 'rgb(65, 65, 65)' + focusBorder: 'rgb(65, 65, 65)', + placeholder: { + color: '#a2a2a2', + opacity: 0.75 + } }, variables: { diff --git a/packages/bruno-app/src/themes/light.js b/packages/bruno-app/src/themes/light.js index a130f2513..a25583136 100644 --- a/packages/bruno-app/src/themes/light.js +++ b/packages/bruno-app/src/themes/light.js @@ -20,7 +20,11 @@ const lightTheme = { input: { bg: 'white', border: '#ccc', - focusBorder: '#8b8b8b' + focusBorder: '#8b8b8b', + placeholder: { + color: '#a2a2a2', + opacity: 0.8 + } }, menubar: { From 1e0c88a2916236b73017c2df01a6a85c414d7edf Mon Sep 17 00:00:00 2001 From: Timon <39559178+Its-treason@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:34:54 +0200 Subject: [PATCH 30/49] fix: Handle ENOSPC error from chokidar (#2725) * fix: Handle ENOSPC error from chokidar Now listens to the error event to check if "ENOSPC" occurrs. The watcher will then automaticly restart in polling mode, so that the user still sees his reqeusts / collections. Fixes: https://github.com/usebruno/bruno/issues/1877 * Add more code comments, add !forcePolling to prevent endless loops and update error message --- packages/bruno-electron/src/app/watcher.js | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/bruno-electron/src/app/watcher.js b/packages/bruno-electron/src/app/watcher.js index 2fbd4cc98..8a434fa64 100644 --- a/packages/bruno-electron/src/app/watcher.js +++ b/packages/bruno-electron/src/app/watcher.js @@ -428,17 +428,16 @@ class Watcher { this.watchers = {}; } - addWatcher(win, watchPath, collectionUid, brunoConfig) { + addWatcher(win, watchPath, collectionUid, brunoConfig, forcePolling = false) { if (this.watchers[watchPath]) { this.watchers[watchPath].close(); } const ignores = brunoConfig?.ignore || []; - const self = this; setTimeout(() => { const watcher = chokidar.watch(watchPath, { ignoreInitial: false, - usePolling: watchPath.startsWith('\\\\') ? true : false, + usePolling: watchPath.startsWith('\\\\') || forcePolling ? true : false, ignored: (filepath) => { const normalizedPath = filepath.replace(/\\/g, '/'); const relativePath = path.relative(watchPath, normalizedPath); @@ -457,14 +456,35 @@ class Watcher { depth: 20 }); + let startedNewWatcher = false; watcher .on('add', (pathname) => add(win, pathname, collectionUid, watchPath)) .on('addDir', (pathname) => addDirectory(win, pathname, collectionUid, watchPath)) .on('change', (pathname) => change(win, pathname, collectionUid, watchPath)) .on('unlink', (pathname) => unlink(win, pathname, collectionUid, watchPath)) - .on('unlinkDir', (pathname) => unlinkDir(win, pathname, collectionUid, watchPath)); + .on('unlinkDir', (pathname) => unlinkDir(win, pathname, collectionUid, watchPath)) + .on('error', (error) => { + // `ENOSPC` stands for "Error No space" but is also thrown if the file watcher limit is reached. + // To prevent loops `!forcePolling` is checked. + if (error.code === 'ENOSPC' && !startedNewWatcher && !forcePolling) { + // This callback is called for every file the watcher is trying to watch. To prevent a spam of messages and + // Multiple watcher being started `startedNewWatcher` is set to prevent this. + startedNewWatcher = true; + watcher.close(); + console.error( + `\nCould not start watcher for ${watchPath}:`, + 'ENOSPC: System limit for number of file watchers reached!', + 'Trying again with polling, this will be slower!\n', + 'Update you system config to allow more concurrently watched files with:', + '"echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"' + ); + this.addWatcher(win, watchPath, collectionUid, brunoConfig, true); + } else { + console.error(`An error occurred in the watcher for: ${watchPath}`, error); + } + }); - self.watchers[watchPath] = watcher; + this.watchers[watchPath] = watcher; }, 100); } From de226d2e4411e10d354b1b1f5c424c3378efb3ca Mon Sep 17 00:00:00 2001 From: Rinku Chaudhari <76877078+therealrinku@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:28:17 +0545 Subject: [PATCH 31/49] feat: added runner delay (#2218) * feat: added runner delay * fix: check if delay is greater than 0 * fix: input type number and added missing onclick --- .../components/RunnerResults/StyledWrapper.js | 13 +++++++++ .../src/components/RunnerResults/index.jsx | 29 +++++++++++++++---- .../ReduxStore/slices/collections/actions.js | 5 ++-- .../bruno-electron/src/ipc/network/index.js | 14 ++++++++- 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/packages/bruno-app/src/components/RunnerResults/StyledWrapper.js b/packages/bruno-app/src/components/RunnerResults/StyledWrapper.js index 0178b90d7..38dd7511e 100644 --- a/packages/bruno-app/src/components/RunnerResults/StyledWrapper.js +++ b/packages/bruno-app/src/components/RunnerResults/StyledWrapper.js @@ -1,6 +1,19 @@ import styled from 'styled-components'; const Wrapper = styled.div` + .textbox { + border: 1px solid #ccc; + padding: 0.2rem 0.5rem; + box-shadow: none; + border-radius: 0px; + outline: none; + box-shadow: none; + transition: border-color ease-in-out 0.1s; + border-radius: 3px; + background-color: ${(props) => props.theme.modal.input.bg}; + border: 1px solid ${(props) => props.theme.modal.input.border}; + } + .item-path { .link { color: ${(props) => props.theme.textLink}; diff --git a/packages/bruno-app/src/components/RunnerResults/index.jsx b/packages/bruno-app/src/components/RunnerResults/index.jsx index e415aeb3c..4b0b68cba 100644 --- a/packages/bruno-app/src/components/RunnerResults/index.jsx +++ b/packages/bruno-app/src/components/RunnerResults/index.jsx @@ -23,6 +23,7 @@ const getRelativePath = (fullPath, pathname) => { export default function RunnerResults({ collection }) { const dispatch = useDispatch(); const [selectedItem, setSelectedItem] = useState(null); + const [delay, setDelay] = useState(null); // ref for the runner output body const runnerBodyRef = useRef(); @@ -78,11 +79,11 @@ export default function RunnerResults({ collection }) { .filter(Boolean); const runCollection = () => { - dispatch(runCollectionFolder(collection.uid, null, true)); + dispatch(runCollectionFolder(collection.uid, null, true, Number(delay))); }; const runAgain = () => { - dispatch(runCollectionFolder(collection.uid, runnerInfo.folderUid, runnerInfo.isRecursive)); + dispatch(runCollectionFolder(collection.uid, runnerInfo.folderUid, runnerInfo.isRecursive, Number(delay))); }; const resetRunner = () => { @@ -116,6 +117,20 @@ export default function RunnerResults({ collection }) { You have {totalRequestsInCollection} requests in this collection.
+
+ + setDelay(e.target.value)} + /> +
+ @@ -167,10 +182,14 @@ export default function RunnerResults({ collection }) { {item.status !== 'error' && item.status !== 'completed' ? ( - ) : ( + ) : item.responseReceived?.status ? ( setSelectedItem(item)}> - ({get(item.responseReceived, 'status')} - {get(item.responseReceived, 'statusText')}) + ({item.responseReceived?.status} + {item.responseReceived?.statusText}) + + ) : ( + setSelectedItem(item)}> + (request failed) )}
diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index b2ed73a94..089c8cf14 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -281,7 +281,7 @@ export const cancelRunnerExecution = (cancelTokenUid) => (dispatch) => { cancelNetworkRequest(cancelTokenUid).catch((err) => console.log(err)); }; -export const runCollectionFolder = (collectionUid, folderUid, recursive) => (dispatch, getState) => { +export const runCollectionFolder = (collectionUid, folderUid, recursive, delay) => (dispatch, getState) => { const state = getState(); const collection = findCollectionByUid(state.collections.collections, collectionUid); @@ -312,7 +312,8 @@ export const runCollectionFolder = (collectionUid, folderUid, recursive) => (dis collectionCopy, environment, collectionCopy.runtimeVariables, - recursive + recursive, + delay ) .then(resolve) .catch((err) => { diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index 9659f45b4..8a0df70ca 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -825,7 +825,7 @@ const registerNetworkIpc = (mainWindow) => { ipcMain.handle( 'renderer:run-collection-folder', - async (event, folder, collection, environment, runtimeVariables, recursive) => { + async (event, folder, collection, environment, runtimeVariables, recursive, delay) => { const collectionUid = collection.uid; const collectionPath = collection.pathname; const folderUid = folder ? folder.uid : null; @@ -944,6 +944,18 @@ const registerNetworkIpc = (mainWindow) => { timeStart = Date.now(); let response, responseTime; try { + if (delay && !Number.isNaN(delay) && delay > 0) { + const delayPromise = new Promise((resolve) => setTimeout(resolve, delay)); + + const cancellationPromise = new Promise((_, reject) => { + abortController.signal.addEventListener('abort', () => { + reject(new Error('Cancelled')); + }); + }); + + await Promise.race([delayPromise, cancellationPromise]); + } + /** @type {import('axios').AxiosResponse} */ response = await axiosInstance(request); timeEnd = Date.now(); From 4c3fe2f7195d235e152e9b885329238859227228 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 8 Aug 2024 13:58:17 +0200 Subject: [PATCH 32/49] Add TRACE to allowed import methods (#2783) --- packages/bruno-schema/src/collections/index.js | 2 +- packages/bruno-schema/src/collections/requestSchema.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bruno-schema/src/collections/index.js b/packages/bruno-schema/src/collections/index.js index d72b9c6ef..eeb4e83d6 100644 --- a/packages/bruno-schema/src/collections/index.js +++ b/packages/bruno-schema/src/collections/index.js @@ -48,7 +48,7 @@ const varsSchema = Yup.object({ const requestUrlSchema = Yup.string().min(0).defined(); const requestMethodSchema = Yup.string() - .oneOf(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']) + .oneOf(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'TRACE']) .required('method is required'); const graphqlBodySchema = Yup.object({ diff --git a/packages/bruno-schema/src/collections/requestSchema.spec.js b/packages/bruno-schema/src/collections/requestSchema.spec.js index 87399c690..9fd223cb2 100644 --- a/packages/bruno-schema/src/collections/requestSchema.spec.js +++ b/packages/bruno-schema/src/collections/requestSchema.spec.js @@ -32,7 +32,7 @@ describe('Request Schema Validation', () => { return Promise.all([ expect(requestSchema.validate(request)).rejects.toEqual( validationErrorWithMessages( - 'method must be one of the following values: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS' + 'method must be one of the following values: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE' ) ) ]); From 7e305be817b5c7db24fc590c9eb2a567c6b27e22 Mon Sep 17 00:00:00 2001 From: Sushant Kumar <132103049+iamsushantk@users.noreply.github.com> Date: Thu, 8 Aug 2024 23:09:29 +1000 Subject: [PATCH 33/49] (feat) Add shade to modal header in dark mode (#2784) --- packages/bruno-app/src/themes/dark.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bruno-app/src/themes/dark.js b/packages/bruno-app/src/themes/dark.js index 12d61e571..9e8e923aa 100644 --- a/packages/bruno-app/src/themes/dark.js +++ b/packages/bruno-app/src/themes/dark.js @@ -158,7 +158,7 @@ const darkTheme = { modal: { title: { color: '#ccc', - bg: 'rgb(48, 48, 49)', + bg: 'rgb(38, 38, 39)', iconColor: '#ccc' }, body: { From 0d3e7acf9b79a19f4f43331347e53a9fc608431f Mon Sep 17 00:00:00 2001 From: Rinku Chaudhari <76877078+therealrinku@users.noreply.github.com> Date: Sun, 11 Aug 2024 19:39:51 +0545 Subject: [PATCH 34/49] fix: query url overflowing (#2804) * fix: query url overflowing * fix: add margin to save btn instead of singlelineeditor --- packages/bruno-app/src/components/RequestPane/QueryUrl/index.js | 2 +- packages/bruno-app/src/components/SingleLineEditor/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js index 03b60d1d7..0c2707ac8 100644 --- a/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js +++ b/packages/bruno-app/src/components/RequestPane/QueryUrl/index.js @@ -74,7 +74,7 @@ const QueryUrl = ({ item, collection, handleRun }) => { />
{ e.stopPropagation(); if (!item.draft) return; diff --git a/packages/bruno-app/src/components/SingleLineEditor/index.js b/packages/bruno-app/src/components/SingleLineEditor/index.js index 8bbd1fd0e..31d0875fd 100644 --- a/packages/bruno-app/src/components/SingleLineEditor/index.js +++ b/packages/bruno-app/src/components/SingleLineEditor/index.js @@ -174,7 +174,7 @@ class SingleLineEditor extends Component { render() { return ( -
+
{this.secretEye(this.props.isSecret)}
From 5706c4b13892da03b7db0d3ea1af93d46407659d Mon Sep 17 00:00:00 2001 From: Sanjai Kumar <84461672+sanjai0py@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:20:56 +0530 Subject: [PATCH 35/49] Added the ablility to save the response in utf8 format. (#2792) --- packages/bruno-electron/src/ipc/network/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/bruno-electron/src/ipc/network/index.js b/packages/bruno-electron/src/ipc/network/index.js index 8a0df70ca..3aa819c4c 100644 --- a/packages/bruno-electron/src/ipc/network/index.js +++ b/packages/bruno-electron/src/ipc/network/index.js @@ -1165,12 +1165,22 @@ const registerNetworkIpc = (mainWindow) => { return `response.${extension}`; }; - const fileName = - getFileNameFromContentDispositionHeader() || getFileNameFromUrlPath() || getFileNameBasedOnContentTypeHeader(); + const getEncodingFormat = () => { + const contentType = getHeaderValue('content-type'); + const extension = mime.extension(contentType) || 'txt'; + return ['json', 'xml', 'html', 'yml', 'yaml', 'txt'].includes(extension) ? 'utf-8' : 'base64'; + }; + const determineFileName = () => { + return ( + getFileNameFromContentDispositionHeader() || getFileNameFromUrlPath() || getFileNameBasedOnContentTypeHeader() + ); + }; + + const fileName = determineFileName(); const filePath = await chooseFileToSave(mainWindow, fileName); if (filePath) { - await writeBinaryFile(filePath, Buffer.from(response.dataBuffer, 'base64')); + await writeBinaryFile(filePath, Buffer.from(response.dataBuffer, getEncodingFormat())); } } catch (error) { return Promise.reject(error); From b23a866e606a52153b77ca0ad1e8bac851cff208 Mon Sep 17 00:00:00 2001 From: Sanjai Kumar <84461672+sanjai0py@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:21:51 +0530 Subject: [PATCH 36/49] Removed the logic that strips the backslash (#2793) --- packages/bruno-app/src/utils/curl/curl-to-json.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/bruno-app/src/utils/curl/curl-to-json.js b/packages/bruno-app/src/utils/curl/curl-to-json.js index 82eb0be95..74bec3def 100644 --- a/packages/bruno-app/src/utils/curl/curl-to-json.js +++ b/packages/bruno-app/src/utils/curl/curl-to-json.js @@ -123,8 +123,7 @@ const curlToJson = (curlCommand) => { request.urlWithoutQuery = 'http://' + request.urlWithoutQuery; } - requestJson.url = request.urlWithoutQuery.replace(/\/$/, ''); - requestJson.raw_url = request.url; + requestJson.url = request.urlWithoutQuery requestJson.method = request.method; if (request.cookies) { From 85ad4c0159ab8c6b2059dd2e7d4fbdedc86b326e Mon Sep 17 00:00:00 2001 From: Sam Wooler Date: Wed, 14 Aug 2024 05:54:17 +0100 Subject: [PATCH 37/49] fix: align folder settings pane + scripts with request pane (#2817) --- .../src/components/FolderSettings/Script/index.js | 8 ++++---- packages/bruno-app/src/components/FolderSettings/index.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/bruno-app/src/components/FolderSettings/Script/index.js b/packages/bruno-app/src/components/FolderSettings/Script/index.js index 6c51c062d..6155e1337 100644 --- a/packages/bruno-app/src/components/FolderSettings/Script/index.js +++ b/packages/bruno-app/src/components/FolderSettings/Script/index.js @@ -44,8 +44,8 @@ const Script = ({ collection, folder }) => {
Pre and post-request scripts that will run before and after any request inside this folder is sent.
-
-
Pre Request
+
+
Pre Request
{ font={get(preferences, 'font.codeFont', 'default')} />
-
-
Post Response
+
+
Post Response
{ }; return ( - +
setTab('headers')}> From 22c096507d4f82024b4beaaa2f6a7a6a19e26d91 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Wed, 14 Aug 2024 10:36:32 +0530 Subject: [PATCH 38/49] chore: bumped version --- packages/bruno-app/src/components/Sidebar/index.js | 2 +- packages/bruno-app/src/providers/App/useTelemetry.js | 2 +- packages/bruno-electron/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/index.js b/packages/bruno-app/src/components/Sidebar/index.js index 59b7a8fe9..a23425c43 100644 --- a/packages/bruno-app/src/components/Sidebar/index.js +++ b/packages/bruno-app/src/components/Sidebar/index.js @@ -129,7 +129,7 @@ const Sidebar = () => { Star */}
-
v1.24.0
+
v1.25.0
diff --git a/packages/bruno-app/src/providers/App/useTelemetry.js b/packages/bruno-app/src/providers/App/useTelemetry.js index 7cd73e8f7..bd5551c91 100644 --- a/packages/bruno-app/src/providers/App/useTelemetry.js +++ b/packages/bruno-app/src/providers/App/useTelemetry.js @@ -60,7 +60,7 @@ const trackStart = () => { event: 'start', properties: { os: platformLib.os.family, - version: '1.24.0' + version: '1.25.0' } }); }; diff --git a/packages/bruno-electron/package.json b/packages/bruno-electron/package.json index 3fd713d86..6c70fe66e 100644 --- a/packages/bruno-electron/package.json +++ b/packages/bruno-electron/package.json @@ -1,5 +1,5 @@ { - "version": "v1.24.0", + "version": "v1.25.0", "name": "bruno", "description": "Opensource API Client for Exploring and Testing APIs", "homepage": "https://www.usebruno.com", From eceb114d6c2c54a4f42c0eb0e02c73415b421d77 Mon Sep 17 00:00:00 2001 From: lohit Date: Wed, 14 Aug 2024 13:23:00 +0530 Subject: [PATCH 39/49] fix/collection-search-validations unit-tests-fix (#2833) * fix: updates * fix: update test title * fix: removed console --- .../bruno-app/src/utils/collections/search.js | 2 +- packages/bruno-app/src/utils/curl/curl-to-json.js | 3 ++- .../bruno-app/src/utils/curl/curl-to-json.spec.js | 11 +++++++++++ packages/bruno-app/src/utils/curl/parse-curl.js | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/packages/bruno-app/src/utils/collections/search.js b/packages/bruno-app/src/utils/collections/search.js index b420687b7..9c2f187e5 100644 --- a/packages/bruno-app/src/utils/collections/search.js +++ b/packages/bruno-app/src/utils/collections/search.js @@ -3,7 +3,7 @@ import filter from 'lodash/filter'; import find from 'lodash/find'; export const doesRequestMatchSearchText = (request, searchText = '') => { - return request.name.toLowerCase().includes(searchText.toLowerCase()); + return request?.name?.toLowerCase().includes(searchText.toLowerCase()); }; export const doesFolderHaveItemsMatchSearchText = (item, searchText = '') => { diff --git a/packages/bruno-app/src/utils/curl/curl-to-json.js b/packages/bruno-app/src/utils/curl/curl-to-json.js index 74bec3def..97d97cfeb 100644 --- a/packages/bruno-app/src/utils/curl/curl-to-json.js +++ b/packages/bruno-app/src/utils/curl/curl-to-json.js @@ -123,7 +123,8 @@ const curlToJson = (curlCommand) => { request.urlWithoutQuery = 'http://' + request.urlWithoutQuery; } - requestJson.url = request.urlWithoutQuery + requestJson.url = request.urlWithoutQuery; + requestJson.raw_url = request.url; requestJson.method = request.method; if (request.cookies) { diff --git a/packages/bruno-app/src/utils/curl/curl-to-json.spec.js b/packages/bruno-app/src/utils/curl/curl-to-json.spec.js index 2704bd4c5..2d9785154 100644 --- a/packages/bruno-app/src/utils/curl/curl-to-json.spec.js +++ b/packages/bruno-app/src/utils/curl/curl-to-json.spec.js @@ -75,4 +75,15 @@ describe('curlToJson', () => { } }); }); + + it('should return and parse a simple curl command with a trailing slash', () => { + const curlCommand = 'curl https://www.usebruno.com/'; + const result = curlToJson(curlCommand); + + expect(result).toEqual({ + url: 'https://www.usebruno.com/', + raw_url: 'https://www.usebruno.com/', + method: 'get' + }); + }); }); diff --git a/packages/bruno-app/src/utils/curl/parse-curl.js b/packages/bruno-app/src/utils/curl/parse-curl.js index 30db1a868..71c925ca7 100644 --- a/packages/bruno-app/src/utils/curl/parse-curl.js +++ b/packages/bruno-app/src/utils/curl/parse-curl.js @@ -187,10 +187,21 @@ const parseCurlCommand = (curlCommand) => { } urlObject.search = null; // Clean out the search/query portion. + + let urlWithoutQuery = URL.format(urlObject); + let urlHost = urlObject?.host; + if (!url?.includes(`${urlHost}/`)) { + if (urlWithoutQuery && urlHost) { + const [beforeHost, afterHost] = urlWithoutQuery.split(urlHost); + urlWithoutQuery = beforeHost + urlHost + afterHost?.slice(1); + } + } + const request = { - url: url, - urlWithoutQuery: URL.format(urlObject) + url, + urlWithoutQuery }; + if (compressed) { request.compressed = true; } From 9d84906f570212867e43be2d2d5295531c3ef7f0 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Wed, 14 Aug 2024 04:48:24 -0500 Subject: [PATCH 40/49] add ability for curl to import basic auth (#2778) --- .../components/Sidebar/NewRequest/index.js | 3 ++- .../ReduxStore/slices/collections/actions.js | 5 ++++- .../bruno-app/src/utils/curl/curl-to-json.js | 17 ++++++++-------- packages/bruno-app/src/utils/curl/index.js | 3 ++- .../bruno-app/src/utils/curl/parse-curl.js | 20 +++++++++++++------ 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js index 3cf2214db..50e7be277 100644 --- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js @@ -109,7 +109,8 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => { collectionUid: collection.uid, itemUid: item ? item.uid : null, headers: request.headers, - body: request.body + body: request.body, + auth: request.auth }) ) .then(() => onClose()) diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index 089c8cf14..e6597b8e7 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -698,7 +698,7 @@ export const moveItemToRootOfCollection = (collectionUid, draggedItemUid) => (di }; export const newHttpRequest = (params) => (dispatch, getState) => { - const { requestName, requestType, requestUrl, requestMethod, collectionUid, itemUid, headers, body } = params; + const { requestName, requestType, requestUrl, requestMethod, collectionUid, itemUid, headers, body, auth } = params; return new Promise((resolve, reject) => { const state = getState(); @@ -730,6 +730,9 @@ export const newHttpRequest = (params) => (dispatch, getState) => { sparql: null, multipartForm: null, formUrlEncoded: null + }, + auth: auth ?? { + mode: 'none' } } }; diff --git a/packages/bruno-app/src/utils/curl/curl-to-json.js b/packages/bruno-app/src/utils/curl/curl-to-json.js index 97d97cfeb..e76f4014a 100644 --- a/packages/bruno-app/src/utils/curl/curl-to-json.js +++ b/packages/bruno-app/src/utils/curl/curl-to-json.js @@ -160,14 +160,15 @@ const curlToJson = (curlCommand) => { } if (request.auth) { - const splitAuth = request.auth.split(':'); - const user = splitAuth[0] || ''; - const password = splitAuth[1] || ''; - - requestJson.auth = { - user: repr(user), - password: repr(password) - }; + if(request.auth.mode === 'basic'){ + requestJson.auth = { + mode: 'basic', + basic: { + username: repr(request.auth.basic?.username), + password: repr(request.auth.basic?.password) + } + } + } } return Object.keys(requestJson).length ? requestJson : {}; diff --git a/packages/bruno-app/src/utils/curl/index.js b/packages/bruno-app/src/utils/curl/index.js index 97bfbd966..e16dc68a5 100644 --- a/packages/bruno-app/src/utils/curl/index.js +++ b/packages/bruno-app/src/utils/curl/index.js @@ -56,7 +56,8 @@ export const getRequestFromCurlCommand = (curlCommand) => { url: request.url, method: request.method, body, - headers: headers + headers: headers, + auth: request.auth }; } catch (error) { console.error(error); diff --git a/packages/bruno-app/src/utils/curl/parse-curl.js b/packages/bruno-app/src/utils/curl/parse-curl.js index 71c925ca7..79db23672 100644 --- a/packages/bruno-app/src/utils/curl/parse-curl.js +++ b/packages/bruno-app/src/utils/curl/parse-curl.js @@ -36,7 +36,8 @@ const parseCurlCommand = (curlCommand) => { boolean: ['I', 'head', 'compressed', 'L', 'k', 'silent', 's', 'G', 'get'], alias: { H: 'header', - A: 'user-agent' + A: 'user-agent', + u: 'user' } }); @@ -237,12 +238,19 @@ const parseCurlCommand = (curlCommand) => { request.data = parsedArguments['data-urlencode']; } - if (parsedArguments.u) { - request.auth = parsedArguments.u; - } - if (parsedArguments.user) { - request.auth = parsedArguments.user; + if (parsedArguments.user && typeof parsedArguments.user === 'string') { + const basicAuth = parsedArguments.user.split(':') + const username = basicAuth[0] || '' + const password = basicAuth[1] || '' + request.auth = { + mode: 'basic', + basic: { + username, + password + } + } } + if (Array.isArray(request.data)) { request.dataArray = request.data; request.data = request.data.join('&'); From 8de6b72ab96871f4eaa02dd564b73fd114efab15 Mon Sep 17 00:00:00 2001 From: Timon <39559178+Its-treason@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:50:17 +0200 Subject: [PATCH 41/49] Fix/enospc (#2789) * fix: Handle ENOSPC error from chokidar Now listens to the error event to check if "ENOSPC" occurrs. The watcher will then automaticly restart in polling mode, so that the user still sees his reqeusts / collections. Fixes: https://github.com/usebruno/bruno/issues/1877 * Add more code comments, add !forcePolling to prevent endless loops and update error message * fix: Also listen for EMFILE for too many watched files --- packages/bruno-electron/src/app/watcher.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bruno-electron/src/app/watcher.js b/packages/bruno-electron/src/app/watcher.js index 8a434fa64..589cd29d8 100644 --- a/packages/bruno-electron/src/app/watcher.js +++ b/packages/bruno-electron/src/app/watcher.js @@ -464,9 +464,10 @@ class Watcher { .on('unlink', (pathname) => unlink(win, pathname, collectionUid, watchPath)) .on('unlinkDir', (pathname) => unlinkDir(win, pathname, collectionUid, watchPath)) .on('error', (error) => { + // `EMFILE` is an error code thrown when to many files are watched at the same time see: https://github.com/usebruno/bruno/issues/627 // `ENOSPC` stands for "Error No space" but is also thrown if the file watcher limit is reached. // To prevent loops `!forcePolling` is checked. - if (error.code === 'ENOSPC' && !startedNewWatcher && !forcePolling) { + if ((error.code === 'ENOSPC' || error.code === 'EMFILE') && !startedNewWatcher && !forcePolling) { // This callback is called for every file the watcher is trying to watch. To prevent a spam of messages and // Multiple watcher being started `startedNewWatcher` is set to prevent this. startedNewWatcher = true; From 1bedfc20461d50904d6f4d7addbe43218a750372 Mon Sep 17 00:00:00 2001 From: Rinku Chaudhari <76877078+therealrinku@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:55:44 +0545 Subject: [PATCH 42/49] feat: added request tab context menu (#2183) * feat: added close menus on the request tab * feat: added close to the left button * feat: added new request and clone request buttons * chore: fix prettier --- .../src/components/Dropdown/StyledWrapper.js | 7 +- .../RequestTabs/RequestTab/index.js | 153 +++++++++++++++++- .../components/RequestTabs/StyledWrapper.js | 1 - .../src/components/RequestTabs/index.js | 9 +- 4 files changed, 165 insertions(+), 5 deletions(-) diff --git a/packages/bruno-app/src/components/Dropdown/StyledWrapper.js b/packages/bruno-app/src/components/Dropdown/StyledWrapper.js index 6ad94e289..7af8b9081 100644 --- a/packages/bruno-app/src/components/Dropdown/StyledWrapper.js +++ b/packages/bruno-app/src/components/Dropdown/StyledWrapper.js @@ -40,10 +40,15 @@ const Wrapper = styled.div` color: ${(props) => props.theme.dropdown.iconColor}; } - &:hover { + &:hover:not(:disabled) { background-color: ${(props) => props.theme.dropdown.hoverBg}; } + &:disabled { + cursor: not-allowed; + color: gray; + } + &.border-top { border-top: solid 1px ${(props) => props.theme.dropdown.separator}; } diff --git a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js index 680782169..8b9bb0c35 100644 --- a/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js +++ b/packages/bruno-app/src/components/RequestTabs/RequestTab/index.js @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useRef, Fragment } from 'react'; import get from 'lodash/get'; import { closeTabs } from 'providers/ReduxStore/slices/tabs'; import { saveRequest } from 'providers/ReduxStore/slices/collections/actions'; @@ -12,12 +12,18 @@ import ConfirmRequestClose from './ConfirmRequestClose'; import RequestTabNotFound from './RequestTabNotFound'; import SpecialTab from './SpecialTab'; import StyledWrapper from './StyledWrapper'; +import Dropdown from 'components/Dropdown'; +import CloneCollectionItem from 'components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index'; +import NewRequest from 'components/Sidebar/NewRequest/index'; -const RequestTab = ({ tab, collection, folderUid }) => { +const RequestTab = ({ tab, collection, tabIndex, collectionRequestTabs, folderUid }) => { const dispatch = useDispatch(); const { storedTheme } = useTheme(); const [showConfirmClose, setShowConfirmClose] = useState(false); + const dropdownTippyRef = useRef(); + const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref); + const handleCloseClick = (event) => { event.stopPropagation(); event.preventDefault(); @@ -28,6 +34,19 @@ const RequestTab = ({ tab, collection, folderUid }) => { ); }; + const handleRightClick = (_event) => { + const menuDropdown = dropdownTippyRef.current; + if (!menuDropdown) { + return; + } + + if (menuDropdown.state.isShown) { + menuDropdown.hide(); + } else { + menuDropdown.show(); + } + }; + const handleMouseUp = (e) => { if (e.button === 1) { e.stopPropagation(); @@ -143,6 +162,7 @@ const RequestTab = ({ tab, collection, folderUid }) => { )}
{ if (!item.draft) return handleMouseUp(e); @@ -159,6 +179,15 @@ const RequestTab = ({ tab, collection, folderUid }) => { {item.name} +
{ ); }; +function RequestTabMenu({ onDropdownCreate, collectionRequestTabs, tabIndex, collection, dropdownTippyRef, dispatch }) { + const [showCloneRequestModal, setShowCloneRequestModal] = useState(false); + const [showAddNewRequestModal, setShowAddNewRequestModal] = useState(false); + + const totalTabs = collectionRequestTabs.length || 0; + const currentTabUid = collectionRequestTabs[tabIndex]?.uid; + const currentTabItem = findItemInCollection(collection, currentTabUid); + + const hasLeftTabs = tabIndex !== 0; + const hasRightTabs = totalTabs > tabIndex + 1; + const hasOtherTabs = totalTabs > 1; + + async function handleCloseTab(event, tabUid) { + event.stopPropagation(); + dropdownTippyRef.current.hide(); + + if (!tabUid) { + return; + } + + try { + const item = findItemInCollection(collection, tabUid); + // silently save unsaved changes before closing the tab + if (item.draft) { + await dispatch(saveRequest(item.uid, collection.uid, true)); + } + + dispatch(closeTabs({ tabUids: [tabUid] })); + } catch (err) {} + } + + function handleCloseOtherTabs(event) { + dropdownTippyRef.current.hide(); + + const otherTabs = collectionRequestTabs.filter((_, index) => index !== tabIndex); + otherTabs.forEach((tab) => handleCloseTab(event, tab.uid)); + } + + function handleCloseTabsToTheLeft(event) { + dropdownTippyRef.current.hide(); + + const leftTabs = collectionRequestTabs.filter((_, index) => index < tabIndex); + leftTabs.forEach((tab) => handleCloseTab(event, tab.uid)); + } + + function handleCloseTabsToTheRight(event) { + dropdownTippyRef.current.hide(); + + const rightTabs = collectionRequestTabs.filter((_, index) => index > tabIndex); + rightTabs.forEach((tab) => handleCloseTab(event, tab.uid)); + } + + function handleCloseSavedTabs(event) { + event.stopPropagation(); + + const savedTabs = collection.items.filter((item) => !item.draft); + const savedTabIds = savedTabs.map((item) => item.uid) || []; + dispatch(closeTabs({ tabUids: savedTabIds })); + } + + function handleCloseAllTabs(event) { + collectionRequestTabs.forEach((tab) => handleCloseTab(event, tab.uid)); + } + + return ( + + {showAddNewRequestModal && ( + setShowAddNewRequestModal(false)} /> + )} + + {showCloneRequestModal && ( + setShowCloneRequestModal(false)} + /> + )} + + } placement="bottom-start"> + + + + + + + + + + + ); +} + export default RequestTab; diff --git a/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js b/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js index 26399d975..93829cca9 100644 --- a/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestTabs/StyledWrapper.js @@ -7,7 +7,6 @@ const Wrapper = styled.div` padding: 0; margin: 0; display: flex; - position: relative; overflow: scroll; &::-webkit-scrollbar { diff --git a/packages/bruno-app/src/components/RequestTabs/index.js b/packages/bruno-app/src/components/RequestTabs/index.js index fbafb55cf..d0cd0b459 100644 --- a/packages/bruno-app/src/components/RequestTabs/index.js +++ b/packages/bruno-app/src/components/RequestTabs/index.js @@ -110,7 +110,14 @@ const RequestTabs = () => { role="tab" onClick={() => handleClick(tab)} > - + ); }) From 3b8909e301a4ad24db134c8cb1b5bd47561514ff Mon Sep 17 00:00:00 2001 From: Daniel Roberto Date: Wed, 14 Aug 2024 07:13:32 -0300 Subject: [PATCH 43/49] feat: add hotkey to close all tabs (#2800) --- .../bruno-app/src/providers/Hotkeys/index.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/bruno-app/src/providers/Hotkeys/index.js b/packages/bruno-app/src/providers/Hotkeys/index.js index 8b0503b1c..53a0fc263 100644 --- a/packages/bruno-app/src/providers/Hotkeys/index.js +++ b/packages/bruno-app/src/providers/Hotkeys/index.js @@ -154,6 +154,31 @@ export const HotkeysProvider = (props) => { }; }, [activeTabUid]); + // close all tabs + useEffect(() => { + Mousetrap.bind(['command+shift+w', 'ctrl+shift+w'], (e) => { + const activeTab = find(tabs, (t) => t.uid === activeTabUid); + if (activeTab) { + const collection = findCollectionByUid(collections, activeTab.collectionUid); + + if (collection) { + const tabUids = tabs.filter((tab) => tab.collectionUid === collection.uid).map((tab) => tab.uid); + dispatch( + closeTabs({ + tabUids: tabUids + }) + ); + } + } + + return false; // this stops the event bubbling + }); + + return () => { + Mousetrap.unbind(['command+shift+w', 'ctrl+shift+w']); + }; + }, [activeTabUid, tabs, collections, dispatch]); + return ( {showSaveRequestModal && ( From 74b1527513e3db78ee1a08326298aaf91e24de22 Mon Sep 17 00:00:00 2001 From: Sushant Kumar <132103049+iamsushantk@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:23:04 +1000 Subject: [PATCH 44/49] feat: Add support for dictionary and use in Welcome page (#2819) --- .../bruno-app/src/components/Welcome/index.js | 25 +++++++++-------- packages/bruno-app/src/dictionaries/en.js | 14 ++++++++++ packages/bruno-app/src/dictionaries/index.js | 5 ++++ packages/bruno-app/src/pages/_app.js | 17 ++++++----- .../src/providers/Dictionary/index.js | 28 +++++++++++++++++++ 5 files changed, 70 insertions(+), 19 deletions(-) create mode 100644 packages/bruno-app/src/dictionaries/en.js create mode 100644 packages/bruno-app/src/dictionaries/index.js create mode 100644 packages/bruno-app/src/providers/Dictionary/index.js diff --git a/packages/bruno-app/src/components/Welcome/index.js b/packages/bruno-app/src/components/Welcome/index.js index 385a71486..54f7b5378 100644 --- a/packages/bruno-app/src/components/Welcome/index.js +++ b/packages/bruno-app/src/components/Welcome/index.js @@ -9,9 +9,11 @@ import CreateCollection from 'components/Sidebar/CreateCollection'; import ImportCollection from 'components/Sidebar/ImportCollection'; import ImportCollectionLocation from 'components/Sidebar/ImportCollectionLocation'; import StyledWrapper from './StyledWrapper'; +import { useDictionary } from 'providers/Dictionary/index'; const Welcome = () => { const dispatch = useDispatch(); + const { dictionary } = useDictionary(); const [importedCollection, setImportedCollection] = useState(null); const [importedTranslationLog, setImportedTranslationLog] = useState({}); const [createCollectionModalOpen, setCreateCollectionModalOpen] = useState(false); @@ -20,7 +22,7 @@ const Welcome = () => { const handleOpenCollection = () => { dispatch(openCollection()).catch( - (err) => console.log(err) && toast.error('An error occurred while opening the collection') + (err) => console.log(err) && toast.error(dictionary.errorWhileOpeningCollection) ); }; @@ -38,12 +40,12 @@ const Welcome = () => { .then(() => { setImportCollectionLocationModalOpen(false); setImportedCollection(null); - toast.success('Collection imported successfully'); + toast.success(dictionary.collectionImportedSuccessfully); }) .catch((err) => { setImportCollectionLocationModalOpen(false); console.error(err); - toast.error('An error occurred while importing the collection. Check the logs for more information.'); + toast.error(dictionary.errorWhileImportingCollection); }); }; @@ -66,46 +68,45 @@ const Welcome = () => {
bruno
-
Opensource IDE for exploring and testing APIs
+
{dictionary.aboutBruno}
-
Collections
+
{dictionary.collections}
setCreateCollectionModalOpen(true)}> - Create Collection + {dictionary.createCollection}
- Open Collection + {dictionary.openCollection}
setImportCollectionModalOpen(true)}> - Import Collection + {dictionary.importCollection}
-
Links
diff --git a/packages/bruno-app/src/dictionaries/en.js b/packages/bruno-app/src/dictionaries/en.js new file mode 100644 index 000000000..c1da5b9ac --- /dev/null +++ b/packages/bruno-app/src/dictionaries/en.js @@ -0,0 +1,14 @@ +export default { + aboutBruno: 'Opensource IDE for exploring and testing APIs', + collections: 'Collections', + createCollection: 'Create Collection', + openCollection: 'Open Collection', + importCollection: 'Import Collection', + documentation: 'Documentation', + reportIssues: 'Report Issues', + gitHub: 'GitHub', + collectionImportedSuccessfully: 'Collection imported successfully', + errorWhileOpeningCollection: 'An error occurred while opening the collection', + errorWhileImportingCollection: + 'An error occurred while importing the collection. Check the logs for more information.' +}; diff --git a/packages/bruno-app/src/dictionaries/index.js b/packages/bruno-app/src/dictionaries/index.js new file mode 100644 index 000000000..fb5f797dc --- /dev/null +++ b/packages/bruno-app/src/dictionaries/index.js @@ -0,0 +1,5 @@ +import en from './en.js'; + +export const dictionaries = { + en +}; diff --git a/packages/bruno-app/src/pages/_app.js b/packages/bruno-app/src/pages/_app.js index cf8b3683e..d2bf8a28d 100644 --- a/packages/bruno-app/src/pages/_app.js +++ b/packages/bruno-app/src/pages/_app.js @@ -14,6 +14,7 @@ import 'codemirror/lib/codemirror.css'; import 'graphiql/graphiql.min.css'; import 'react-tooltip/dist/react-tooltip.css'; import '@usebruno/graphql-docs/dist/esm/index.css'; +import { DictionaryProvider } from 'providers/Dictionary/index'; function SafeHydrate({ children }) { return
{typeof window === 'undefined' ? null : children}
; @@ -59,13 +60,15 @@ function MyApp({ Component, pageProps }) { - - - - - - - + + + + + + + + + diff --git a/packages/bruno-app/src/providers/Dictionary/index.js b/packages/bruno-app/src/providers/Dictionary/index.js new file mode 100644 index 000000000..75a399f27 --- /dev/null +++ b/packages/bruno-app/src/providers/Dictionary/index.js @@ -0,0 +1,28 @@ +import React from 'react'; +import { useState, useContext } from 'react'; +import { dictionaries } from 'src/dictionaries/index'; + +export const DictionaryContext = React.createContext(); + +const DictionaryProvider = (props) => { + const [language, setLanguage] = useState('en'); + const dictionary = dictionaries[language] ?? dictionaries.en; + + return ( + + <>{props.children} + + ); +}; + +const useDictionary = () => { + const context = useContext(DictionaryContext); + + if (context === undefined) { + throw new Error(`useDictionary must be used within a DictionaryProvider`); + } + + return context; +}; + +export { useDictionary, DictionaryProvider }; From 4169bb7ea4b3ddd0203140f59c1e9cd0c6de5612 Mon Sep 17 00:00:00 2001 From: Chae Jeong Ah Date: Fri, 16 Aug 2024 19:16:38 +0900 Subject: [PATCH 45/49] fix: add path params on newHttpRequest (#2843) --- .../ReduxStore/slices/collections/actions.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index e6597b8e7..5cb8c7603 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -39,7 +39,7 @@ import { import { each } from 'lodash'; import { closeAllCollectionTabs } from 'providers/ReduxStore/slices/tabs'; import { resolveRequestFilename } from 'utils/common/platform'; -import { parseQueryParams, splitOnFirst } from 'utils/url/index'; +import { parsePathParams, parseQueryParams, splitOnFirst } from 'utils/url/index'; import { sendCollectionOauth2Request as _sendCollectionOauth2Request } from 'utils/network/index'; import { name } from 'file-loader'; @@ -708,11 +708,20 @@ export const newHttpRequest = (params) => (dispatch, getState) => { } const parts = splitOnFirst(requestUrl, '?'); - const params = parseQueryParams(parts[1]); - each(params, (urlParam) => { + const queryParams = parseQueryParams(parts[1]); + each(queryParams, (urlParam) => { urlParam.enabled = true; + urlParam.type = 'query'; }); + const pathParams = parsePathParams(requestUrl); + each(pathParams, (pathParm) => { + pathParams.enabled = true; + pathParm.type = 'path' + }); + + const params = [...queryParams, ...pathParams]; + const item = { uid: uuid(), type: requestType, From f0b7bf343022dd93094098f12602b08a6bec1f4d Mon Sep 17 00:00:00 2001 From: Sushant Kumar <132103049+iamsushantk@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:19:27 +1000 Subject: [PATCH 46/49] feat: Reuse dictionary in preferences support page (#2834) * feat: Re-use dictonary text in Preferences/Support component * feat: Re-use dictionary text in Preferences/Support component --- .../src/components/Preferences/Support/index.js | 13 ++++++++----- packages/bruno-app/src/dictionaries/en.js | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/bruno-app/src/components/Preferences/Support/index.js b/packages/bruno-app/src/components/Preferences/Support/index.js index dfd6fabed..5e1b0dacc 100644 --- a/packages/bruno-app/src/components/Preferences/Support/index.js +++ b/packages/bruno-app/src/components/Preferences/Support/index.js @@ -1,39 +1,42 @@ import React from 'react'; import { IconSpeakerphone, IconBrandTwitter, IconBrandGithub, IconBrandDiscord, IconBook } from '@tabler/icons'; import StyledWrapper from './StyledWrapper'; +import { useDictionary } from 'providers/Dictionary/index'; const Support = () => { + const { dictionary } = useDictionary(); + return ( diff --git a/packages/bruno-app/src/dictionaries/en.js b/packages/bruno-app/src/dictionaries/en.js index c1da5b9ac..a9ff316cd 100644 --- a/packages/bruno-app/src/dictionaries/en.js +++ b/packages/bruno-app/src/dictionaries/en.js @@ -10,5 +10,7 @@ export default { collectionImportedSuccessfully: 'Collection imported successfully', errorWhileOpeningCollection: 'An error occurred while opening the collection', errorWhileImportingCollection: - 'An error occurred while importing the collection. Check the logs for more information.' + 'An error occurred while importing the collection. Check the logs for more information.', + discord: 'Discord', + twitter: 'Twitter' }; From b872fdfe6de74f0ec41a73399bc6f1f216c181a6 Mon Sep 17 00:00:00 2001 From: Pragadesh-45 <54320162+Pragadesh-45@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:49:00 +0530 Subject: [PATCH 47/49] Bugfix- Import blank directory Exception (#2845) * typofix: Loc is required * handle empty dirpath on import collection * fix: collection import bug fix --------- Co-authored-by: Anoop M D --- .../components/Sidebar/ImportCollectionLocation/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js index ff8db4eaa..7dd827298 100644 --- a/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js +++ b/packages/bruno-app/src/components/Sidebar/ImportCollectionLocation/index.js @@ -115,7 +115,7 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName, trans collectionLocation: Yup.string() .min(1, 'must be at least 1 character') .max(500, 'must be 500 characters or less') - .required('name is required') + .required('Location is required') }), onSubmit: (values) => { handleSubmit(values.collectionLocation); @@ -124,7 +124,9 @@ const ImportCollectionLocation = ({ onClose, handleSubmit, collectionName, trans const browse = () => { dispatch(browseDirectory()) .then((dirPath) => { - formik.setFieldValue('collectionLocation', dirPath); + if (typeof dirPath === 'string' && dirPath.length > 0) { + formik.setFieldValue('collectionLocation', dirPath); + } }) .catch((error) => { formik.setFieldValue('collectionLocation', ''); From df120787ca4236c6c92b26eacf2e93379351a6ea Mon Sep 17 00:00:00 2001 From: Adrian Date: Fri, 16 Aug 2024 16:35:33 +0200 Subject: [PATCH 48/49] fix: remove scope with auth code grant (#2815) --- packages/bruno-electron/src/ipc/network/oauth2-helper.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/bruno-electron/src/ipc/network/oauth2-helper.js b/packages/bruno-electron/src/ipc/network/oauth2-helper.js index 216c3be97..7a1a5b503 100644 --- a/packages/bruno-electron/src/ipc/network/oauth2-helper.js +++ b/packages/bruno-electron/src/ipc/network/oauth2-helper.js @@ -32,9 +32,6 @@ const resolveOAuth2AuthorizationCodeAccessToken = async (request, collectionUid) client_secret: clientSecret, state: state }; - if (scope) { - data['scope'] = scope; - } if (pkce) { data['code_verifier'] = codeVerifier; } From 017d2235b858b486849b03d2855e4ddf8b2f4db2 Mon Sep 17 00:00:00 2001 From: Daniel Roberto Date: Fri, 16 Aug 2024 11:38:33 -0300 Subject: [PATCH 49/49] fix: remove duplicate tailwind classes in RequestNotFound component (#2801) --- .../src/components/RequestTabPanel/RequestNotFound/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bruno-app/src/components/RequestTabPanel/RequestNotFound/index.js b/packages/bruno-app/src/components/RequestTabPanel/RequestNotFound/index.js index db0e45e41..cb62ac8a0 100644 --- a/packages/bruno-app/src/components/RequestTabPanel/RequestNotFound/index.js +++ b/packages/bruno-app/src/components/RequestTabPanel/RequestNotFound/index.js @@ -30,7 +30,7 @@ const RequestNotFound = ({ itemUid }) => { return (
-
+
Request no longer exists.
This can happen when the .bru file associated with this request was deleted on your filesystem.