~edwardloveall/Scribe#12: 
Adding support for non-Medium domains?

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, 52.0.16.118 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)?

Status
REPORTED
Submitter
~nyanpasu64
Assigned to
No-one
Submitted
13 days ago
Updated
12 days ago
Labels
No labels applied.

~edwardloveall 13 days ago

Hello 👋

A while back I added support for medium's redirectUrl query param. When scribe sees redirectUrl in the query params, it will look for the post id there instead of in the URLs path. Many (all?) custom domains first get routed through a URL that looks like this:

https://medium.com/m/global-identity?redirectUrl=<original, escaped blog post url>

If you're using the redirector extension mentioned in the FAQ, it will see this medium.com URL and automatically redirect to Scribe, properly rendering the page. When I clicked on your link above, this is what happened for me in my browser.

Is this something you've tried at all? If so, do you feel like it solves the problem?

~nyanpasu64 12 days ago

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.

~edwardloveall 12 days ago

Gotcha, thanks for the research. Anecdotally, this is not my experience on my version of Firefox, but that doesn't help you much, now does it? 😂

Other than Scribe supporting that redirect, I'm not sure what else the Scribe website can do. Scribe can only act when a user is on scribe.rip (or its other instances) and not before. This has to be handled by the browser or an extension to the browser, and I'm not interested in writing an extension at this time.

One thing you could do is block medium.com entirely. All Scribe needs to render an article is the post ID a the end of the URL. In your post example it would be fb0b36601557. Visiting https://scribe.rip/fb0b36601557 works. When you get to a website like bekk, you could grab the post id and be on your way.

Register here or Log in to comment, or comment via email.