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

Override File with dynamic names #43

Open jmscavaleiro opened 3 years ago

jmscavaleiro commented 3 years ago

Hi,

Any way to override a js file which is served each time with a new name with a fixed number of characters?

I believe it's a good feature to add if it's not possible to do it yet. Is there any idea if it's possible to make it? I can offer myself to develop it.

Kind regards.

kylepaulsen commented 3 years ago

if the file name has no patterns to it (other than having a .js at the end) then yeah the best you can do is something like: https://somesite.com/js/*.js which would obv overwrite everything that ends in js. However! you can also have overrides go to the original location like this: https://somesite.com/js/main.js -> https://somesite.com/js/main.js Seems pointless right? Well, if you put this rule above the rule with the * in it, then main.js wont get overridden.

But yeah if all js files have random names and you only want to override one of them, then I'm not sure what to do.

Maybe block all scripts and then copy paste and inject each script.

jmscavaleiro commented 3 years ago

Hi Kyle!

Many thanks for your answer. But there is a way: (not The Mandalorian one but it could 😉)

Do you have a way to read the file name of the source that will be override and give your file the same name?

We can divide the feature in two:

  1. If the source folder only have one file it will be pretty straightforward.
  2. If the folder contains more than a file, the system must identify which file to override based on a couple of rules. For instance: the number of lines of code inside each and match with the desired file based on it. Or if it finds a specific string inside it. Or simply put (but maybe hardly done): the user could decide in runtime whitch file should match to override.

What do you think? It's doable?

Kind regards, João Cavaleiro

jmscavaleiro commented 3 years ago

Hi Kyle,

I am willing to develop the above suggested features. Is it okay for you to fork the code and go ahead?

Kind regards, João Cavaleiro

kylepaulsen commented 3 years ago

I am no longer accepting PRs for this repo unless for critical basic functionality bug fixes. This project has been in maintenance mode ( https://github.com/kylepaulsen/ResourceOverride/blob/master/maintenance_notice.md ) for a while now.

You are free to do whatever you like with the code, so long as you follow the included license. https://github.com/kylepaulsen/ResourceOverride/blob/master/LICENSE