forked from rDrama/rDrama
restore nitter (as nitter.unixfox.eu)
parent
7b6cc5ee6a
commit
1dcf0b7828
|
@ -65,6 +65,9 @@ def normalize_urls_runtime(body, v):
|
|||
if v and v.reddit != 'old.reddit.com':
|
||||
body = reddit_to_vreddit_regex.sub(rf'\1https://{v.reddit}/\2/', body)
|
||||
|
||||
if v and v.nitter:
|
||||
body = twitter_to_nitter_regex.sub(r'\1https://nitter.unixfox.eu/', body)
|
||||
|
||||
if v and v.imgsed:
|
||||
body = instagram_to_imgsed_regex.sub(r'\1https://imgsed.com/', body)
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ class User(Base):
|
|||
newtab = Column(Boolean, default=False)
|
||||
newtabexternal = Column(Boolean, default=True)
|
||||
reddit = Column(String, default='old.reddit.com')
|
||||
nitter = Column(Boolean, default=False)
|
||||
imgsed = Column(Boolean)
|
||||
frontsize = Column(Integer, default=25)
|
||||
controversial = Column(Boolean, default=False)
|
||||
|
|
|
@ -37,6 +37,9 @@ def _archiveorg(url):
|
|||
|
||||
def archive_url(url):
|
||||
gevent.spawn(_archiveorg, url)
|
||||
if url.startswith('https://twitter.com/'):
|
||||
url = url.replace('https://twitter.com/', 'https://nitter.unixfox.eu/')
|
||||
gevent.spawn(_archiveorg, url)
|
||||
if url.startswith('https://instagram.com/'):
|
||||
url = url.replace('https://instagram.com/', 'https://imginn.com/')
|
||||
gevent.spawn(_archiveorg, url)
|
||||
|
|
|
@ -126,6 +126,8 @@ greentext_regex = re.compile("(\n|^)>([^ >][^\n]*)", flags=re.A)
|
|||
|
||||
allowed_domain_regex = re.compile("[a-z0-9\-.]+", flags=re.I|re.A)
|
||||
|
||||
twitter_to_nitter_regex = re.compile('(^|>|")https:\/\/twitter.com\/(?!i\/)', flags=re.A)
|
||||
|
||||
instagram_to_imgsed_regex = re.compile('(^|>|")https:\/\/instagram.com\/(?!reel\/)', flags=re.A)
|
||||
|
||||
color_regex = re.compile("[a-f0-9]{6}", flags=re.A)
|
||||
|
|
|
@ -766,6 +766,9 @@ def normalize_url(url):
|
|||
.replace("https://x.com", "https://twitter.com") \
|
||||
.replace("https://www.twitter.com", "https://twitter.com") \
|
||||
.replace("https://fxtwitter.com", "https://twitter.com") \
|
||||
.replace("https://nitter.unixfox.eu/", "https://twitter.com/") \
|
||||
.replace("https://nitter.42l.fr/", "https://twitter.com/") \
|
||||
.replace("https://nitter.unixfox.eu/", "https://twitter.com/") \
|
||||
.replace("https://m.facebook.com", "https://facebook.com") \
|
||||
.replace("https://en.m.wikipedia.org", "https://en.wikipedia.org") \
|
||||
.replace("https://www.instagram.com", "https://instagram.com") \
|
||||
|
|
|
@ -169,6 +169,7 @@ def settings_personal_post(v):
|
|||
updated = updated or update_flag("hidevotedon", "hidevotedon")
|
||||
updated = updated or update_flag("newtab", "newtab")
|
||||
updated = updated or update_flag("newtabexternal", "newtabexternal")
|
||||
updated = updated or update_flag("nitter", "nitter")
|
||||
updated = updated or update_flag("imgsed", "imgsed")
|
||||
updated = updated or update_flag("controversial", "controversial")
|
||||
updated = updated or update_flag("show_sigs", "show_sigs")
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
<section id="site-settings-external-services-section" class="settings-section-section">
|
||||
<h5>External Services</h5>
|
||||
<div class="settings-section rounded">
|
||||
{{common.toggle_section("Use Nitter for Twitter Links", "nitter", "nitter", v.nitter, "Enable if you would like to automatically convert twitter.com links to nitter.unixfox.eu links.", false)}}
|
||||
{{common.toggle_section("Use imgsed for Instagram Links", "imgsed", "imgsed", v.imgsed, "Enable if you would like to automatically convert instagram.com links to imgsed.com links.", false)}}
|
||||
<div class="d-lg-flex border-bottom">
|
||||
<div class="title w-lg-25">
|
||||
|
|
|
@ -123,6 +123,7 @@ CREATE TABLE public.users (
|
|||
background character varying(167),
|
||||
verified character varying(100),
|
||||
received_award_count integer DEFAULT 0 NOT NULL,
|
||||
nitter boolean NOT NULL,
|
||||
truescore integer DEFAULT 0 NOT NULL,
|
||||
frontsize integer DEFAULT 25 NOT NULL,
|
||||
coins_spent integer DEFAULT 0 NOT NULL,
|
||||
|
@ -3064,4 +3065,3 @@ ALTER TABLE ONLY public.comments
|
|||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
||||
|
|
Loading…
Reference in New Issue