stylish
stylish copied to clipboard
Search not working anymore
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"}
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…).
Yep, it looks like ANY referrer will do, it just has to be be included.
