Skip to content

Commit

Permalink
Merge pull request #237 from wakatime/feature/browser-activity-filter…
Browse files Browse the repository at this point in the history
…-fixes

Fix browser filter strings
  • Loading branch information
alanhamlett authored Mar 25, 2024
2 parents 1ded43b + f449dce commit bcd4bd0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion WakaTime/Helpers/FilterManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class FilterManager {
}
case .allowlist:
let addressMatchesAllowlist = patterns.contains { pattern in
httpAddress.matchesRegex(pattern) || httpsAddress.matchesRegex(pattern)
address.matchesRegex(pattern) || httpAddress.matchesRegex(pattern) || httpsAddress.matchesRegex(pattern)
}
// If none of the patterns on the allowlist match the given address, filter the site out
if !addressMatchesAllowlist {
Expand Down
14 changes: 8 additions & 6 deletions WakaTime/Helpers/PropertiesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,14 @@ class PropertiesManager {
get {
guard let allowlist = UserDefaults.standard.string(forKey: Keys.allowlist.rawValue) else {
return
"https://github.com/\n" +
"https://gitlab.com/\n" +
"https://stackoverflow.com/\n" +
"https://docs.python.org/\n" +
"https://google.com/\n" +
"https://npmjs.com"
"https?://(\\w\\.)*github\\.com/\n" +
"https?://(\\w\\.)*gitlab\\.com/\n" +
"^stackoverflow\\.com/\n" +
"^docs\\.python\\.org/\n" +
"https?://(\\w\\.)*golang\\.org/\n" +
"https?://(\\w\\.)*go\\.dev/\n" +
"https?://(\\w\\.)*npmjs\\.com/\n" +
"https?//localhost[:\\d+]?/"
}

return allowlist
Expand Down
6 changes: 3 additions & 3 deletions WakaTime/Views/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SettingsView: NSView, NSTextFieldDelegate, NSTextViewDelegate {
// MARK: Denylist/Allowlist

lazy var filterTypeLabel: NSTextField = {
NSTextField(labelWithString: "Logging Style:")
NSTextField(labelWithString: "Browser Filter:")
}()

lazy var filterSegmentedControl: NSSegmentedControl = {
Expand Down Expand Up @@ -230,11 +230,11 @@ class SettingsView: NSView, NSTextFieldDelegate, NSTextViewDelegate {
let denylistTitle = "Denylist:"
let denylistRemarks =
"Sites that you don't want to show in your reports. " +
"One line per site."
"Only applicable to browsing activity. One regex per line."
let allowlistTitle = "Allowlist:"
let allowlistRemarks =
"Sites that you want to show in your reports. " +
"One line per site."
"Only applicable to browsing activity. One regex per line."

var title: String
var remarks: String
Expand Down

0 comments on commit bcd4bd0

Please sign in to comment.