mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
* feat: migrated email service to plane-ee * feat: added build files * fix: goreleaser for naming the binary * fix: github CI * feat: added certification generation * fix: github CI * feat: changed name for email service * minor fixes to docker file and cert gen process. Added k8s manifest for testing * removed build-email action * added eks-cloudflare-setup instructions * added support to gke * modfied container ports from 25 465 587 to 10025 10465 10587 * cleanup yml files * email docs cleanup * added email service build action in plane cloud github action file * fix: typo fix of email service image name * fix: replaced base action for email service * fix: registry name * fix: uses in email service * feat:modified-k8s-proxy * updated k8s manifest * updated k8s template * fix: email build action * fix image name * fixed the spam detection mechanism * upated k8s manifest --------- Co-authored-by: Manish Gupta <manish@plane.so> Co-authored-by: akshat5302 <akshatjain9782@gmail.com> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: Manish Gupta <59428681+mguptahub@users.noreply.github.com>
47 lines
1.0 KiB
Go
47 lines
1.0 KiB
Go
package parser
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func IsSpam(content string) bool {
|
|
spamWords, err := os.ReadFile("spam.txt")
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return false
|
|
}
|
|
// convert spamWords to string
|
|
spamWordsStr := string(spamWords)
|
|
spamWordsArr := strings.Split(spamWordsStr, "\n")
|
|
|
|
for _, word := range spamWordsArr {
|
|
word = strings.TrimSpace(word)
|
|
if word != "" && strings.Contains(strings.ToLower(content), word) {
|
|
fmt.Println("Detected spam word: ", word)
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func IsBacklistedDomain(email string) bool {
|
|
blacklistedDomains, err := os.ReadFile("domain-blacklist.txt")
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return false
|
|
}
|
|
// convert blacklistedDomains to string
|
|
blacklistedDomainsStr := string(blacklistedDomains)
|
|
// blacklistedDomainsArr := strings.Split(blacklistedDomainsStr, "\n")
|
|
|
|
atIndex := strings.LastIndex(email, "@")
|
|
if atIndex == -1 {
|
|
return true
|
|
}
|
|
emailDomain := email[atIndex+1:]
|
|
return strings.Contains(blacklistedDomainsStr, emailDomain+"\n")
|
|
}
|