-
Notifications
You must be signed in to change notification settings - Fork 977
Conversation
Update: thanks to the Electron maintainers who pointed out my very-obvious typo, this is now actually doing redirects. :) |
@@ -9,7 +9,7 @@ module.exports.register = (wnd, filteringFn) => { | |||
filteringFns.push(filteringFn) | |||
if (!wnds.has(wnd)) { | |||
wnds.add(wnd) | |||
wnd.webContents.session.webRequest.onBeforeRequest((details, cb) => { | |||
wnd.webContents.session.webRequest.onBeforeSendHeaders((details, cb) => { |
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.
Is it any slower to block onBeforeSendHeaders instead of onBeforeRequest?
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.
I'd expect them to be roughly the same
For Please push back if you think it's ok to include it as is. |
if (dbErr) { | ||
console.log('error loading httpse rulesets.sqlite') | ||
} else { | ||
console.log('loaded httpse ruleset db') |
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.
We can probably comment this one out, and other non error cases.
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 catch, this was just here to prove that it is doing something for subresource loads
Looking great, I'd love to get this in before the beta. The main thing before merging is just to check if the DB is also GPL'ed or get permission for including that statically. |
Please also add a switch in app/appConfig.js for enabled in case we need to disable this last minute before the 20th. |
Yep, it's GPL so this sounds right. |
will do. will these switches be exposed to users eventually or even for the beta? |
The config is just for us currently but anything in there should be moved to app settings once we have them. |
I'd love to have settings for beta but I don't think we'll have enough time for 0.7 maybe shortly after though. |
726dde8
to
37c74e8
Compare
I've updated this so HTTPS Everywhere also uses |
Great, good to merge? |
Will resolve and merge for now! |
Note: this is not quite working yet due to a possible Electron webRequest bug
Registering multiple listeners on onBeforeRequest caused the request to be completed before HTTPS Everywhere got the chance to rewrite it. This may be a bug in how Electron handles conflict resolution between multiple request listeners.
It seems that usually the rulesets have loaded by the time the first network request happens. So instead of aborting if the rulesets haven't loaded, load the listeners anyway.
366dae0
to
df71e4e
Compare
The rulesets.sqlite file is taken from the tip of https://github.com/efforg/https-everywhere/tree/stable. Eventually we need a script to automatically fetch this and run
npm run-script preload-httpse
per release or so.The rewrite logic is basically:
httpse-targets.json
).