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

fix: Update user-agent #3526

Closed ndragon798 closed 3 months ago

ndragon798 commented 3 months ago

What type of PR is this?

What this PR does / why we need it: Update user-agent to bypass block on thekitchn.com

Which issue(s) this PR fixes: #3524

Tested via spinning it up in docker-compose

boc-the-git commented 3 months ago

Worth noting @hay-kot has a very similar PR: https://github.com/mealie-recipes/mealie/pull/3457 It looks like it'd be more future-proof, though on the face of it he hasn't finished testing it.

ndragon798 commented 3 months ago

I'm looking at adding a more robust UA rotation method but I wanted a simple fix for now. There quite a few api's that we could pull a list of current UAs automatically and just rotate through those so we don't get an 1 user-agent banned.

hay-kot commented 3 months ago

https://github.com/mealie-recipes/mealie/pull/3457 - Is tested. (failing CI is unrelated to PR)

I'm looking at adding a more robust UA rotation method but I wanted a simple fix for now. There quite a few api's that we could pull a list of current UAs automatically and just rotate through those so we don't get an 1 user-agent banned.

Is an interesting idea. If you implement this, I'd suggest letting it be user configurable either by a comma separated list via ENV variable or a JSON file or something and then using a factory pattern or something to pick one at random which one to use.

ndragon798 commented 3 months ago

Closing the PR since the other one was merged.