smmr-software / privacy-redirect-safari

A Safari extension that redirects Twitter, YouTube, Reddit, and more to privacy friendly alternatives.
GNU General Public License v3.0
165 stars 14 forks source link

Only works on Twitter #2

Closed timharek closed 3 years ago

timharek commented 3 years ago

I have enabled all of the redirects and it does not work google.com, translate.google.com, youtube.com, maps.google.com nor reddit.com(or old.reddit.com). Only one that works is Twitter.

I'm using an M1 Mac and I bought the extention via the App Store.

Please let me know how I can help sort out this issue :)

FIGBERT commented 3 years ago

A few questions about your setup:

  1. Have you given the extension permissions on all those sites?
  2. Have you opened the app settings at any point?
  3. Have you customized the redirect destinations? (i.e. what does it look like when you open the app settings)
  4. Are there any error messages in Safari's dev console that you can see when navigating to those sites?

Some possible root issues that spring to mind when a page doesn't redirect:

  1. Lacking permission to access the sites
  2. The destination is undefined for some reason, which causes the extension not to redirect.
    1. The defaults could possibly be set earlier, as now I think it (might?) require you to open the settings page, which is not ideal.
    2. It's also possible that we could add a fall back in JS that redirects you to the default location (i.e. nitter.net for Twitter) if the value for Nitter instance is undefined. Not sure if this will lead to more confusion, however. Will need further input.
  3. Something unforeseen related to M1, as neither I nor @jneplokh have M1 Macs.
timharek commented 3 years ago

Regarding my setup

  1. Yes, I have given the extension to all the required sites
  2. Yes, I have tried to both use default and custom values for all the sites
3. This what it currently looks like ![Skjermbilde 2021-08-10 kl 08 43 57](https://user-images.githubusercontent.com/5453010/128820523-c1f94f73-16c9-4edc-9449-642d70e1602a.png) ![Skjermbilde 2021-08-10 kl 08 47 37](https://user-images.githubusercontent.com/5453010/128820990-8ca46875-53fb-4ab4-aaf3-a585dd453fbd.png) ![Skjermbilde 2021-08-10 kl 08 49 40](https://user-images.githubusercontent.com/5453010/128821250-651deec5-09c2-4b9c-9298-153d864b0c63.png)
  1. Only that it fails to load https://adservice.google.com/adsid/google/ui, which is most likely blocked by my PiHole. Nothing else. I have tried disabling the whole PiHole to check if it's that, but it's not :/
FIGBERT commented 3 years ago

Huh, nothing obvious there that I can find. Been trying to reproduce it on my end, I'm thinking it's got something to do with the M1 as that's the only variable different between our setups. I'll try and look into this more, but I'm sorry I can't see that much more to do as I don't have an M1 machine myself.

Rjevski commented 3 years ago

Same problem here. M1 Air on Big Sur 11.5.2.

On YouTube nothing obvious is in the dev tools beyond a ton of crap being blocked by a separate content blocker.

If I go in the "sources" and look at extension scripts I don't see anything related to this add-on being loaded. Is this expected?

FIGBERT commented 3 years ago

When navigating to one of the supported sites, there should be a content script loaded that checks for your settings and then runs if the redirect is enabled – I'm not certain that "sources" is where that shows up, but it sounds right.

@jneplokh is potentially going to be able to work on an M1 Mac in the next week or so – we can investigate more then. In the meantime, I might cook up a build from the main branch for you to potentially test and see if the changes made since last publishing to the App Store affect this error.

redstrate commented 3 years ago

I wanted to leave a comment that I tried compiling this on my (Intel) Mac but it fails to work even on Twitter. The extension is enabled, and nothing happens regardless of anything I can tweak in Safari or the native settings. There's nothing in the dev tools either at least where I looked. I haven't tried the Mac App Store version, although I wouldn't mind buying it knowing it might work :-)

FIGBERT commented 3 years ago

We think we've narrowed down what the issue is, but we're not sure how to fix it just yet. Both @jneplokh and I are able to reproduce the bug.

In ContentView.swift and InstancesView.swift we make calls with the @AppStorage property wrapper to set the user settings. They're initialized with our default values: all redirects are enabled, and the basic instances are configured: https://github.com/smmr-software/privacy-redirect-safari/blob/27f4fd9dfcabe326614383000b0e375bec38268c/Privacy%20Redirect%20for%20Safari/ContentView.swift#L14-L19 https://github.com/smmr-software/privacy-redirect-safari/blob/27f4fd9dfcabe326614383000b0e375bec38268c/Privacy%20Redirect%20for%20Safari/InstancesView.swift#L18-L23

However, the defaults don't seem to be set initially when accessed from SafariWebExtensionHandler.swift: https://github.com/smmr-software/privacy-redirect-safari/blob/27f4fd9dfcabe326614383000b0e375bec38268c/Privacy%20Redirect%20for%20Safari%20Extension/SafariWebExtensionHandler.swift#L31-L36 Instead, booleans return false and strings return nil, the UserDefaults behavior for unset keys. This stops the extension from redirecting, as it sees that all redirects are disabled and thus does nothing.

We're investigating the root cause of this issue, but in the meantime our hacky fix (which seems to work on our end, but let us know) is to toggle all of the settings off and on.

Rjevski commented 3 years ago

Yes - toggling the settings resolved the problem.

FIGBERT commented 3 years ago

Just pushed an commit that should solve this issue – sending this over to the App Store now. Obviously, if the issue persists, please let us know!

timharek commented 3 years ago

Can confirm that this works now! Awesome 😄 Great work