Replaces links to twitter.com an "x.com" to a nitter server #1461

Closed
loma-one wants to merge 3 commits from (deleted):develop into develop
Contributor

In the meantime, links are increasingly being shared on x.com instead of twitter.com. The addon has not yet been able to capture links on x.com and redirect them to nitter.

In the meantime, links are increasingly being shared on x.com instead of twitter.com. The addon has not yet been able to capture links on x.com and redirect them to nitter.
loma-one added 1 commit 2024-01-22 19:42:32 +01:00
In the meantime, links are increasingly being shared on x.com instead of twitter.com. The addon has not yet been able to capture links on x.com and redirect them to nitter.
MrPetovan requested changes 2024-01-22 20:47:18 +01:00
@ -3,3 +3,2 @@
* Name: nitter
* Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node.
* Version: 2.0
* Description: Replaces links to twitter.com an "x.com" to a nitter server in all displays of postings on a node.
Owner

*and

*and
@ -56,3 +56,3 @@
/*
* replace "twitter.com" with "nitter.net"
* replace "twitter.com" an "x.com" with "nitter.net"
Owner

*and

*and
@ -70,2 +70,4 @@
$b['html'] = str_replace('https://twitter.com', $nitter, $b['html']);
$replaced = true;
}
if (strstr($b['html'], 'https://x.com')) {
Owner

Wrong indentation, should be one fewer tabulation.

Also matching on just x.com exposes partial matches on different domains like x.commercial.biz. We'd be better off matching on https://x.com/ with the trailing slash.

Same goes for the https://twitter.com/ match.

Wrong indentation, should be one fewer tabulation. Also matching on just `x.com` exposes partial matches on different domains like `x.commercial.biz`. We'd be better off matching on `https://x.com/` with the trailing slash. Same goes for the `https://twitter.com/` match.
MrPetovan added the
2024.03
label 2024-01-22 20:47:24 +01:00
loma-one added 1 commit 2024-01-23 08:15:26 +01:00
loma-one added 1 commit 2024-01-23 08:16:33 +01:00
heluecht reviewed 2024-01-25 06:21:27 +01:00
@ -64,3 +64,2 @@
$nitter = DI::config()->get('nitter', 'server', 'https://nitter.net');
if (strstr($b['html'], 'https://mobile.twitter.com')) {
$b['html'] = str_replace('https://mobile.twitter.com', $nitter, $b['html']);
if (strstr($b['html'], 'https://mobile.twitter.com/')) {
Owner

It seems as if the nitter server url is stored without a trailing /. So replacing the url including a trailing / with the nitter url without a trailing / will not work.

It seems as if the nitter server url is stored without a trailing `/`. So replacing the url including a trailing `/` with the nitter url without a trailing `/` will not work.
Author
Contributor

I have checked this on my test instance. The Nitter instance is referenced in all URL constellations. The jump works if a / is inserted.

I had understood the note above to mean that after each str_replace command a / must be placed after the domain to avoid confusion with e.g. x.commercial.biz. Is there a misunderstanding on my part?

I have checked this on my test instance. The Nitter instance is referenced in all URL constellations. The jump works if a `/` is inserted. I had understood the note above to mean that after each str_replace command a / must be placed after the domain to avoid confusion with e.g. x.commercial.biz. Is there a misunderstanding on my part?
Owner

It looks like the Nitter service will stop working as soon as the remaining guest Twitter accounts will expire. The creator is sunsetting the project, which means we should deprecate the addon as well, making these changes moot.

It looks like the Nitter service will stop working as soon as the remaining guest Twitter accounts will expire. The creator is sunsetting the project, which means we should deprecate the addon as well, making these changes moot.
Owner

Yeah, it's really said that the work had been in vain.

Yeah, it's really said that the work had been in vain.
MrPetovan closed this pull request 2024-02-12 17:57:08 +01:00

Pull request closed

Sign in to join this conversation.
No description provided.