fdfd
This commit is contained in:
parent
76dd80e2e1
commit
1d68543551
4 changed files with 43 additions and 37 deletions
|
@ -37,6 +37,7 @@ services:
|
||||||
- READ_ONLY=0
|
- READ_ONLY=0
|
||||||
- BOT_DISABLE=0
|
- BOT_DISABLE=0
|
||||||
- COINS_NAME=Dramacoins
|
- COINS_NAME=Dramacoins
|
||||||
|
- DEFAULT_TIME_FILTER=day
|
||||||
- DEFAULT_THEME=dark
|
- DEFAULT_THEME=dark
|
||||||
- DEFAULT_COLOR=ff66ac #YOU HAVE TO PICK ONE OF THOSE COLORS OR SHIT WILL BREAK: ff66ac, 805ad5, 62ca56, 38a169, 80ffff, 2a96f3, eb4963, ff0000, f39731, 30409f, 3e98a7, e4432d, 7b9ae4, ec72de, 7f8fa6, f8db58
|
- DEFAULT_COLOR=ff66ac #YOU HAVE TO PICK ONE OF THOSE COLORS OR SHIT WILL BREAK: ff66ac, 805ad5, 62ca56, 38a169, 80ffff, 2a96f3, eb4963, ff0000, f39731, 30409f, 3e98a7, e4432d, 7b9ae4, ec72de, 7f8fa6, f8db58
|
||||||
- SLOGAN=Dude bussy lmao
|
- SLOGAN=Dude bussy lmao
|
||||||
|
|
|
@ -19,6 +19,8 @@ from files.helpers.security import *
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
defaulttheme = environ.get("DEFAULT_THEME", "light").strip()
|
defaulttheme = environ.get("DEFAULT_THEME", "light").strip()
|
||||||
defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip()
|
defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip()
|
||||||
|
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "day").strip()
|
||||||
|
|
||||||
class User(Base, Stndrd, Age_times):
|
class User(Base, Stndrd, Age_times):
|
||||||
__tablename__ = "users"
|
__tablename__ = "users"
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
|
@ -86,7 +88,7 @@ class User(Base, Stndrd, Age_times):
|
||||||
stored_subscriber_count = Column(Integer, default=0)
|
stored_subscriber_count = Column(Integer, default=0)
|
||||||
defaultsortingcomments = Column(String, default="top")
|
defaultsortingcomments = Column(String, default="top")
|
||||||
defaultsorting = Column(String, default="hot")
|
defaultsorting = Column(String, default="hot")
|
||||||
defaulttime = Column(String, default="day")
|
defaulttime = Column(String, default=defaulttimefilter)
|
||||||
|
|
||||||
is_nofollow = Column(Boolean, default=False)
|
is_nofollow = Column(Boolean, default=False)
|
||||||
custom_filter_list = Column(String(1000))
|
custom_filter_list = Column(String(1000))
|
||||||
|
|
|
@ -4,6 +4,8 @@ from files.helpers.get import *
|
||||||
from files.__main__ import app, cache
|
from files.__main__ import app, cache
|
||||||
from files.classes.submission import Submission
|
from files.classes.submission import Submission
|
||||||
|
|
||||||
|
defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "day").strip()
|
||||||
|
|
||||||
@app.get("/post/")
|
@app.get("/post/")
|
||||||
def slash_post():
|
def slash_post():
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
@ -207,7 +209,7 @@ def front_all(v):
|
||||||
defaulttime = v.defaulttime
|
defaulttime = v.defaulttime
|
||||||
else:
|
else:
|
||||||
defaultsorting = "hot"
|
defaultsorting = "hot"
|
||||||
defaulttime = "day"
|
defaulttime = defaulttimefilter
|
||||||
|
|
||||||
sort=request.args.get("sort", defaultsorting)
|
sort=request.args.get("sort", defaultsorting)
|
||||||
t=request.args.get('t', defaulttime)
|
t=request.args.get('t', defaulttime)
|
||||||
|
@ -409,7 +411,7 @@ def all_comments(v):
|
||||||
page = int(request.args.get("page", 1))
|
page = int(request.args.get("page", 1))
|
||||||
|
|
||||||
sort=request.args.get("sort", "new")
|
sort=request.args.get("sort", "new")
|
||||||
t=request.args.get("t", "day")
|
t=request.args.get("t", defaulttimefilter)
|
||||||
|
|
||||||
idlist = comment_idlist(v=v,
|
idlist = comment_idlist(v=v,
|
||||||
page=page,
|
page=page,
|
||||||
|
|
|
@ -871,41 +871,42 @@ def submit_post(v):
|
||||||
n = Notification(comment_id=c_jannied.id, user_id=v.id)
|
n = Notification(comment_id=c_jannied.id, user_id=v.id)
|
||||||
g.db.add(n)
|
g.db.add(n)
|
||||||
|
|
||||||
c = Comment(author_id=261,
|
if "rdrama" in request.host or new_post.url:
|
||||||
distinguish_level=6,
|
c = Comment(author_id=261,
|
||||||
parent_submission=new_post.id,
|
distinguish_level=6,
|
||||||
level=1,
|
parent_submission=new_post.id,
|
||||||
over_18=False,
|
level=1,
|
||||||
is_bot=True,
|
over_18=False,
|
||||||
app_id=None,
|
is_bot=True,
|
||||||
|
app_id=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
g.db.add(c)
|
||||||
|
g.db.flush()
|
||||||
|
|
||||||
|
new_post.comment_count = 1
|
||||||
|
g.db.add(new_post)
|
||||||
|
|
||||||
|
if "rdrama" in request.host:
|
||||||
|
if v.id == 995: body = "fuck off carp"
|
||||||
|
else: body = random.choice(snappyquotes)
|
||||||
|
body += "\n\n---\n\n"
|
||||||
|
else: body = ""
|
||||||
|
if new_post.url:
|
||||||
|
body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={urllib.parse.quote(new_post.url)}&run=1) (click to archive)"
|
||||||
|
gevent.spawn(archiveorg, new_post.url)
|
||||||
|
with CustomRenderer(post_id=new_post.id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
||||||
|
body_html = sanitize(body_md)
|
||||||
|
c_aux = CommentAux(
|
||||||
|
id=c.id,
|
||||||
|
body_html=body_html,
|
||||||
|
body=body
|
||||||
)
|
)
|
||||||
|
g.db.add(c_aux)
|
||||||
g.db.add(c)
|
g.db.flush()
|
||||||
g.db.flush()
|
n = Notification(comment_id=c.id, user_id=v.id)
|
||||||
|
g.db.add(n)
|
||||||
new_post.comment_count = g.db.query(Comment).filter_by(parent_submission=new_post.id).count()
|
g.db.flush()
|
||||||
g.db.add(new_post)
|
|
||||||
|
|
||||||
if "rdrama" in request.host:
|
|
||||||
if v.id == 995: body = "fuck off carp"
|
|
||||||
else: body = random.choice(snappyquotes)
|
|
||||||
body += "\n\n---\n\n"
|
|
||||||
else: body = ""
|
|
||||||
if new_post.url:
|
|
||||||
body += f"Snapshots:\n\n* [reveddit.com](https://reveddit.com/{new_post.url})\n* [archive.org](https://web.archive.org/{new_post.url})\n* [archive.ph](https://archive.ph/?url={urllib.parse.quote(new_post.url)}&run=1) (click to archive)"
|
|
||||||
gevent.spawn(archiveorg, new_post.url)
|
|
||||||
with CustomRenderer(post_id=new_post.id) as renderer: body_md = renderer.render(mistletoe.Document(body))
|
|
||||||
body_html = sanitize(body_md)
|
|
||||||
c_aux = CommentAux(
|
|
||||||
id=c.id,
|
|
||||||
body_html=body_html,
|
|
||||||
body=body
|
|
||||||
)
|
|
||||||
g.db.add(c_aux)
|
|
||||||
g.db.flush()
|
|
||||||
n = Notification(comment_id=c.id, user_id=v.id)
|
|
||||||
g.db.add(n)
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
v.post_count = v.submissions.filter_by(is_banned=False, deleted_utc=0).count()
|
v.post_count = v.submissions.filter_by(is_banned=False, deleted_utc=0).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue