From fb13fae3855b66397d0e0da8fc42c7e23780353b Mon Sep 17 00:00:00 2001 From: Cheese Date: Mon, 10 Oct 2022 00:28:34 +0900 Subject: [PATCH] add and fix translations in ko.json (#2752) --- .github/workflows/codeql-analysis.yml | 6 +- .github/workflows/deploy-netlify.yml | 6 +- .github/workflows/deploy-prod.yml | 7 +- .github/workflows/deploy-staging-netlify.yml | 2 + .github/workflows/tests.yml | 12 +- Dockerfile | 6 +- TRANSLATIONS.md | 6 +- firebase.json | 2 +- package.json | 7 +- packages/hoppscotch-app/.env.example | 3 +- .../hoppscotch-app/assets/scss/styles.scss | 18 +- packages/hoppscotch-app/gql-codegen.yml | 3 +- packages/hoppscotch-app/locales/en.json | 10 +- packages/hoppscotch-app/locales/ko.json | 40 +- packages/hoppscotch-app/package.json | 7 +- packages/hoppscotch-app/src/components.d.ts | 10 +- .../src/components/app/Footer.vue | 12 +- .../src/components/app/Header.vue | 56 +-- .../src/components/app/PaneLayout.vue | 11 +- .../src/components/app/Shortcuts.vue | 4 +- .../src/components/button/Primary.vue | 4 +- .../src/components/button/Secondary.vue | 4 +- .../src/components/collections/ChooseType.vue | 2 +- .../collections/teams/Collection.vue | 34 +- .../components/collections/teams/Folder.vue | 34 +- .../components/environments/ChooseType.vue | 151 +++++++ .../components/environments/ImportExport.vue | 107 ++++- .../src/components/environments/index.vue | 373 ++++++++++++------ .../environments/{ => my}/Details.vue | 40 +- .../environments/{ => my}/Environment.vue | 26 +- .../src/components/environments/my/index.vue | 121 ++++++ .../components/environments/teams/Details.vue | 340 ++++++++++++++++ .../environments/teams/Environment.vue | 176 +++++++++ .../components/environments/teams/index.vue | 177 +++++++++ .../src/components/firebase/Login.vue | 76 +--- .../src/components/history/index.vue | 9 +- .../src/components/http/BodyParameters.vue | 4 +- .../src/components/http/Request.vue | 7 +- .../src/components/http/TestResult.vue | 16 +- .../src/components/profile/Picture.vue | 12 +- .../src/components/profile/Shortcode.vue | 7 +- .../src/components/teams/Invite.vue | 5 +- .../src/components/teams/Team.vue | 9 +- .../src/helpers/RequestRunner.ts | 31 +- .../CreateDuplicateEnvironment.graphql | 8 + .../mutations/CreateTeamEnvironment.graphql | 7 + .../mutations/DeleteTeamEnvironment.graphql | 3 + .../mutations/UpdateTeamEnvironment.graphql | 7 + .../gql/queries/GetInviteDetails.graphql | 1 + .../gql/queries/GetTeamEnvironments.graphql | 10 + .../TeamEnvironmentCreated.graphql | 8 + .../TeamEnvironmentDeleted.graphql | 5 + .../TeamEnvironmentUpdated.graphql | 8 + .../backend/mutations/TeamEnvironment.ts | 69 ++++ .../editor/extensions/HoppEnvironment.ts | 10 + .../hoppscotch-app/src/helpers/fb/auth.ts | 27 +- .../src/helpers/teams/TeamEnvironment.ts | 10 + .../helpers/teams/TeamEnvironmentAdapter.ts | 238 +++++++++++ .../src/helpers/utils/EffectiveURL.ts | 2 +- .../hoppscotch-app/src/layouts/default.vue | 50 ++- .../src/newstore/environments.ts | 121 ++++-- .../src/newstore/localpersistence.ts | 25 +- .../hoppscotch-app/src/pages/join-team.vue | 3 +- packages/hoppscotch-app/src/pages/profile.vue | 11 +- packages/hoppscotch-app/src/vite-envs.d.ts | 1 + pnpm-lock.yaml | 136 ++++++- 66 files changed, 2292 insertions(+), 461 deletions(-) create mode 100644 packages/hoppscotch-app/src/components/environments/ChooseType.vue rename packages/hoppscotch-app/src/components/environments/{ => my}/Details.vue (91%) rename packages/hoppscotch-app/src/components/environments/{ => my}/Environment.vue (84%) create mode 100644 packages/hoppscotch-app/src/components/environments/my/index.vue create mode 100644 packages/hoppscotch-app/src/components/environments/teams/Details.vue create mode 100644 packages/hoppscotch-app/src/components/environments/teams/Environment.vue create mode 100644 packages/hoppscotch-app/src/components/environments/teams/index.vue create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/mutations/CreateDuplicateEnvironment.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/mutations/CreateTeamEnvironment.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/mutations/DeleteTeamEnvironment.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/mutations/UpdateTeamEnvironment.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/queries/GetTeamEnvironments.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/subscriptions/TeamEnvironmentCreated.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/subscriptions/TeamEnvironmentDeleted.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/gql/subscriptions/TeamEnvironmentUpdated.graphql create mode 100644 packages/hoppscotch-app/src/helpers/backend/mutations/TeamEnvironment.ts create mode 100644 packages/hoppscotch-app/src/helpers/teams/TeamEnvironment.ts create mode 100644 packages/hoppscotch-app/src/helpers/teams/TeamEnvironmentAdapter.ts diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7bbb9ca25..ab9c411a2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,7 +42,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: # Run extended queries including queries using machine learning queries: security-extended @@ -55,7 +55,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v2 # โ„น๏ธ Command-line programs to run using the OS shell. # ๐Ÿ“š https://git.io/JvXDl @@ -69,4 +69,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/deploy-netlify.yml b/.github/workflows/deploy-netlify.yml index 8369f31ae..3f39d3b84 100644 --- a/.github/workflows/deploy-netlify.yml +++ b/.github/workflows/deploy-netlify.yml @@ -12,15 +12,15 @@ jobs: - name: Checkout Repository uses: actions/checkout@v3 + - name: Setup Environment + run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env + - name: Setup and run pnpm install uses: pnpm/action-setup@v2.2.2 with: version: 7 run_install: true - - name: Setup Environment - run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env - - name: Build Site env: VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 8db04ea12..3a111d765 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -9,8 +9,11 @@ jobs: deploy_live_website: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: FirebaseExtended/action-hosting-deploy@v0 + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Deploy to Firebase (production) + uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: '${{ secrets.GITHUB_TOKEN }}' firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_POSTWOMAN_API }}' diff --git a/.github/workflows/deploy-staging-netlify.yml b/.github/workflows/deploy-staging-netlify.yml index f809efa38..9dd4681c5 100644 --- a/.github/workflows/deploy-staging-netlify.yml +++ b/.github/workflows/deploy-staging-netlify.yml @@ -15,6 +15,8 @@ jobs: - name: Setup and run pnpm install uses: pnpm/action-setup@v2.2.2 + env: + VITE_BACKEND_GQL_URL: ${{ secrets.STAGING_BACKEND_GQL_URL }} with: version: 7 run_install: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 55aa9a834..a037ea631 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,17 +15,23 @@ jobs: node-version: ["lts/*"] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Setup Environment + run: mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env + - name: Setup and run pnpm install uses: pnpm/action-setup@v2.2.2 with: version: 7 run_install: true + - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} cache: pnpm + - name: Run tests run: pnpm test diff --git a/Dockerfile b/Dockerfile index 8e2770e31..5f69b35b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,11 +17,13 @@ COPY . . RUN npm install -g pnpm +RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env + RUN pnpm i --unsafe-perm=true ENV HOST 0.0.0.0 EXPOSE 3000 -RUN mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env +RUN pnpm run generate -CMD ["pnpm", "run", "start", "--host", "0.0.0.0"] +CMD ["pnpm", "run", "start"] diff --git a/TRANSLATIONS.md b/TRANSLATIONS.md index 42efe7ca4..1e74805a2 100644 --- a/TRANSLATIONS.md +++ b/TRANSLATIONS.md @@ -11,10 +11,10 @@ if there is no existing translation, you can create a new one by following these 1. **[Fork the repository](https://github.com/hoppscotch/hoppscotch/fork).** 2. **Checkout the `i18n` branch for latest translations.** 3. **Create a new branch for your translation with base branch `i18n`.** -4. **Create target language file in the [`locales`](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/locales) directory.** -5. **Copy the contents of the source file [`locales/en.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/locales/en.json) to the target language file.** +4. **Create target language file in the [`/packages/hoppscotch-app/locales`](https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/locales) directory.** +5. **Copy the contents of the source file [`/packages/hoppscotch-app/locales/en.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/locales/en.json) to the target language file.** 6. **Translate the strings in the target language file.** -7. **Add your language entry to [`languages.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/languages.json).** +7. **Add your language entry to [`/packages/hoppscotch-app/languages.json`](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-app/languages.json).** 8. **Save & commit changes.** 9. **Send a pull request.** diff --git a/firebase.json b/firebase.json index 4b823a6f3..bf0af746e 100644 --- a/firebase.json +++ b/firebase.json @@ -5,7 +5,7 @@ }, "hosting": { "predeploy": [ - "cd packages/hoppscotch-app && mv .env.example .env && cd ../.. && npm install -g pnpm && pnpm i && pnpm run generate" + "mv packages/hoppscotch-app/.env.example packages/hoppscotch-app/.env && npm install -g pnpm && pnpm i && pnpm run generate" ], "public": "packages/hoppscotch-app/dist", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], diff --git a/package.json b/package.json index ae16cf4af..79b40525c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hoppscotch-app", - "version": "3.0.0", + "version": "3.0.1", "description": "Open source API development ecosystem", "author": "Hoppscotch (support@hoppscotch.io)", "private": true, @@ -10,7 +10,7 @@ "prepare": "husky install", "dev": "pnpm -r do-dev", "generate": "pnpm -r do-build-prod", - "start": "pnpm -r do-prod-start", + "start": "http-server packages/hoppscotch-app/dist -p 3000", "lint": "pnpm -r do-lint", "typecheck": "pnpm -r do-typecheck", "lintfix": "pnpm -r do-lintfix", @@ -27,6 +27,7 @@ "devDependencies": { "@commitlint/cli": "^16.2.3", "@commitlint/config-conventional": "^16.2.1", - "@types/node": "^17.0.24" + "@types/node": "^17.0.24", + "http-server": "^14.1.1" } } diff --git a/packages/hoppscotch-app/.env.example b/packages/hoppscotch-app/.env.example index c5bd6cbba..673d3505c 100644 --- a/packages/hoppscotch-app/.env.example +++ b/packages/hoppscotch-app/.env.example @@ -14,8 +14,9 @@ VITE_MESSAGING_SENDER_ID=421993993223 VITE_APP_ID=1:421993993223:web:ec0baa8ee8c02ffa1fc6a2 VITE_MEASUREMENT_ID=G-BBJ3R80PJT -# Base URL +# Base URLs VITE_BASE_URL=https://hoppscotch.io +VITE_SHORTCODE_BASE_URL=https://hopp.sh # Backend URLs VITE_BACKEND_GQL_URL=https://api.hoppscotch.io/graphql diff --git a/packages/hoppscotch-app/assets/scss/styles.scss b/packages/hoppscotch-app/assets/scss/styles.scss index d0766ad52..47d63df69 100644 --- a/packages/hoppscotch-app/assets/scss/styles.scss +++ b/packages/hoppscotch-app/assets/scss/styles.scss @@ -122,6 +122,7 @@ a { .cm-tooltip { .tippy-box { @apply fixed; + @apply inline-flex; @apply -mt-6; } } @@ -134,7 +135,8 @@ a { @apply rounded; @apply truncate; @apply shadow; - @apply leading-body; + @apply leading-normal; + @apply items-center; font-size: 86%; kbd { @@ -152,6 +154,13 @@ a { .tippy-svg-arrow svg { @apply fill-tooltip; } + + .env-icon { + @apply inline-flex; + @apply items-center; + @apply mr-1; + @apply text-accentDark; + } } .tippy-box[data-theme="popover"] { @@ -163,7 +172,7 @@ a { @apply text-secondary text-body; @apply p-2; @apply shadow-lg; - @apply leading-body; + @apply leading-normal; @apply border border-dividerDark; @apply focus: outline-none; scroll-behavior: smooth; @@ -455,6 +464,7 @@ pre.ace_editor { @apply px-1; @apply border border-dividerDark; @apply shadow-sm; + @apply Content-Type in Headers", + "new": "์ƒˆ๋กœ์šด ์š”์ฒญ", + "override": "๋ฎ์–ด์“ฐ๊ธฐ", + "override_help": "ํ—ค๋”์— Content-Type๋ฅผ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.", "overriden": "Overridden", "parameter_list": "์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ๋ชฉ๋ก", "parameters": "ํŒŒ๋ผ๋ฏธํ„ฐ", @@ -381,7 +381,7 @@ "type": "์š”์ฒญ ์œ ํ˜•", "url": "URL", "variables": "๋ณ€์ˆ˜", - "view_my_links": "View my links" + "view_my_links": "๋‚ด ๋งํฌ ๋ณด๊ธฐ" }, "response": { "body": "์‘๋‹ต ๋ณธ๋ฌธ", @@ -517,7 +517,7 @@ }, "show": { "code": "์ฝ”๋“œ ํ‘œ์‹œ", - "collection": "Expand Collection Panel", + "collection": "๋ชจ์Œ์ง‘ ๋ณด๊ธฐ", "more": "์ž์„ธํžˆ ๋ณด๊ธฐ", "sidebar": "์‚ฌ์ด๋“œ๋ฐ” ํ‘œ์‹œ" }, @@ -541,9 +541,9 @@ "connected": "์—ฐ๊ฒฐ๋จ", "connected_to": "{name}์— ์—ฐ๊ฒฐ๋จ", "connecting_to": "{name}์— ์—ฐ๊ฒฐ ์ค‘...", - "connection_error": "Failed to connect", - "connection_failed": "Connection failed", - "connection_lost": "Connection lost", + "connection_error": "์—ฐ๊ฒฐ ์‹คํŒจ", + "connection_failed": "์—ฐ๊ฒฐ ์‹คํŒจ", + "connection_lost": "์—ฐ๊ฒฐ ๋Š๊น€", "copied_to_clipboard": "ํด๋ฆฝ๋ณด๋“œ์— ๋ณต์‚ฌ๋จ", "deleted": "์‚ญ์ œ๋จ", "deprecated": "๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š์Œ", diff --git a/packages/hoppscotch-app/package.json b/packages/hoppscotch-app/package.json index d066bb8d0..a1cb9a296 100644 --- a/packages/hoppscotch-app/package.json +++ b/packages/hoppscotch-app/package.json @@ -1,22 +1,21 @@ { "name": "hoppscotch-app", "private": true, - "version": "3.0.0", + "version": "3.0.1", "scripts": { "dev": "pnpm exec npm-run-all -p -l dev:*", "dev:vite": "vite", - "dev:gql-codegen": "graphql-codegen --config gql-codegen.yml --watch", + "dev:gql-codegen": "graphql-codegen --require dotenv/config --config gql-codegen.yml --watch", "build": "node --max_old_space_size=16384 ./node_modules/vite/bin/vite.js build", "lint": "eslint src --ext .ts,.js,.vue --ignore-path .gitignore .", "prod-lint": "cross-env HOPP_LINT_FOR_PROD=true pnpm run lint", "lintfix": "eslint --fix src --ext .ts,.js,.vue --ignore-path .gitignore .", "generate": "pnpm run build", "preview": "vite preview", - "gql-codegen": "graphql-codegen --config gql-codegen.yml", + "gql-codegen": "graphql-codegen --require dotenv/config --config gql-codegen.yml", "postinstall": "pnpm run gql-codegen", "do-dev": "pnpm run dev", "do-build-prod": "pnpm run build", - "do-prod-start": "pnpm run preview", "do-lint": "pnpm run prod-lint", "do-typecheck": "pnpm run lint", "do-lintfix": "pnpm run lintfix" diff --git a/packages/hoppscotch-app/src/components.d.ts b/packages/hoppscotch-app/src/components.d.ts index e31270467..61eff4281 100644 --- a/packages/hoppscotch-app/src/components.d.ts +++ b/packages/hoppscotch-app/src/components.d.ts @@ -55,9 +55,14 @@ declare module '@vue/runtime-core' { CollectionsTeamsFolder: typeof import('./components/collections/teams/Folder.vue')['default'] CollectionsTeamsRequest: typeof import('./components/collections/teams/Request.vue')['default'] Environments: typeof import('./components/environments/index.vue')['default'] - EnvironmentsDetails: typeof import('./components/environments/Details.vue')['default'] - EnvironmentsEnvironment: typeof import('./components/environments/Environment.vue')['default'] + EnvironmentsChooseType: typeof import('./components/environments/ChooseType.vue')['default'] EnvironmentsImportExport: typeof import('./components/environments/ImportExport.vue')['default'] + EnvironmentsMy: typeof import('./components/environments/my/index.vue')['default'] + EnvironmentsMyDetails: typeof import('./components/environments/my/Details.vue')['default'] + EnvironmentsMyEnvironment: typeof import('./components/environments/my/Environment.vue')['default'] + EnvironmentsTeams: typeof import('./components/environments/teams/index.vue')['default'] + EnvironmentsTeamsDetails: typeof import('./components/environments/teams/Details.vue')['default'] + EnvironmentsTeamsEnvironment: typeof import('./components/environments/teams/Environment.vue')['default'] FirebaseLogin: typeof import('./components/firebase/Login.vue')['default'] FirebaseLogout: typeof import('./components/firebase/Logout.vue')['default'] GraphqlAuthorization: typeof import('./components/graphql/Authorization.vue')['default'] @@ -102,6 +107,7 @@ declare module '@vue/runtime-core' { IconLucideLoader: typeof import('~icons/lucide/loader')['default'] IconLucideMinus: typeof import('~icons/lucide/minus')['default'] IconLucideSearch: typeof import('~icons/lucide/search')['default'] + IconLucideUser: typeof import('~icons/lucide/user')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default'] LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default'] LensesHeadersRendererEntry: typeof import('./components/lenses/HeadersRendererEntry.vue')['default'] diff --git a/packages/hoppscotch-app/src/components/app/Footer.vue b/packages/hoppscotch-app/src/components/app/Footer.vue index 7eb35e9b0..b9f1f0ba5 100644 --- a/packages/hoppscotch-app/src/components/app/Footer.vue +++ b/packages/hoppscotch-app/src/components/app/Footer.vue @@ -38,7 +38,7 @@ interactive trigger="click" theme="popover" - :on-shown="() => tippyActions.focus()" + :on-shown="() => tippyActions!.focus()" > { } // Template refs -const tippyActions = ref(null) -const documentation = ref(null) -const shortcuts = ref(null) -const chat = ref(null) +const tippyActions = ref(null) +const documentation = ref(null) +const shortcuts = ref(null) +const chat = ref(null) diff --git a/packages/hoppscotch-app/src/components/app/Header.vue b/packages/hoppscotch-app/src/components/app/Header.vue index afd44070f..6922c04bd 100644 --- a/packages/hoppscotch-app/src/components/app/Header.vue +++ b/packages/hoppscotch-app/src/components/app/Header.vue @@ -71,8 +71,15 @@ theme: 'tooltip', }" :url="currentUser.photoURL" - :alt="currentUser.displayName" - :title="currentUser.displayName" + :alt=" + currentUser.displayName || + t('profile.default_hopp_displayname') + " + :title=" + currentUser.displayName || + currentUser.email || + t('profile.default_hopp_displayname') + " indicator :indicator-styles=" network.isOnline ? 'bg-green-500' : 'bg-red-500' @@ -81,8 +88,12 @@
- {{ currentUser.displayName }} + {{ + currentUser.displayName || + t("profile.default_hopp_displayname") + }} {{ currentUser.email }} @@ -142,7 +156,7 @@ diff --git a/packages/hoppscotch-app/src/components/environments/ImportExport.vue b/packages/hoppscotch-app/src/components/environments/ImportExport.vue index 48cb463a9..0eaefd97b 100644 --- a/packages/hoppscotch-app/src/components/environments/ImportExport.vue +++ b/packages/hoppscotch-app/src/components/environments/ImportExport.vue @@ -12,7 +12,7 @@ interactive trigger="click" theme="popover" - :on-shown="() => tippyActions.focus()" + :on-shown="() => tippyActions!.focus()" > -
- -
+ + -
-
-
-
- - + + +
-
- - - {{ t("empty.environments") }} - - -
- - + diff --git a/packages/hoppscotch-app/src/components/environments/Details.vue b/packages/hoppscotch-app/src/components/environments/my/Details.vue similarity index 91% rename from packages/hoppscotch-app/src/components/environments/Details.vue rename to packages/hoppscotch-app/src/components/environments/my/Details.vue index 5cb8ff41d..3e4c6aa34 100644 --- a/packages/hoppscotch-app/src/components/environments/Details.vue +++ b/packages/hoppscotch-app/src/components/environments/my/Details.vue @@ -104,15 +104,9 @@ - + @@ -120,7 +114,7 @@ diff --git a/packages/hoppscotch-app/src/components/environments/teams/Details.vue b/packages/hoppscotch-app/src/components/environments/teams/Details.vue new file mode 100644 index 000000000..8c838c59f --- /dev/null +++ b/packages/hoppscotch-app/src/components/environments/teams/Details.vue @@ -0,0 +1,340 @@ + + + diff --git a/packages/hoppscotch-app/src/components/environments/teams/Environment.vue b/packages/hoppscotch-app/src/components/environments/teams/Environment.vue new file mode 100644 index 000000000..cc4796451 --- /dev/null +++ b/packages/hoppscotch-app/src/components/environments/teams/Environment.vue @@ -0,0 +1,176 @@ + + + diff --git a/packages/hoppscotch-app/src/components/environments/teams/index.vue b/packages/hoppscotch-app/src/components/environments/teams/index.vue new file mode 100644 index 000000000..f37b9a386 --- /dev/null +++ b/packages/hoppscotch-app/src/components/environments/teams/index.vue @@ -0,0 +1,177 @@ + + + diff --git a/packages/hoppscotch-app/src/components/firebase/Login.vue b/packages/hoppscotch-app/src/components/firebase/Login.vue index cf84bda9d..8bcb6d92b 100644 --- a/packages/hoppscotch-app/src/components/firebase/Login.vue +++ b/packages/hoppscotch-app/src/components/firebase/Login.vue @@ -129,7 +129,6 @@ import { setProviderInfo, currentUser$, signInWithEmail, - linkWithFBCredential, linkWithFBCredentialFromAuthError, getGithubCredentialFromResult, } from "~/helpers/fb/auth" @@ -191,32 +190,11 @@ export default defineComponent({ this.showLoginSuccess() } catch (e) { console.error(e) - // An error happened. - if ( - (e as any).code === "auth/account-exists-with-different-credential" - ) { - // Step 2. - // User's email already exists. - // The pending Google credential. - const pendingCred = (e as any).credential - this.toast.info(`${this.t("auth.account_exists")}`, { - duration: 0, - closeOnSwipe: false, - action: { - text: `${this.t("action.yes")}`, - onClick: async (_, toastObject) => { - const { user } = await signInUserWithGithub() - await linkWithFBCredential(user, pendingCred) - - this.showLoginSuccess() - - toastObject.goAway(0) - }, - }, - }) - } else { - this.toast.error(`${this.t("error.something_went_wrong")}`) - } + /* + A auth/account-exists-with-different-credential Firebase error wont happen between Google and any other providers + Seems Google account overwrites accounts of other providers https://github.com/firebase/firebase-android-sdk/issues/25 + */ + this.toast.error(`${this.t("error.something_went_wrong")}`) } this.signingInWithGoogle = false @@ -228,27 +206,22 @@ export default defineComponent({ const result = await signInUserWithGithub() const credential = getGithubCredentialFromResult(result)! const token = credential.accessToken - setProviderInfo(result.providerId!, token!) this.showLoginSuccess() } catch (e) { console.error(e) - // An error happened. + // This user's email is already present in Firebase but with other providers, namely Google or Microsoft if ( (e as any).code === "auth/account-exists-with-different-credential" ) { - // Step 2. - // User's email already exists. this.toast.info(`${this.t("auth.account_exists")}`, { duration: 0, closeOnSwipe: false, action: { text: `${this.t("action.yes")}`, onClick: async (_, toastObject) => { - const { user } = await signInUserWithGoogle() - await linkWithFBCredentialFromAuthError(user, e) - + await linkWithFBCredentialFromAuthError(e) this.showLoginSuccess() toastObject.goAway(0) @@ -270,32 +243,15 @@ export default defineComponent({ this.showLoginSuccess() } catch (e) { console.error(e) - // An error happened. - if ( - (e as any).code === "auth/account-exists-with-different-credential" - ) { - // Step 2. - // User's email already exists. - // The pending Microsoft credential. - const pendingCred = (e as any).credential - this.toast.info(`${this.t("auth.account_exists")}`, { - duration: 0, - closeOnSwipe: false, - action: { - text: `${this.t("action.yes")}`, - onClick: async (_, toastObject) => { - const { user } = await signInUserWithGithub() - await linkWithFBCredential(user, pendingCred) - - this.showLoginSuccess() - - toastObject.goAway(0) - }, - }, - }) - } else { - this.toast.error(`${this.t("error.something_went_wrong")}`) - } + /* + A auth/account-exists-with-different-credential Firebase error wont happen between MS with Google or Github + If a Github account exists and user then logs in with MS email we get a "Something went wrong toast" and console errors and MS replaces GH as only provider. + The error messages are as follows: + FirebaseError: Firebase: Error (auth/popup-closed-by-user). + @firebase/auth: Auth (9.6.11): INTERNAL ASSERTION FAILED: Pending promise was never set + They may be related to https://github.com/firebase/firebaseui-web/issues/947 + */ + this.toast.error(`${this.t("error.something_went_wrong")}`) } this.signingInWithMicrosoft = false diff --git a/packages/hoppscotch-app/src/components/history/index.vue b/packages/hoppscotch-app/src/components/history/index.vue index 4f9245e67..aecc1bc94 100644 --- a/packages/hoppscotch-app/src/components/history/index.vue +++ b/packages/hoppscotch-app/src/components/history/index.vue @@ -56,7 +56,7 @@ /> return ( !!input.updatedOn && (filterText.value.length === 0 || - deepCheckForRegex(input, new RegExp(filterText.value, "gi"))) + deepCheckForRegex( + input, + new RegExp(escapeRegExp(filterText.value), "gi") + )) ) } ), diff --git a/packages/hoppscotch-app/src/components/http/BodyParameters.vue b/packages/hoppscotch-app/src/components/http/BodyParameters.vue index 26c7367bc..11b9c3a4c 100644 --- a/packages/hoppscotch-app/src/components/http/BodyParameters.vue +++ b/packages/hoppscotch-app/src/components/http/BodyParameters.vue @@ -250,7 +250,7 @@ watch( workingParams.value, A.filterMap( flow( - O.fromPredicate((e) => e.entry.key !== ""), + O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile), O.map((e) => e.entry) ) ) @@ -271,7 +271,7 @@ watch(workingParams, (newWorkingParams) => { newWorkingParams, A.filterMap( flow( - O.fromPredicate((e) => e.entry.key !== ""), + O.fromPredicate((e) => e.entry.key !== "" || e.entry.isFile), O.map((e) => e.entry) ) ) diff --git a/packages/hoppscotch-app/src/components/http/Request.vue b/packages/hoppscotch-app/src/components/http/Request.vue index 72a82d8db..0f930873b 100644 --- a/packages/hoppscotch-app/src/components/http/Request.vue +++ b/packages/hoppscotch-app/src/components/http/Request.vue @@ -452,17 +452,20 @@ const copyRequest = async () => { } const copyShareLink = (shareLink: string) => { + const link = `${ + import.meta.env.VITE_SHORTCODE_BASE_URL ?? "https://hopp.sh" + }/r${shareLink}` if (navigator.share) { const time = new Date().toLocaleTimeString() const date = new Date().toLocaleDateString() navigator.share({ title: "Hoppscotch", text: `Hoppscotch โ€ข Open source API development ecosystem at ${time} on ${date}`, - url: `https://hopp.sh/r${shareLink}`, + url: link, }) } else { copyLinkIcon.value = IconCheck - copyToClipboard(`https://hopp.sh/r${shareLink}`) + copyToClipboard(link) toast.success(`${t("state.copied_to_clipboard")}`) } } diff --git a/packages/hoppscotch-app/src/components/http/TestResult.vue b/packages/hoppscotch-app/src/components/http/TestResult.vue index c3d5d2317..29a459682 100644 --- a/packages/hoppscotch-app/src/components/http/TestResult.vue +++ b/packages/hoppscotch-app/src/components/http/TestResult.vue @@ -194,7 +194,7 @@ class="my-4" /> - { }) const selectedEnvironmentIndex = useStream( - selectedEnvIndex$, - -1, - setCurrentEnvironment + selectedEnvironmentIndex$, + { type: "NO_ENV_SELECTED" }, + setSelectedEnvironmentIndex ) const globalEnvVars = useReadonlyStream(globalEnv$, []) as Ref< @@ -275,7 +275,9 @@ const globalEnvVars = useReadonlyStream(globalEnv$, []) as Ref< }> > -const noEnvSelected = computed(() => selectedEnvironmentIndex.value === -1) +const noEnvSelected = computed( + () => selectedEnvironmentIndex.value.type === "NO_ENV_SELECTED" +) const globalHasAdditions = computed(() => { if (!testResults.value?.envDiff.selected.additions) return false diff --git a/packages/hoppscotch-app/src/components/profile/Picture.vue b/packages/hoppscotch-app/src/components/profile/Picture.vue index 12d2ea121..3e958bd28 100644 --- a/packages/hoppscotch-app/src/components/profile/Picture.vue +++ b/packages/hoppscotch-app/src/components/profile/Picture.vue @@ -16,9 +16,13 @@ v-else class="absolute flex items-center justify-center object-cover object-center transition bg-primaryDark text-accentContrast" :class="[`rounded-${rounded}`, `w-${size} h-${size}`]" - :style="`background-color: ${toHex(initial)}`" + :style="`background-color: ${initial ? toHex(initial) : '#480000'}`" > - {{ initial.charAt(0).toUpperCase() }} + + +