Compare commits
3 Commits
fix/defaul
...
fix/email-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d05518024 | ||
|
|
480a5f1f79 | ||
|
|
6f23667c9c |
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col space-y-2">
|
<div class="flex flex-col space-y-2">
|
||||||
<div v-if="isTooltipComponent" class="flex flex-col px-4 pt-2">
|
<div class="flex flex-col px-4 pt-2">
|
||||||
<h2 class="inline-flex pb-1 font-semibold text-secondaryDark">
|
<h2 class="inline-flex pb-1 font-semibold text-secondaryDark">
|
||||||
{{ t("settings.interceptor") }}
|
{{ t("settings.interceptor") }}
|
||||||
</h2>
|
</h2>
|
||||||
@@ -19,9 +19,6 @@
|
|||||||
:value="interceptor.interceptorID"
|
:value="interceptor.interceptorID"
|
||||||
:label="unref(interceptor.name(t))"
|
:label="unref(interceptor.name(t))"
|
||||||
:selected="interceptorSelection === interceptor.interceptorID"
|
:selected="interceptorSelection === interceptor.interceptorID"
|
||||||
:class="{
|
|
||||||
'!px-0 hover:bg-transparent': !isTooltipComponent,
|
|
||||||
}"
|
|
||||||
@change="interceptorSelection = interceptor.interceptorID"
|
@change="interceptorSelection = interceptor.interceptorID"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -42,15 +39,6 @@ import { InterceptorService } from "~/services/interceptor.service"
|
|||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
isTooltipComponent?: boolean
|
|
||||||
}>(),
|
|
||||||
{
|
|
||||||
isTooltipComponent: true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const interceptorService = useService(InterceptorService)
|
const interceptorService = useService(InterceptorService)
|
||||||
|
|
||||||
const interceptorSelection =
|
const interceptorSelection =
|
||||||
|
|||||||
@@ -36,6 +36,16 @@
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="space-y-4 py-4">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<HoppSmartToggle
|
||||||
|
:on="extensionEnabled"
|
||||||
|
@change="extensionEnabled = !extensionEnabled"
|
||||||
|
>
|
||||||
|
{{ t("settings.extensions_use_toggle") }}
|
||||||
|
</HoppSmartToggle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -45,12 +55,34 @@ import IconCheckCircle from "~icons/lucide/check-circle"
|
|||||||
import { useI18n } from "@composables/i18n"
|
import { useI18n } from "@composables/i18n"
|
||||||
import { ExtensionInterceptorService } from "~/platform/std/interceptors/extension"
|
import { ExtensionInterceptorService } from "~/platform/std/interceptors/extension"
|
||||||
import { useService } from "dioc/vue"
|
import { useService } from "dioc/vue"
|
||||||
|
import { computed } from "vue"
|
||||||
|
import { InterceptorService } from "~/services/interceptor.service"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
|
const interceptorService = useService(InterceptorService)
|
||||||
const extensionService = useService(ExtensionInterceptorService)
|
const extensionService = useService(ExtensionInterceptorService)
|
||||||
|
|
||||||
const extensionVersion = extensionService.extensionVersion
|
const extensionVersion = extensionService.extensionVersion
|
||||||
const hasChromeExtInstalled = extensionService.chromeExtensionInstalled
|
const hasChromeExtInstalled = extensionService.chromeExtensionInstalled
|
||||||
const hasFirefoxExtInstalled = extensionService.firefoxExtensionInstalled
|
const hasFirefoxExtInstalled = extensionService.firefoxExtensionInstalled
|
||||||
|
|
||||||
|
const extensionEnabled = computed({
|
||||||
|
get() {
|
||||||
|
return (
|
||||||
|
interceptorService.currentInterceptorID.value ===
|
||||||
|
extensionService.interceptorID
|
||||||
|
)
|
||||||
|
},
|
||||||
|
set(active) {
|
||||||
|
if (active) {
|
||||||
|
interceptorService.currentInterceptorID.value =
|
||||||
|
extensionService.interceptorID
|
||||||
|
} else {
|
||||||
|
interceptorService.currentInterceptorID.value =
|
||||||
|
platform.interceptors.default
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -8,6 +8,16 @@
|
|||||||
:label="t('app.proxy_privacy_policy')"
|
:label="t('app.proxy_privacy_policy')"
|
||||||
/>.
|
/>.
|
||||||
</div>
|
</div>
|
||||||
|
<div class="space-y-4 py-4">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<HoppSmartToggle
|
||||||
|
:on="proxyEnabled"
|
||||||
|
@change="proxyEnabled = !proxyEnabled"
|
||||||
|
>
|
||||||
|
{{ t("settings.proxy_use_toggle") }}
|
||||||
|
</HoppSmartToggle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="flex items-center space-x-2 py-4">
|
<div class="flex items-center space-x-2 py-4">
|
||||||
<HoppSmartInput
|
<HoppSmartInput
|
||||||
v-model="PROXY_URL"
|
v-model="PROXY_URL"
|
||||||
@@ -40,6 +50,7 @@ import { computed } from "vue"
|
|||||||
import { useService } from "dioc/vue"
|
import { useService } from "dioc/vue"
|
||||||
import { InterceptorService } from "~/services/interceptor.service"
|
import { InterceptorService } from "~/services/interceptor.service"
|
||||||
import { proxyInterceptor } from "~/platform/std/interceptors/proxy"
|
import { proxyInterceptor } from "~/platform/std/interceptors/proxy"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -48,11 +59,23 @@ const interceptorService = useService(InterceptorService)
|
|||||||
|
|
||||||
const PROXY_URL = useSetting("PROXY_URL")
|
const PROXY_URL = useSetting("PROXY_URL")
|
||||||
|
|
||||||
const proxyEnabled = computed(
|
const proxyEnabled = computed({
|
||||||
() =>
|
get() {
|
||||||
interceptorService.currentInterceptorID.value ===
|
return (
|
||||||
proxyInterceptor.interceptorID
|
interceptorService.currentInterceptorID.value ===
|
||||||
)
|
proxyInterceptor.interceptorID
|
||||||
|
)
|
||||||
|
},
|
||||||
|
set(active) {
|
||||||
|
if (active) {
|
||||||
|
interceptorService.currentInterceptorID.value =
|
||||||
|
proxyInterceptor.interceptorID
|
||||||
|
} else {
|
||||||
|
interceptorService.currentInterceptorID.value =
|
||||||
|
platform.interceptors.default
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const clearIcon = refAutoReset<typeof IconRotateCCW | typeof IconCheck>(
|
const clearIcon = refAutoReset<typeof IconRotateCCW | typeof IconCheck>(
|
||||||
IconRotateCCW,
|
IconRotateCCW,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { cloneDeep, defaultsDeep, has } from "lodash-es"
|
import { cloneDeep, defaultsDeep, has } from "lodash-es"
|
||||||
import { Observable } from "rxjs"
|
import { Observable } from "rxjs"
|
||||||
import { distinctUntilChanged, pluck } from "rxjs/operators"
|
import { distinctUntilChanged, pluck } from "rxjs/operators"
|
||||||
|
import { nextTick } from "vue"
|
||||||
|
import { platform } from "~/platform"
|
||||||
import type { KeysMatching } from "~/types/ts-utils"
|
import type { KeysMatching } from "~/types/ts-utils"
|
||||||
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
import DispatchingStore, { defineDispatchers } from "./DispatchingStore"
|
||||||
|
|
||||||
@@ -68,52 +70,63 @@ export type SettingsDef = {
|
|||||||
HAS_OPENED_SPOTLIGHT: boolean
|
HAS_OPENED_SPOTLIGHT: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getDefaultSettings = (): SettingsDef => ({
|
export const getDefaultSettings = (): SettingsDef => {
|
||||||
syncCollections: true,
|
const defaultSettings: SettingsDef = {
|
||||||
syncHistory: true,
|
syncCollections: true,
|
||||||
syncEnvironments: true,
|
syncHistory: true,
|
||||||
|
syncEnvironments: true,
|
||||||
|
|
||||||
WRAP_LINES: {
|
WRAP_LINES: {
|
||||||
httpRequestBody: true,
|
httpRequestBody: true,
|
||||||
httpResponseBody: true,
|
httpResponseBody: true,
|
||||||
httpHeaders: true,
|
httpHeaders: true,
|
||||||
httpParams: true,
|
httpParams: true,
|
||||||
httpUrlEncoded: true,
|
httpUrlEncoded: true,
|
||||||
httpPreRequest: true,
|
httpPreRequest: true,
|
||||||
httpTest: true,
|
httpTest: true,
|
||||||
httpRequestVariables: true,
|
httpRequestVariables: true,
|
||||||
graphqlQuery: true,
|
graphqlQuery: true,
|
||||||
graphqlResponseBody: true,
|
graphqlResponseBody: true,
|
||||||
graphqlHeaders: false,
|
graphqlHeaders: false,
|
||||||
graphqlVariables: false,
|
graphqlVariables: false,
|
||||||
graphqlSchema: true,
|
graphqlSchema: true,
|
||||||
importCurl: true,
|
importCurl: true,
|
||||||
codeGen: true,
|
codeGen: true,
|
||||||
cookie: true,
|
cookie: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Set empty because interceptor module will set the default value
|
CURRENT_INTERCEPTOR_ID: "",
|
||||||
CURRENT_INTERCEPTOR_ID: "",
|
|
||||||
|
|
||||||
// TODO: Interceptor related settings should move under the interceptor systems
|
// TODO: Interceptor related settings should move under the interceptor systems
|
||||||
PROXY_URL: "https://proxy.hoppscotch.io/",
|
PROXY_URL: "https://proxy.hoppscotch.io/",
|
||||||
URL_EXCLUDES: {
|
URL_EXCLUDES: {
|
||||||
auth: true,
|
auth: true,
|
||||||
httpUser: true,
|
httpUser: true,
|
||||||
httpPassword: true,
|
httpPassword: true,
|
||||||
bearerToken: true,
|
bearerToken: true,
|
||||||
oauth2Token: true,
|
oauth2Token: true,
|
||||||
},
|
},
|
||||||
THEME_COLOR: "indigo",
|
THEME_COLOR: "indigo",
|
||||||
BG_COLOR: "system",
|
BG_COLOR: "system",
|
||||||
TELEMETRY_ENABLED: true,
|
TELEMETRY_ENABLED: true,
|
||||||
EXPAND_NAVIGATION: false,
|
EXPAND_NAVIGATION: false,
|
||||||
SIDEBAR: true,
|
SIDEBAR: true,
|
||||||
SIDEBAR_ON_LEFT: false,
|
SIDEBAR_ON_LEFT: false,
|
||||||
COLUMN_LAYOUT: true,
|
COLUMN_LAYOUT: true,
|
||||||
|
|
||||||
HAS_OPENED_SPOTLIGHT: false,
|
HAS_OPENED_SPOTLIGHT: false,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// Wait for platform to initialize before setting CURRENT_INTERCEPTOR_ID
|
||||||
|
nextTick(() => {
|
||||||
|
applySetting(
|
||||||
|
"CURRENT_INTERCEPTOR_ID",
|
||||||
|
platform?.interceptors.default || "browser"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
return defaultSettings
|
||||||
|
}
|
||||||
|
|
||||||
type ApplySettingPayload = {
|
type ApplySettingPayload = {
|
||||||
[K in keyof SettingsDef]: {
|
[K in keyof SettingsDef]: {
|
||||||
|
|||||||
@@ -98,12 +98,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-8 p-8 md:col-span-2">
|
<div class="space-y-8 p-8 md:col-span-2">
|
||||||
<section class="flex flex-col space-y-2">
|
|
||||||
<h4 class="font-semibold text-secondaryDark">
|
|
||||||
{{ t("settings.interceptor") }}
|
|
||||||
</h4>
|
|
||||||
<AppInterceptor :is-tooltip-component="false" />
|
|
||||||
</section>
|
|
||||||
<section v-for="[id, settings] in interceptorsWithSettings" :key="id">
|
<section v-for="[id, settings] in interceptorsWithSettings" :key="id">
|
||||||
<h4 class="font-semibold text-secondaryDark">
|
<h4 class="font-semibold text-secondaryDark">
|
||||||
{{ settings.entryTitle(t) }}
|
{{ settings.entryTitle(t) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user