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

Some header control settings #85

Open
brian6932 opened this issue Jul 7, 2024 · 1 comment
Open

Some header control settings #85

brian6932 opened this issue Jul 7, 2024 · 1 comment

Comments

@brian6932
Copy link
Contributor

Some sites like danbooru (cdn.donmai.us) require a browser user-agent, pixiv (i.pximg.net) requires a referer be set to https://pixiv.net, some sites like gyazo, photobucket, imgur, reddit, and tumblr just require the accept header to be deleted on their cdn links. Typically on browsers, I use a web-ext called simple-modify-headers. I think such a feature could be kinda neat in ImgurViewer, and can potentially make it have a simpler default rule set for some sites and an easier route to PRs. Within the web-ext it imports and exports rules from JSON.

{
	"format_version": "1.2",
	"target_page": "",
	"headers": [
		{
			"url_contains": "i.gyazo.com",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": ".photobucket.com",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": "i.redd.it",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": "preview.redd.it",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": "i.imgur.com",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": "media.tumblr.com",
			"action": "delete",
			"header_name": "accept",
			"header_value": "",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		},
		{
			"url_contains": "i.pximg.net",
			"action": "add",
			"header_name": "referer",
			"header_value": "https://pixiv.net",
			"comment": "",
			"apply_on": "req",
			"status": "on"
		}
	],
	"debug_mode": false,
	"show_comments": true,
	"use_url_contains": true
}
@SpartanJ
Copy link
Owner

SpartanJ commented Jul 8, 2024

Sounds cool, I haven't found in my personal use the necessity to fake an HTTP header to be able to see an image (but ImgurViewer always fakes the user-agent for videos since it's almost always required). I won't particularly develop it myself but feel free to send a PR and I'll gladly accept it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants