kylepaulsen / ResourceOverride

An extension to help you gain full control of any website by redirecting traffic, replacing, editing, or inserting new content.
MIT License
467 stars 117 forks source link

Can't create a rule to prepend to a URL #20

Closed salfter closed 6 years ago

salfter commented 6 years ago

It looks like prepending something to a URL causes the plugin to get stuck in a loop. Splitting the rule into two separate rules for HTTP and HTTPS doesn't help, either. It looks like what's needed is a way to have a rule work only against the entire URL instead of a substring. Perhaps a "^" operator (as with sed) to mark the beginning would work.

Consider this example:

*://**.4chan.org/*** rewritten to https://archive.is/*://**.4chan.org/***

If I click a link (such as http://boards.4chan.org/pol/thread/160062891/creamy-memes-for-our-team), it gets redirected to https://archive.is/http://boards.4chan.org/pol/thread/160062891/creamy-memes-for-our-team, as I want. When I then click the "archive this URL" link (https://archive.is/?url=http://boards.4chan.org/pol/thread/160062891/creamy-memes-for-our-team), though, it then gets redirected to https://archive.is/https://archive.is/?url=http://boards.4chan.org/pol/thread/160062891/creamy-memes-for-our-team, which isn't where we want to go.

kylepaulsen commented 6 years ago

Make a rule above that one that looks like: https://archive.is/ --> https://archive.is/

This rule doesn't redirect anywhere, but it will stop the rules below from executing.

On Mon, Feb 12, 2018 at 2:45 PM, Scott Alfter notifications@github.com wrote:

Consider this example:

://.4chan.org/ http://4chan.org/ rewritten to https://archive.is/*://**.4chan.org/***

If I click a link (such as http://boards.4chan.org/pol/ thread/160062891/creamy-memes-for-our-team), it gets redirected to https://archive.is/http://boards.4chan.org/pol/thread/ 160062891/creamy-memes-for-our-team, as I want. When I then click the "archive this URL" link (https://archive.is/?url=http: //boards.4chan.org/pol/thread/160062891/creamy-memes-for-our-team), though, it then gets redirected to https://archive.is/https:// archive.is/?url=http://boards.4chan.org/pol/thread/ 160062891/creamy-memes-for-our-team, which t.

More generally, it looks like prepending something to a URL causes the plugin to get stuck in a loop. Splitting the rule into two separate rules for HTTP and HTTPS doesn't help, either. It looks like what's needed is a way to have a rule work only against the entire URL instead of a substring. Perhaps a "^" operator (as with sed) to mark the beginning would work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kylepaulsen/ResourceOverride/issues/20, or mute the thread https://github.com/notifications/unsubscribe-auth/AA01LAHbfHuZ7qtygRltj2mATe-s2IEcks5tUL8kgaJpZM4SC8hy .

-- -Kyle Paulsen

salfter commented 6 years ago

Tried it out...looks like that does the trick. My first attempt at then archiving a page failed (since the fetches are done client-side), but temporarily disabling the plugin allows archiving to proceed as it should.