refactor(wildcard): optimize and add caching (#1634)

* fix(wildcard): avoid excessive allocations every loop

* are you going to Scarborough Fair?

* ruby ruby ruby ruby

* ride on, little murphy

* shirley?

* to the moon

* reggie are you there?

* code 99

* my doctorate is in Art History

* helps to be consistent

* tidy

* slow and steady gets the clam

* oysters were better anyway

* DIAL TONE
This commit is contained in:
Kyle Sanderson 2024-09-02 02:18:14 -07:00 committed by GitHub
parent bc0f4cc055
commit 982f7ddf68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 177 additions and 60 deletions

View file

@ -37,9 +37,10 @@ func (s *lunaSeaSender) Name() string {
return "lunasea"
}
var lunaWebhook = regexp.MustCompile(`/(radarr|sonarr|lidarr|tautulli|overseerr)/`)
func (s *lunaSeaSender) rewriteWebhookURL(url string) string {
re := regexp.MustCompile(`/(radarr|sonarr|lidarr|tautulli|overseerr)/`)
return re.ReplaceAllString(url, "/custom/")
return lunaWebhook.ReplaceAllString(url, "/custom/")
} // `custom` is not mentioned in their docs, so I thought this would be a good idea to add to avoid user errors
func NewLunaSeaSender(log zerolog.Logger, settings domain.Notification) domain.NotificationSender {