Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/implement mvp new tab page #6923

Merged

Conversation

lups2000
Copy link
Contributor

@lups2000 lups2000 commented Jun 13, 2024

Description

In this PR, I've begun implementing the initial MVP for the new Capture tab, following the mockup proposed here. I started implementing the Regular mode and a simplified version of the Local mode.

TODOs:

  • Improve design mode toggle
  • Remove inline style
  • Make Regular mode functional
  • Make Local mode functional
  • Add new tests

DEMO:

Screen.Recording.2024-06-16.at.15.07.13.mov

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

lups2000 and others added 17 commits June 11, 2024 09:12
…6910)

* autofix generated JS files and do not patch them in tests

* autofix: setup python

* [autofix.ci] apply automated fixes

* autofix: setup node

* add missing newline

* fixup

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix clipboard handling in safari

closes mitmproxy#6911, mitmproxy#6909

Co-authored-by: Can Yesilyurt <[email protected]>

* [autofix.ci] apply automated fixes

* update dependencies

---------

Co-authored-by: Can Yesilyurt <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix zstd decompression (issue mitmproxy#6914)

* add our fix to CHANGELOG

* add explicit read_across_frames=True + move zstd test to test_encoding.py

---------

Co-authored-by: Maximilian Hils <[email protected]>
mhils

This comment was marked as outdated.

@lups2000

This comment was marked as outdated.

web/src/js/components/Modes/Regular.tsx Outdated Show resolved Hide resolved
web/src/js/ducks/modes.ts Outdated Show resolved Hide resolved
mhils and others added 4 commits June 14, 2024 17:43
* Add HttpConnectedHook and HttpConnectErrorHook

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@mhils mhils force-pushed the feature/implement-mvp-new-tab-page branch from 33170c3 to f0147cb Compare June 21, 2024 21:10
Copy link
Member

@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've integrated the latest capture-tab changes and did a few commits with cleanups. Please take a look at them and extrapolate to the rest. 😄

@lups2000
Copy link
Contributor Author

thank you @mhils 🙏 , I updated the last tests (FIXMEs) according to what you have done before :)

web/src/js/__tests__/ducks/modes/localSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/localSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/regularSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/regularSpec.tsx Outdated Show resolved Hide resolved
web/src/js/ducks/modes/utils.ts Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/regularSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modesSpec.tsx Outdated Show resolved Hide resolved
web/src/js/ducks/modes/regular.ts Outdated Show resolved Hide resolved
web/src/js/ducks/modes/utils.ts Outdated Show resolved Hide resolved
Copy link
Member

@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks much more solid now - thanks!

web/src/js/__tests__/ducks/modes/localSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/utilsSpec.tsx Outdated Show resolved Hide resolved
web/src/js/__tests__/ducks/modes/utilsSpec.tsx Outdated Show resolved Hide resolved
web/src/js/ducks/modes/utils.ts Show resolved Hide resolved
web/src/js/ducks/modes/utils.ts Outdated Show resolved Hide resolved

if (listenAt) {
if (listenAt.includes(":")) {
[host, port] = listenAt.split(":");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add tests for IPv6 listen_addrs, this will fail. 😉

We can put this into web/src/js/utils.ts:

export function rpartition(str: string, sep: string): [string, string] {
  const lastIndex = str.lastIndexOf(sep);
  if (lastIndex === -1) {
    return ['', str];
  }
  const before = str.slice(0, lastIndex);
  const after = str.slice(lastIndex + sep.length);
  return [before, after];
}

Copy link
Contributor Author

@lups2000 lups2000 Jun 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

example? I took inspiration from what you linked to me 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think with this new version?

@lups2000
Copy link
Contributor Author

just a small "issue" now: I don't know why when toggling the local mode we're getting : VM105:6 ImmutableStateInvariantMiddleware took 43ms, which is more than the warning threshold of 32ms. If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions. It is disabled in production builds, so you don't need to worry about that. in the console 🤔

Copy link
Member

@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀🚀🚀

listen_host: "localhost",
};
const result = includeModeState("regular", mode);
expect(result).toEqual(["regular"]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This here is a really annoying edge case: The mode specs currently don't support host only, but a UI for this would probably have it as separate input. Something we should tackle, but not in this PR. :)

@mhils mhils merged commit d9770ad into mitmproxy:capture-tab Jun 24, 2024
23 checks passed
mhils added a commit that referenced this pull request Jun 26, 2024
commit 5ca998d
Author: Matteo Luppi <[email protected]>
Date:   Wed Jun 26 17:27:47 2024 +0200

    Sync capture tab to main (#6963)

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <[email protected]>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * mitmproxy 10.3.1

    * reopen main for development

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <[email protected]>

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * release ci: strip "v" prefix from sigstore file

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * Update autofix action (#6946)

    update autofix action

    * Fix issue #6944: Optimize response/request_body_buf by using list of byte chunks to avoid concatenation overhead (#6952)

    * Fix the issue #6944: non-linear growth in processing time with mitmproxy regarding packet size. Replace the string (bytes) concatenation implementation of request_body_buf and response_body_buf to a list of chunk of bytes.

    * Update the CHANGELOG.md regarding issue #6944

    * [autofix.ci] apply automated fixes

    * Update CHANGELOG.md

    * [autofix.ci] apply automated fixes

    * move receivebuffer into dedicated class

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <[email protected]>

    * Use existing API to unpack/pack domain names in HTTPS records (#6949)

    * Use existing API to unpack/pack domain names in HTTPS records

    * [autofix.ci] apply automated fixes

    * tangentially related grammar fix

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <[email protected]>

    * Add support for DNS over TCP (#6935)

    * Parse DNS over TCP messages

    * [autofix.ci] apply automated fixes

    * Update _next_layer to detect DNS over TCP messages

    * [autofix.ci] apply automated fixes

    * Fixup

    * allow query pipelining

    * [autofix.ci] apply automated fixes

    * Restructure pack/unpack mechanism and update tests

    * Add tests

    * [autofix.ci] apply automated fixes

    * [autofix.ci] apply automated fixes (attempt 2/3)

    * [autofix.ci] apply automated fixes

    * [autofix.ci] apply automated fixes

    * Update next_layer test

    * Add suggested changes

    * [autofix.ci] apply automated fixes

    * bump minimum hypothesis version

    * bump hypothesis for good

    * Update CHANGELOG.md

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <[email protected]>

    * web: fix "show more" button (#6958)

    fix #6951

    ---------

    Co-authored-by: Maximilian Hils <[email protected]>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: mitmproxy release bot <[email protected]>
    Co-authored-by: Andras Spitzer <[email protected]>
    Co-authored-by: Gaurav Jain <[email protected]>
    Co-authored-by: Walt Chen <[email protected]>
    Co-authored-by: jackfromeast <[email protected]>
    Co-authored-by: Maximilian Hils <[email protected]>
    Co-authored-by: Alexander Prinzhorn <[email protected]>

commit e047e76
Author: Matteo Luppi <[email protected]>
Date:   Wed Jun 26 13:07:27 2024 +0200

    Feature/wireguard mode (#6959)

    * define first components

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <[email protected]>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * define first modes components

    * adapt code to reuse checkbox component

    * mitmproxy 10.3.1

    * reopen main for development

    * [autofix.ci] apply automated fixes

    * improve mode toggle design

    * remove inline style

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <[email protected]>

    * first attempt to make the modes functional

    * [autofix.ci] apply automated fixes

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * refactor code according to review

    * [autofix.ci] apply automated fixes

    * first prototype regular mode

    * [autofix.ci] apply automated fixes

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * change name regular duck

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * rewrite updateMode function and error handling regular mode

    * remove label component

    * add input field to local mode and fix onKeyDown issue

    * add dropdown to reverse mode

    * [autofix.ci] apply automated fixes

    * change defualt string reverse dropdown

    * add new logic to handle modes in the duck

    * add local mode with no applications

    * [autofix.ci] apply automated fixes

    * regular mode is now persistent

    * forgot recieve event in regular mode

    * join receive and update event

    * make local mode functional

    * make wireguard mode functional

    * [autofix.ci] apply automated fixes

    * make reverse mode functional

    * [autofix.ci] apply automated fixes

    * fix bug reverse mode when refreshing

    * fix bug local mode

    * [autofix.ci] apply automated fixes

    * fix old test

    * implement first tests

    * [autofix.ci] apply automated fixes

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * remove wireguard and reverse modes

    * change name function to set local applications

    * remove error handling

    * remove left over

    * add some other review changes

    * [autofix.ci] apply automated fixes

    * release ci: strip "v" prefix from sigstore file

    * fix addListen Addr function

    * adjust reverse protocol attribute

    * create proper method to parse the mode

    * adjust passing applications to local mode

    * fix onKeyDown listener and add new input field to local mode

    * [autofix.ci] apply automated fixes

    * remove leftover

    * update tests

    * [autofix.ci] apply automated fixes

    * remove wireguard and reverse files

    * remove additional state local mode

    * adjust tests local mode

    * update tests local mode

    * update last tests modes

    * [autofix.ci] apply automated fixes

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * use fetchMock instead of jest.mock

    this is slightly nicer because we are testing at the application boundary

    * duck tests should use action creators and not manually construct actions

    * move toggleLocal to fetchMock

    * move updateMode and ModeState into utils

    this avoids circular imports. utils may not be the perfect place, but much better than the circular imports

    * nits

    * [autofix.ci] apply automated fixes

    * update tests regular and local mode

    * [autofix.ci] apply automated fixes

    * review changes tests

    * [autofix.ci] apply automated fixes

    * adjust parseMode issue

    * [autofix.ci] apply automated fixes

    * add first components for wireguard mode

    * fix CI

    * fix typo

    * add tests to wireguard mode

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: Maximilian Hils <[email protected]>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: mitmproxy release bot <[email protected]>
    Co-authored-by: Andras Spitzer <[email protected]>
    Co-authored-by: Gaurav Jain <[email protected]>
    Co-authored-by: Walt Chen <[email protected]>

commit d9770ad
Author: Matteo Luppi <[email protected]>
Date:   Mon Jun 24 19:40:47 2024 +0200

    Feature/implement mvp new tab page (#6923)

commit afb22c2
Author: Maximilian Hils <[email protected]>
Date:   Fri Jun 21 23:09:31 2024 +0200

    Sync `capture-tab` with `main` (#6943)

    * Update CHANGELOG.md

    * Autofix generated JS files and do not patch them in tests (#6910)

    * autofix generated JS files and do not patch them in tests

    * autofix: setup python

    * [autofix.ci] apply automated fixes

    * autofix: setup node

    * add missing newline

    * fixup

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * Update package-lock.json, bump esbuild (#6915)

    update node version, bump esbuild

    * Fix clipboard handling in safari (#6917)

    * fix clipboard handling in safari

    closes #6911, #6909

    Co-authored-by: Can Yesilyurt <[email protected]>

    * [autofix.ci] apply automated fixes

    * update dependencies

    ---------

    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * mitmproxy 10.3.1

    * reopen main for development

    * release script: add one less newline

    * fix zstd decompression (#6921)

    * fix zstd decompression (issue #6914)

    * add our fix to CHANGELOG

    * add explicit read_across_frames=True + move zstd test to test_encoding.py

    ---------

    Co-authored-by: Maximilian Hils <[email protected]>

    * Update CHANGELOG.md

    * web: Upgrade Redux (#6926)

    * update redux and fix resulting test and type failures
    * update prettier

    * Use upstream urwid again (#6929)

    use upstream urwid again

    * Add `HttpConnectedHook` and `HttpConnectErrorHook` (#6930)

    * Add HttpConnectedHook and HttpConnectErrorHook

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * make DNS mode listen for both UDP and TCP (#6912)

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

    * release ci: strip "v" prefix from sigstore file

    * fix: OSError raised when ipv6 is disabled (#6942)

    the function should return None in this case

    * [autofix.ci] apply automated fixes

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Can Yesilyurt <[email protected]>
    Co-authored-by: mitmproxy release bot <[email protected]>
    Co-authored-by: Andras Spitzer <[email protected]>
    Co-authored-by: Gaurav Jain <[email protected]>
    Co-authored-by: Walt Chen <[email protected]>

commit d0867f6
Author: Matteo Luppi <[email protected]>
Date:   Mon Jun 10 11:27:54 2024 +0200

    Feature/add new capture tab (#6887)

    * add just the new tab to the header

    * remove header menu from capture tab

    * create context to handle the current active menu tab

    * update tests

    * remove useless comments

    * update tests to reach higher coverage

    * remove context, use props to achieve same result

    * update tests

    * [autofix.ci] apply automated fixes

    * add test for capture menu component

    * adjust changelog format

    * [autofix.ci] apply automated fixes

    * fix CHANGELOG

    ---------

    Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
    Co-authored-by: Maximilian Hils <[email protected]>
    Co-authored-by: Maximilian Hils <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants