Skip to content

Commit

Permalink
Merge pull request TypeError#1 from TypeError/master
Browse files Browse the repository at this point in the history
Older kotlin version
  • Loading branch information
Hannah-PortSwigger authored Dec 19, 2019
2 parents 38a2575 + ca8cc9f commit 978e5c4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kotlin.code.style=official
kotlin_version=1.3.61
kotlin_version=1.3.21
26 changes: 21 additions & 5 deletions src/BookmarkOptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,21 @@ class BookmarkOptions(
bookmarksPanel.model.refreshBookmarks()
SwingUtilities.invokeLater {
val bookmarks = bookmarksPanel.bookmarks
val highlightedProxyHistory = callbacks.proxyHistory.filter { it.highlight != null }
val bookmarkRequests = bookmarks.map { callbacks.helpers.bytesToString(it.requestResponse.request) }
val bookmarksToAdd = highlightedProxyHistory
.filter { !bookmarkRequests.contains(callbacks.helpers.bytesToString(it.request)) }.toTypedArray()
val bookmarkResponses =
bookmarks.map { callbacks.helpers.bytesToString(it.requestResponse.response ?: ByteArray(0)) }
val proxyHistory = callbacks.proxyHistory.asSequence()
val bookmarksToAdd = proxyHistory
.filter { it.highlight != null }
.filterNot {
bookmarkRequests.contains(callbacks.helpers.bytesToString(it.request)) &&
bookmarkResponses.contains(
callbacks.helpers.bytesToString(it.response)
)
}
.distinct()
.toList()
.toTypedArray()
bookmarksPanel.addBookmark(bookmarksToAdd)
}
}
Expand All @@ -54,8 +65,13 @@ class BookmarkOptions(
if (searchText.isNotEmpty()) {
val filteredBookmarks = bookmarks
.filter {
callbacks.helpers.bytesToString(it.requestResponse.request).toLowerCase().contains(searchText) &&
callbacks.helpers.bytesToString(it.requestResponse.response).toLowerCase().contains(
it.url.toString().toLowerCase().contains(searchText) ||
callbacks.helpers.bytesToString(it.requestResponse.request).toLowerCase().contains(
searchText
) ||
callbacks.helpers.bytesToString(
it.requestResponse.response ?: ByteArray(0)
).toLowerCase().contains(
searchText
)
}.toMutableList()
Expand Down

0 comments on commit 978e5c4

Please sign in to comment.