Enable using of configured http proxy for media #1298

Open
digletthat wants to merge 1 commit from digletthat/proxy-for-media into master
digletthat commented 2025-10-19 14:23:52 -04:00 (Migrated from github.com)

Currently, configured http proxy (Config.proxy, Config.proxy_auth) is only used for API calls. Media (twimg.com) is always downloaded directly. This PR adds usage of proxy for media too.

This PR adds some code duplication: both http_pool and routes/media modules now have setHttpProxy method and proxy var. Maybe I should refactor this a bit and make single global var and setter somewhere, but I'm not sure where to put it.

Also, maybe there should be separate proxy settings for API and media in config?

This is my first code edits in nim language.

Currently, configured http proxy (`Config.proxy`, `Config.proxy_auth`) is only used for API calls. Media (`twimg.com`) is always downloaded directly. This PR adds usage of proxy for media too. This PR adds some code duplication: both `http_pool` and `routes/media` modules now have `setHttpProxy` method and `proxy` var. Maybe I should refactor this a bit and make single global var and setter somewhere, but I'm not sure where to put it. Also, maybe there should be separate proxy settings for API and media in config? This is my first code edits in nim language.
unixfox commented 2025-11-17 08:57:18 -05:00 (Migrated from github.com)

Does this allow to toggle on or off in the preferences?

Does this allow to toggle on or off in the preferences?
digletthat commented 2025-11-17 14:52:07 -05:00 (Migrated from github.com)

Does this allow to toggle on or off in the preferences?

No. I don't think it should be configurable by user. It's related to http proxy that is used for outgoing http requests, so it's part of nitter server configuration.

> Does this allow to toggle on or off in the preferences? No. I don't think it should be configurable by user. It's related to http proxy that is used for outgoing http requests, so it's part of nitter server configuration.
unixfox commented 2025-11-17 15:57:40 -05:00 (Migrated from github.com)

Now that I think again about this PR, I didn't fully understand it well.

It's not about activating or deactivating the media proxy in nitter. But the http proxy when used in nitter. Sorry.

Now that I think again about this PR, I didn't fully understand it well. It's not about activating or deactivating the media proxy in nitter. But the http proxy when used in nitter. Sorry.
zedeus commented 2025-11-18 03:35:42 -05:00 (Migrated from github.com)

I'm not sure I agree with this change. The purpose of the proxy is circumvent IP bans, and avoid IP-based detection. API requests are low bandwidth, media certainly isn't, and most proxies are either slow, expensive, or both. If you add a separate mediaProxy or something, then it makes sense, but having a proxy configured should not mean all media requests flow through it without a way to turn that off.

I'm not sure I agree with this change. The purpose of the proxy is circumvent IP bans, and avoid IP-based detection. API requests are low bandwidth, media certainly isn't, and most proxies are either slow, expensive, or both. If you add a separate `mediaProxy` or something, then it makes sense, but having a proxy configured should not mean all media requests flow through it without a way to turn that off.
This pull request has changes conflicting with the target branch.
  • src/nitter.nim
  • src/routes/media.nim
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin digletthat/proxy-for-media:digletthat/proxy-for-media
git switch digletthat/proxy-for-media

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff digletthat/proxy-for-media
git switch digletthat/proxy-for-media
git rebase master
git switch master
git merge --ff-only digletthat/proxy-for-media
git switch digletthat/proxy-for-media
git rebase master
git switch master
git merge --no-ff digletthat/proxy-for-media
git switch master
git merge --squash digletthat/proxy-for-media
git switch master
git merge --ff-only digletthat/proxy-for-media
git switch master
git merge digletthat/proxy-for-media
git push origin master
Sign in to join this conversation.
No description provided.