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

Search not working anymore #52

Open
Gummibando opened this issue Jul 11, 2018 · 2 comments
Open

Search not working anymore #52

Gummibando opened this issue Jul 11, 2018 · 2 comments

Comments

@Gummibando
Copy link

Search does not work anymore.

While the categories "tag cloud"
(via https://userstyles.org/api/v1/categories/site)
gets loaded in the Stylish extension interface,

a search
(via https://userstyles.org/api/v1/styles/subcategory?search=fritz&per_page=22&country=us&page=1)
returns a fatal error in the JSON result set.
{"error":"fatal error"}

@Gummibando
Copy link
Author

Gummibando commented Jul 11, 2018

Huh, it gets weirder.
If you open the search link above from the GitHub webpage (e.g. just clicking the search link above), you get a valid JSON result set.
If you open the link in a new window, you get an error 500 and the "fatal error" message in the JSON result.
After a bit of tinkering (Debookee, ftw.) it looks like the request needs a referrer.

This is the HTTP request if the link is invoked from the Stylish extension, e.g. a search is performed in Stylish (no referrer in the HTTP request):

13:30:16	https://userstyles.org/api/v1/styles/subcategory?search=fritz&per_page=22&country=us&page=1	GET	500 	application/json	23 B
	:authority: userstyles.org				
	accept: application/json, text/javascript, */*; q=0.01				
	user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15				
	accept-language: en-us				
	accept-encoding: br, gzip, deflate				
	dnt: 1

Result: Error 500, error message in JSON result.

This is the HTTP request if the link is invoked from the userstyles.org web page, e.g. a search is performed there (referrer https:/userstyles.org… in the HTTP request):

13:29:01	https://userstyles.org/api/v1/styles/search?search=fritz&page=1	GET	200 	application/json	13.6 kB
	:authority: userstyles.org				
	accept: */*				
	referer: https://userstyles.org/styles/browse?search_terms=fritz				
	dnt: 1				
	user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15				
	accept-language: en-us				
	accept-encoding: br, gzip, deflate

Result: Correct JSON result set.
The same happens when the link is opened from GitHub, e.g. clicking the search link in the first comment (HTTP referrer https://github.com…).

@Gummibando
Copy link
Author

Gummibando commented Jul 11, 2018

Yep, it looks like ANY referrer will do, it just has to be be included.

screen shot 2018-07-11 at 14 00 28

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

1 participant