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

Create HighlightListenerPort.bambda #60

Merged
merged 2 commits into from
Feb 22, 2024
Merged

Conversation

Bogo-6
Copy link
Contributor

@Bogo-6 Bogo-6 commented Feb 22, 2024

Just a highlighter in case you use more listener ports.

Bambda Contributions

  • Bambda has a valid header, featuring an @author annotation and suitable description
  • Bambda compiles and executes as expected
  • Only .bambda files have been added or modified (README.md files are automatically updated / generated after PR merge)

Just a highlighter in case you use more listener ports.
@PortSwiggerWiener
Copy link
Collaborator

Thanks for the pull request. It looks good. You could make it a bit more generic using a couple of maps. E.g.:

var colorMap = Map.of(
    8080, HighlightColor.BLUE,
    8082, HighlightColor.YELLOW
);
var notesMap = Map.of(
    8080, "User 1", 
    8082, "User 2"
);


var listenerPort = requestResponse.listenerPort();
var color = colorMap.get(listenerPort);
var notes = notesMap.get(listenerPort);

if (manualColorHighlightEnabled && color != null) {
    requestResponse.annotations().setHighlightColor(color);
}

if (manualColorHighlightEnabled && notes != null) {
    requestResponse.annotations().setNotes(notes);
}

return color != null || notes != null;

What do you think?

@Bogo-6
Copy link
Contributor Author

Bogo-6 commented Feb 22, 2024

Thanks, it looks cleaner. In the example, the boolean manualColorHighlightEnabled is missing, the rest works as it should.

Copy link
Collaborator

@PortSwiggerWiener PortSwiggerWiener left a comment

Choose a reason for hiding this comment

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

Thanks for making the changes!

Looks good 👍

@ps-porpoise ps-porpoise merged commit 6905a5a into PortSwigger:main Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants