diff --git a/files/classes/comment.py b/files/classes/comment.py index 9f5ed80c4..3aeda07a0 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -345,8 +345,7 @@ class Comment(Base): body = censor_slurs(body, v) if v: - if v.teddit: body = body.replace("old.reddit.com", "teddit.net") - elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com") + body = body.replace("old.reddit.com", v.reddit) if v.nitter and not '/i/' in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net") diff --git a/files/classes/submission.py b/files/classes/submission.py index 8643f351e..5b17deb43 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -346,9 +346,9 @@ class Submission(Base): @lazy def realurl(self, v): if v and self.url and self.url.startswith("https://old.reddit.com/"): - url = self.url - if v.teddit: url = self.url.replace("old.reddit.com", "teddit.net") - elif not v.oldreddit: url = self.url.replace("old.reddit.com", "reddit.com") + + url = self.url.replace("old.reddit.com", v.reddit) + if '/comments/' in url and "sort=" not in url: if "?" in url: url += "&context=9" else: url += "?context=8" @@ -368,8 +368,7 @@ class Submission(Base): body = censor_slurs(body, v) if v: - if v.teddit: body = body.replace("old.reddit.com", "teddit.net") - elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com") + body = body.replace("old.reddit.com", v.reddit) if v.nitter and '/i/' not in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net") @@ -434,8 +433,7 @@ class Submission(Base): body = censor_slurs(body, v) if v: - if v.teddit: body = body.replace("old.reddit.com", "teddit.net") - elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com") + body = body.replace("old.reddit.com", v.reddit) if v.nitter and '/i/' not in body and '/retweets' not in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net") diff --git a/files/classes/user.py b/files/classes/user.py index fe81b8898..02d179441 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -81,8 +81,7 @@ class User(Base): flairchanged = Column(Integer) newtab = Column(Boolean, default=False) newtabexternal = Column(Boolean, default=True) - oldreddit = Column(Boolean, default=True) - teddit = Column(Boolean) + reddit = Column(String) nitter = Column(Boolean) mute = Column(Boolean) unmutable = Column(Boolean) diff --git a/files/routes/settings.py b/files/routes/settings.py index b353a64d5..ed5d287b1 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -55,6 +55,12 @@ def settings_profile_post(v): v.background = request.values.get("background") v.theme = 'transparent' + elif request.values.get("reddit", v.reddit) != v.reddit: + reddit = request.values.get("reddit") + if reddit in {'old.reddit.com', 'reddit.com', 'teddit.net', 'libredd.it', 'unddit.com'}: + updated = True + v.reddit = reddit + elif request.values.get("slurreplacer", v.slurreplacer) != v.slurreplacer: updated = True v.slurreplacer = request.values.get("slurreplacer") == 'true' @@ -79,14 +85,6 @@ def settings_profile_post(v): updated = True v.newtabexternal = request.values.get("newtabexternal") == 'true' - elif request.values.get("oldreddit", v.oldreddit) != v.oldreddit: - updated = True - v.oldreddit = request.values.get("oldreddit") == 'true' - - elif request.values.get("teddit", v.teddit) != v.teddit: - updated = True - v.teddit = request.values.get("teddit") == 'true' - elif request.values.get("nitter", v.nitter) != v.nitter: updated = True v.nitter = request.values.get("nitter") == 'true' diff --git a/files/templates/settings_filters.html b/files/templates/settings_filters.html index d69b99a74..04a1f58a5 100644 --- a/files/templates/settings_filters.html +++ b/files/templates/settings_filters.html @@ -177,39 +177,20 @@
-
- +
- -
- - +

Change the domain you would like to view reddit posts in.

+
+
- Enable if you would like to automatically convert reddit.com links to teddit.net links. - -
- -
- -
- -
- -
- -
- -
- - -
- - Enable if you would like to automatically convert reddit.com links to old.reddit.com links. -
diff --git a/schema.sql b/schema.sql index 96c76498f..ff490e4d3 100644 --- a/schema.sql +++ b/schema.sql @@ -593,7 +593,6 @@ CREATE TABLE public.users ( customtitleplain character varying(100), themecolor character varying(6) NOT NULL, changelogsub boolean DEFAULT false NOT NULL, - oldreddit boolean DEFAULT true NOT NULL, css character varying(4000), profilecss character varying(4000), coins integer DEFAULT 0 NOT NULL, @@ -630,7 +629,6 @@ CREATE TABLE public.users ( alt boolean, longpost integer, unblockable boolean, - teddit boolean, bird integer, fish boolean, lootboxes_bought integer DEFAULT 0 NOT NULL, diff --git a/seed-db.sql b/seed-db.sql index 8d54cad77..b189a1192 100644 --- a/seed-db.sql +++ b/seed-db.sql @@ -1,38 +1,38 @@ INSERT INTO public.users (username, passhash, created_utc, admin_level, over_18, is_activated, bio, bio_html, login_nonce, is_private, unban_utc, original_username, customtitle, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor, - customtitleplain, theme, themecolor, changelogsub, oldreddit, css, profilecss, coins, agendaposter, + customtitleplain, theme, themecolor, changelogsub, reddit, css, profilecss, coins, agendaposter, post_count, comment_count, background, verified, truecoins, cardview, subs ) VALUES ('rDrama', '', 0, 0, true, true, '', '', 0, false, 0, 'rDrama', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', - '', 'dark', 'ff66ac', false, false, '', '', 0, 0, + '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('AutoJanny', '', 0, 0, true, true, '', '', 0, false, 0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', - '', 'dark', 'ff66ac', false, false, '', '', 0, 0, + '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('Snappy', '', 0, 0, true, true, '', '', 0, false, 0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('longpostbot', '', 0, 0, true, true, '', '', 0, false, 0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('zozbot', '', 0, 0, true, true, '', '', 0, false, 0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('AutoPoller', '', 0, 0, true, true, '', '', 0, false, 0, 'AutoPoller', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('AutoBetter', '', 0, 0, true, true, '', '', 0, false, 0, 'AutoBetter', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2), ('AutoChoice', '', 0, 0, true, true, '', '', 0, false, 0, 'AutoChoice', '', 'hot', 'top', 'day', '62ca56', 'e4432d', - '', 'dark', '30409f', false, false, '', '', 0, 0, + '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, 0, 0, '', 'Verified', 0, false, 2); INSERT INTO public.badge_defs VALUES