master
Aevann1 2022-04-10 20:42:58 +02:00
parent e9e9a72921
commit 51ebba5bca
7 changed files with 30 additions and 57 deletions

View File

@ -345,8 +345,7 @@ class Comment(Base):
body = censor_slurs(body, v) body = censor_slurs(body, v)
if v: if v:
if v.teddit: body = body.replace("old.reddit.com", "teddit.net") body = body.replace("old.reddit.com", v.reddit)
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
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") 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")

View File

@ -346,9 +346,9 @@ class Submission(Base):
@lazy @lazy
def realurl(self, v): def realurl(self, v):
if v and self.url and self.url.startswith("https://old.reddit.com/"): 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") url = self.url.replace("old.reddit.com", v.reddit)
elif not v.oldreddit: url = self.url.replace("old.reddit.com", "reddit.com")
if '/comments/' in url and "sort=" not in url: if '/comments/' in url and "sort=" not in url:
if "?" in url: url += "&context=9" if "?" in url: url += "&context=9"
else: url += "?context=8" else: url += "?context=8"
@ -368,8 +368,7 @@ class Submission(Base):
body = censor_slurs(body, v) body = censor_slurs(body, v)
if v: if v:
if v.teddit: body = body.replace("old.reddit.com", "teddit.net") body = body.replace("old.reddit.com", v.reddit)
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
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") 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) body = censor_slurs(body, v)
if v: if v:
if v.teddit: body = body.replace("old.reddit.com", "teddit.net") body = body.replace("old.reddit.com", v.reddit)
elif not v.oldreddit: body = body.replace("old.reddit.com", "reddit.com")
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") 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")

View File

@ -81,8 +81,7 @@ class User(Base):
flairchanged = Column(Integer) flairchanged = Column(Integer)
newtab = Column(Boolean, default=False) newtab = Column(Boolean, default=False)
newtabexternal = Column(Boolean, default=True) newtabexternal = Column(Boolean, default=True)
oldreddit = Column(Boolean, default=True) reddit = Column(String)
teddit = Column(Boolean)
nitter = Column(Boolean) nitter = Column(Boolean)
mute = Column(Boolean) mute = Column(Boolean)
unmutable = Column(Boolean) unmutable = Column(Boolean)

View File

@ -55,6 +55,12 @@ def settings_profile_post(v):
v.background = request.values.get("background") v.background = request.values.get("background")
v.theme = 'transparent' 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: elif request.values.get("slurreplacer", v.slurreplacer) != v.slurreplacer:
updated = True updated = True
v.slurreplacer = request.values.get("slurreplacer") == 'true' v.slurreplacer = request.values.get("slurreplacer") == 'true'
@ -79,14 +85,6 @@ def settings_profile_post(v):
updated = True updated = True
v.newtabexternal = request.values.get("newtabexternal") == '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: elif request.values.get("nitter", v.nitter) != v.nitter:
updated = True updated = True
v.nitter = request.values.get("nitter") == 'true' v.nitter = request.values.get("nitter") == 'true'

View File

@ -177,39 +177,20 @@
<div class="settings-section rounded"> <div class="settings-section rounded">
<div class="d-lg-flex border-bottom"> <div class="d-lg-flex border-bottom">
<div class="title w-lg-25"> <div class="title w-lg-25">
<label for="oldreddit">Use Teddit.net</label> <label for="reddit">Reddit Domain</label>
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the domain you would like to view reddit posts in.</p>
<div class="custom-control custom-switch"> <div class="input-group mb2">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="teddit" name="teddit"{% if v.teddit %} checked{% endif %} onchange="post_toast(this,'/settings/profile?teddit='+document.getElementById('teddit').checked);"> <select autocomplete="off" id='reddit' class="form-control" form="profile-settings" name="reddit" onchange="post_toast(this,'/settings/profile?reddit='+document.getElementById('reddit').value)">
<label class="custom-control-label" for="teddit"></label> {% for entry in ['old.reddit.com', 'reddit.com', 'unddit.com', 'teddit.net', 'libredd.it'] %}
<option value="{{entry}}"{{' selected' if v.reddit==entry}}>{{entry}}</option>
{% endfor %}
</select>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to automatically convert reddit.com links to teddit.net links.</span>
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="oldreddit">Use Old Reddit</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="oldreddit" name="oldreddit"{% if v.oldreddit %} checked{% endif %} onchange="post_toast(this,'/settings/profile?oldreddit='+document.getElementById('oldreddit').checked);">
<label class="custom-control-label" for="oldreddit"></label>
</div>
<span class="text-small-extra text-muted">Enable if you would like to automatically convert reddit.com links to old.reddit.com links.</span>
</div> </div>
</div> </div>

View File

@ -593,7 +593,6 @@ CREATE TABLE public.users (
customtitleplain character varying(100), customtitleplain character varying(100),
themecolor character varying(6) NOT NULL, themecolor character varying(6) NOT NULL,
changelogsub boolean DEFAULT false NOT NULL, changelogsub boolean DEFAULT false NOT NULL,
oldreddit boolean DEFAULT true NOT NULL,
css character varying(4000), css character varying(4000),
profilecss character varying(4000), profilecss character varying(4000),
coins integer DEFAULT 0 NOT NULL, coins integer DEFAULT 0 NOT NULL,
@ -630,7 +629,6 @@ CREATE TABLE public.users (
alt boolean, alt boolean,
longpost integer, longpost integer,
unblockable boolean, unblockable boolean,
teddit boolean,
bird integer, bird integer,
fish boolean, fish boolean,
lootboxes_bought integer DEFAULT 0 NOT NULL, lootboxes_bought integer DEFAULT 0 NOT NULL,

View File

@ -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, 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, 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 post_count, comment_count, background, verified, truecoins, cardview, subs
) VALUES ('rDrama', '', 0, 0, true, true, '', '', 0, false, ) VALUES ('rDrama', '', 0, 0, true, true, '', '', 0, false,
0, 'rDrama', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', 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), 0, 0, '', 'Verified', 0, false, 2),
('AutoJanny', '', 0, 0, true, true, '', '', 0, false, ('AutoJanny', '', 0, 0, true, true, '', '', 0, false,
0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', 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), 0, 0, '', 'Verified', 0, false, 2),
('Snappy', '', 0, 0, true, true, '', '', 0, false, ('Snappy', '', 0, 0, true, true, '', '', 0, false,
0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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), 0, 0, '', 'Verified', 0, false, 2),
('longpostbot', '', 0, 0, true, true, '', '', 0, false, ('longpostbot', '', 0, 0, true, true, '', '', 0, false,
0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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), 0, 0, '', 'Verified', 0, false, 2),
('zozbot', '', 0, 0, true, true, '', '', 0, false, ('zozbot', '', 0, 0, true, true, '', '', 0, false,
0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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), 0, 0, '', 'Verified', 0, false, 2),
('AutoPoller', '', 0, 0, true, true, '', '', 0, false, ('AutoPoller', '', 0, 0, true, true, '', '', 0, false,
0, 'AutoPoller', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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), 0, 0, '', 'Verified', 0, false, 2),
('AutoBetter', '', 0, 0, true, true, '', '', 0, false, ('AutoBetter', '', 0, 0, true, true, '', '', 0, false,
0, 'AutoBetter', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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), 0, 0, '', 'Verified', 0, false, 2),
('AutoChoice', '', 0, 0, true, true, '', '', 0, false, ('AutoChoice', '', 0, 0, true, true, '', '', 0, false,
0, 'AutoChoice', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 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); 0, 0, '', 'Verified', 0, false, 2);
INSERT INTO public.badge_defs VALUES INSERT INTO public.badge_defs VALUES