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

Not rewrites headers in request made by another addon #39

Open
Baton34 opened this issue Feb 19, 2022 · 12 comments
Open

Not rewrites headers in request made by another addon #39

Baton34 opened this issue Feb 19, 2022 · 12 comments

Comments

@Baton34
Copy link
Contributor

Baton34 commented Feb 19, 2022

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

@didierfred
Copy link
Owner

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

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 21, 2022

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.

@didierfred
Copy link
Owner

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

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 21, 2022

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.

@didierfred
Copy link
Owner

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

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 21, 2022

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.

@didierfred
Copy link
Owner

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

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 22, 2022

@didierfred
Copy link
Owner

still not able to reproduce on my computer

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 22, 2022

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).

@didierfred
Copy link
Owner

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

@Baton34
Copy link
Contributor Author

Baton34 commented Feb 22, 2022

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.

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