remotes/1693045480750635534/spooky-22
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)
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")

View File

@ -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")

View File

@ -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)

View File

@ -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'

View File

@ -177,39 +177,20 @@
<div class="settings-section rounded">
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="oldreddit">Use Teddit.net</label>
<label for="reddit">Reddit Domain</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<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);">
<label class="custom-control-label" for="teddit"></label>
<p>Change the domain you would like to view reddit posts in.</p>
<div class="input-group mb2">
<select autocomplete="off" id='reddit' class="form-control" form="profile-settings" name="reddit" onchange="post_toast(this,'/settings/profile?reddit='+document.getElementById('reddit').value)">
{% 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>
<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>

View File

@ -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,

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,
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