Compare commits
1 Commits
add-realti
...
refactor/i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00588bcc0a |
@@ -257,6 +257,7 @@
|
|||||||
"error": {
|
"error": {
|
||||||
"browser_support_sse": "This browser doesn't seems to have Server Sent Events support.",
|
"browser_support_sse": "This browser doesn't seems to have Server Sent Events support.",
|
||||||
"check_console_details": "Check console log for details.",
|
"check_console_details": "Check console log for details.",
|
||||||
|
"check_how_to_add_origin": "Check how you can add an origin",
|
||||||
"curl_invalid_format": "cURL is not formatted properly",
|
"curl_invalid_format": "cURL is not formatted properly",
|
||||||
"danger_zone": "Danger zone",
|
"danger_zone": "Danger zone",
|
||||||
"delete_account": "Your account is currently an owner in these teams:",
|
"delete_account": "Your account is currently an owner in these teams:",
|
||||||
@@ -277,6 +278,7 @@
|
|||||||
"no_environments_to_export": "No environments to export. Please create an environment to get started.",
|
"no_environments_to_export": "No environments to export. Please create an environment to get started.",
|
||||||
"no_results_found": "No matches found",
|
"no_results_found": "No matches found",
|
||||||
"page_not_found": "This page could not be found",
|
"page_not_found": "This page could not be found",
|
||||||
|
"please_install_extension": "Please install the extension and add origin to the extension.",
|
||||||
"proxy_error": "Proxy error",
|
"proxy_error": "Proxy error",
|
||||||
"script_fail": "Could not execute pre-request script",
|
"script_fail": "Could not execute pre-request script",
|
||||||
"something_went_wrong": "Something went wrong",
|
"something_went_wrong": "Something went wrong",
|
||||||
|
|||||||
12
packages/hoppscotch-common/src/components.d.ts
vendored
12
packages/hoppscotch-common/src/components.d.ts
vendored
@@ -1,11 +1,11 @@
|
|||||||
// generated by unplugin-vue-components
|
/* eslint-disable */
|
||||||
// We suggest you to commit this file into source control
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
import '@vue/runtime-core'
|
|
||||||
|
|
||||||
export {}
|
export {}
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
AppActionHandler: typeof import('./components/app/ActionHandler.vue')['default']
|
AppActionHandler: typeof import('./components/app/ActionHandler.vue')['default']
|
||||||
AppAnnouncement: typeof import('./components/app/Announcement.vue')['default']
|
AppAnnouncement: typeof import('./components/app/Announcement.vue')['default']
|
||||||
@@ -154,6 +154,7 @@ declare module '@vue/runtime-core' {
|
|||||||
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
|
IconLucideMinus: typeof import('~icons/lucide/minus')['default']
|
||||||
IconLucideSearch: typeof import('~icons/lucide/search')['default']
|
IconLucideSearch: typeof import('~icons/lucide/search')['default']
|
||||||
IconLucideUsers: typeof import('~icons/lucide/users')['default']
|
IconLucideUsers: typeof import('~icons/lucide/users')['default']
|
||||||
|
InterceptorsErrorPlaceholder: typeof import('./components/interceptors/ErrorPlaceholder.vue')['default']
|
||||||
InterceptorsExtensionSubtitle: typeof import('./components/interceptors/ExtensionSubtitle.vue')['default']
|
InterceptorsExtensionSubtitle: typeof import('./components/interceptors/ExtensionSubtitle.vue')['default']
|
||||||
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
|
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']
|
||||||
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
|
LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default']
|
||||||
@@ -218,5 +219,4 @@ declare module '@vue/runtime-core' {
|
|||||||
WorkspaceCurrent: typeof import('./components/workspace/Current.vue')['default']
|
WorkspaceCurrent: typeof import('./components/workspace/Current.vue')['default']
|
||||||
WorkspaceSelector: typeof import('./components/workspace/Selector.vue')['default']
|
WorkspaceSelector: typeof import('./components/workspace/Selector.vue')['default']
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,8 +58,8 @@
|
|||||||
v-for="(field, index) in filteredQueryFields"
|
v-for="(field, index) in filteredQueryFields"
|
||||||
:key="`field-${index}`"
|
:key="`field-${index}`"
|
||||||
:gql-field="field"
|
:gql-field="field"
|
||||||
@jump-to-type="handleJumpToType"
|
|
||||||
class="p-4"
|
class="p-4"
|
||||||
|
@jump-to-type="handleJumpToType"
|
||||||
/>
|
/>
|
||||||
</HoppSmartTab>
|
</HoppSmartTab>
|
||||||
<HoppSmartTab
|
<HoppSmartTab
|
||||||
@@ -72,8 +72,8 @@
|
|||||||
v-for="(field, index) in filteredMutationFields"
|
v-for="(field, index) in filteredMutationFields"
|
||||||
:key="`field-${index}`"
|
:key="`field-${index}`"
|
||||||
:gql-field="field"
|
:gql-field="field"
|
||||||
@jump-to-type="handleJumpToType"
|
|
||||||
class="p-4"
|
class="p-4"
|
||||||
|
@jump-to-type="handleJumpToType"
|
||||||
/>
|
/>
|
||||||
</HoppSmartTab>
|
</HoppSmartTab>
|
||||||
<HoppSmartTab
|
<HoppSmartTab
|
||||||
@@ -86,8 +86,8 @@
|
|||||||
v-for="(field, index) in filteredSubscriptionFields"
|
v-for="(field, index) in filteredSubscriptionFields"
|
||||||
:key="`field-${index}`"
|
:key="`field-${index}`"
|
||||||
:gql-field="field"
|
:gql-field="field"
|
||||||
@jump-to-type="handleJumpToType"
|
|
||||||
class="p-4"
|
class="p-4"
|
||||||
|
@jump-to-type="handleJumpToType"
|
||||||
/>
|
/>
|
||||||
</HoppSmartTab>
|
</HoppSmartTab>
|
||||||
<HoppSmartTab
|
<HoppSmartTab
|
||||||
|
|||||||
@@ -350,7 +350,6 @@ const newSendRequest = async () => {
|
|||||||
const streamResult = await streamPromise
|
const streamResult = await streamPromise
|
||||||
|
|
||||||
requestCancelFunc.value = cancel
|
requestCancelFunc.value = cancel
|
||||||
|
|
||||||
if (E.isRight(streamResult)) {
|
if (E.isRight(streamResult)) {
|
||||||
subscribeToStream(
|
subscribeToStream(
|
||||||
streamResult.right,
|
streamResult.right,
|
||||||
@@ -365,6 +364,20 @@ const newSendRequest = async () => {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
// TODO: Change this any to a proper type
|
||||||
|
const result = (streamResult.right as any).value
|
||||||
|
if (
|
||||||
|
result.type === "network_fail" &&
|
||||||
|
result.error?.error === "NO_PW_EXT_HOOK"
|
||||||
|
) {
|
||||||
|
const errorResponse: HoppRESTResponse = {
|
||||||
|
type: "extension_error",
|
||||||
|
error: result.error.humanMessage.heading,
|
||||||
|
component: result.error.component,
|
||||||
|
req: result.req,
|
||||||
|
}
|
||||||
|
updateRESTResponse(errorResponse)
|
||||||
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,6 +11,12 @@
|
|||||||
<HoppSmartSpinner class="my-4" />
|
<HoppSmartSpinner class="my-4" />
|
||||||
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
|
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<component
|
||||||
|
:is="response.component"
|
||||||
|
v-if="response.type === 'extension_error'"
|
||||||
|
class="flex-1"
|
||||||
|
/>
|
||||||
<HoppSmartPlaceholder
|
<HoppSmartPlaceholder
|
||||||
v-if="response.type === 'network_fail'"
|
v-if="response.type === 'network_fail'"
|
||||||
:src="`/images/states/${colorMode.value}/youre_lost.svg`"
|
:src="`/images/states/${colorMode.value}/youre_lost.svg`"
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
<template>
|
||||||
|
<HoppSmartPlaceholder
|
||||||
|
:src="`/images/states/${colorMode.value}/youre_lost.svg`"
|
||||||
|
:alt="`${t('error.network_fail')}`"
|
||||||
|
:heading="t('error.network_fail')"
|
||||||
|
large
|
||||||
|
>
|
||||||
|
<div class="my-1 text-secondaryLight flex flex-col items-center">
|
||||||
|
<span>
|
||||||
|
{{ t("error.please_install_extension") }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ t("error.check_how_to_add_origin") }}
|
||||||
|
<HoppSmartLink
|
||||||
|
blank
|
||||||
|
to="https://docs.hoppscotch.io/documentation/features/interceptor#browser-extension"
|
||||||
|
class="text-accent hover:text-accentDark"
|
||||||
|
>
|
||||||
|
here
|
||||||
|
</HoppSmartLink>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col py-4 space-y-2">
|
||||||
|
<span>
|
||||||
|
<HoppSmartItem
|
||||||
|
to="https://chrome.google.com/webstore/detail/hoppscotch-browser-extens/amknoiejhlmhancpahfcfcfhllgkpbld"
|
||||||
|
blank
|
||||||
|
:icon="IconChrome"
|
||||||
|
label="Chrome"
|
||||||
|
:info-icon="hasChromeExtInstalled ? IconCheckCircle : null"
|
||||||
|
:active-info-icon="hasChromeExtInstalled"
|
||||||
|
outline
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<HoppSmartItem
|
||||||
|
to="https://addons.mozilla.org/en-US/firefox/addon/hoppscotch"
|
||||||
|
blank
|
||||||
|
:icon="IconFirefox"
|
||||||
|
label="Firefox"
|
||||||
|
:info-icon="hasFirefoxExtInstalled ? IconCheckCircle : null"
|
||||||
|
:active-info-icon="hasFirefoxExtInstalled"
|
||||||
|
outline
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="py-4 space-y-4">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<HoppSmartToggle
|
||||||
|
:on="extensionEnabled"
|
||||||
|
@change="extensionEnabled = !extensionEnabled"
|
||||||
|
>
|
||||||
|
{{ t("settings.extensions_use_toggle") }}
|
||||||
|
</HoppSmartToggle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</HoppSmartPlaceholder>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import IconChrome from "~icons/brands/chrome"
|
||||||
|
import IconFirefox from "~icons/brands/firefox"
|
||||||
|
import IconCheckCircle from "~icons/lucide/check-circle"
|
||||||
|
import { useI18n } from "@composables/i18n"
|
||||||
|
import { ExtensionInterceptorService } from "~/platform/std/interceptors/extension"
|
||||||
|
import { useService } from "dioc/vue"
|
||||||
|
import { computed } from "vue"
|
||||||
|
import { InterceptorService } from "~/services/interceptor.service"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
import { useColorMode } from "~/composables/theming"
|
||||||
|
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
const t = useI18n()
|
||||||
|
|
||||||
|
const interceptorService = useService(InterceptorService)
|
||||||
|
const extensionService = useService(ExtensionInterceptorService)
|
||||||
|
|
||||||
|
const hasChromeExtInstalled = extensionService.chromeExtensionInstalled
|
||||||
|
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>
|
||||||
@@ -152,12 +152,14 @@ export function useStreamSubscriber(): {
|
|||||||
error?: (e: any) => void,
|
error?: (e: any) => void,
|
||||||
complete?: () => void
|
complete?: () => void
|
||||||
) => {
|
) => {
|
||||||
const sub = stream.subscribe({
|
let sub: Subscription | null = null
|
||||||
|
|
||||||
|
sub = stream.subscribe({
|
||||||
next,
|
next,
|
||||||
error,
|
error,
|
||||||
complete: () => {
|
complete: () => {
|
||||||
if (complete) complete()
|
if (complete) complete()
|
||||||
subs.splice(subs.indexOf(sub), 1)
|
if (sub) subs.splice(subs.indexOf(sub), 1)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { HoppRESTRequest } from "@hoppscotch/data"
|
import { HoppRESTRequest } from "@hoppscotch/data"
|
||||||
|
import { Component } from "vue"
|
||||||
|
|
||||||
export type HoppRESTResponseHeader = { key: string; value: string }
|
export type HoppRESTResponseHeader = { key: string; value: string }
|
||||||
|
|
||||||
@@ -39,3 +40,9 @@ export type HoppRESTResponse =
|
|||||||
|
|
||||||
req: HoppRESTRequest
|
req: HoppRESTRequest
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: "extension_error"
|
||||||
|
error: string
|
||||||
|
component: Component
|
||||||
|
req: HoppRESTRequest
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { computed, readonly, ref } from "vue"
|
|||||||
import { browserIsChrome, browserIsFirefox } from "~/helpers/utils/userAgent"
|
import { browserIsChrome, browserIsFirefox } from "~/helpers/utils/userAgent"
|
||||||
import SettingsExtension from "~/components/settings/Extension.vue"
|
import SettingsExtension from "~/components/settings/Extension.vue"
|
||||||
import InterceptorsExtensionSubtitle from "~/components/interceptors/ExtensionSubtitle.vue"
|
import InterceptorsExtensionSubtitle from "~/components/interceptors/ExtensionSubtitle.vue"
|
||||||
|
import InterceptorsErrorPlaceholder from "~/components/interceptors/ErrorPlaceholder.vue"
|
||||||
|
|
||||||
export const defineSubscribableObject = <T extends object>(obj: T) => {
|
export const defineSubscribableObject = <T extends object>(obj: T) => {
|
||||||
const proxyObject = {
|
const proxyObject = {
|
||||||
@@ -217,6 +218,7 @@ export class ExtensionInterceptorService
|
|||||||
description: () => "Heading not found",
|
description: () => "Heading not found",
|
||||||
},
|
},
|
||||||
error: "NO_PW_EXT_HOOK",
|
error: "NO_PW_EXT_HOOK",
|
||||||
|
component: InterceptorsErrorPlaceholder,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export type InterceptorError =
|
|||||||
description: (t: ReturnType<typeof getI18n>) => string
|
description: (t: ReturnType<typeof getI18n>) => string
|
||||||
}
|
}
|
||||||
error?: unknown
|
error?: unknown
|
||||||
|
component?: Component
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user