diff --git a/files/classes/comment.py b/files/classes/comment.py index 6c4f056b7..1f002e883 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -22,6 +22,7 @@ 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.nitter: body = twitter_to_nitter_regex.sub(r'https://nitter.42l.fr/\1', body) + if v.imginn: body = body.replace('https://instagram.com/', 'https://imginn.com/') return body diff --git a/files/classes/user.py b/files/classes/user.py index 401d9d63a..799632416 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -82,6 +82,7 @@ class User(Base): newtabexternal = Column(Boolean, default=True) reddit = Column(String, default='old.reddit.com') nitter = Column(Boolean) + imginn = Column(Boolean) mute = Column(Boolean) unmutable = Column(Boolean) eye = Column(Boolean) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 46a837c77..832f7900f 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -100,6 +100,10 @@ def execute_snappy(post, v): newposturl = newposturl.replace('https://twitter.com/', 'https://nitter.42l.fr/') gevent.spawn(archiveorg, newposturl) + if newposturl.startswith('https://instagram.com/'): + newposturl = newposturl.replace('https://instagram.com/', 'https://imginn.com/') + gevent.spawn(archiveorg, newposturl) + captured = [] body_for_snappy = post.body_html.replace(' data-src="', ' src="') @@ -138,6 +142,10 @@ def execute_snappy(post, v): href = href.replace('https://twitter.com/', 'https://nitter.42l.fr/') gevent.spawn(archiveorg, href) + if href.startswith('https://instagram.com/'): + href = href.replace('https://instagram.com/', 'https://imginn.com/') + gevent.spawn(archiveorg, href) + body = body.strip() body_html = sanitize(body) diff --git a/files/routes/settings.py b/files/routes/settings.py index 3f4b23e95..e1a094452 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -80,6 +80,10 @@ def settings_profile_post(v): updated = True v.nitter = request.values.get("nitter") == 'true' + elif request.values.get("imginn", v.imginn) != v.imginn: + updated = True + v.imginn = request.values.get("imginn") == 'true' + elif request.values.get("controversial", v.controversial) != v.controversial: updated = True v.controversial = request.values.get("controversial") == 'true' diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index 2f4217216..ad47c8149 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -211,6 +211,32 @@ +

Instagram Links

+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ + Enable if you would like to automatically convert instagram.com links to imginn.com links. + +
+ +
+ +
+ +

Reddit Links