-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement origin domain matching #68
Conversation
It doesn't do anything yet, but save/restore works.
Required for ESLint to recognize private fields.
That's the oldest version to support private class fields according to MDN. 91 is on the way out as ESR, so no-one should be running anything older anyway.
The key part is the RuleMatch.better() method, which encapsulates the decision which match is better. That will make it easier to modify the rule system going forward.
Thanks for the suggestion, Crystal! Co-authored-by: Crystal Cat <58235142+crystal-cat@users.noreply.github.com>
The rule to apply is selected as follows: * Use the rule with the longest match for the target domain * Among rules with the same target domain match use the rule with the longst origin domain match Every rule *must* have a target domain, the origin domain is optional (match length is zero if missing).
The value for "target" was missing, leading to those for later fields shifting.
Are you able to upload a beta version to AMO? AFAIK, only users intentionally installing a beta version on AMO will get it. Of course, you may want to confirm my AFAIK first! |
I had the same thought yesterday and checked. 😸 Unfortunately it looks like AMO removed the beta channel option: https://extensionworkshop.com/documentation/publish/distribute-pre-release-versions/ What I could do is get a beta version signed for self-distribution and offer it through a pre-release here, with the catch that you'd have to manually update to further beta versions. Well, unless I also set up my own update manifest, too, but that's additional maintenance effort and if I forget to remove it before release that'd be bad. 😅 |
Ah, now that you mention it, I am recalling that they made that change. 😸 Another option (and one I would personally prefer), is to publish another extension called "Referer Modifier BETA" on AMO. I've seen a few other extensions do this, and it seems to be a good workaround. I can write the blurb (description) for the beta version, if that helps you. |
Purely negative regular expressions like (?<!\.?y\.test)$ (for any domain that isn't y.test or its subdomain) result in a zero length match, and should have priority over rules with no origin match at all.
It ends up in the console on every website load, which is a bit much. Keep the concept around as Rule.toString() so it's easily available if needed.
A separate beta extension seems like a lot more trouble, both for me and people who want to test: It'd need a separate add-on ID, configuration wouldn't carry over automatically, and beta users would never automatically switch back to release, which means I'd have to maintain it indefinitely. I think I'll use self-distributed beta releases as needed, and set up an update manifest if it looks like there'll be many. Which I don't expect. 😅 Anyway, a beta release won't happen until I merge this, which should be very soon. 🙂 |
@wvxwxvw, if you'd like to update the RU localization before I release 1.0 let me know and I'll create an issue listing the messages that changed. If not that's fine too, no pressure. 🙂 |
Beta release is here: https://github.com/airtower-luna/referer-mod/releases/tag/v1.0beta1 |
@airtower-luna |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
Origin matching allows users to let rules apply only to requests originating from certain domains. The origin is the domain that would appear in an unmodified
Referer
.The rule to apply is selected based on the length of matches in the target and origin domains as follows:
Every rule must have a target domain, the origin domain is optional (origin match length is zero if missing).
Closes #15, closes #12.