mealie-recipes / mealie

Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
https://docs.mealie.io
GNU Affero General Public License v3.0
5.78k stars 628 forks source link

feat: Automatically keep user-agent up to date with latest user-agent #3529

Closed ndragon798 closed 2 weeks ago

ndragon798 commented 2 months ago

What type of PR is this?

What this PR does / why we need it: Removes the chore of updating the user-agent that we use instead automatically grabbing the most popular user-agent every day.

Which issue(s) this PR fixes:

Fixes #3524 Fixes #3457

Testing

Tested locally using docker-compose and using built in testing via task py:check

hay-kot commented 2 months ago

I'm somewhat skeptical on adding this package into the project, especially since it hits an external API that we don't control.

Do you know what the fallback behavior is if the API isn't available?

ndragon798 commented 2 months ago

Yeah it will fall back to using a default user-agent defined in the package. I only know this because I updated the package before I added here. https://github.com/Lennolium/simple-useragent/blob/249b6169749c71f8d5ff64e1d1f8347dd5ef47cb/src/simple_useragent/core.py#L42

_FALLBACK_DESKTOP = [
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
        "AppleWebKit/537.36 (KHTML, like Gecko) "
        "Chrome/110.0.0.0 Safari/537.36"
        ]

If it is able to reach out once then it will just fall back to the cached UA. The cache is updated every 24 hours.

github-actions[bot] commented 1 month ago

This PR is stale because it has been open 45 days with no activity.

boc-the-git commented 2 weeks ago

Thanks for raising the PR @ndragon798, we do appreciate it! We've thought about this one a bit and decided not to proceed with it. Ultimately this is a very rare issue, and we don't think it's worth adding another dependency into the project for it. We can absolutely revisit that decision if this starts to become a regular issue, but it hasn't been historically.