refactor(cache): rename httpHttpsAgents to sslSession across preferences and UI

This commit is contained in:
lohit-bruno
2026-03-05 18:24:01 +05:30
parent adf5721ae0
commit f070812845
5 changed files with 18 additions and 18 deletions

View File

@@ -12,7 +12,7 @@ import debounce from 'lodash/debounce';
import get from 'lodash/get';
const cacheSchema = Yup.object().shape({
httpHttpsAgents: Yup.object({
sslSession: Yup.object({
enabled: Yup.boolean()
})
});
@@ -38,8 +38,8 @@ const Cache = () => {
const formik = useFormik({
initialValues: {
httpHttpsAgents: {
enabled: get(preferences, 'cache.httpHttpsAgents.enabled', false)
sslSession: {
enabled: get(preferences, 'cache.sslSession.enabled', false)
}
},
validationSchema: cacheSchema,
@@ -82,8 +82,8 @@ const Cache = () => {
const handleResetCache = () => {
dispatch(clearHttpHttpsAgentCache())
.then(() => toast.success('Agent cache cleared'))
.catch(() => toast.error('Failed to clear agent cache'));
.then(() => toast.success('ssl session cache cleared'))
.catch(() => toast.error('Failed to clear ssl session cache'));
};
return (
@@ -93,14 +93,14 @@ const Cache = () => {
<div className="flex items-center my-2">
<input
id="httpHttpsAgents.enabled"
id="sslSession.enabled"
type="checkbox"
name="httpHttpsAgents.enabled"
checked={formik.values.httpHttpsAgents.enabled}
name="sslSession.enabled"
checked={formik.values.sslSession.enabled}
onChange={handleAgentCachingChange}
className="mousetrap mr-0"
/>
<label className="block ml-2 select-none" htmlFor="httpHttpsAgents.enabled">
<label className="block ml-2 select-none" htmlFor="sslSession.enabled">
Enable SSL session caching
</label>
</div>
@@ -110,7 +110,7 @@ const Cache = () => {
</div>
<div className="mt-6">
<button type="button" className="purge-button" onClick={handleResetCache}>
<button type="button" className="text-link cursor-pointer hover:underline" onClick={handleResetCache}>
Clear
</button>
</div>

View File

@@ -45,8 +45,8 @@ const initialState = {
interval: 1000
},
cache: {
httpHttpsAgents: {
enabled: true
sslSession: {
enabled: false
}
}
},

View File

@@ -195,7 +195,7 @@ const buildCertsAndProxyConfig = async ({
shouldUseCustomCaCertificate: preferencesUtil.shouldUseCustomCaCertificate(),
customCaCertificateFilePath: preferencesUtil.getCustomCaCertificateFilePath(),
shouldKeepDefaultCaCertificates: preferencesUtil.shouldKeepDefaultCaCertificates(),
cacheSslSession: preferencesUtil.isHttpHttpsAgentCachingEnabled()
cacheSslSession: preferencesUtil.isSslSessionCachingEnabled()
};
// Get client certificates from bruno config and interpolate

View File

@@ -108,7 +108,7 @@ const defaultPreferences = {
zoomPercentage: 100
},
cache: {
httpHttpsAgents: {
sslSession: {
enabled: false
}
}
@@ -171,7 +171,7 @@ const preferencesSchema = Yup.object().shape({
zoomPercentage: Yup.number().min(50).max(150)
}),
cache: Yup.object({
httpHttpsAgents: Yup.object({
sslSession: Yup.object({
enabled: Yup.boolean()
})
}).optional()
@@ -361,8 +361,8 @@ const preferencesUtil = {
getZoomPercentage: () => {
return get(getPreferences(), 'display.zoomPercentage', 100);
},
isHttpHttpsAgentCachingEnabled: () => {
return get(getPreferences(), 'cache.httpHttpsAgents.enabled', false);
isSslSessionCachingEnabled: () => {
return get(getPreferences(), 'cache.sslSession.enabled', false);
},
hasLaunchedBefore: () => {
return get(getPreferences(), 'onboarding.hasLaunchedBefore', false);

View File

@@ -111,7 +111,7 @@ function setupProxyAgents({
interpolationOptions,
timeline
}) {
const disableCache = !preferencesUtil.isHttpHttpsAgentCachingEnabled();
const disableCache = !preferencesUtil.isSslSessionCachingEnabled();
// Ensure TLS options are properly set
const tlsOptions = {