mirror of
https://github.com/aykhans/bsky-feedgen.git
synced 2025-06-05 04:12:03 +00:00
Compare commits
No commits in common. "b9633e84dac7465824dd9f0d296dfd01c8e50de2" and "bc29dabd8a720906085fc81c4481c7d22d38f657" have entirely different histories.
b9633e84da
...
bc29dabd8a
@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
const version = "0.2.201"
|
||||
const version = "0.2.2"
|
||||
|
@ -1,3 +1,3 @@
|
||||
package main
|
||||
|
||||
const version = "0.1.106"
|
||||
const version = "0.1.105"
|
||||
|
@ -110,24 +110,16 @@ func (generator *Generator) Start(ctx context.Context, cursorOption types.Genera
|
||||
}
|
||||
|
||||
func (generator *Generator) IsValid(post *collections.Post) bool {
|
||||
// Skip posts that are deep replies (not direct replies to original posts)
|
||||
if post.Reply != nil && post.Reply.RootURI != post.Reply.ParentURI {
|
||||
return false
|
||||
}
|
||||
|
||||
// Check if the user who created this post is in our pre-defined list
|
||||
// This allows for explicit inclusion/exclusion of specific users
|
||||
if isValidUser := Users.IsValid(post.DID); isValidUser != nil {
|
||||
return *isValidUser
|
||||
}
|
||||
|
||||
// A post is considered valid if it meets either of the following criteria:
|
||||
// 1. It's primarily in Azerbaijani (language code "az") with less than 3 detected languages
|
||||
// (to filter out multi-language spam)
|
||||
// 2. It contains Azerbaijan-related keywords in the text AND has at least one valid language
|
||||
// from our approved language list
|
||||
if (slices.Contains(post.Langs, "az") && len(post.Langs) < 3) ||
|
||||
(generator.textRegex.MatchString(post.Text) && Langs.IsExistsAny(post.Langs)) {
|
||||
if (slices.Contains(post.Langs, "az") && len(post.Langs) < 3) || // Posts in Azerbaijani language with fewer than 3 languages
|
||||
generator.textRegex.MatchString(post.Text) { // Posts containing Azerbaijan-related keywords
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,6 @@ var Users = generator.Users{
|
||||
"did:plc:6bvhdvgeqkj7nol2zodtqmww": false,
|
||||
"did:plc:k6sxlkd5ssq2uaylzisap2tw": false,
|
||||
"did:plc:uxljnh22mmfzmr4i3oien6mx": false,
|
||||
"did:plc:w5gg2zgwcyfevphehdcmavev": false,
|
||||
"did:plc:ckawbibgmrwg3lbskfppwtlw": false,
|
||||
"did:plc:43fdk46qa5gsokzygzildsaq": false,
|
||||
|
||||
// Valid
|
||||
"did:plc:jbt4qi6psd7rutwzedtecsq7": true,
|
||||
@ -45,10 +42,3 @@ var Users = generator.Users{
|
||||
"did:plc:ftoopigdpuzqt2kpeyqxsofx": true,
|
||||
"did:plc:cs2cbzojm6hmx5lfxiuft3mq": true,
|
||||
}
|
||||
|
||||
var Langs = generator.Langs{
|
||||
"az": true,
|
||||
"en": true,
|
||||
"tr": true,
|
||||
"ru": true,
|
||||
}
|
||||
|
@ -67,23 +67,3 @@ func (u Users) GetAll() []string {
|
||||
|
||||
return allUsers
|
||||
}
|
||||
|
||||
type Langs map[string]bool
|
||||
|
||||
// IsExistsAny checks if any of the given language codes exist in the Langs map.
|
||||
//
|
||||
// Parameters:
|
||||
// - langs: A slice of language code strings to check for existence
|
||||
//
|
||||
// Returns:
|
||||
// - bool: true if at least one language code from the input slice exists in the map,
|
||||
// false if none of the provided language codes exist
|
||||
func (l Langs) IsExistsAny(langs []string) bool {
|
||||
for _, lang := range langs {
|
||||
if _, ok := l[lang]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user