Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

Add proxy settings.

NBTX85d51b236254
diff --git a/pages/settings.vue b/pages/settings.vue
index c5a11311a..9ed43f5df 100644
--- a/pages/settings.vue
+++ b/pages/settings.vue
@@ -5,8 +5,8 @@
<li>
<h3 class="title">Background</h3>
<div class="backgrounds">
- <span v-for="theme in themes" :key="theme.class" @click="applyTheme(theme.class)">
- <swatch :color="theme.color" :name="theme.name" :class="{ vibrant: theme.vibrant }" :active="settings.THEME_CLASS === theme.class"></swatch>
+ <span :key="theme.class" @click="applyTheme(theme.class)" v-for="theme in themes">
+ <swatch :active="settings.THEME_CLASS === theme.class" :class="{ vibrant: theme.vibrant }" :color="theme.color" :name="theme.name"></swatch>
</span>
</div>
</li>
@@ -15,22 +15,47 @@
<li>
<h3 class="title">Color</h3>
<div class="colors">
- <span v-for="entry in colors" :key="entry.color" @click.prevent="setActiveColor(entry.color, entry.vibrant)">
- <swatch :color="entry.color" :name="entry.name" :class="{ vibrant: entry.vibrant }" :active="settings.THEME_COLOR === entry.color.toUpperCase()" />
+ <span :key="entry.color" @click.prevent="setActiveColor(entry.color, entry.vibrant)" v-for="entry in colors">
+ <swatch :active="settings.THEME_COLOR === entry.color.toUpperCase()" :class="{ vibrant: entry.vibrant }" :color="entry.color" :name="entry.name" />
</span>
</div>
<p>
- <input id="disableFrameColors" type="checkbox" :checked="!settings.DISABLE_FRAME_COLORS" @change="toggleSetting('DISABLE_FRAME_COLORS')">
+ <input :checked="!settings.DISABLE_FRAME_COLORS" @change="toggleSetting('DISABLE_FRAME_COLORS')" id="disableFrameColors" type="checkbox">
<label for="disableFrameColors">Enable multi-colored frames</label>
</p>
</li>
</ul>
</pw-section>
+
+ <pw-section class="blue" label="Proxy">
+ <ul>
+ <li>
+ <p>
+ <input :checked="settings.PROXY_ENABLED" @change="toggleSetting('PROXY_ENABLED')"
+ id="enableProxy"
+ type="checkbox">
+ <label for="enableProxy">Enable proxy</label>
+ </p>
+ </li>
+ </ul>
+
+ <ul>
+ <li>
+ <label for="url">URL</label>
+ <input id="url" type="url" v-model="url">
+ </li>
+ <li>
+ <label for="key">Key</label>
+ <input id="key" type="password" v-model="url">
+ </li>
+ </ul>
+ </pw-section>
</div>
</template>
<script>
import section from "../components/section";
import swatch from "../components/settings/swatch";
+
export default {
data() {
return {
@@ -87,6 +112,8 @@
THEME_CLASS: this.$store.state.postwoman.settings.THEME_CLASS || '',
THEME_COLOR: '',
THEME_COLOR_VIBRANT: true,
+
+ PROXY_ENABLED: this.$store.state.postwoman.settings.PROXY_ENABLED || false,
DISABLE_FRAME_COLORS: this.$store.state.postwoman.settings.DISABLE_FRAME_COLORS || false
}
}
diff --git a/store/postwoman.js b/store/postwoman.js
index fb07b5d13..3c7ea48ec 100644
--- a/store/postwoman.js
+++ b/store/postwoman.js
@@ -24,7 +24,16 @@ export const SETTINGS_KEYS = [
* to emphasise the different sections.
* This setting allows that to be turned off.
*/
- "DISABLE_FRAME_COLORS"
+ "DISABLE_FRAME_COLORS",
+
+ /**
+ * Whether or not requests should be proxied.
+ */
+ "PROXY_ENABLED",
+
+
+ "PROXY_URL",
+ "PROXY_AUTH"
];
export const state = () => ({