#12 Adding support for non-Medium domains? 2 years ago

Comment by ~nyanpasu64 on ~edwardloveall/Scribe

I didn't install Redirector because I didn't want an extra extension and already had Violentmonkey for userscripts. (But it seems Redirector is faster to redirect than Violentmonkey, even when it's set to @run-at document-start...)

In any case, neither Violentmonkey set to @match https://*.medium.com/* or @include /^https?://(?:.*\.)*(?<!link\.)medium\.com(/.*)?$/, nor Redirector set to ^https?://(?:.*\.)*(?<!link\.)medium\.com(/.*)?$, redirect the above site. And looking at Firefox's network inspector with "persist logs" enabled, the page does not redirect me through https://medium.com/m/global-identity?redirectUrl=.... And reenabling JS on medium.com (in uBlock Origin) and unblocking it from setting cookies (in Firefox), and clearing cookies on blogg.bekk.no, doesn't cause the redirect to happen. I even tried visiting https://blogg.bekk.no/how-javascript-engines-achieve-great-performance-fb0b36601557 on a clean Firefox profile, and no redirect happened when I opened F12 Network and reloaded the page.

I found that global-identity is only triggered on the first visit to a Medium domain (or first refresh after clearing that domain's cookies, by clicking Firefox's Lock ("Site information for blogg.bekk.no") → "Clear cookies and site data"). Subsequent page refreshes, navigating back and clicking on the same link, and clicking on a link to a different page on the same domain don't cause a global-identity redirect. Logging into medium.com on a different tab and refreshing the custom domain triggers global-identity (logging into Medium on the custom domain doesn't). Logging out from the custom domain, or logging out from medium.com and refreshing the custom domain, both triggers global-identity.

In summary, I think the global-identity redirect only occurs on first visit to a custom Medium domain, or when the logged-in state changes. And this isn't reliable enough to redirect all visits to a Medium proxy domain to scribe.rip.

#12 Adding support for non-Medium domains? 2 years ago

Ticket created by ~nyanpasu64 on ~edwardloveall/Scribe

Sites like https://blogg.bekk.no/how-javascript-engines-achieve-great-performance-fb0b36601557 host Medium.com content. This particular site resolves to a medium.com-owned IP address (in my case, etc., I'm not sure if other Medium reskins use Medium IPs or not). But because they aren't hosted under the medium.com domain, automatic redirections won't work.

A bookmarklet containing window.location.replace("https://scribe.rip"+location.pathname+location.search+location.hash) works if you click it manually.

What's the best solution to redirect these pages? Use JS to detect Medium pages using a heuristic? Detect IP addresses like uBlock Origin does (https://github.com/gorhill/uBlock/wiki/Permissions#access-ip-address-and-hostname-information)?