SimpleModifyHeaders icon indicating copy to clipboard operation
SimpleModifyHeaders copied to clipboard

Not rewrites headers in request made by another addon

Open Baton34 opened this issue 3 years ago • 12 comments

I use Imagus addon for view images in full size on certain sites. Its take original picture link and defines new link for fullsize image. In this case it fetch api.500px.com for image data and SMH did not touch header of this request. Why header stays not modified? Here screenshot with "debug mode" and "Filter URL per rules" enabled.

smh

Baton34 avatar Feb 19 '22 11:02 Baton34

An explaination could be that you have a space character at the end of the field "When URL contains"

Could you check that ?

I will anyway add a method to remove the spaces at the end of this field

didierfred avatar Feb 20 '22 21:02 didierfred

Could you check that ?

I checked it, no spaces. If I copy link from net viewer window and paste it to firefox address bar and run it - SMH works fine and adds header to request.

Baton34 avatar Feb 21 '22 06:02 Baton34

i check the imagus addon on my computer (either firefox and chrome) and it works for me on 500px.com web site

I was on https://500px.com/popular

Could you check on this precise url and see if the token is set when loading images ?

image

didierfred avatar Feb 21 '22 09:02 didierfred

Try import this rule to imagus (Imagus settings, import arrow, replace existing data, from text): {"R_500px.com":{"link":"^(?:photos\\.)?(500px\\.)com/(?:photo/)?(\\d+).*","url":"https://api.$1com/v1/photos?ids=$2&image_size[]=34&image_size[]=2048","res":":\nvar i=JSON.parse($._).photos[$[2]],u=i.image_url\nreturn [[['#'+u[1], u[0]], [i.name, i.description, i.location, i.camera, i.lens, 'by ' + i.user.username + ' (' + i.user.fullname + ')'].filter(Boolean).join(' | ')]]","img":"^(?:pp?|drs)cdn\\.(500px\\.)org/+(?:photo/)?(\\d+)/+[^/]+/.+","note":"by Baton34V + Gros-Poulet (SMH rule)"}} Then import this SMH rule {"format_version":"1.2","target_page":"","headers":[{"url_contains":"api.500px.com","action":"add","header_name":"X-500PX-TOKEN","header_value":"fetch","comment":"500PX","apply_on":"req","status":"on"}],"debug_mode":false,"show_comments":true,"use_url_contains":true} Then reload 500px.com page. Move mouse to any picture, imagus show it in full size. Now look in net view tab and find request to "api.500px.com/..." and there is no token in header. I dont understand why.

Baton34 avatar Feb 21 '22 10:02 Baton34

I load your imagus + smh configuration , but i did not reproduce the problem the header is modified .

Having no account , i'm not connected to 500px.com ,did you test being disconnected , the behavior may change ..

image

image

didierfred avatar Feb 21 '22 12:02 didierfred

You not have request made by Imagus on your screenshot. It must be api.500px.com/v1/photos?ids=... smh2 You need to hover mouse pointer over any image on 500px page, then image should be shown in full size. And after than there will be request from imagus in the net view tab.

Baton34 avatar Feb 21 '22 12:02 Baton34

I tested beeing connected , beeing disconnect to the web site , i have not the problem .

I have not exactly your url as the parameter ids is not the first parameter of the request

image

didierfred avatar Feb 22 '22 08:02 didierfred

I capture video for you https://user-images.githubusercontent.com/10797316/155097588-5a8d026f-98c9-41ca-80ae-19e146bb7bc0.mp4

Baton34 avatar Feb 22 '22 08:02 Baton34

still not able to reproduce on my computer

didierfred avatar Feb 22 '22 16:02 didierfred

Does this mean imagus is down and you can't see the full size image? Are you clicking the save button after importing the rule into imagus and then reloading the tab with 500px.com open? After that, a pop-up window with a full-sized image should appear when you hover your mouse over the image on the 500px.com page (without authorization on 500px.com).

Baton34 avatar Feb 22 '22 16:02 Baton34

imagus is working well , i have the full size images . It s just in my case the header is modify

didierfred avatar Feb 22 '22 16:02 didierfred

Just in my case the title has been changed

but I don't see any requests to "api.500px.com/v1/photos?ids=..." on your screens. Do you have a different rule for 500px.com in imagus? Maybe this request just doesn't show up in the network tab... I don't understand what's going on... Without this request, imagus cannot get the link to the full size image in order to download it.

Baton34 avatar Feb 22 '22 16:02 Baton34