chore: merge hoppscotch/main into hoppscotch/next

This commit is contained in:
Andrew Bastin
2024-08-23 15:05:01 +05:30
31 changed files with 819 additions and 701 deletions

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:80 :3170 {
reverse_proxy localhost:8080
}

View File

@@ -1,6 +1,6 @@
{
"name": "hoppscotch-backend",
"version": "2024.7.1",
"version": "2024.7.2",
"description": "",
"author": "",
"private": true,

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "@hoppscotch/common",
"private": true,
"version": "2024.7.1",
"version": "2024.7.2",
"scripts": {
"dev": "pnpm exec npm-run-all -p -l dev:*",
"test": "vitest --run",

View File

@@ -1,26 +1,33 @@
<template>
<div
class="flex flex-col py-2 px-4 w-72 relative border border-[#BCB78B] bg-[#FEFFD2] rounded-md text-[#7E7103]"
class="flex flex-col p-[1px] w-72 relative border border-dividerDark bg-dividerLight rounded-md text-secondary border-animation overflow-hidden"
:class="{
'before:top-1/2 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2 before:aspect-square before:w-full before:absolute before:rounded-md': true,
}"
>
<button
class="absolute top-2 right-2 hover:text-black"
@click="$emit('close-toast')"
<div
class="overflow-hidden relative flex flex-1 bg-dividerLight px-4 py-2 rounded-md"
>
<IconLucideX />
</button>
<div class="flex flex-col space-y-3">
<p class="leading-5 font-semibold">
{{ t("app.updated_text", { version: version }) }}
</p>
<button
class="flex items-center space-x-1 hover:underline"
@click="openWhatsNew"
class="absolute top-2 right-2 hover:text-secondaryLight"
@click="$emit('close-toast')"
>
<span>
{{ t("app.see_whats_new") }}
</span>
<IconLucideArrowUpRight />
<IconLucideX />
</button>
<div class="flex flex-col space-y-3">
<p class="leading-5 font-semibold">
{{ t("app.updated_text", { version: version }) }}
</p>
<button
class="flex items-center space-x-1 hover:underline"
@click="openWhatsNew"
>
<span>
{{ t("app.see_whats_new") }}
</span>
<IconLucideArrowUpRight />
</button>
</div>
</div>
</div>
</template>
@@ -44,3 +51,41 @@ const openWhatsNew = () => {
if (props.notesUrl) platform.io.openExternalLink(props.notesUrl)
}
</script>
<style>
/* Transition Classes */
.list-enter-active {
transition: all 1s ease;
}
.list-leave-active {
transition: all 0.4s ease;
}
.list-enter-from,
.list-leave-to {
opacity: 0;
transform: translateY(-30px);
}
.list-leave-active {
position: absolute;
}
/* Conic gradient */
.border-animation::before {
background: conic-gradient(
transparent 270deg,
var(--accent-dark-color),
transparent
);
animation: rotate 4s linear infinite;
}
@keyframes rotate {
from {
transform: translate(-50%, -50%) scale(1.4) rotate(0turn);
}
to {
transform: translate(-50%, -50%) scale(1.4) rotate(1turn);
}
}
</style>

View File

@@ -139,16 +139,27 @@ const workspace = workspaceService.currentWorkspace
// Switch to my environments if workspace is personal and to team environments if workspace is team
// also resets selected environment if workspace is personal and the previous selected environment was a team environment
watch(workspace, (newWorkspace) => {
if (newWorkspace.type === "personal") {
const { type: newWorkspaceType } = newWorkspace
if (newWorkspaceType === "personal") {
switchToMyEnvironments()
if (selectedEnvironmentIndex.value.type !== "MY_ENV") {
setSelectedEnvironmentIndex({
type: "NO_ENV_SELECTED",
})
}
} else if (newWorkspace.type === "team") {
} else {
updateSelectedTeam(newWorkspace)
}
const newTeamID =
newWorkspaceType === "team" ? newWorkspace.teamID : undefined
// Set active environment to the `No environment` state
// if navigating away from a team workspace
if (
selectedEnvironmentIndex.value.type === "TEAM_ENV" &&
selectedEnvironmentIndex.value.teamID !== newTeamID
) {
setSelectedEnvironmentIndex({
type: "NO_ENV_SELECTED",
})
}
})
watch(

View File

@@ -143,7 +143,7 @@ watch(rawParamsBody, (newVal) => {
// propagate the edits from codemirror back to the body
watch(codemirrorValue, (updatedValue) => {
if (updatedValue && updatedValue !== rawParamsBody.value) {
if (updatedValue !== undefined && updatedValue !== rawParamsBody.value) {
rawParamsBody.value = updatedValue
}
})

View File

@@ -70,9 +70,11 @@
:title="`${t(
'action.send'
)} <kbd>${getSpecialKey()}</kbd><kbd>↩</kbd>`"
:label="`${!loading ? t('action.send') : t('action.cancel')}`"
:label="`${
!isTabResponseLoading ? t('action.send') : t('action.cancel')
}`"
class="min-w-[5rem] flex-1 rounded-r-none"
@click="!loading ? newSendRequest() : cancelRequest()"
@click="!isTabResponseLoading ? newSendRequest() : cancelRequest()"
/>
<span class="flex">
<tippy
@@ -238,7 +240,7 @@ import { useReadonlyStream, useStreamSubscriber } from "@composables/stream"
import { useToast } from "@composables/toast"
import { useVModel } from "@vueuse/core"
import * as E from "fp-ts/Either"
import { Ref, computed, ref, onUnmounted } from "vue"
import { computed, ref, onUnmounted } from "vue"
import { defineActionHandler, invokeAction } from "~/helpers/actions"
import { runMutation } from "~/helpers/backend/GQLClient"
import { UpdateRequestDocument } from "~/helpers/backend/graphql"
@@ -302,6 +304,10 @@ const curlText = ref("")
const loading = ref(false)
const isTabResponseLoading = computed(
() => tab.value.document.response?.type === "loading"
)
const showCurlImportModal = ref(false)
const showCodegenModal = ref(false)
const showSaveRequestModal = ref(false)
@@ -318,8 +324,6 @@ const saveRequestAction = ref<any | null>(null)
const history = useReadonlyStream<RESTHistoryEntry[]>(restHistory$, [])
const requestCancelFunc: Ref<(() => void) | null> = ref(null)
const userHistories = computed(() => {
return history.value.map((history) => history.request.endpoint).slice(0, 10)
})
@@ -351,7 +355,8 @@ const newSendRequest = async () => {
const [cancel, streamPromise] = runRESTRequest$(tab)
const streamResult = await streamPromise
requestCancelFunc.value = cancel
tab.value.document.cancelFunction = cancel
if (E.isRight(streamResult)) {
subscribeToStream(
streamResult.right,
@@ -441,7 +446,7 @@ onUnmounted(() => {
const cancelRequest = () => {
loading.value = false
requestCancelFunc.value?.()
tab.value.document.cancelFunction?.()
updateRESTResponse(null)
}

View File

@@ -16,6 +16,7 @@
v-if="properties?.includes('bodyParams') ?? true"
:id="'bodyParams'"
:label="`${t('tab.body')}`"
:indicator="isBodyFilled"
>
<HttpBody
v-model:headers="request.headers"
@@ -154,6 +155,10 @@ const newActiveRequestVariablesCount = computed(() => {
return count ? count : null
})
const isBodyFilled = computed(() => {
return Boolean(request.value.body.body && request.value.body.body.length > 0)
})
defineActionHandler("request.open-tab", ({ tab }) => {
selectedOptionTab.value = tab as RESTOptionTabs
})

View File

@@ -43,6 +43,10 @@ export function useWhatsNewDialog() {
version: hoppscotchCommonPkgVersion,
},
position: "bottom-left",
style: {
bottom: "15px",
left: "30px",
},
duration: Infinity,
})
}

View File

@@ -87,4 +87,9 @@ export type HoppRESTDocument = {
* (if any)
*/
inheritedProperties?: HoppInheritedProperty
/**
* The function responsible for cancelling the tab request call
*/
cancelFunction?: () => void
}

View File

@@ -539,6 +539,7 @@ export const REST_TAB_STATE_SCHEMA = z
responseTabPreference: z.optional(z.string()),
optionTabPreference: z.optional(z.enum(validRestOperations)),
inheritedProperties: z.optional(HoppInheritedPropertySchema),
cancelFunction: z.optional(z.function()),
})
.strict(),
})

View File

@@ -1,6 +1,5 @@
import { Service } from "dioc"
import { reactive } from "vue"
import { computed } from "vue"
import { reactive, computed } from "vue"
/**
* Defines a secret environment variable.

View File

@@ -1,7 +1,7 @@
{
"name": "@hoppscotch/selfhost-desktop",
"private": true,
"version": "2024.7.1",
"version": "2024.7.2",
"type": "module",
"scripts": {
"dev:vite": "vite",

View File

@@ -1296,7 +1296,7 @@ dependencies = [
[[package]]
name = "hoppscotch-desktop"
version = "24.7.1"
version = "24.7.2"
dependencies = [
"cocoa 0.25.0",
"dashmap",

View File

@@ -1,6 +1,6 @@
[package]
name = "hoppscotch-desktop"
version = "24.7.1"
version = "24.7.2"
description = "A Tauri App"
authors = ["you"]
license = ""

View File

@@ -8,7 +8,7 @@
},
"package": {
"productName": "Hoppscotch",
"version": "24.7.1"
"version": "24.7.2"
},
"tauri": {
"allowlist": {

View File

@@ -80,7 +80,7 @@ export const getSyncInitFunction = <T extends DispatchingStore<any, any>>(
)
}
stopSubscriptions = startSubscriptions()
stopSubscriptions = startSubscriptions?.()
}
function stopListeningToSubscriptions() {
@@ -90,7 +90,7 @@ export const getSyncInitFunction = <T extends DispatchingStore<any, any>>(
)
}
stopSubscriptions()
stopSubscriptions?.()
}
return {

View File

@@ -9,9 +9,18 @@ import { updateUserSettings } from "./settings.api"
export const settingsSyncDefinition: StoreSyncDefinitionOf<
typeof settingsStore
> = {
toggleSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
toggleNestedSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
applySetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
applyNestedSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
}
export const settingsSyncer = getSyncInitFunction(

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:8080 {
try_files {path} /
root * /site

View File

@@ -1,7 +1,7 @@
{
"name": "@hoppscotch/selfhost-web",
"private": true,
"version": "2024.7.1",
"version": "2024.7.2",
"type": "module",
"scripts": {
"dev:vite": "vite",

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:80 :3000 {
try_files {path} /
root * /site/selfhost-web

View File

@@ -80,7 +80,7 @@ export const getSyncInitFunction = <T extends DispatchingStore<any, any>>(
)
}
stopSubscriptions = startSubscriptions()
stopSubscriptions = startSubscriptions?.()
}
function stopListeningToSubscriptions() {
@@ -90,7 +90,7 @@ export const getSyncInitFunction = <T extends DispatchingStore<any, any>>(
)
}
stopSubscriptions()
stopSubscriptions?.()
}
return {

View File

@@ -9,9 +9,18 @@ import { updateUserSettings } from "./settings.api"
export const settingsSyncDefinition: StoreSyncDefinitionOf<
typeof settingsStore
> = {
toggleSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
toggleNestedSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
applySetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
applyNestedSetting() {
updateUserSettings(JSON.stringify(settingsStore.value))
},
}
export const settingsSyncer = getSyncInitFunction(

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:8080 {
try_files {path} /
root * /site

View File

@@ -1,7 +1,7 @@
{
"name": "hoppscotch-sh-admin",
"private": true,
"version": "2024.7.1",
"version": "2024.7.2",
"type": "module",
"scripts": {
"dev": "pnpm exec npm-run-all -p -l dev:*",

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:80 :3100 {
try_files {path} /
root * /site/sh-admin-multiport-setup

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:80 :3100 {
handle_path /admin* {
root * /site/sh-admin-subpath-access