Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(irc): allow lazy announcer nicks #1322

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

s0up4200
Copy link
Collaborator

@s0up4200 s0up4200 commented Dec 29, 2023

Given how some indexers are “lazy” in the lack of a better word with NickServ identifying their announcers, this seems like a good addition.

d27ef46 simplifies this by making it support a suffixed digit all the time. This commit reverts all the previous commits.

Outdated ![CleanShot 2023-12-29 at 22 53 11@2x](https://github.com/autobrr/autobrr/assets/18177310/d7277ffc-f398-4647-a607-2f943800ef26)

@s0up4200 s0up4200 added web backend Backend irc database Database related database-migrations Database migrations to change the schema labels Dec 29, 2023
@s0up4200 s0up4200 requested a review from zze0s December 29, 2023 21:52
@s0up4200 s0up4200 added this to the v1.36.0 milestone Dec 30, 2023
internal/database/postgres_migrate.go Outdated Show resolved Hide resolved
internal/database/sqlite_migrate.go Outdated Show resolved Hide resolved
@s0up4200 s0up4200 linked an issue Dec 30, 2023 that may be closed by this pull request
@s0up4200 s0up4200 removed web database Database related database-migrations Database migrations to change the schema labels Dec 30, 2023
@s0up4200 s0up4200 marked this pull request as draft January 6, 2024 11:29
@zze0s zze0s removed this from the v1.36.0 milestone Jan 28, 2024
@s0up4200 s0up4200 added the help wanted Extra attention is needed label Jan 31, 2024
@s0up4200 s0up4200 linked an issue Feb 4, 2024 that may be closed by this pull request
@Flupster
Copy link
Contributor

Flupster commented Feb 5, 2024

Considering the variability in bot nickname postfixes, it might be impractical to assume that a digit will be appended for the IRC nick. From my observation a _ postfix appears to be more prevalent. I suggest the following approach:

// Verify if the nickname concludes with an asterisk and holds the correct prefix
if strings.HasSuffix(announcer, "*") && strings.HasPrefix(nick, announcer) {
    return true
}

// Confirm if the nickname starts with the announcer and comprises one additional character
if strings.HasPrefix(nick, announcer) && len(nick) == len(announcer)+1 {
    return true
}

Since IRC nicknames typically do not permit asterisks, this adjustment accommodates cases where an announcer ends with an asterisk in its definition. Additionally, I have omitted the requirement for the last character to be a digit, which was the original issue I anticipated.

Copy link
Collaborator

@zze0s zze0s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to allow this I think we should go over all definitions and hardcode the URLs so that the worst thing that can happen is someone just announcing old ids on the same domain. Currently most of our definitions just do a loose addr match and tries to find things like id=(.+) on the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend help wanted Extra attention is needed irc
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Not correctly monitoring IRC announcements for SpeedApp Tracker TorrentDay announcer issue on IRC
5 participants