ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
https://proxyman.io
5.34k stars 177 forks source link

Add support custom terminal like iterm2 for automatic setup #2060

Open fleitman opened 1 week ago

fleitman commented 1 week ago

Description

At the moment, the documentation says:

Only the pre-configured Terminal app is able to capture HTTP traffic out of the box. If you would like to use your own Terminal app (e.g. iTerm2, Hyper, etc), please use the Manual Setup.

The result is a flow of 3 taps

  1. Click Setup
  2. Click Automatic Setup
  3. Open new terminal

Changes to flow

  1. Click Setup
  2. Click Manual Setup
  3. Click copy to Clipboard
  4. Open the appropriate terminal
  5. Enter command+v
  6. Press enter

At a minimum I would like to be able to select a terminal for auto tuning Ideally, I would like a more user-friendly interface, for example, a button that immediately opens the terminal in 1 click, and with the hotkey held down, for example, option copied to the clipboard

Why this feature/change is important?

Because now it is not particularly clear that you need to poke "Setup" and you have to Google to configure the terminal, this requires an excessive number of clicks.

NghiaTranUIT commented 1 week ago

Thanks for opening the ticket.

I support the built-in Terminal app because it natively supports Apple Script. From what I remember, I had some problems with iTerm2 with the AppScript, and I couldn't find any feasible solution, so I skipped it.

Let me re-investigate and find an alternative solution 👍

fleitman commented 1 week ago

Try:

tell application "iTerm"
    set newWindow to (create window with default profile)
    tell current session of newWindow
        write text "set -a && . ~/.proxyman/proxyman_env_automatic_setup.sh && set +a"
    end tell
end tell
fleitman commented 1 week ago

Or for new tab

tell application "iTerm"
    activate
    delay 0.5 -- A small delay for iTerm to create a window
    if (count of windows) is 0 then
        set newWindow to (create window with default profile)
        tell current session of newWindow
        end tell
    else
        tell current window
            set newTab to (create tab with default profile)
            delay 0.5 -- A small delay for iTerm to create a tab
            set newSession to current session of newTab
        end tell
    end if
    tell newSession
        write text "set -a && . ~/.proxyman/proxyman_env_automatic_setup.sh && set +a"
    end tell
end tell
NghiaTranUIT commented 1 week ago

Thanks @fleitman , let's try this Beta build: https://download.proxyman.io/beta/Proxyman_5.5.0_support_auto_setup_for_iTerm2.dmg

CleanShot 2024-06-18 at 10 10 58@2x

fleitman commented 1 week ago

@NghiaTranUIT yes, the iterm2 setup now works via proxyman. Perhaps you should add a check mark so that instead of a new window it makes a new tab (it's not very critical for me, since I was still looking for a solution for you, I already bind the apple script :))

What do you think about improving usability in this area?

Ideally, I would like a more user-friendly interface, for example, a button that immediately opens the terminal in 1 click, and with the hotkey held down, for example, option copied to the clipboard

NghiaTranUIT commented 1 week ago

Update with new Apple Script for iTerm 2: https://download.proxyman.io/beta/Proxyman_5.5.0_Improve_iterm2_apple_script.dmg

Ideally, I would like a more user-friendly interface, for example, a button that immediately opens the terminal in 1 click, and with the hotkey held down, for example, option copied to the clipboard

IMO, it's better to show the Auto and Manual Setup since it's easier to understand. From my experience, users might not be aware that holding the Option and clicking will copy to the clipboard.

Manual Setup also displays the command line, so power users will understand what is going on.