Compare commits

...

318 Commits

Author SHA1 Message Date
Gusram
c26c33ef63 Merge branch 'main' of github.com:hoppscotch/hoppscotch 2024-12-04 16:39:53 +08:00
James George
a08c6f6b3e chore(cli): drop Node.js v18 support (#4583) 2024-12-02 21:49:46 +05:30
Anwarul Islam
e2e769db71 chore: collection runner enhancements and ui clean up (#4564)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-28 17:55:00 +05:30
Akash K
d2401d6ceb chore: add inspection warning for proxy interceptor with binary data (#4569) 2024-11-28 13:21:29 +05:30
jamesgeorge007
69b94886a6 chore: bump version to 2024.11.0 2024-11-27 17:44:55 +05:30
Shreyas
22515582c5 chore: show warning for interceptors not supporting binary data (#4566)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-27 16:53:30 +05:30
Akash K
a66771bbd0 feat: add autocomplete for multipart/formdata individual content types (#4565) 2024-11-27 15:20:28 +05:30
Akash K
9cc1e47b39 fix: show file chip for the selected file in binary body (#4562)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-27 15:05:35 +05:30
Mir Arif Hasan
5dccce39b4 feat: env file sync with infra config (#4545) 2024-11-26 19:52:51 +05:30
Akash K
80d7dd046d feat: support for binary body (#4466)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-26 19:48:01 +05:30
Joel Jacob Stephen
37bf0567ea refactor(sh-admin): updated documentation links in dashboard (#4560)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-26 19:13:08 +05:30
Anwarul Islam
e8ed938b4c feat: collection runner (#3600)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-11-26 15:56:09 +05:30
jamesgeorge007
f091c1bdc5 chore: remove reference to ReqType enum
The `ReqType` enum isn't available in the cloud context since the BE only deals with teams and GQL isn't supported under the same, hence there isn't a use case to differentiate between request types from the cloud BE context.
2024-11-26 12:30:54 +05:30
Mir Arif Hasan
c9fb5bf45c fix: return 0 complexity for introspection fields (#4549) 2024-11-25 19:25:40 +05:30
Nivedin
b81cf87fd6 chore: update response original request version (#4555)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-25 18:34:03 +05:30
Akash K
2721fd9bf6 chore: continue openapi imports on error with a partial import (#4535) 2024-11-25 12:50:20 +05:30
Akash K
b706a43d2e feat: collection import summaries (#4489)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-25 11:42:26 +05:30
Akash K
c74c42ebaf feat: add individual content types for formadata (#4550)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-24 19:36:10 +05:30
shobanrajm
b78cd57884 feat: collection CLI runner with iterations and data feed (#4475)
Co-authored-by: Shoban <mshobanr@ford.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-22 22:38:51 +05:30
James George
e040f44245 fix: resolve GraphQL collection tree and tab dissociation issues (#4537) 2024-11-22 22:31:00 +05:30
Joel Jacob Stephen
73f3e54c00 feat: introducing user guidance and error management helpers in admin dashboard (#4548) 2024-11-22 22:22:34 +05:30
jamesgeorge007
dad15133f4 chore: resolve lint errors 2024-11-21 17:30:52 +05:30
jamesgeorge007
c9ac305b95 chore: merge hoppscotch/main into hoppscotch/next 2024-11-13 14:25:47 +05:30
Akash K
1dc0cee536 feat: show login dialogue for features behind login (#4431) 2024-11-13 12:41:39 +05:30
jamesgeorge007
908f936f50 chore: bump version to 2024.10.2 2024-11-12 22:35:30 +05:30
Anwarul Islam
e1fbe68796 hotfix: graphql connection error handler (#4523)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-11-12 21:15:48 +05:30
Shreyas
3de3209d5e fix(cli): use os-specific invalid paths for tests (#4518) 2024-11-07 13:26:24 +05:30
Andrew Bastin
80dbe8c8fe fix: clicking on run query without connecting connects without docs polling (#4516) 2024-11-07 12:28:04 +05:30
Andrew Bastin
e87ec8c026 chore: bump version to 2024.10.1 2024-11-06 20:50:08 +05:30
jamesgeorge007
3fc43cc9b9 test: bump timeout
Specify timeout at the CLI e2e test suite level.
2024-11-06 19:22:54 +05:30
Shreyas
ecf5d9f6d2 fix(agent): propagate default values to persistent store (#4511) 2024-11-06 15:00:52 +05:30
James George
6a9d056dee fix(selfhost-desktop): specify Digest Auth support for Proxy interceptor (#4505) 2024-11-06 11:46:38 +05:30
Mir Arif Hasan
d3999b9510 chore: user deletetion if not solo team owner (#4508) (HSB-497) 2024-11-05 21:18:23 +05:30
Andrew Bastin
6ad2b5a3bb fix: correct broken codemirror-lang-graphql in node 22 (#4514) 2024-11-05 16:06:39 +05:30
James George
223dd25788 chore: introduce supportsDigestAuth field at the interceptor service level (#4498) 2024-10-30 21:44:14 +05:30
Shreyas
8643819926 chore(agent): bump version to 0.1.2 (#4497)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-10-30 21:11:32 +05:30
jamesgeorge007
c3518cf678 chore: add showInterceptorWarningForDigestAuth field under platformFeatureFlags
Introduce a new platform-level feature flag indicating whether to display a warning via the inspector regarding supported interceptor alongside Digest Auth.
2024-10-30 18:28:15 +05:30
James George
8ac934599a fix: process headers correctly in Digest Auth and other updates (#4494) 2024-10-30 17:12:19 +05:30
Anwarul Islam
1236e6b719 fix: scrollbar appearing on digest auth input fields and other improvements (#4492)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-29 20:35:13 +05:30
Andrew Bastin
108315d1b4 chore: bump version to 24.10.0 2024-10-29 17:25:37 +05:30
Shreyas
75bac21b46 feat(desktop): add CA cert and HTTP proxy support for native interceptor (#4491) 2024-10-29 17:13:32 +05:30
Anwarul Islam
4b2f04df82 feat: add support for Digest authorization (#4339)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-10-29 12:34:40 +05:30
Andrew Bastin
c1bc74635f feat: ability for aio in sub-path access configurations to specify alternate ports (#4480) 2024-10-29 00:05:52 +05:30
Mir Arif Hasan
161e598809 feat: user workspace stats api added (#4467) (HSB-495)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-10-28 23:53:53 +05:30
Pranay Pandey
936c97b53a feat: add button to export test results as json (#4419)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-10-28 21:23:21 +05:30
Anwarul Islam
20c4767dce fix: trailing comma makes json invalid (#4416)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-28 21:04:08 +05:30
shobanrajm
84f0f478d4 fix: postman env variables are to be imported as secrets (#4474)
Co-authored-by: Shoban <mshobanr@ford.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-28 16:58:12 +05:30
Nivedin
3722be0de1 fix: codegen breaking in example tab and minor UI updates (#4478)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-28 16:09:40 +05:30
Raphael Hehl
479cbfe1c8 chore: improve German translation (#4461)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-10-25 14:17:22 +05:30
subframe7536
0be7836d40 feat(i18n/cn): update CN translation (#4457) 2024-10-25 14:09:48 +05:30
Sawako
c743298c0d fix(i18n/es): fixed translation errors and translated missing keys (#4455)
Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com>
2024-10-25 13:50:25 +05:30
Nivedin
c72ded2251 chore: environment highlight colour schema update (#4464)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-25 13:01:38 +05:30
Shreyas
8dc471f33f feat: hoppscotch-relay for request forwarding (#4471) 2024-10-25 01:36:15 +05:30
Shreyas
58407ae9dd feat(ci): portable and installer build workflow for hoppscotch-agent (#4472) 2024-10-25 01:29:10 +05:30
jamesgeorge007
8e8073424d fix: syntax highlighting in editor views
Pin `@codemirror/view` to `v6.25.1`.
2024-10-24 22:14:05 +05:30
Shreyas
bd7bd97809 feat: portable version of hoppscotch-agent (#4468) 2024-10-24 15:46:20 +05:30
Shreyas
f52219bb95 feat: openssl based hoppscotch-relay for request forwarding (#4442) 2024-10-24 14:20:51 +05:30
Andrew Bastin
deedf35bf0 fix: type errors in tab service 2024-10-24 04:02:07 +05:30
James George
7aa43232cc chore: bump dependencies (#4444) 2024-10-24 03:25:55 +05:30
Shreyas
7dfb06c137 chore(desktop): major version dependency bumps (#4443) 2024-10-23 21:59:18 +05:30
Shreyas
aef11e329f chore(agent): major version dependency bump (#4446) 2024-10-23 21:22:19 +05:30
Joel Jacob Stephen
79aefed322 chore(sh-admin): bump dependencies (#4433)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-23 18:51:00 +05:30
Pranay Pandey
cf0978bce0 feat: add the ability to configure query params encoding for requests (#4412)
Co-authored-by: nivedin <nivedinp@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-23 18:44:21 +05:30
Joel Jacob Stephen
0e00eeb950 feat: introducing ability to set custom collection import size limit (#4440) 2024-10-23 18:34:40 +05:30
James George
f10fac9f44 fix: resolve empty state image correctly in profile page (#4456) 2024-10-22 22:04:18 +05:30
xLansang
b6fba6f50e fix: prevent keypress actions in the loading state (#4462)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-22 22:00:30 +05:30
jamesgeorge007
cd1f7bb6b7 chore: merge hoppscotch/main into hoppscotch/next 2024-10-21 14:56:17 +05:30
Andrew Bastin
9da5f63e70 chore: bump version to 2024.9.3 2024-10-17 16:58:51 +05:30
Andrew Bastin
88295cc6e4 fix: i18n strings not falling back correctly (#4447) 2024-10-17 16:27:17 +05:30
Mir Arif Hasan
fa59dc9faf fix: downgrade eslint related package (#4445) (HSB-494) 2024-10-17 15:59:02 +05:30
Mir Arif Hasan
2a95ee8d19 feat: hoppscotch-backend dependency update (#4426) (HSB-489) 2024-10-17 03:16:54 +05:30
Andrew Bastin
28727cd6c2 chore: bump version 2024.9.2 2024-10-14 21:19:45 +05:30
Joel Jacob Stephen
30079b842d fix(sh-admin): resolve i18n strings correctly on error toast with remove member action (#4429) 2024-10-11 20:47:10 +05:30
Akash K
79bf0d0363 fix: add full request as request context (#4422)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-10 18:11:58 +05:30
Dmitry
bb21b13471 fix: resolve personal environments correctly while editing via quick peek (#4384)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-10-10 17:15:54 +05:30
Andrew Bastin
cda1ed5f94 chore: bump version to 2024.9.1 2024-10-05 21:05:11 +05:30
Andrew Bastin
8e91078f43 fix: comments being stripped out of json request body (#4402) 2024-10-04 23:41:40 +05:30
Andrew Bastin
fdb250a608 chore: bump agent version to 0.1.1 2024-10-04 13:00:32 +05:30
Andrew Bastin
771f57841a chore: update public key 2024-10-03 22:47:34 +05:30
Andrew Bastin
025a8fc0cb chore: update agent updater config 2024-10-03 22:20:45 +05:30
Andrew Bastin
cd25ba7d92 chore: agent should emit updater artifacts 2024-10-03 21:55:34 +05:30
Andrew Bastin
f75900ed30 feat: hoppscotch agent and agent interceptor (#4396)
Co-authored-by: CuriousCorrelation <CuriousCorrelation@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-03 20:26:30 +05:30
shuaixr
0f27cf2d49 fix: correct SVG rendering issue by adjusting blob type (#3565) (#4397) 2024-10-03 19:04:45 +05:30
Anwarul Islam
a283edec6e fix: prettify JSON request body with comments (#4399)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-10-03 18:56:01 +05:30
Nivedin
8535004023 fix: add fallback for type field in restTabState schema (#4398) 2024-10-03 18:24:07 +05:30
jamesgeorge007
ebb7eeade4 fix: show loading spinner while submitting prompt generation feedback 2024-10-01 17:07:30 +05:30
Akash K
c90aaec65d fix: update copy + improve ux on ai experiments (#4393)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-10-01 16:17:31 +05:30
Nivedin
1a7860035f fix: request variable list item remove bug (#4392) 2024-10-01 14:12:29 +05:30
Anwarul Islam
dcdcdeb1db feat: support for comments on application/json request body (#4335) 2024-10-01 14:08:01 +05:30
jamesgeorge007
3d9dc36d77 chore: bump version to 2024.9.0 2024-10-01 13:10:52 +05:30
jamesgeorge007
9e6b8b6e40 chore: remove $nowISO from pre-defined variables list 2024-10-01 12:50:15 +05:30
Akash K
0b5a424b69 feat: modify body with ai & feedback on ai requests hoppscotch-common bindings (#4386)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-30 22:21:14 +05:30
James George
5e9f8743d4 feat: extend duplicate collection to personal workspace in SH (#4368) 2024-09-30 21:20:19 +05:30
Nivedin
58857be650 feat: save api responses (#4382)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-30 19:06:53 +05:30
Akash K
fdf5bf34ed feat: support import collections between workspaces (#4377)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-30 18:42:09 +05:30
Kishan Jadav
e4d9f82a75 feat: support for predefined variables (#3886)
Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-30 14:33:40 +05:30
Akash K
db8cf229ac chore: make client secret optional across grant types (#4363)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-27 17:20:26 +05:30
Balu Babu
fc37196354 chore: export single User/Team Collection (#4359)
* chore: added query to export single TeamCollection data

* chore: added query to export single UserCollection data

* chore: fixed typo

* chore: completed requested changes in PR review
2024-09-27 16:55:47 +05:30
Anwarul Islam
421e6b76c9 feat: add generate data schema option in spotlight searcher (#4356) 2024-09-27 16:47:55 +05:30
Balu Babu
062b0fdda0 chore: addition of new GQL subscription for UserCollection duplication (#4358)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-26 22:54:44 +05:30
James George
5742968eda feat: duplicate global environment under team workspaces (#4334)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-09-25 18:14:55 +05:30
Shreyas
7ab1a0a6e3 fix(desktop): content security policy config preventing app launch (#4365)
fix(desktop): content security policy config preventing desktop app launch
2024-09-23 17:02:22 +05:30
Palak Chopra
bfe3b3a9c3 refactor: make global environment a versioned entity (#4216)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-23 17:01:14 +05:30
HelixY2J
1701961335 feat: add loading state for import actions (#4217)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-23 17:00:48 +05:30
Andrew Bastin
e9e1366cc8 chore: revert vite-plugin-pages and vite-plugin-pwa versions 2024-09-20 14:20:14 +05:30
Andrew Bastin
412de9a44e chore: bump lockfiles 2024-09-19 20:47:24 +05:30
Akash K
626b5fea7f chore: preemptly update pwa settings to avoid missing files in the service worker cache (#4344)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-09-19 19:09:14 +05:30
Dmitry
5a06e52389 feat(filename): added filename in download functional (#4329)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-09-19 18:23:40 +05:30
Nivedin
875e2fae97 fix: workspace environment list reset (#4361) 2024-09-19 18:17:07 +05:30
Andrew Bastin
c2e9e3dfe2 chore: bump version to 2024.8.3 2024-09-19 18:04:34 +05:30
Andrew Bastin
9aa1858642 chore: bump vulnerable dependencies 2024-09-19 18:02:18 +05:30
Shreyas
e554bde64d feat(desktop): faster launch with resolved desktop app startup issues (#4357) 2024-09-18 18:24:26 +05:30
jcgurango
cf2b1b50fa fix: preserve description while toggling field enabled status (#4340)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-09-11 19:06:49 +05:30
Andrew Bastin
7f18a847fa chore: update vulnerable dependencies 2024-09-11 14:21:31 +05:30
Andrew Bastin
2bc46ed6cb chore: bump version to 2024.8.2 2024-09-11 13:45:19 +05:30
Dmitry
35cc8c247d fix(status): fix import status message (#4325)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2024-09-11 13:05:05 +05:30
Nivedin
53839e1091 fix: close context menu when no text is selected (#4337) 2024-09-11 11:40:21 +05:30
Trivikram Kamat
bb87206b58 chore: bump github actions to v4 (#4333) 2024-09-10 13:32:12 +05:30
James George
a395643387 fix: ensure cross-platform compatibility with file exports (#4336) 2024-09-10 12:53:33 +05:30
Andrew Bastin
3b29a56ba0 chore: bump version to 2024.8.1 2024-09-01 21:31:29 +05:30
Andrew Bastin
519b520913 fix: sidebar codegen crashing and AWS Signature Auth flow (#4315)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
2024-09-01 21:25:06 +05:30
Anwarul Islam
c2fb6aee3f chore: AWS Signature Authorization type flow updates (#4311)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-30 20:28:27 +05:30
Anwarul Islam
15efbc887c feat: graphql response schema ui (#4310)
feat: data schema added for graphql response
2024-08-30 17:38:01 +05:30
James George
9ca899a28a feat(cli): add support for AWS Signature Authorization type (#4305) 2024-08-30 14:12:32 +05:30
Anwarul Islam
703b71de2c feat: add support for AWS Signature auth type (#4142)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-08-30 14:00:13 +05:30
Nivedin
5a2eed60c9 fix: resolve multiple UI issues and account for description field in syncing context (#4309)
* fix: collection properties header bulk update editor bug

* chore: add migration step while resolving `headers` in the syncing context

Resolve type errors.

* fix: prevent inifinite loading state in add environments modal

Toggle back the loading state if attempting to create an environment from a team workspace without specifying a name.

* fix: tab change when clicking computed auth

* fix: ensure tab change action works in GQL headers view

`Go to Authorization tab` action.

* chore: account for REST params while adding description fields

Writing to store after pulling from the syncing context.

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-30 12:15:19 +05:30
Anwarul Islam
9ad6a419c1 feat: new ui for response interface generation (#4105)
* feat: codegen body added

* feat: new ui added for response interface

* feat: generate code component added

* chore: default collection tab

* feat: generate data schema

* chore: clean up

* chore: minor code refactor

* fix: only render if `isDrawerOpen` is true

* chore: clean up

* chore: clean up

---------

Co-authored-by: nivedin <nivedinp@gmail.com>
2024-08-30 12:10:52 +05:30
Andrew Bastin
a177bdced0 chore: update vulnerable dependencies 2024-08-29 18:03:44 +05:30
Andrew Bastin
c048c31c6b chore: bump version to 2024.8.0 2024-08-29 16:01:37 +05:30
Akash K
9a86d0c207 feat: support importing HAR ( Http Archive Format ) files (#4307)
* feat: import har files to hoppscotch

* chore: fix some edge cases

* chore: exclude query params from the generated request endpoint

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-29 14:33:07 +05:30
Jean-Paul van Ravensberg
55c1c31b73 feat: oci labels on sh containers (#4269) 2024-08-29 14:04:00 +05:30
Patrick Thoelken
1105fb8274 fix: broken healthchecks on sh containers (#4300) 2024-08-29 13:53:59 +05:30
Akash K
181ad098e0 feat: ability to refresh tokens for oauth flows (#4302)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-29 13:27:31 +05:30
Nivedin
2ed7221182 fix: colour mode bug in profile page (#4304) 2024-08-28 18:48:59 +05:30
Dmitry
34f5617adc chore(lang): update ru locale #2 (#4298)
chore(lang): update ru locale

Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2024-08-28 13:58:33 +05:30
Nivedin
3e2c72bdb2 feat: sort environments alphabetically (#4280)
* feat: sort environments alphabetically in sidebar and selector

* fix: correct typo in i18n string key

* fix: rename and export team environments bug

* chore: added sortEnvironments util function

* chore: ads doc

* chore: cleanup

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-28 13:16:10 +05:30
Anwarul Islam
43730d66f6 feat: description field for request parameters and headers (#4187)
* feat: key-value component added for reuse

* chore: inspection result added

* chore: add `HoppRESTRequest` schema `v7`

* feat: add `description` for field for REST request headers

* feat: add `description` for field for GraphQL request headers

* fix: synchronization logic b/w bulk edit context and the default view

- Add `HoppGQLRequest` schema `v6`.
- Fix pre-existing issue with changes in bulk edit context not immediately reflecting in the default GQL request headers view.

* feat: support importing `description` fields from external sources

* test: fix failing tests

* chore: include description field for computed headers

Headers computed based on authorization info & inherited entries.

* feat: add `description` field for headers at the collection level

Add `HoppCollection` schema `v3`.

* test: fix failing tests

* ci: update tests workflow target branch trigger

* chore: cleanup

* chore: cleanup

* chore: rely on type inference

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-08-27 14:30:12 +05:30
James George
33b0a54af1 feat(cli): add support for request variables (#4275)
feat: add support for request variables in the CLI
2024-08-26 19:21:29 +05:30
Mir Arif Hasan
10e8f4ef19 HSB-482 fix: add env missing checks (#4282)
fix: add env missing checks
2024-08-26 16:36:15 +05:30
Christian Hansen
a8822badcf chore: updated and corrected Danish translations. (#4290)
Update da.json with correct Danish
2024-08-26 12:43:14 +05:30
Dmitry
3e2b9f8e2b chore(lang): update ru locale (#4295)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2024-08-26 12:22:46 +05:30
lwp2070809
86fc4d9eb5 bug: .env.example fix comments formatting (#4296) 2024-08-26 11:25:13 +05:30
Andrew Bastin
ef3193ad6d chore: merge hoppscotch/main into hoppscotch/next 2024-08-23 15:05:01 +05:30
Nivedin
f115c4ab8e fix: persist request execution context between tabs (#4284) 2024-08-22 22:40:21 +05:30
Andrew Bastin
0218555909 chore: bump version to 2024.7.2 2024-08-21 21:12:34 +05:30
Andrew Bastin
e8319a08df fix: issues with port binding in different container runtimes (#4279) 2024-08-21 19:07:53 +05:30
James George
559c71e39b fix: sync all settings actions in SH (#4263) 2024-08-20 01:22:10 +05:30
Anwarul Islam
775051bac3 chore: update WhatsNewDialog UI and position (#4252)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-08-20 01:21:34 +05:30
Nivedin
9fdde2b788 fix: reset currentEnv if there is a shared workspace change (#4255)
* fix: reset currentEnv if there is a shared workspace change

* chore: cleanup

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-19 15:43:32 +05:30
Dmitry
f1cb417a5e fix: improvement for body tab and RawBody empty string bug (#4273)
* feat(body-label): added label that showing tab is not empty

* fix(body-raw): value is not updated when was empty

---------

Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2024-08-19 15:42:35 +05:30
Tasnim Tantawi
d15e809dcb fix: update Arabic translations (#4260)
* Complete Arabic translation

* add removed translations

* chore: format doc

---------

Co-authored-by: nivedin <nivedinp@gmail.com>
2024-08-19 15:40:14 +05:30
Mir Arif Hasan
67f0324521 HSB-473 feat: encrypt sensitive data before storing in db (#4212)
* feat: encryption added on onMuduleInit

* feat: encryption changes added on sh admin mutations and query

* chore: fetch minimum column from DB

* feat: data encryption added on account table

* test: infra config test case update

* chore: env example modified

* chore: update variable name

* chore: refactor the code

* feat: client-ids made encrypted

* chore: encrypted auth client id's

---------

Co-authored-by: Balu Babu <balub997@gmail.com>
2024-08-14 13:04:12 +05:30
Andrew Bastin
3f78bf1062 chore: bump version to 2024.7.1 2024-08-08 20:14:55 +05:30
Andrew Bastin
afea75694f refactor: slim down the backend containers (#4233)
* refactor: slim down the backend containers

* refactor: make containers run as non-root user in container

* chore: correct casing for the build stage definitions

* chore: remove docker compose version field as its obsolete

* chore: optimise chown and chmod into the COPY command itself

* chore: add package overrides for packages with reported vulns

* chore: add pnpm to containers + set workdir dir to the backend project

* fix: permission issues with the fe containers

* chore: define env variables on AIO
2024-08-08 11:31:13 +05:30
Paul Vogel
bbda18c728 i18n: Fix german translation for "label" (#4240) 2024-08-07 21:47:32 +05:30
James George
a8bcc75467 fix: ensure Content-Type header priority in the CLI (#4242)
- Ensure the `Content-Type` header takes priority over the value set in the request body.
- Introduces `HoppRESTRequest` schema `v6` with `text/xml` added under the supported content types.
2024-08-07 21:46:27 +05:30
Akash K
31b691bb37 chore: add ai renames at more places (#4244)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-08-07 21:43:32 +05:30
James George
1fdb0f2d04 chore: hide duplicate Global environment action for a team workspace (#4245) 2024-08-07 21:42:37 +05:30
jamesgeorge007
1908625297 fix: use correct callback URL for GitHub provider infra config 2024-08-06 23:12:03 +05:30
Paul Vogel
8e58b58b6f i18n: Add german translations for section "access token" (#4241)
Add german translations for the access token section
2024-08-06 17:39:54 +05:30
artu-ole
f05966b335 fix: path not taken into account for socket.io connection without token auth (#4226)
fix: path not taken into account for socket.io connection
2024-08-06 17:35:50 +05:30
Muhammed Ajmal M
5bccab0aa0 fix: add to parameters regex (#4238) 2024-08-06 15:18:14 +05:30
Balu Babu
0140208753 chore: user management api additions (#4231)
* feat: added route to delete users in user management api's

* chore: added lastLoggedOn and lastActiveOn fields to user response type

* chore: changed return type

* chore: changed target to prod for hopp-old-backend service
2024-08-05 15:31:59 +05:30
Gusram
f7efffcd79 Merge branch 'main' of github.com:hoppscotch/hoppscotch 2024-08-01 12:25:21 +08:00
James George
4fd6d6ddb4 fix(cli): remove postinstall script (#4229) 2024-07-31 19:10:11 +05:30
Akash K
40f93fc7f4 chore: add analytics event for ai experiments (#4224) 2024-07-30 18:55:09 +05:30
Akash K
adb7782b58 chore: enable ai experiments by default in settings (#4223) 2024-07-30 18:32:32 +05:30
Andrew Bastin
a9fc7e6a62 chore: bump version to 2024.7.0 2024-07-30 14:41:12 +05:30
Akash K
d68cfb313e feat: hoppscotch-common & platform additions for ai experiments (#4222)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-07-30 12:16:44 +05:30
Joel Jacob Stephen
2a37235229 fix(sh-admin): resolved issue while rendering images (#4221)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-07-29 22:59:02 +05:30
Mir Arif Hasan
e26528cedf fix: infra token expriry check on guard (#4219)
fix: null check added in infraToken expiry check on guard
2024-07-29 19:38:17 +05:30
James George
c9f92282bf feat: duplicate REST/GraphQL collections (#4211)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-07-29 18:37:34 +05:30
Joel Jacob Stephen
c24d5c5302 feat(sh-admin): introducing infra-tokens to admin dashboard (#4202)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-07-29 17:50:06 +05:30
Mir Arif Hasan
783d911f8d HSB-462 feat: infra token module and sh apis (#4191)
* feat: infra token module added

* feat: infra token guard added

* feat: token prefix removed

* feat: get pending invites api added

* docs: swagger doc added for get user invites api

* feat: delete user invitation api added

* feat: get users api added

* feat: update user api added

* feat: update admin status api added

* feat: create invitation api added

* chore: swagger doc update for create user invite

* feat: interceptor added to track last used on

* feat: change db schema

* chore: readonly tag added

* feat: get user by id api added

* fix: return type of a function

* feat: controller name change

* chore: improve token extractino

* chore: added email validation logic

---------

Co-authored-by: Balu Babu <balub997@gmail.com>
2024-07-29 12:36:18 +05:30
Nivedin
c88ea5c8b2 fix: auth bug when value is a secret environment (#4210)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-07-27 20:54:16 +05:30
James George
5f96cda5e2 feat(cli): add support for JUnit reporter (#4189) 2024-07-26 22:56:58 +05:30
jamesgeorge007
ecf0901491 chore: merge hoppscotch/main into hoppscotch/next 2024-07-26 22:39:48 +05:30
Joel Jacob Stephen
9e445cda84 refactor(sh-admin): updated invite flow for the admin dashboard (#4176)
* feat: new success invite link modal introduced

* refactor: replaced button with lucide icon

* style: vertical padding to lucide icon

* feat: new success invite modal component

* refactor: hide copy link button when there are no pending invites

* refactor: changed copy link button to copy invite link

* chore: minor UI update

---------

Co-authored-by: nivedin <nivedinp@gmail.com>
2024-07-26 20:14:41 +05:30
Balu Babu
9cde6c597b feat: duplicate team and user collections (#4207)
* chore: created new mutation for team-collection duplication

* feat: completed duplication function in TeamCollection module

* feat: user-collection duplication complete

* chore: changed duplicated title suffix for collections

* chore: added return type to argument for duplication mutation in user-collections

* chore: capitalized duplicate in duplicate collection service4 methods

* chore: changed target of hopp-old-backend service to prod
2024-07-24 21:55:08 +05:30
Balu Babu
df730e4d21 feat: Ability to toggle cookies to work in HTTP (#4194)
* feat: added new env variable

* feat: made http secure cookie conditional

* chore: added comments to env files

* chore: changed target of hopp-old-backend service to prod
2024-07-24 21:44:39 +05:30
Andrew Bastin
4457eeb74c chore: bump versions 2024-07-22 22:12:32 +05:30
jamesgeorge007
bf5d62364d chore: bump CLI tests timeout 2024-07-22 19:21:16 +05:30
Dmitry
f913899ad5 fix: fix issue for multipart/form-data and cookie header (#4172)
* fix(multipart-formdata): fix type for data variable

* fix(multipart-formdata): fix parameter filter for unsetted file

* fix(multipart-formdata): add mime type for sending file

* fix(multipart-formdata): add application/octet-stream by default mimetype

* fix(multipart-formdata): remove content-type: multipart/form-data header

* fix(multipart-formdata): remove cookie cookie header if not present

* fix(multipart-formdata): fix content-type filter

---------

Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2024-07-22 18:33:38 +05:30
Nivedin
7652dab9c4 fix: codemirror search bar misaligned (#4203)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-07-22 17:04:53 +05:30
Anwarul Islam
801df8ea97 feat: persist HTML response preview preference (#4177)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-07-19 16:18:55 +05:30
Nivedin
25a519a2e9 fix: wrap line button showing inconsistency bug (#4188) 2024-07-18 15:20:57 +05:30
Nivedin
8c6b80dc42 fix: embeds response and request option section getting hidden bug (#4181)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-07-18 15:13:43 +05:30
Nivedin
7ebc9a6fd6 fix: secret variables being populated as undefined on code snippets (#4180) 2024-07-18 14:44:37 +05:30
Paul Vogel
7ad3f660ae i18n: add german translations (#4196)
Add german translations
2024-07-18 14:26:09 +05:30
Paul Vogel
199a7234fa i18n: fix existing german translations (#4195)
Fix existing german translations
2024-07-18 14:19:46 +05:30
Anwarul Islam
90bb470b3a fix: <img> is flex's immediate child therefore it stretch to its parent width (#4173)
* fix: img is flex immediate child and renders in full width

* chore: remove unnecesary use of flex
2024-07-17 21:34:08 +05:30
Nivedin
1dee1e1b1a chore: cleanup i18n translations (#4166) 2024-07-05 17:52:50 +03:00
Muhammed Ajmal M
71ac013a38 fix: ctrl+enter inserting newline in code (#4108)
* fix: ctrl+enter inserting newline in code

* chore: add 'cmd+enter' to the key list

---------

Co-authored-by: nivedin <nivedinp@gmail.com>
2024-07-02 15:07:27 +05:30
Nivedin
fe79c47d1f fix: codemirror crashing due to cursor not updating (#4151)
fix: cursor not updating while filtering
2024-07-02 13:41:20 +05:30
Akash K
2917d50c6a feat: copyable invite links (#4153)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-06-28 18:48:10 +03:00
Joel Jacob Stephen
0c06f26893 refactor(sh-admin): improvements to invite links in dashboard (#4152) 2024-06-28 16:15:40 +03:00
Andrew Bastin
fba22ea687 refactor: move pwa update toast to the bottom center 2024-06-28 15:10:04 +03:00
Andrew Bastin
fd60c630fd refactor: remove auto dismissal of whats new toast and move it to the bottom left 2024-06-28 15:05:16 +03:00
Mir Arif Hasan
7deb49b244 HSB-453 hotfix: remove !! operator (#4150)
fix: remove !! operator
2024-06-28 14:32:24 +05:30
jamesgeorge007
ac84166b8b chore: update documentation link references 2024-06-28 11:49:09 +05:30
jamesgeorge007
07e7180dc9 chore: update CLI documentation link references
Bump CLI version.
2024-06-28 11:16:47 +05:30
Joel Jacob Stephen
1d1462df69 feat(sh-admin): introducing advanced SMTP configurations and invite links to dashboard (#4087)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-06-27 22:15:50 +03:00
Anwarul Islam
b851d3003c feat: added change log prompt for PWA updates (#4098)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-06-27 19:03:33 +03:00
James George
3b70668162 feat: CLI collection runner command generation UI flow (#4141)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-06-27 19:17:56 +05:30
James George
a9afb17dc0 feat(cli): access team workspace collections and environments (#4095)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-06-27 18:11:29 +05:30
Mir Arif Hasan
fa2f73ee40 HSB-439 feature: invite link with SMTP optional (#4078)
* feat: env variable added in infra-config for smtp enable status

* feat: event emitter added

* feat: added advance mailer configurations from infra config

* test: fix test cases

* feat: added query to see is smtp enabled or not

* feat: email auth provider disabled on smtp disable

* chore: restrict on update directly instead of dedicated mutation

* fix: feedback resolved

* chore: modify mailer module

* chore: error handle in mailer functions

* chore: removed unused imports

* chore: remove event-emit

* chore: update env example

* test: fix broken test cases

* chore: feedback resolved

* chore: isSMTPEnabled moved to infra config resolver

* fix: email can not reenable if smtp not enabled
2024-06-27 17:53:40 +05:30
Joel Jacob Stephen
b3e42bf7c3 feat(sh-admin): introducing last active status to users table and individual user's page in dashboard (#4077)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-06-26 12:30:40 +05:30
jamesgeorge007
25fd35770a fix: regression with missing lucide icon pack
Add `@iconify-json/lucide` as a dev dependency to all packages that consume `unplugin-icons`.
2024-06-26 11:59:21 +05:30
Andrew Bastin
762cd2207b chore: bump version to 2024.6.0 2024-06-25 21:29:30 +05:30
Andrew Bastin
1da5dde0ba refactor: bump dioc to 3.0.2 2024-06-25 20:54:25 +05:30
Mir Arif Hasan
190a3b8eaf fix: crashes in user last login interceptor (#4146)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-06-25 17:15:04 +05:30
Andrew Bastin
aead9e6c98 feat: client certificates and ability to skip ssl cert verification in desktop app (#4111)
Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com>
2024-06-25 16:57:07 +05:30
Joel Jacob Stephen
5e3bc01922 refactor(common): improvements to banner handling logic (#4123) 2024-06-25 15:14:52 +05:30
Andrew Bastin
9479258acb chore: merge hoppscotch/patch into hoppscotch/next 2024-06-24 16:09:12 +05:30
Andrew Bastin
7baabebcee chore: merge hoppscotch/main into hoppscotch/patch
there was a hotfix to update the CLI version with a patch release
2024-06-24 16:07:43 +05:30
Andrew Bastin
6e63c723b7 chore: bump cli to 0.8.1 due to new hopp-data schema change 2024-06-24 16:04:39 +05:30
Nivedin
fac90ac342 fix: styling issue on selection in codemirror (#4122) 2024-06-24 12:15:04 +05:30
Anwarul Islam
9d02c8e6c9 feat: added codegen tab in the sidebar (#4099) 2024-06-24 12:03:19 +05:30
Anwarul Islam
d45f15e9cb fix: prevent unwanted variable wrapping during Insomnia import (#4076)
feat: conditionally check path variable
2024-06-24 11:46:50 +05:30
James George
021ecf17ce feat: introduce personal access tokens for authorization (#4094)
Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com>
2024-06-24 11:45:31 +05:30
Nivedin
257974325e fix: large content scroll bug in codemirror editor (#4138) 2024-06-21 23:27:22 +05:30
Mir Arif Hasan
c2085b8b6f HSB-450 feature: user last active on (#4121)
* feat: userLastActiveOnInterceptor added and update func added in userService

* chore: changed user model parameter description

* chore: commented out docker volume for hopp-old-service

* chore: changed backend to work with secure cookies

---------

Co-authored-by: Balu Babu <balub997@gmail.com>
2024-06-21 12:40:21 +05:30
Andrew Bastin
cfb77f2bfe chore: merge hoppscotch/patch into hoppscotch/next 2024-06-20 22:26:42 +05:30
Andrew Bastin
292d752f32 chore: update CONTRIBUTING.md 2024-06-17 21:50:10 +05:30
Andrew Bastin
73090c7a2b chore: update PR template 2024-06-17 21:47:59 +05:30
Andrew Bastin
e6cd03c283 chore: update SECURITY.md 2024-06-17 21:41:47 +05:30
Andrew Bastin
cc1be91446 chore: update CODEOWNERS 2024-06-17 21:14:37 +05:30
Andrew Bastin
c2cb295bcb chore: bump version to 2024.3.4 2024-06-14 04:14:16 +05:30
Andrew Bastin
31f1e1b21a fix: headers having different values with the same key are not shown (#4112)
* feat: allow ability for multiple headers with the same key to be shown

* chore: remove extension inspector in selfhost-desktop

* chore: cleanup

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-06-12 14:11:43 +05:30
Akash K
93807bfe8f fix: make client credential optional in authcode + pkce flow (#4114)
* fix: make client credential optional

* test: update test fixtures

---------

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2024-06-12 14:10:54 +05:30
Andrew Bastin
e3ad0c9e2e feat: add ability for platforms to define custom login selector ui 2024-06-11 06:20:02 +05:30
Balu Babu
465ea2b4e0 chore: changed the returned status type for errors in the access-tokens (#4107)
* chore: changed the returned status type for errors in the access-token interceptor

* chore: removed unused pagination args
2024-06-07 12:08:35 +05:30
Alexandre Rodrigues Batista
f13478da86 fix(sh-desktop): add missing @hoppscotch/data to selfhost-desktop (#4097) 2024-06-06 20:37:45 +05:30
Joel Jacob Stephen
5805826994 refactor(sh-admin): improved error handling and dynamic user actions in admin dashboard (#4044)
* feat: new helper functions for better error management

* refactor: new i18n strings

* refactor: better error handling in invite modal and members component

* refactor: better user management

* refactor: better error handling in config handler

* refactor: updated logic of dynamic action row

* refactor: better naming for computed properties

* feat: new error message when an admin tries to invite himself

* refactor: updated error message when user is already invited

* refactor: reverted i18n string for user already invited back to the old string

* refactor: removed show prop from invite modal

* refactor: improved implementation for getting the compiled error messages

* feat: new error message when email inputted is of an invalid format

* refactor: minor optimization

---------

Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-06-03 17:17:46 +05:30
islamzeki
5fd7c28894 locale: update tr i18n translations (#4057)
* Update tr.json

i18n

* Update tr.json

i18n

* Update tr.json

l10n

* Update tr.json

l10n based on en.json

* Update tr.json

* Update tr.json
2024-06-03 14:35:32 +05:30
Joel Jacob Stephen
b601a2f55f fix(sh-admin): saving changes to server configurations post a failed attempt will require a page reload in dashboard (#4081)
* fix: resolved an issue with server restart component

* refactor: early return if any mutation fails when initiating server restart

* fix: ensure further attempts go through after a failed reset configs action

---------

Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-06-03 14:31:44 +05:30
Nivedin
bece13e6b0 fix: precision lost when json is beautified (#4086) 2024-06-03 14:30:31 +05:30
Nivedin
d0350ec789 fix: add previous value as optional in test schema env diff (#4071)
* fix: add previous value as optional

* refactor: remove method chaining for consistency

---------

Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-06-03 14:29:48 +05:30
Nivedin
5c214a8da0 fix: persist interceptor state for logged out user (#4060)
* fix: persist interceptor state for loged out user

* refactor: update interceptor section in settings page

* chore: update settings page interceptor section UI

* chore: minoir ui and code refactor
2024-06-03 14:28:58 +05:30
Gusram
2c0805fafe docs(desktop): update building instruction 2024-05-31 01:41:06 +08:00
Gusram
26b4f64824 chore(desktop): update dependencies version 2024-05-31 01:39:36 +08:00
Gusram
4156551b24 feat(desktop): implement backend wrapper auth 2024-05-31 00:39:19 +08:00
Balu Babu
4bd23a8f4c feat: adding support for hopp-cli in self-host Hoppscotch (#4079)
* feat: created a new table to store user PATs

* chore: renamed UserTokens table name to PersonalAccessToken

* chore: added unique property to token column

* chore: made expiresOn field optional

* chore: created access-token module

* feat: created access-token rest routes

* chore: created a new auth guard for PATs

* chore: scaffolded routes in team collection and environments modules for CLI

* chore: created method to update lastUsedOn property for accessTokens

* chore: created interceptor to update lastUsedOn property of PAT

* feat: interceptor to update lastUpdatedOn property complete

* chore: removed unused imports in access-token interceptor

* chore: moved routes to fetch collection and environment into access-token module

* feat: added routes to fetch collections and environments for CLI

* chore: modified access-token interceptor

* chore: removed log statement from interceptor

* chore: added team member checking logic to ForCLI methods in team collection and environments module

* chore: changed return error messages to those defined in spec

* chore: added comments to all service methods

* chore: removed unused imports

* chore: updated testcases for team-environments module service file

* chore: added and updated testcases

* chore: removed unneseccary SQL from auto-generated migration sql for PAT

* chore: remobed JWTAuthGuard from relevant routes in PAT controllers file

* chore: modified token for auth in PATAuthGuard

* chore: changed error codes in some certain service methods in access-token module

* feat: worked on feedback for PR review

* chore: renamed service method in access-token module

* chore: removed console log statements

* chore: modified cli error type

* test: fix broken test case

* chore: changed target of hopp-old-backend to prod

---------

Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
2024-05-28 16:39:50 +05:30
Mir Arif Hasan
f4f3fdf2d5 HSB-445 feature: storing user last login timestamp (#4074)
* feat: lastLoggedOn added in schema and service function

* feat: add lastLoggedOn logic for magic link

* test: update test cases

* feat: add lastLoggedOn in gql model

* fix: nullable allowed in model attribute

* fix: resolve feedback

* feat: user last login interceptor added
2024-05-27 21:49:42 +05:30
Mir Arif Hasan
b7a3ae231b HSB-431 fix: email case sensitive in email provider (#4042)
* feat: code level email insensitivity added

* test: fix broken test case

* chore: updated testcase for findUserByEmail in user module

---------

Co-authored-by: Balu Babu <balub997@gmail.com>
2024-05-15 12:37:35 +05:30
Nivedin
f8ac6dfeb1 chore: add workspace switcher login A/B testing flow (#4053)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-05-10 16:35:42 +05:30
Andrew Bastin
7d2d335b37 chore: revert back default interceptor for sh app to browser 2024-05-10 16:13:51 +05:30
Andrew Bastin
76875db865 chore: bump selfhost-desktop lockfile version 2024-05-10 15:04:16 +05:30
Balu Babu
96e2d87b57 feat: update node version to node20-apline3.19 (#4040) 2024-05-10 14:24:34 +05:30
islamzeki
be353d9f72 chore(i18n): update tr.json (#4039) 2024-05-10 14:16:04 +05:30
Nivedin
38bc2c12c3 refactor: set default interceptor to "proxy" (#4051) 2024-05-10 14:01:43 +05:30
Stéfany Larissa
97644fa508 chore: update pt-br translations (#4003) 2024-05-10 13:56:58 +05:30
Dmitry
eb3446ae23 locale: update ru locale (#4005)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
Co-authored-by: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com>
2024-05-10 13:51:25 +05:30
Dmitry
6c29961d09 Added new button to save request modal (#3976)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
Co-authored-by: Nivedin <53208152+nivedin@users.noreply.github.com>
2024-05-09 20:52:22 +05:30
Nivedin
ef1117d8cc refactor: switch workspace after creation (#4015)
Co-authored-by: amk-dev <akash.k.mohan98@gmail.com>
2024-05-09 20:28:24 +05:30
Balu Babu
5c4b651aee feat: healthcheck for external services (#4048)
* chore: installed terminus package and scaffolded the health module

* feat: added healthcheck for database with prisma

* chore: renamed label from prisma to database in health check route

* chore: reverted target of hopp-old-backend service to prod
2024-05-07 20:05:17 +05:30
Andrew Bastin
391e5a20f5 chore: bump versions to 2024.3.3 2024-05-06 22:57:33 +05:30
Andrew Bastin
4b8f3bd8da fix: code generate modal erroring out (#4033) 2024-05-06 22:44:13 +05:30
Joel Jacob Stephen
94248076e6 refactor(sh-admin): improved handling of server configurations in admin dashboard (#3971)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-05-06 21:50:31 +05:30
Nivedin
eecc3db4e9 chore: update placeholder text (#4023) 2024-04-30 16:49:32 +05:30
Andrew Bastin
426e7594f4 fix: tab systems erroring out due to out of sync tabOrdering and tabMap 2024-04-29 20:32:27 +05:30
Andrew Bastin
934dc473f0 chore: bump version to 2024.3.2 2024-04-29 19:21:48 +05:30
Andrew Bastin
be57255bf7 refactor: update to dioc v3 (#4009)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-04-29 19:06:18 +05:30
Balu Babu
f89561da54 fix: resolved mailer module email issue (#4000) 2024-04-29 12:05:07 +05:30
Joel Jacob Stephen
c2c4e620c2 fix(common): rest and graphql pages not being rendered when french is selected as app language (#4004)
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-04-25 18:01:46 +05:30
Andrew Bastin
844eee0fa4 chore: update @hoppscotch/cli README 2024-04-22 21:12:27 +05:30
Andrew Bastin
d21bb65511 chore: bump cli version to 0.8 2024-04-22 20:29:03 +05:30
Andrew Bastin
4f614f7257 chore: bump version to 2024.3.1 2024-04-22 20:26:25 +05:30
Nivedin
0e2887b4e9 feat: first time user spotlight animation (#3977) 2024-04-22 12:21:30 +05:30
Andrew Bastin
18652ce400 fix: update prod.Dockerfile to add additional required deps during base build 2024-04-20 01:54:34 +05:30
Eduardo San Martin Morote
08c655235d fix: use pressed key rather than its code (#3978)
Co-authored-by: Joel Jacob Stephen <70131076+JoelJacobStephen@users.noreply.github.com>
2024-04-19 22:35:13 +05:30
Vincent M
51412549e8 chore(i18n): french lang translation (#3986) 2024-04-19 21:21:15 +05:30
James George
22c6eabd13 chore: migrate Node.js implementation for js-sandbox to isolated-vm (#3973)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2024-04-19 21:08:46 +05:30
Mir Arif Hasan
a079e0f04b refactor: infra-config code refactor (#3982)
* chore: add getMissingInfraConfigEntries to avoid code duplication

* feat: isServiceConfigured modified

* docs: add missing function doc

* feat: argon2 version updated and removed types-argon2 depricated package

* Revert "feat: argon2 version updated and removed types-argon2 depricated package"

This reverts commit b99f3c5aae.

* Revert "feat: isServiceConfigured modified"

This reverts commit eaa6f105bb.
2024-04-19 12:43:43 +05:30
jamesgeorge007
375d53263a test: fix failing tests 2024-04-16 23:55:07 +05:30
Thomas Bonnet
57ef3e085f chore(i18n): Updating the packages/hoppscotch-common/locales/fr.json file. (#3555) 2024-04-16 18:15:38 +05:30
Timotej
9fb6e59e36 fix(desktop): set window caption color if Windows version >= 11 (#3939) 2024-04-16 17:51:26 +05:30
Sawako
1b0802b0e6 fix: spanish lang translation messages (#3950) 2024-04-16 17:47:10 +05:30
krisztianbarat
fb45fe4627 chore(i18n): update locale hu (#3875) 2024-04-16 17:45:55 +05:30
Akash K
0f592d1789 fix: use proper values for addTo field when auth type is api-key (#3966) 2024-04-16 17:44:28 +05:30
jamesgeorge007
787aab650f fix: redirect to the users list view on successful deletion from the profile view
SH Admin dashboard
2024-03-28 21:20:48 +05:30
Anwarul Islam
1f7a8edb14 fix: lint errors removed by using satisfies or as for type (#3934)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
Co-authored-by: amk-dev <akash.k.mohan98@gmail.com>
2024-03-28 20:28:48 +05:30
James George
81f1e05a6c chore(sh-admin): alert the user while deleting users who are team owners (#3937)
Co-authored-by: amk-dev <akash.k.mohan98@gmail.com>
Co-authored-by: nivedin <nivedinp@gmail.com>
2024-03-28 20:17:24 +05:30
James George
0a71783eaa fix(common): ensure requests are translated to the latest version during import and search actions (#3931) 2024-03-25 17:09:54 +05:30
Nivedin
c326f54f7e feat: added mutation and function to platform for updating user profile name (#3929)
Co-authored-by: amk-dev <akash.k.mohan98@gmail.com>
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-25 14:41:25 +05:30
Dmitry
1113c79e20 fix: can't import curl command with data-urlencode (#3905)
Co-authored-by: Anwarul Islam <anwaarulislaam@gmail.com>
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-25 13:12:48 +05:30
Akash K
6fd30f9aca chore: spotlight improvements for team requests search (#3930)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-25 12:41:18 +05:30
Anwarul Islam
2c5b0dcd1b feat: focus codemirror view when ImportCurl component launched (#3911)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-22 18:21:16 +05:30
Anwarul Islam
6f4455ba03 fix: request failing on change content type to multipart-formdata (#3922)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-22 18:11:16 +05:30
Nivedin
ba8c4480d9 fix: workspace list section bugs (#3925)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-22 18:02:28 +05:30
Joel Jacob Stephen
380397cc55 refactor(sh-admin): improvements to pending invites page in dashboard (#3926) 2024-03-22 17:54:40 +05:30
Akash K
d19807b212 chore: split axios request options into platform (#3927)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-22 13:42:41 +05:30
Balu Babu
c89c2a5f5c feat: added new mutation to update username in hopp app (#3924)
* feat: added new mutation to update username in hopp app

* feat: display name length validation added

---------

Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
2024-03-22 12:07:38 +05:30
Anwarul Islam
256553b9bb chore: update copy for header inspection (#3907)
Co-authored-by: James George <jamesgeorge998001@gmail.com>
2024-03-21 22:15:23 +05:30
Akash K
89d9951f3b fix: fix typo in team search url (#3923)
fix: fix typo in team search endpoint url

Co-authored-by: James George <jamesgeorge998001@gmail.com>
2024-03-21 16:44:58 +05:30
Balu Babu
dd65ad3103 chore: added input validation to search query (#3921) 2024-03-21 16:13:11 +05:30
Balu Babu
018ed3db26 refactor: AIO healthcheck bash script (#3920)
* chore: added logic to make script with with subpath

* chore: removed variable from failed echo message
2024-03-21 16:12:13 +05:30
Andrew Bastin
a9cd6c0c01 chore: update internal deployment docker compose config 2024-03-21 02:38:55 +05:30
James George
e53382666a fix(common): prevent exception with ShortcodeListAdapter initialization (#3917) 2024-03-20 20:29:04 +05:30
James George
7621ff2961 feat: add extended support for versioned entities in the CLI (#3912) 2024-03-20 20:13:22 +05:30
Akash K
fc20b76080 fix: direct import from url failing (#3918) 2024-03-20 20:06:51 +05:30
Nivedin
146c73d7b6 feat: github enterprise SSO provider addition (#3914) 2024-03-20 20:01:56 +05:30
Akash K
6b58915caa feat: oauth revamp + support for multiple grant types in oauth (#3885)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-20 00:18:03 +05:30
Akash K
457857a711 feat: team search in workspace search and spotlight (#3896)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-19 18:50:35 +05:30
Balu Babu
a3f3e3e62d refactor: collection search query (#3908) 2024-03-19 17:12:35 +05:30
Andrew Bastin
66f20d10e1 chore: enable subpath based access in test deploy docker compose 2024-03-19 16:26:04 +05:30
Andrew Bastin
32e9366609 chore: update test deploy docker compose aio port 2024-03-19 15:53:08 +05:30
Andrew Bastin
e41e956273 chore: add test deployment docker compose file 2024-03-19 14:39:57 +05:30
Nivedin
a14870f3f0 fix: collection auth headers active tab update bug and type fix (#3899) 2024-03-15 21:17:34 +05:30
Andrew Bastin
0e96665254 refactor: use trigram search index instead of full text search (#3900)
Co-authored-by: Balu Babu <balub997@gmail.com>
2024-03-15 20:10:12 +05:30
kaifulee
efdc1c2f5d chore: fix some typos (#3895)
Signed-off-by: kaifulee <cuishuang@outlook.com>
2024-03-15 20:06:34 +05:30
Andrew Bastin
c5334d4c06 chore(sh-admin): bump @hoppscotch/ui version to 0.1.3 2024-03-15 12:43:05 +05:30
Balu Babu
4f549974ed fix: reset infra-config bug (#3898) 2024-03-14 21:46:34 +05:30
Nivedin
41d617b507 fix: secret env bug in firebase due to undefined value (#3881)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-13 17:11:51 +05:30
Joel Jacob Stephen
be7387ed19 refactor(sh-admin): updated data sharing doc links + remove disabled property from all inputs in configurations (#3894) 2024-03-13 16:18:27 +05:30
Joel Jacob Stephen
acfb0189df feat(sh-admin): enhanced user management in admin dashboard (#3814)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-13 14:45:13 +05:30
Nivedin
8fdba760a2 refactor: personal workspace nomenclature update (#3893)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-13 14:21:23 +05:30
Nivedin
bf98009abb fix: request variable version syncing bug (#3889)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
2024-03-12 11:42:05 +05:30
825 changed files with 84812 additions and 28992 deletions

View File

@@ -6,9 +6,17 @@ DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch
JWT_SECRET="secret1233"
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY= 3
REFRESH_TOKEN_VALIDITY="604800000" # Default validity is 7 days (604800000 ms) in ms
ACCESS_TOKEN_VALIDITY="86400000" # Default validity is 1 day (86400000 ms) in ms
# Default validity is 7 days (604800000 ms) in ms
REFRESH_TOKEN_VALIDITY="604800000"
# Default validity is 1 day (86400000 ms) in ms
ACCESS_TOKEN_VALIDITY="86400000"
SESSION_SECRET='add some secret here'
# Reccomended to be true, set to false if you are using http
# Note: Some auth providers may not support http requests
ALLOW_SECURE_COOKIES=true
# Sensitive Data Encryption Key while storing in Database (32 character)
DATA_ENCRYPTION_KEY="data encryption key with 32 char"
# Hoppscotch App Domain Config
REDIRECT_URL="http://localhost:3000"
@@ -35,9 +43,20 @@ MICROSOFT_SCOPE="user.read"
MICROSOFT_TENANT="common"
# Mailer config
MAILER_SMTP_URL="smtps://user@domain.com:pass@smtp.domain.com"
MAILER_SMTP_ENABLE="true"
MAILER_USE_CUSTOM_CONFIGS="false"
MAILER_ADDRESS_FROM='"From Name Here" <from@example.com>'
MAILER_SMTP_URL="smtps://user@domain.com:pass@smtp.domain.com" # used if custom mailer configs is false
# The following are used if custom mailer configs is true
MAILER_SMTP_HOST="smtp.domain.com"
MAILER_SMTP_PORT="587"
MAILER_SMTP_SECURE="true"
MAILER_SMTP_USER="user@domain.com"
MAILER_SMTP_PASSWORD="pass"
MAILER_TLS_REJECT_UNAUTHORIZED="true"
# Rate Limit Config
RATE_LIMIT_TTL=60 # In seconds
RATE_LIMIT_MAX=100 # Max requests per IP
@@ -47,6 +66,7 @@ RATE_LIMIT_MAX=100 # Max requests per IP
# Base URLs
VITE_BACKEND_LOGIN_API_URL=http://localhost:5444
VITE_BASE_URL=http://localhost:3000
VITE_SHORTCODE_BASE_URL=http://localhost:3000
VITE_ADMIN_URL=http://localhost:3100

View File

@@ -7,20 +7,15 @@ Please make sure that the pull request is limited to one type (docs, feature, et
<!-- If this pull request closes an issue, please mention the issue number below -->
Closes # <!-- Issue # here -->
### Description
<!-- Add a brief description of the pull request -->
<!-- Add an introduction into what this PR tries to solve in a couple of sentences -->
### What's changed
<!-- Describe point by point the different things you have changed in this PR -->
<!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax
- [ ] Not Completed
- [x] Completed
-->
### Checks
<!-- Make sure your pull request passes the CI checks and do check the following fields as needed - -->
- [ ] My pull request adheres to the code style of this project
- [ ] My code requires changes to the documentation
- [ ] I have updated the documentation as required
- [ ] All the tests have passed
### Additional Information
<!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. -->
### Notes to reviewers
<!-- Any information you feel the reviewer should know about when reviewing your PR -->

View File

@@ -0,0 +1,249 @@
on:
workflow_dispatch:
inputs:
version:
description: Tag of the version to build
required: true
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Checkout hoppscotch/hoppscotch
uses: actions/checkout@v3
with:
repository: hoppscotch/hoppscotch
ref: main
token: ${{ secrets.CHECKOUT_GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Rust targets (Mac)
if: matrix.platform == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Install additional tools (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
# Install Tauri CLI (binary)
curl -LO "https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v2.0.1/cargo-tauri-x86_64-unknown-linux-gnu.tgz"
tar -xzf cargo-tauri-x86_64-unknown-linux-gnu.tgz
chmod +x cargo-tauri
sudo mv cargo-tauri /usr/local/bin/tauri
# Install Trunk (binary)
curl -LO "https://github.com/thedodd/trunk/releases/download/v0.17.5/trunk-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf trunk-x86_64-unknown-linux-gnu.tar.gz
chmod +x trunk
sudo mv trunk /usr/local/bin/
- name: Install additional tools (Mac)
if: matrix.platform == 'macos-latest'
run: |
# Install Tauri CLI (binary)
mkdir __dist/
cd __dist/
curl -LO "https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v2.0.1/cargo-tauri-aarch64-apple-darwin.zip"
unzip cargo-tauri-aarch64-apple-darwin.zip
chmod +x cargo-tauri
sudo mv cargo-tauri /usr/local/bin/tauri
- name: Install system dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Setting up Windows Environment and injecting before bundle command (Windows only)
if: matrix.platform == 'windows-latest'
shell: bash
env:
WINDOWS_SIGN_COMMAND: trusted-signing-cli -e ${{ secrets.AZURE_ENDPOINT }} -a ${{ secrets.AZURE_CODE_SIGNING_NAME }} -c ${{ secrets.AZURE_CERT_PROFILE_NAME }} %1
run: |
cd packages/hoppscotch-agent
# Inject signing command into main conf.
cat './src-tauri/tauri.conf.json' | jq '.bundle .windows += { "signCommand": env.WINDOWS_SIGN_COMMAND}' > './src-tauri/temp.json' && mv './src-tauri/temp.json' './src-tauri/tauri.conf.json'
# Inject signing command into portable conf.
cat './src-tauri/tauri.portable.conf.json' | jq '.bundle .windows += { "signCommand": env.WINDOWS_SIGN_COMMAND}' > './src-tauri/temp_portable.json' && mv './src-tauri/temp_portable.json' './src-tauri/tauri.portable.conf.json'
cargo install trusted-signing-cli@0.3.0
- name: Set platform-specific variables
run: |
if [ "${{ matrix.platform }}" = "ubuntu-22.04" ]; then
echo "target_arch=$(rustc -Vv | grep host | awk '{print $2}')" >> $GITHUB_ENV
echo "target_ext=" >> $GITHUB_ENV
echo "target_os_name=linux" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "windows-latest" ]; then
echo "target_arch=x86_64-pc-windows-msvc" >> $GITHUB_ENV
echo "target_ext=.exe" >> $GITHUB_ENV
echo "target_os_name=win" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "macos-latest" ]; then
echo "target_os_name=mac" >> $GITHUB_ENV
fi
- name: Setup macOS code signing
if: matrix.platform == 'macos-latest'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
security import certificate.p12 -k build.keychain -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
shell: bash
run: |
cd packages/hoppscotch-agent
pnpm install --filter hoppscotch-agent
- name: Build Tauri app (Linux)
if: matrix.platform == 'ubuntu-22.04'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
run: |
cd packages/hoppscotch-agent
pnpm tauri build --verbose -b deb -b appimage -b updater
- name: Build Tauri app (Mac)
if: matrix.platform == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
run: |
cd packages/hoppscotch-agent
pnpm tauri build --verbose --target x86_64-apple-darwin
pnpm tauri build --verbose --target aarch64-apple-darwin
- name: Build Tauri app (Windows)
if: matrix.platform == 'windows-latest'
shell: powershell
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
run: |
cd packages/hoppscotch-agent
# Build the portable version first and move it.
# This way the next build will regenerate `hoppscotch-agent.exe`.
pnpm tauri build --verbose --config src-tauri/tauri.portable.conf.json -- --no-default-features --features portable
Rename-Item -Path "src-tauri/target/release/hoppscotch-agent.exe" -NewName "hoppscotch-agent-portable.exe"
# Build the installer version.
pnpm tauri build --verbose -b msi -b updater
- name: Zip portable executable (Windows)
if: matrix.platform == 'windows-latest'
shell: powershell
run: |
Compress-Archive -Path "packages/hoppscotch-agent/src-tauri/target/release/hoppscotch-agent-portable.exe" -DestinationPath "packages/hoppscotch-agent/src-tauri/target/release/Hoppscotch_Agent_win_x64_portable.zip"
- name: Prepare artifacts
shell: bash
run: |
mkdir artifacts
mkdir artifacts/sigs
if [ "${{ matrix.platform }}" = "ubuntu-22.04" ]; then
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/appimage/*.AppImage artifacts/Hoppscotch_Agent_linux_x64.AppImage
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/appimage/*.AppImage.sig artifacts/sigs/Hoppscotch_Agent_linux_x64.AppImage.sig
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/deb/*.deb artifacts/Hoppscotch_Agent_linux_x64.deb
elif [ "${{ matrix.platform }}" = "macos-latest" ]; then
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/*_x64.dmg artifacts/Hoppscotch_Agent_mac_x64.dmg
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/macos/*.app.tar.gz artifacts/Hoppscotch_Agent_mac_update_x64.tar.gz
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/macos/*.app.tar.gz.sig artifacts/sigs/Hoppscotch_Agent_mac_update_x64.tar.gz.sig
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*_aarch64.dmg artifacts/Hoppscotch_Agent_mac_aarch64.dmg
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz artifacts/Hoppscotch_Agent_mac_update_aarch64.tar.gz
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz.sig artifacts/sigs/Hoppscotch_Agent_mac_update_aarch64.tar.gz.sig
elif [ "${{ matrix.platform }}" = "windows-latest" ]; then
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/msi/*_x64_en-US.msi artifacts/Hoppscotch_Agent_win_x64.msi
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/msi/*_x64_en-US.msi.sig artifacts/sigs/Hoppscotch_Agent_win_x64.msi.sig
mv packages/hoppscotch-agent/src-tauri/target/release/Hoppscotch_Agent_win_x64_portable.zip artifacts/Hoppscotch_Agent_win_x64_portable.zip
fi
- name: Generate checksums (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
cd artifacts
mkdir shas
for file in *; do
if [ -f "$file" ]; then
sha256sum "$file" > "shas/${file}.sha256"
fi
done
- name: Generate checksums (Mac)
if: matrix.platform == 'macos-latest'
run: |
cd artifacts
mkdir shas
for file in *; do
if [ -f "$file" ]; then
shasum -a 256 "$file" > "shas/${file}.sha256"
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Hoppscotch_Agent-${{ matrix.platform }}
path: artifacts/*

View File

@@ -33,7 +33,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup environment
run: cp .env.example .env

View File

@@ -2,9 +2,9 @@ name: Node.js CI
on:
push:
branches: [main, staging, "release/**"]
branches: [main, next, patch]
pull_request:
branches: [main, staging, "release/**"]
branches: [main, next, patch]
jobs:
test:
@@ -17,22 +17,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup environment
run: mv .env.example .env
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: 8
run_install: true
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: pnpm
- name: Run tests
run: pnpm test

View File

@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup environment
run: mv .env.example .env
@@ -26,7 +26,7 @@ jobs:
run_install: true
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@ pids
*.pid
*.seed
*.pid.lock
*.env
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

View File

@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit ""

View File

@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run pre-commit
npm run pre-commit

View File

@@ -1,30 +1,21 @@
# CODEOWNERS is prioritized from bottom to top
# If none of the below matched
* @AndrewBastin @liyasthomas
# Packages
/packages/codemirror-lang-graphql/ @AndrewBastin
/packages/hoppscotch-cli/ @AndrewBastin
/packages/hoppscotch-common/ @amk-dev @AndrewBastin
/packages/hoppscotch-cli/ @jamesgeorge007
/packages/hoppscotch-data/ @AndrewBastin
/packages/hoppscotch-js-sandbox/ @AndrewBastin
/packages/hoppscotch-ui/ @anwarulislam
/packages/hoppscotch-web/ @amk-dev
/packages/hoppscotch-selfhost-web/ @amk-dev
/packages/hoppscotch-js-sandbox/ @jamesgeorge007
/packages/hoppscotch-selfhost-web/ @jamesgeorge007
/packages/hoppscotch-selfhost-desktop/ @AndrewBastin
/packages/hoppscotch-sh-admin/ @JoelJacobStephen
/packages/hoppscotch-backend/ @ankitsridhar16 @balub
/packages/hoppscotch-backend/ @balub
# Sections within Hoppscotch Common
/packages/hoppscotch-common/src/components @anwarulislam
/packages/hoppscotch-common/src/components/collections @nivedin @amk-dev
/packages/hoppscotch-common/src/components/environments @nivedin @amk-dev
/packages/hoppscotch-common/src/composables @amk-dev
/packages/hoppscotch-common/src/modules @AndrewBastin @amk-dev
/packages/hoppscotch-common/src/pages @AndrewBastin @amk-dev
/packages/hoppscotch-common/src/newstore @AndrewBastin @amk-dev
# READMEs and other documentation files
*.md @liyasthomas
README.md @liyasthomas
# The lockfile has no owner
pnpm-lock.yaml
# Self Host deployment related files
*.Dockerfile @balub
docker-compose.yml @balub
docker-compose.deploy.yml @balub
*.Caddyfile @balub
.dockerignore @balub

View File

@@ -11,7 +11,4 @@ Please note we have a code of conduct, please follow it in all your interactions
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this
Pull Request would represent. The versioning scheme we use is [SemVer](https://semver.org).
4. You may merge the Pull Request once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer merge it for you.
3. Make sure you do not expose environment variables or other sensitive information in your PR.

View File

@@ -4,19 +4,36 @@ This document outlines security procedures and general policies for the Hoppscot
- [Security Policy](#security-policy)
- [Reporting a security vulnerability](#reporting-a-security-vulnerability)
- [What is not a valid vulnerability](#what-is-not-a-valid-vulnerability)
- [Incident response process](#incident-response-process)
## Reporting a security vulnerability
Report security vulnerabilities by emailing the Hoppscotch Support team at support@hoppscotch.io.
We use [Github Security Advisories](https://github.com/hoppscotch/hoppscotch/security/advisories) to manage vulnerability reports and collaboration.
Someone from the Hoppscotch team shall report to you within 48 hours of the disclosure of the vulnerability in GHSA. If no response was received, please reach out to
Hoppscotch Support at support@hoppscotch.io along with the GHSA advisory link.
The primary security point of contact from Hoppscotch Support team will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.
> NOTE: Since we have multiple open source components, Advisories may move into the relevant repo (for example, an XSS in a UI component might be part of [`@hoppscotch/ui`](https://github.com/hoppscotch/ui)).
> If in doubt, open your report in `hoppscotch/hoppscotch` GHSA.
**Do not create a GitHub issue ticket to report a security vulnerability.**
**Do not create a GitHub issue ticket to report a security vulnerability!**
The Hoppscotch team and community take all security vulnerability reports in Hoppscotch seriously. Thank you for improving the security of Hoppscotch. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.
The Hoppscotch team takes all security vulnerability reports in Hoppscotch seriously. We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.
Report security bugs in third-party modules to the person or team maintaining the module.
## What is not a valid vulnerability
We receive many reports about different sections of the Hoppscotch platform. Hence, we have a fine line we have drawn defining what is considered valid vulnerability.
Please refrain from opening an advisory if it describes the following:
- A vulnerability in a dependency of Hoppscotch (unless you have practical attack with it on the Hoppscotch codebase)
- Reports of vulnerabilities related to old runtimes (like NodeJS) or container images used by the codebase
- Vulnerabilities present when using Hoppscotch in anything other than the defined minimum requirements that Hoppscotch supports.
Hoppscotch Team ensures security support for:
- Modern Browsers (Chrome/Firefox/Safari/Edge) with versions up to 1 year old.
- Windows versions on or above Windows 10 on Intel and ARM.
- macOS versions dating back up to 2 years on Intel and Apple Silicon.
- Popular Linux distributions with up-to-date packages with preference to x86/64 CPUs.
- Docker/OCI Runtimes (preference to Docker and Podman) dating back up to 1 year.
## Incident response process

View File

@@ -1,3 +1,8 @@
{
admin off
persist_config off
}
:3000 {
try_files {path} /
root * /site/selfhost-web
@@ -13,7 +18,3 @@
:3170 {
reverse_proxy localhost:8080
}
:80 {
respond 404
}

View File

@@ -1,16 +1,9 @@
:3000 {
respond 404
{
admin off
persist_config off
}
:3100 {
respond 404
}
:3170 {
reverse_proxy localhost:8080
}
:80 {
:{$HOPP_AIO_ALTERNATE_PORT:80} {
# Serve the `selfhost-web` SPA by default
root * /site/selfhost-web
file_server

View File

@@ -51,7 +51,7 @@ fs.rmSync("build.env")
const caddyFileName = process.env.ENABLE_SUBPATH_BASED_ACCESS === 'true' ? 'aio-subpath-access.Caddyfile' : 'aio-multiport-setup.Caddyfile'
const caddyProcess = runChildProcessWithPrefix("caddy", ["run", "--config", `/etc/caddy/${caddyFileName}`, "--adapter", "caddyfile"], "App/Admin Dashboard Caddy")
const backendProcess = runChildProcessWithPrefix("pnpm", ["run", "start:prod"], "Backend Server")
const backendProcess = runChildProcessWithPrefix("node", ["/dist/backend/dist/main.js"], "Backend Server")
caddyProcess.on("exit", (code) => {
console.log(`Exiting process because Caddy Server exited with code ${code}`)

46
docker-compose.deploy.yml Normal file
View File

@@ -0,0 +1,46 @@
# THIS IS NOT TO BE USED FOR PERSONAL DEPLOYMENTS!
# Internal Docker Compose Image used for internal testing deployments
services:
hoppscotch-db:
image: postgres:15
user: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: testpass
POSTGRES_DB: hoppscotch
healthcheck:
test:
[
"CMD-SHELL",
"sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"
]
interval: 5s
timeout: 5s
retries: 10
hoppscotch-aio:
container_name: hoppscotch-aio
build:
dockerfile: prod.Dockerfile
context: .
target: aio
environment:
- DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch
- ENABLE_SUBPATH_BASED_ACCESS=true
env_file:
- ./.env
depends_on:
hoppscotch-db:
condition: service_healthy
command: ["sh", "-c", "pnpm exec prisma migrate deploy && node /usr/src/app/aio_run.mjs"]
healthcheck:
test:
- CMD
- curl
- '-f'
- 'http://localhost:80'
interval: 2s
timeout: 10s
retries: 30

View File

@@ -1,7 +1,6 @@
# To make it easier to self-host, we have a preset docker compose config that also
# has a container with a Postgres instance running.
# You can tweak around this file to match your instances
version: "3.7"
services:
# This service runs the backend app in the port 3170
@@ -100,7 +99,7 @@ services:
test:
[
"CMD-SHELL",
"sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'"
"sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'",
]
interval: 5s
timeout: 5s
@@ -112,7 +111,7 @@ services:
build:
dockerfile: packages/hoppscotch-backend/Dockerfile
context: .
target: dev
target: prod
env_file:
- ./.env
restart: always
@@ -122,7 +121,7 @@ services:
- PORT=3000
volumes:
# Uncomment the line below when modifying code. Only applicable when using the "dev" target.
- ./packages/hoppscotch-backend/:/usr/src/app
# - ./packages/hoppscotch-backend/:/usr/src/app
- /usr/src/app/node_modules/
depends_on:
hoppscotch-db:

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
curlCheck() {
if ! curl -s --head "$1" | head -n 1 | grep -q "HTTP/1.[01] [23].."; then
@@ -9,6 +9,10 @@ curlCheck() {
fi
}
curlCheck "http://localhost:3000"
curlCheck "http://localhost:3100"
curlCheck "http://localhost:3170/ping"
if [ "$ENABLE_SUBPATH_BASED_ACCESS" = "true" ]; then
curlCheck "http://localhost:80/backend/ping"
else
curlCheck "http://localhost:3000"
curlCheck "http://localhost:3100"
curlCheck "http://localhost:3170/ping"
fi

View File

@@ -7,7 +7,7 @@
"license": "MIT",
"scripts": {
"preinstall": "npx only-allow pnpm",
"prepare": "husky install",
"prepare": "husky",
"dev": "pnpm -r do-dev",
"gen-gql": "cross-env GQL_SCHEMA_EMIT_LOCATION='../../../gql-gen/backend-schema.gql' pnpm -r generate-gql-sdl",
"generate": "pnpm -r do-build-prod",
@@ -23,22 +23,32 @@
"./packages/*"
],
"devDependencies": {
"@commitlint/cli": "16.3.0",
"@commitlint/config-conventional": "16.2.4",
"@hoppscotch/ui": "0.1.0",
"@types/node": "17.0.27",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@hoppscotch/ui": "0.2.2",
"@types/node": "22.7.6",
"cross-env": "7.0.3",
"http-server": "14.1.1",
"husky": "7.0.4",
"lint-staged": "12.4.0"
"husky": "9.1.6",
"lint-staged": "15.2.10"
},
"pnpm": {
"overrides": {
"vue": "3.3.9"
"cookie": "0.7.2",
"vue": "3.5.12",
"@nestjs-modules/mailer>mjml": "5.0.0-alpha.4",
"subscriptions-transport-ws>ws": "7.5.10",
"braces": "3.0.3",
"send": "0.19.0",
"pug": "3.0.3",
"body-parser": "1.20.3",
"path-to-regexp@3.2.0": "3.3.0",
"micromatch@<4.0.8": "4.0.8",
"dset@3.1.3": "3.1.4"
},
"packageExtensions": {
"httpsnippet@3.0.1": {
"peerDependencies": {
"@hoppscotch/httpsnippet": {
"dependencies": {
"ajv": "6.12.3"
}
}

View File

@@ -5,7 +5,7 @@
"author": "Hoppscotch (support@hoppscotch.io)",
"license": "MIT",
"scripts": {
"prepare": "rollup -c"
"prepare": "rollup -c && tsc --emitDeclarationOnly --declaration"
},
"type": "module",
"main": "dist/index.cjs",
@@ -25,8 +25,7 @@
"@lezer/generator": "1.5.1",
"mocha": "9.2.2",
"rollup": "3.29.4",
"rollup-plugin-dts": "6.0.2",
"rollup-plugin-ts": "3.4.5",
"@rollup/plugin-typescript": "12.1.1",
"typescript": "5.2.2"
}
}
}

View File

@@ -1,4 +1,4 @@
import typescript from "rollup-plugin-ts"
import typescript from "@rollup/plugin-typescript"
import { lezer } from "@lezer/generator/rollup"
export default {
@@ -8,5 +8,10 @@ export default {
{ file: "dist/index.cjs", format: "cjs" },
{ dir: "./dist", format: "es" },
],
plugins: [lezer(), typescript()],
plugins: [
lezer(),
typescript({
tsconfig: "./tsconfig.json"
})
],
}

View File

@@ -5,6 +5,7 @@
"module": "es2020",
"newLine": "lf",
"declaration": true,
"declarationDir": "./dist",
"moduleResolution": "node",
"allowJs": true
},

View File

@@ -0,0 +1,3 @@
source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="
use devenv

33
packages/hoppscotch-agent/.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# Devenv
.devenv*
devenv.local.nix
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml

View File

@@ -0,0 +1,16 @@
# Tauri + Vue + TypeScript
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
## Type Support For `.vue` Imports in TS
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).

View File

@@ -0,0 +1,153 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1729277673,
"owner": "cachix",
"repo": "devenv",
"rev": "3c3ab087b53d3e4699a43018ac71b5e1091ed73d",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1728973961,
"owner": "nix-community",
"repo": "fenix",
"rev": "d6a9ff4d1e60c347a23bc96ccdb058d37a810541",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1729265718,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ccc0c2126893dd20963580b6478d1a10a4512185",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1729181673,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4eb33fe664af7b41a4c446f87d20c9a0a6321fa3",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1729104314,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"fenix": "fenix",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1729259624,
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "3ddfb0da474bdf243a655a5d785de9b59c7f1397",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@@ -0,0 +1,116 @@
{ pkgs, lib, config, inputs, ... }:
let
rosettaPkgs =
if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64
then pkgs.pkgsx86_64Darwin
else pkgs;
darwinPackages = with pkgs; [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Foundation
darwin.apple_sdk.frameworks.AppKit
darwin.apple_sdk.frameworks.WebKit
];
linuxPackages = with pkgs; [
libsoup_3
webkitgtk_4_1
librsvg
libappindicator
libayatana-appindicator
];
in {
# https://devenv.sh/packages/
packages = with pkgs; [
git
postgresql_16
# FE and Node stuff
nodejs_22
nodePackages_latest.typescript-language-server
nodePackages_latest.vls
nodePackages_latest.prisma
prisma-engines
# Cargo
cargo-edit
] ++ lib.optionals pkgs.stdenv.isDarwin darwinPackages
++ lib.optionals pkgs.stdenv.isLinux linuxPackages;
# https://devenv.sh/basics/
env = {
APP_GREET = "Hoppscotch";
} // lib.optionalAttrs pkgs.stdenv.isLinux {
# NOTE: Setting these `PRISMA_*` environment variable fixes
# Error: Failed to fetch sha256 checksum at https://binaries.prisma.sh/all_commits/<hash>/linux-nixos/libquery_engine.so.node.gz.sha256 - 404 Not Found
# See: https://github.com/prisma/prisma/discussions/3120
PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine";
LD_LIBRARY_PATH = lib.makeLibraryPath [
pkgs.libappindicator
pkgs.libayatana-appindicator
];
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
# Place to put macOS-specific environment variables
};
# https://devenv.sh/scripts/
scripts = {
hello.exec = "echo hello from $APP_GREET";
e.exec = "emacs";
};
enterShell = ''
git --version
${lib.optionalString pkgs.stdenv.isDarwin ''
# Place to put macOS-specific shell initialization
''}
${lib.optionalString pkgs.stdenv.isLinux ''
# Place to put Linux-specific shell initialization
''}
'';
# https://devenv.sh/tests/
enterTest = ''
echo "Running tests"
'';
# https://devenv.sh/integrations/dotenv/
dotenv.enable = true;
# https://devenv.sh/languages/
languages = {
typescript.enable = true;
javascript = {
enable = true;
pnpm.enable = true;
npm.enable = true;
};
rust = {
enable = true;
channel = "nightly";
components = [
"rustc"
"cargo"
"clippy"
"rustfmt"
"rust-analyzer"
"llvm-tools-preview"
"rust-src"
"rustc-codegen-cranelift-preview"
];
};
};
# https://devenv.sh/pre-commit-hooks/
# pre-commit.hooks.shellcheck.enable = true;
# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";
# See full reference at https://devenv.sh/reference/options/
}

View File

@@ -0,0 +1,23 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
# For NodeJS-22 and above
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
# nixpkgs:
# url: github:cachix/devenv-nixpkgs/rolling
fenix:
url: github:nix-community/fenix
inputs:
nixpkgs:
follows: nixpkgs
# If you're using non-OSS software, you can set allowUnfree to true.
allowUnfree: true
# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"
# If you have more than one devenv you can merge them
#imports:
# - ./backend

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hoppscotch Agent</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@@ -0,0 +1,34 @@
{
"name": "hoppscotch-agent",
"private": true,
"version": "0.1.3",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@hoppscotch/ui": "^0.2.1",
"@tauri-apps/api": "^2.0.2",
"@tauri-apps/plugin-shell": "^2.0.0",
"@vueuse/core": "^11.1.0",
"axios": "^1.7.7",
"fp-ts": "^2.16.9",
"vue": "3.3.9"
},
"devDependencies": {
"@iconify-json/lucide": "^1.2.8",
"@tauri-apps/cli": "^2.0.3",
"@types/node": "^22.7.5",
"@vitejs/plugin-vue": "^5.1.4",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"typescript": "^5.6.3",
"unplugin-icons": "^0.19.3",
"vite": "^5.4.8",
"vue-tsc": "^2.1.6"
}
}

2952
packages/hoppscotch-agent/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View File

@@ -0,0 +1,6 @@
<svg width="206" height="231" viewBox="0 0 206 231" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M143.143 84C143.143 96.1503 133.293 106 121.143 106C108.992 106 99.1426 96.1503 99.1426 84C99.1426 71.8497 108.992 62 121.143 62C133.293 62 143.143 71.8497 143.143 84Z" fill="#FFC131"/>
<ellipse cx="84.1426" cy="147" rx="22" ry="22" transform="rotate(180 84.1426 147)" fill="#24C8DB"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M166.738 154.548C157.86 160.286 148.023 164.269 137.757 166.341C139.858 160.282 141 153.774 141 147C141 144.543 140.85 142.121 140.558 139.743C144.975 138.204 149.215 136.139 153.183 133.575C162.73 127.404 170.292 118.608 174.961 108.244C179.63 97.8797 181.207 86.3876 179.502 75.1487C177.798 63.9098 172.884 53.4021 165.352 44.8883C157.82 36.3744 147.99 30.2165 137.042 27.1546C126.095 24.0926 114.496 24.2568 103.64 27.6274C92.7839 30.998 83.1319 37.4317 75.8437 46.1553C74.9102 47.2727 74.0206 48.4216 73.176 49.5993C61.9292 50.8488 51.0363 54.0318 40.9629 58.9556C44.2417 48.4586 49.5653 38.6591 56.679 30.1442C67.0505 17.7298 80.7861 8.57426 96.2354 3.77762C111.685 -1.01901 128.19 -1.25267 143.769 3.10474C159.348 7.46215 173.337 16.2252 184.056 28.3411C194.775 40.457 201.767 55.4101 204.193 71.404C206.619 87.3978 204.374 103.752 197.73 118.501C191.086 133.25 180.324 145.767 166.738 154.548ZM41.9631 74.275L62.5557 76.8042C63.0459 72.813 63.9401 68.9018 65.2138 65.1274C57.0465 67.0016 49.2088 70.087 41.9631 74.275Z" fill="#FFC131"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.4045 76.4519C47.3493 70.6709 57.2677 66.6712 67.6171 64.6132C65.2774 70.9669 64 77.8343 64 85.0001C64 87.1434 64.1143 89.26 64.3371 91.3442C60.0093 92.8732 55.8533 94.9092 51.9599 97.4256C42.4128 103.596 34.8505 112.392 30.1816 122.756C25.5126 133.12 23.9357 144.612 25.6403 155.851C27.3449 167.09 32.2584 177.598 39.7906 186.112C47.3227 194.626 57.153 200.784 68.1003 203.846C79.0476 206.907 90.6462 206.743 101.502 203.373C112.359 200.002 122.011 193.568 129.299 184.845C130.237 183.722 131.131 182.567 131.979 181.383C143.235 180.114 154.132 176.91 164.205 171.962C160.929 182.49 155.596 192.319 148.464 200.856C138.092 213.27 124.357 222.426 108.907 227.222C93.458 232.019 76.9524 232.253 61.3736 227.895C45.7948 223.538 31.8055 214.775 21.0867 202.659C10.3679 190.543 3.37557 175.59 0.949823 159.596C-1.47592 143.602 0.768139 127.248 7.41237 112.499C14.0566 97.7497 24.8183 85.2327 38.4045 76.4519ZM163.062 156.711L163.062 156.711C162.954 156.773 162.846 156.835 162.738 156.897C162.846 156.835 162.954 156.773 163.062 156.711Z" fill="#24C8DB"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,25 @@
# Enable static linking for C runtime library on Windows.
#
# Rust uses the msvc toolchain on Windows,
# which by default dynamically links the C runtime (CRT) to the binary.
#
# This creates a runtime dependency on the Visual C++ Redistributable (`vcredist`),
# meaning the target machine must have `vcredist` installed for the application to run.
#
# Since `portable` version doesn't have an installer,
# we can't rely on it to install dependencies, so this config.
#
# Basically:
# - The `+crt-static` flag instructs the Rust compiler to statically link the C runtime for Windows builds.\
# - To avoids runtime errors related to missing `vcredist` installations.
# - Results in a larger binary size because the runtime is bundled directly into the executable.
#
# For MSVC targets specifically, it will compile code with `/MT` or static linkage.
# See: - RFC 1721: https://rust-lang.github.io/rfcs/1721-crt-static.html
# - Rust Reference - Runtime: https://doc.rust-lang.org/reference/runtime.html
# - MSVC Linking Options: https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library
# - Rust Issue #37406: https://github.com/rust-lang/rust/issues/37406
# - Tauri Issue #3048: https://github.com/tauri-apps/tauri/issues/3048
# - Rust Linkage: https://doc.rust-lang.org/reference/linkage.html
[target.'cfg(windows)']
rustflags = ["-C", "target-feature=+crt-static"]

View File

@@ -0,0 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# Generated by Tauri
# will have schema files for capabilities auto-completion
/gen/schemas

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
[package]
name = "hoppscotch-agent"
version = "0.1.3"
description = "A cross-platform HTTP request agent for Hoppscotch for advanced request handling including custom headers, certificates, proxies, and local system integration."
authors = ["AndrewBastin", "CuriousCorrelation"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "hoppscotch_agent_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies]
tauri-build = { version = "2.0.1", features = [] }
[dependencies]
tauri = { version = "2.0.4", features = ["tray-icon", "image-png"] }
tauri-plugin-shell = "2.0.1"
tauri-plugin-autostart = { version = "2.0.1", optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1.40.0", features = ["full"] }
dashmap = { version = "6.1.0", features = ["serde"] }
axum = { version = "0.7.7" }
axum-extra = { version = "0.9.4", features = ["typed-header"] }
tower-http = { version = "0.6.1", features = ["cors"] }
tokio-util = "0.7.12"
uuid = { version = "1.11.0", features = [ "v4", "fast-rng" ] }
chrono = { version = "0.4", features = ["serde"] }
rand = "0.8.5"
log = "0.4.22"
env_logger = "0.11.5"
hoppscotch-relay = { path = "../../hoppscotch-relay" }
thiserror = "1.0.64"
tauri-plugin-store = "2.1.0"
x25519-dalek = { version = "2.0.1", features = ["getrandom"] }
base16 = "0.2.1"
aes-gcm = { version = "0.10.3", features = ["aes"] }
tauri-plugin-updater = "2.0.2"
tauri-plugin-dialog = "2.0.1"
lazy_static = "1.5.0"
tauri-plugin-single-instance = "2.0.1"
tauri-plugin-http = { version = "2.0.1", features = ["gzip"] }
native-dialog = "0.7.0"
[target.'cfg(windows)'.dependencies]
tempfile = { version = "3.13.0" }
winreg = { version = "0.52.0" }
[dev-dependencies]
mockito = "1.5.0"
[features]
default = ["tauri-plugin-autostart"]
portable = []

View File

@@ -0,0 +1,5 @@
fn main() {
tauri_build::build();
println!("cargo::rerun-if-env-changed=UPDATER_PUB_KEY");
println!("cargo::rerun-if-env-changed=UPDATER_URL");
}

View File

@@ -0,0 +1,24 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main", "test"],
"permissions": [
{
"identifier": "http:default",
"allow": [
{
"url": "https://*.tauri.app"
},
{
"url": "https://*.microsoft.*"
}
]
},
"core:default",
"shell:allow-open",
"core:window:allow-close",
"core:window:allow-set-focus",
"core:window:allow-set-always-on-top"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 948 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,220 @@
use axum::{
body::Bytes,
extract::{Path, State},
http::HeaderMap,
Json,
};
use axum_extra::{
headers::{authorization::Bearer, Authorization},
TypedHeader,
};
use hoppscotch_relay::{RequestWithMetadata, ResponseWithMetadata};
use std::sync::Arc;
use tauri::{AppHandle, Emitter};
use x25519_dalek::{EphemeralSecret, PublicKey};
use crate::{
error::{AgentError, AgentResult},
model::{AuthKeyResponse, ConfirmedRegistrationRequest, HandshakeResponse},
state::{AppState, Registration},
util::EncryptedJson,
};
use chrono::Utc;
use rand::Rng;
use serde_json::json;
use uuid::Uuid;
fn generate_otp() -> String {
let otp: u32 = rand::thread_rng().gen_range(0..1_000_000);
format!("{:06}", otp)
}
pub async fn handshake(
State((_, app_handle)): State<(Arc<AppState>, AppHandle)>,
) -> AgentResult<Json<HandshakeResponse>> {
Ok(Json(HandshakeResponse {
status: "success".to_string(),
__hoppscotch__agent__: true,
agent_version: app_handle.package_info().version.to_string(),
}))
}
pub async fn receive_registration(
State((state, app_handle)): State<(Arc<AppState>, AppHandle)>,
) -> AgentResult<Json<serde_json::Value>> {
let otp = generate_otp();
let mut active_registration_code = state.active_registration_code.write().await;
if !active_registration_code.is_none() {
return Ok(Json(
json!({ "message": "There is already an existing registration happening" }),
));
}
*active_registration_code = Some(otp.clone());
app_handle
.emit("registration_received", otp)
.map_err(|_| AgentError::InternalServerError)?;
Ok(Json(
json!({ "message": "Registration received and stored" }),
))
}
pub async fn verify_registration(
State((state, app_handle)): State<(Arc<AppState>, AppHandle)>,
Json(confirmed_registration): Json<ConfirmedRegistrationRequest>,
) -> AgentResult<Json<AuthKeyResponse>> {
state
.validate_registration(&confirmed_registration.registration)
.await
.then_some(())
.ok_or(AgentError::InvalidRegistration)?;
let auth_key = Uuid::new_v4().to_string();
let created_at = Utc::now();
let auth_key_copy = auth_key.clone();
let agent_secret_key = EphemeralSecret::random();
let agent_public_key = PublicKey::from(&agent_secret_key);
let their_public_key = {
let public_key_slice: &[u8; 32] =
&base16::decode(&confirmed_registration.client_public_key_b16)
.map_err(|_| AgentError::InvalidClientPublicKey)?[0..32]
.try_into()
.map_err(|_| AgentError::InvalidClientPublicKey)?;
PublicKey::from(public_key_slice.to_owned())
};
let shared_secret = agent_secret_key.diffie_hellman(&their_public_key);
let _ = state.update_registrations(app_handle.clone(), |regs| {
regs.insert(
auth_key_copy,
Registration {
registered_at: created_at,
shared_secret_b16: base16::encode_lower(shared_secret.as_bytes()),
},
);
})?;
let auth_payload = json!({
"auth_key": auth_key,
"created_at": created_at
});
app_handle
.emit("authenticated", &auth_payload)
.map_err(|_| AgentError::InternalServerError)?;
Ok(Json(AuthKeyResponse {
auth_key,
created_at,
agent_public_key_b16: base16::encode_lower(agent_public_key.as_bytes()),
}))
}
pub async fn run_request<T>(
State((state, _app_handle)): State<(Arc<AppState>, T)>,
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
headers: HeaderMap,
body: Bytes,
) -> AgentResult<EncryptedJson<ResponseWithMetadata>> {
let nonce = headers
.get("X-Hopp-Nonce")
.ok_or(AgentError::Unauthorized)?
.to_str()
.map_err(|_| AgentError::Unauthorized)?;
let req: RequestWithMetadata = state
.validate_access_and_get_data(auth_header.token(), nonce, &body)
.ok_or(AgentError::Unauthorized)?;
let req_id = req.req_id;
let reg_info = state
.get_registration_info(auth_header.token())
.ok_or(AgentError::Unauthorized)?;
let cancel_token = tokio_util::sync::CancellationToken::new();
state.add_cancellation_token(req.req_id, cancel_token.clone());
let cancel_token_clone = cancel_token.clone();
// Execute the HTTP request in a blocking thread pool and handles cancellation.
//
// It:
// 1. Uses `spawn_blocking` to run the sync `run_request_task`
// without blocking the main Tokio runtime.
// 2. Uses `select!` to concurrently wait for either
// a. the task to complete,
// b. or a cancellation signal.
//
// Why spawn_blocking?
// - `run_request_task` uses synchronous curl operations which would block
// the async runtime if not run in a separate thread.
// - `spawn_blocking` moves this operation to a thread pool designed for
// blocking tasks, so other async operations to continue unblocked.
let result = tokio::select! {
res = tokio::task::spawn_blocking(move || hoppscotch_relay::run_request_task(&req, cancel_token_clone)) => {
match res {
Ok(task_result) => Ok(task_result?),
Err(_) => Err(AgentError::InternalServerError),
}
},
_ = cancel_token.cancelled() => {
Err(AgentError::RequestCancelled)
}
};
state.remove_cancellation_token(req_id);
result.map(|val| EncryptedJson {
key_b16: reg_info.shared_secret_b16,
data: val,
})
}
/// Provides a way for registered clients to check if their
/// registration still holds, this route is supposed to return
/// an encrypted `true` value if the given auth_key is good.
/// Since its encrypted with the shared secret established during
/// registration, the client also needs the shared secret to verify
/// if the read fails, or the auth_key didn't validate and this route returns
/// undefined, we can count on the registration not being valid anymore.
pub async fn registered_handshake(
State((state, _)): State<(Arc<AppState>, AppHandle)>,
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
) -> AgentResult<EncryptedJson<serde_json::Value>> {
let reg_info = state.get_registration_info(auth_header.token());
match reg_info {
Some(reg) => Ok(EncryptedJson {
key_b16: reg.shared_secret_b16,
data: json!(true),
}),
None => Err(AgentError::Unauthorized),
}
}
pub async fn cancel_request<T>(
State((state, _app_handle)): State<(Arc<AppState>, T)>,
TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
Path(req_id): Path<usize>,
) -> AgentResult<Json<serde_json::Value>> {
if !state.validate_access(auth_header.token()) {
return Err(AgentError::Unauthorized);
}
if let Some((_, token)) = state.remove_cancellation_token(req_id) {
token.cancel();
Ok(Json(json!({"message": "Request cancelled successfully"})))
} else {
Err(AgentError::RequestNotFound)
}
}

View File

@@ -0,0 +1,58 @@
use native_dialog::{MessageDialog, MessageType};
pub fn panic(msg: &str) {
const FATAL_ERROR: &str = "Fatal error";
MessageDialog::new()
.set_type(MessageType::Error)
.set_title(FATAL_ERROR)
.set_text(msg)
.show_alert()
.unwrap_or_default();
log::error!("{}: {}", FATAL_ERROR, msg);
panic!("{}: {}", FATAL_ERROR, msg);
}
pub fn info(msg: &str) {
log::info!("{}", msg);
MessageDialog::new()
.set_type(MessageType::Info)
.set_title("Info")
.set_text(msg)
.show_alert()
.unwrap_or_default();
}
pub fn warn(msg: &str) {
log::warn!("{}", msg);
MessageDialog::new()
.set_type(MessageType::Warning)
.set_title("Warning")
.set_text(msg)
.show_alert()
.unwrap_or_default();
}
pub fn error(msg: &str) {
log::error!("{}", msg);
MessageDialog::new()
.set_type(MessageType::Error)
.set_title("Error")
.set_text(msg)
.show_alert()
.unwrap_or_default();
}
pub fn confirm(title: &str, msg: &str, icon: MessageType) -> bool {
MessageDialog::new()
.set_type(icon)
.set_title(title)
.set_text(msg)
.show_confirm()
.unwrap_or_default()
}

View File

@@ -0,0 +1,81 @@
use axum::{
http::StatusCode,
response::{IntoResponse, Response},
Json,
};
use serde_json::json;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AgentError {
#[error("Invalid Registration")]
InvalidRegistration,
#[error("Invalid Client Public Key")]
InvalidClientPublicKey,
#[error("Unauthorized")]
Unauthorized,
#[error("Request not found or already completed")]
RequestNotFound,
#[error("Internal server error")]
InternalServerError,
#[error("Invalid request: {0}")]
BadRequest(String),
#[error("Client certificate error")]
ClientCertError,
#[error("Root certificate error")]
RootCertError,
#[error("Invalid method")]
InvalidMethod,
#[error("Invalid URL")]
InvalidUrl,
#[error("Invalid headers")]
InvalidHeaders,
#[error("Request run error: {0}")]
RequestRunError(String),
#[error("Request cancelled")]
RequestCancelled,
#[error("Failed to clear registrations")]
RegistrationClearError,
#[error("Failed to insert registrations")]
RegistrationInsertError,
#[error("Failed to save registrations to store")]
RegistrationSaveError,
#[error("Serde error: {0}")]
Serde(#[from] serde_json::Error),
#[error("Store error: {0}")]
TauriPluginStore(#[from] tauri_plugin_store::Error),
#[error("Relay error: {0}")]
Relay(#[from] hoppscotch_relay::RelayError),
}
impl IntoResponse for AgentError {
fn into_response(self) -> Response {
let (status, error_message) = match self {
AgentError::InvalidRegistration => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::InvalidClientPublicKey => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::Unauthorized => (StatusCode::UNAUTHORIZED, self.to_string()),
AgentError::RequestNotFound => (StatusCode::NOT_FOUND, self.to_string()),
AgentError::InternalServerError => (StatusCode::INTERNAL_SERVER_ERROR, self.to_string()),
AgentError::BadRequest(msg) => (StatusCode::BAD_REQUEST, msg),
AgentError::ClientCertError => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::RootCertError => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::InvalidMethod => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::InvalidUrl => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::InvalidHeaders => (StatusCode::BAD_REQUEST, self.to_string()),
AgentError::RequestRunError(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg),
AgentError::RequestCancelled => (StatusCode::BAD_REQUEST, self.to_string()),
_ => (
StatusCode::INTERNAL_SERVER_ERROR,
"Internal Server Error".to_string(),
),
};
let body = Json(json!({
"error": error_message,
}));
(status, body).into_response()
}
}
pub type AgentResult<T> = std::result::Result<T, AgentError>;

View File

@@ -0,0 +1,2 @@
pub const AGENT_STORE: &str = "app_data.bin";
pub const REGISTRATIONS: &str = "registrations";

View File

@@ -0,0 +1,178 @@
pub mod controller;
pub mod dialog;
pub mod error;
pub mod global;
pub mod model;
pub mod route;
pub mod server;
pub mod state;
pub mod tray;
pub mod updater;
pub mod util;
pub mod webview;
use log::{error, info};
use std::sync::Arc;
use tauri::{Emitter, Listener, Manager, WebviewWindowBuilder};
use tauri_plugin_updater::UpdaterExt;
use tokio_util::sync::CancellationToken;
use model::Payload;
use state::AppState;
#[tauri::command]
async fn get_otp(state: tauri::State<'_, Arc<AppState>>) -> Result<Option<String>, ()> {
Ok(state.active_registration_code.read().await.clone())
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
env_logger::init();
// The installer takes care of installing `WebView`,
// this check is only required for portable variant.
#[cfg(all(feature = "portable", windows))]
webview::init_webview();
let cancellation_token = CancellationToken::new();
let server_cancellation_token = cancellation_token.clone();
tauri::Builder::default()
// NOTE: Currently, plugins run in the order they were added in to the builder,
// so `tauri_plugin_single_instance` needs to be registered first.
// See: https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/single-instance
.plugin(tauri_plugin_single_instance::init(|app, args, cwd| {
info!("{}, {args:?}, {cwd}", app.package_info().name);
app.emit("single-instance", Payload::new(args, cwd))
.unwrap();
// Application is already running, bring it to foreground.
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();
} else {
error!("Failed to get `main` window");
}
}))
.plugin(tauri_plugin_store::Builder::new().build())
.setup(move |app| {
let app_handle = app.app_handle();
#[cfg(all(desktop, not(feature = "portable")))]
{
use tauri_plugin_autostart::MacosLauncher;
use tauri_plugin_autostart::ManagerExt;
let _ = app.handle().plugin(tauri_plugin_autostart::init(
MacosLauncher::LaunchAgent,
None,
));
let autostart_manager = app.autolaunch();
println!(
"autostart enabled: {}",
autostart_manager.is_enabled().unwrap()
);
if !autostart_manager.is_enabled().unwrap() {
let _ = autostart_manager.enable();
println!(
"autostart updated: {}",
autostart_manager.is_enabled().unwrap()
);
}
};
#[cfg(desktop)]
{
let _ = app
.handle()
.plugin(tauri_plugin_updater::Builder::new().build());
let _ = app.handle().plugin(tauri_plugin_dialog::init());
let updater = app.updater_builder().build().unwrap();
let app_handle_ref = app_handle.clone();
tauri::async_runtime::spawn_blocking(|| {
tauri::async_runtime::block_on(async {
updater::check_and_install_updates(app_handle_ref, updater).await;
})
});
};
let app_state = Arc::new(AppState::new(app_handle.clone())?);
app.manage(app_state.clone());
let server_cancellation_token = server_cancellation_token.clone();
let server_app_handle = app_handle.clone();
tauri::async_runtime::spawn(async move {
server::run_server(app_state, server_cancellation_token, server_app_handle).await;
});
#[cfg(all(desktop))]
{
let handle = app.handle();
tray::create_tray(handle)?;
}
// Blocks the app from populating the macOS dock
#[cfg(target_os = "macos")]
{
app_handle
.set_activation_policy(tauri::ActivationPolicy::Accessory)
.unwrap();
};
let app_handle_ref = app_handle.clone();
app_handle.listen("registration_received", move |_| {
WebviewWindowBuilder::from_config(
&app_handle_ref,
&app_handle_ref.config().app.windows[0],
)
.unwrap()
.build()
.unwrap()
.show()
.unwrap();
});
Ok(())
})
.manage(cancellation_token)
.on_window_event(|window, event| {
match &event {
tauri::WindowEvent::CloseRequested { .. } => {
let app_state = window.state::<Arc<AppState>>();
let mut current_code = app_state.active_registration_code.blocking_write();
if current_code.is_some() {
*current_code = None;
}
}
_ => {}
};
})
.invoke_handler(tauri::generate_handler![get_otp])
.build(tauri::generate_context!())
.expect("error while building tauri application")
.run(|app_handle, event| match event {
tauri::RunEvent::ExitRequested { api, code, .. } => {
if code.is_none() || matches!(code, Some(0)) {
api.prevent_exit()
} else if code.is_some() {
let state = app_handle.state::<CancellationToken>();
state.cancel();
}
}
_ => {}
});
}

View File

@@ -0,0 +1,6 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
hoppscotch_agent_lib::run()
}

View File

@@ -0,0 +1,47 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
/// Single instance payload.
#[derive(Clone, Serialize)]
pub struct Payload {
args: Vec<String>,
cwd: String,
}
impl Payload {
pub fn new(args: Vec<String>, cwd: String) -> Self {
Self { args, cwd }
}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct HandshakeResponse {
#[allow(non_snake_case)]
pub __hoppscotch__agent__: bool,
pub status: String,
pub agent_version: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct ConfirmedRegistrationRequest {
pub registration: String,
/// base16 (lowercase) encoded public key shared by the client
/// to the agent so that the agent can establish a shared secret
/// which will be used to encrypt traffic between agent
/// and client after registration
pub client_public_key_b16: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct AuthKeyResponse {
pub auth_key: String,
pub created_at: DateTime<Utc>,
/// base16 (lowercase) encoded public key shared by the
/// agent so that the client can establish a shared secret
/// which will be used to encrypt traffic between agent
/// and client after registration
pub agent_public_key_b16: String,
}

View File

@@ -0,0 +1,28 @@
use axum::{
routing::{get, post},
Router,
};
use std::sync::Arc;
use tauri::AppHandle;
use crate::{controller, state::AppState};
pub fn route(state: Arc<AppState>, app_handle: AppHandle) -> Router {
Router::new()
.route("/handshake", get(controller::handshake))
.route(
"/receive-registration",
post(controller::receive_registration),
)
.route(
"/verify-registration",
post(controller::verify_registration),
)
.route(
"/registered-handshake",
get(controller::registered_handshake),
)
.route("/request", post(controller::run_request))
.route("/cancel-request/:req_id", post(controller::cancel_request))
.with_state((state, app_handle))
}

View File

@@ -0,0 +1,34 @@
use axum::Router;
use std::sync::Arc;
use tokio_util::sync::CancellationToken;
use tower_http::cors::CorsLayer;
use crate::route;
use crate::state::AppState;
pub async fn run_server(
state: Arc<AppState>,
cancellation_token: CancellationToken,
app_handle: tauri::AppHandle,
) {
let cors = CorsLayer::permissive();
let app = Router::new()
.merge(route::route(state, app_handle))
.layer(cors);
let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 9119));
println!("Server running on http://{}", addr);
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.with_graceful_shutdown(async move {
cancellation_token.cancelled().await;
})
.await
.unwrap();
println!("Server shut down");
}

Some files were not shown because too many files have changed in this diff Show More