forked from rDrama/rDrama
Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost
commit
43a33b1359
|
@ -2,3 +2,4 @@
|
|||
*.js linguist-detectable=true
|
||||
*.html linguist-detectable=false
|
||||
*.py linguist-detectable=true
|
||||
* text=auto
|
||||
|
|
47
Dockerfile
47
Dockerfile
|
@ -1,11 +1,48 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
ADD .. /service
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN /service/ubuntu_setup.sh
|
||||
RUN apt update
|
||||
RUN apt -y upgrade
|
||||
RUN apt install -y supervisor
|
||||
RUN apt install -y python3-pip
|
||||
RUN apt install -y ffmpeg
|
||||
RUN apt install -y imagemagick
|
||||
RUN apt install -y postgresql
|
||||
RUN apt install -y libpq-dev
|
||||
RUN apt install -y nano
|
||||
|
||||
COPY requirements.txt /etc/requirements.txt
|
||||
|
||||
RUN pip3 install -r /etc/requirements.txt
|
||||
|
||||
RUN mkdir /images
|
||||
RUN mkdir /songs
|
||||
RUN mkdir /videos
|
||||
RUN mkdir /audio
|
||||
RUN mkdir /asset_submissions
|
||||
RUN mkdir /asset_submissions/marseys
|
||||
RUN mkdir /asset_submissions/hats
|
||||
RUN mkdir /asset_submissions/marseys/original
|
||||
RUN mkdir /asset_submissions/hats/original
|
||||
|
||||
ENV NODE_VERSION=16.13.0
|
||||
RUN apt install -y curl
|
||||
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
||||
ENV NVM_DIR=/root/.nvm
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
|
||||
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
|
||||
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
|
||||
RUN node --version
|
||||
RUN npm --version
|
||||
RUN npm i -g yarn
|
||||
|
||||
RUN apt install -y nginx
|
||||
RUN rm /etc/nginx/sites-available -r
|
||||
RUN rm /etc/nginx/sites-enabled/default
|
||||
RUN mkdir /etc/nginx/includes
|
||||
|
||||
EXPOSE 80/tcp
|
||||
|
||||
RUN apt install -y supervisor
|
||||
|
||||
CMD [ "/usr/bin/supervisord", "-c", "/service/supervisord.conf" ]
|
||||
CMD [ "/usr/bin/supervisord", "-c", "/rDrama/supervisord.conf" ]
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
version: '2.3'
|
||||
|
||||
services:
|
||||
files:
|
||||
container_name: "rDrama"
|
||||
build:
|
||||
context: .
|
||||
volumes:
|
||||
- "./:/service"
|
||||
- "./:/rDrama"
|
||||
- "./nginx.conf:/etc/nginx/sites-enabled/1"
|
||||
- "./nginx-serve-static.conf:/etc/nginx/includes/serve-static"
|
||||
env_file: env
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://postgres@postgres:5432
|
||||
|
@ -15,11 +15,10 @@ services:
|
|||
- "redis"
|
||||
- "postgres"
|
||||
ports:
|
||||
- "5000:5000"
|
||||
- "80:80"
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
- nginx
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
|
@ -36,11 +35,3 @@ services:
|
|||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
nginx:
|
||||
image: nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.txt:/etc/nginx/conf.d/default.conf
|
||||
- ./nginx-serve-static.txt:/etc/nginx/includes/serve-static
|
||||
|
|
4
env
4
env
|
@ -1,4 +1,4 @@
|
|||
FLASK_APP=/service/files/cli:app
|
||||
FLASK_APP=/rDrama/files/cli:app
|
||||
MASTER_KEY=blahblahblah
|
||||
DOMAIN=localhost
|
||||
SITE_NAME=rDrama
|
||||
|
@ -33,4 +33,4 @@ CF_KEY=blahblahblah
|
|||
CF_ZONE=blahblahblah
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
NODE_VERSION=16.13.0
|
||||
NVM_DIR=/root/.nvm
|
||||
NVM_DIR=/root/.nvm
|
||||
|
|
|
@ -129,10 +129,7 @@ def teardown_request(error):
|
|||
del g.db
|
||||
stdout.flush()
|
||||
|
||||
if app.config["SERVER_NAME"] == 'localhost':
|
||||
from files.routes import *
|
||||
from files.routes.chat import *
|
||||
elif "load_chat" in argv:
|
||||
if "load_chat" in argv:
|
||||
from files.routes.chat import *
|
||||
else:
|
||||
from files.routes import *
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -328,7 +328,7 @@ class Comment(Base):
|
|||
|
||||
@lazy
|
||||
def realbody(self, v):
|
||||
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
|
||||
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.parent_comment.author_id, self.top_comment.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
|
||||
|
||||
body = self.body_html or ""
|
||||
|
||||
|
@ -392,7 +392,7 @@ class Comment(Base):
|
|||
|
||||
@lazy
|
||||
def plainbody(self, v):
|
||||
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
|
||||
if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.parent_comment.author_id, self.top_comment.author_id, self.post.author_id])): return f"<p>{CC} ONLY</p>"
|
||||
|
||||
body = self.body
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ if SITE_NAME == 'rDrama':
|
|||
"elon musk": "rocket daddy",
|
||||
"fake and gay": "fake and straight",
|
||||
" rapist": " male feminist",
|
||||
" pedo": " libertarian",
|
||||
" pedo ": " libertarian ",
|
||||
" kys": " keep yourself safe",
|
||||
"kys ": "keep yourself safe ",
|
||||
}
|
||||
|
|
|
@ -61,10 +61,6 @@ def sub_inactive_purge_task():
|
|||
Submission.private == False, Submission.is_banned == False,
|
||||
Submission.deleted_utc == 0).all()]
|
||||
active_holes.append('changelog') # system hole immune from deletion
|
||||
active_holes.append('furry') # house holes immune from deletion
|
||||
active_holes.append('vampire')
|
||||
active_holes.append('racist')
|
||||
active_holes.append('femboy')
|
||||
|
||||
dead_holes = g.db.query(Sub).filter(Sub.name.notin_(active_holes)).all()
|
||||
names = [x.name for x in dead_holes]
|
||||
|
|
|
@ -9,6 +9,16 @@ from files.helpers.get import *
|
|||
from files.helpers.wrappers import *
|
||||
from files.routes.static import marsey_list
|
||||
|
||||
@app.get('/asset_submissions/<path:path>')
|
||||
@limiter.exempt
|
||||
def asset_submissions(path):
|
||||
resp = make_response(send_from_directory('/asset_submissions', path))
|
||||
resp.headers.remove("Cache-Control")
|
||||
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
||||
resp.headers.remove("Content-Type")
|
||||
resp.headers.add("Content-Type", "image/webp")
|
||||
return resp
|
||||
|
||||
@app.get("/submit/marseys")
|
||||
@auth_required
|
||||
def submit_marseys(v):
|
||||
|
|
|
@ -284,7 +284,7 @@ def sign_up_post(v):
|
|||
return signup_error("There was a problem. Please try again.")
|
||||
|
||||
if not hmac.compare_digest(correct_formkey, form_formkey):
|
||||
return signup_error("There was a problem. Please try again.")
|
||||
return signup_error("There was a problem. Please try again!")
|
||||
|
||||
if not request.values.get(
|
||||
"password") == request.values.get("password_confirm"):
|
||||
|
|
|
@ -1110,7 +1110,7 @@ def undelete_post_pid(pid, v):
|
|||
def toggle_comment_nsfw(cid, v):
|
||||
comment = get_comment(cid)
|
||||
|
||||
if comment.author_id != v.id and not v.admin_level > 1:
|
||||
if comment.author_id != v.id and not v.admin_level > 1 and not (comment.post.sub and v.mods(comment.post.sub)):
|
||||
abort(403)
|
||||
|
||||
comment.over_18 = not comment.over_18
|
||||
|
@ -1132,7 +1132,7 @@ def toggle_comment_nsfw(cid, v):
|
|||
def toggle_post_nsfw(pid, v):
|
||||
post = get_post(pid)
|
||||
|
||||
if post.author_id != v.id and not v.admin_level > 1:
|
||||
if post.author_id != v.id and not v.admin_level > 1 and not (post.sub and v.mods(post.sub)):
|
||||
abort(403)
|
||||
|
||||
post.over_18 = not post.over_18
|
||||
|
|
|
@ -297,6 +297,40 @@ def static_service(path):
|
|||
|
||||
return resp
|
||||
|
||||
### BEGIN FALLBACK ASSET SERVING
|
||||
# In production, we have nginx serve these locations now.
|
||||
# These routes stay for local testing. Requests don't reach them on prod.
|
||||
|
||||
@app.get('/images/<path>')
|
||||
@app.get('/hostedimages/<path>')
|
||||
@app.get("/static/images/<path>")
|
||||
@limiter.exempt
|
||||
def images(path):
|
||||
resp = make_response(send_from_directory('/images', path))
|
||||
resp.headers.remove("Cache-Control")
|
||||
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
||||
resp.headers.remove("Content-Type")
|
||||
resp.headers.add("Content-Type" ,"image/webp")
|
||||
return resp
|
||||
|
||||
@app.get('/videos/<path>')
|
||||
@limiter.exempt
|
||||
def videos(path):
|
||||
resp = make_response(send_from_directory('/videos', path))
|
||||
resp.headers.remove("Cache-Control")
|
||||
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
||||
return resp
|
||||
|
||||
@app.get('/audio/<path>')
|
||||
@limiter.exempt
|
||||
def audio(path):
|
||||
resp = make_response(send_from_directory('/audio', path))
|
||||
resp.headers.remove("Cache-Control")
|
||||
resp.headers.add("Cache-Control", "public, max-age=3153600")
|
||||
return resp
|
||||
|
||||
### END FALLBACK ASSET SERVING
|
||||
|
||||
@app.get("/robots.txt")
|
||||
def robots_txt():
|
||||
return send_file("assets/robots.txt")
|
||||
|
|
|
@ -1,193 +1,193 @@
|
|||
from files.helpers.wrappers import *
|
||||
from files.helpers.get import *
|
||||
from files.helpers.const import *
|
||||
from files.classes import *
|
||||
from flask import *
|
||||
from files.__main__ import app, limiter, cache
|
||||
|
||||
@app.get("/votes/<link>")
|
||||
@admin_level_required(PERMS['VOTES_VISIBLE'])
|
||||
def vote_info_get(v, link):
|
||||
try:
|
||||
if "p_" in link: thing = get_post(int(link.split("p_")[1]), v=v)
|
||||
elif "c_" in link: thing = get_comment(int(link.split("c_")[1]), v=v)
|
||||
else: abort(400)
|
||||
except: abort(400)
|
||||
|
||||
if thing.ghost and v.id != AEVANN_ID: abort(403)
|
||||
|
||||
if isinstance(thing, Submission):
|
||||
if thing.author.shadowbanned and not (v and v.admin_level):
|
||||
thing_id = g.db.query(Submission.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Submission.id).first()[0]
|
||||
else: thing_id = thing.id
|
||||
|
||||
ups = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=1).order_by(Vote.created_utc).all()
|
||||
|
||||
downs = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=-1).order_by(Vote.created_utc).all()
|
||||
|
||||
elif isinstance(thing, Comment):
|
||||
if thing.author.shadowbanned and not (v and v.admin_level):
|
||||
thing_id = g.db.query(Comment.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Comment.id).first()[0]
|
||||
else: thing_id = thing.id
|
||||
|
||||
ups = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=1).order_by(CommentVote.created_utc).all()
|
||||
|
||||
downs = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=-1 ).order_by(CommentVote.created_utc).all()
|
||||
|
||||
else: abort(400)
|
||||
|
||||
return render_template("votes.html",
|
||||
v=v,
|
||||
thing=thing,
|
||||
ups=ups,
|
||||
downs=downs)
|
||||
|
||||
|
||||
@app.post("/vote/post/<post_id>/<new>")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@is_not_permabanned
|
||||
def vote_post(post_id, new, v):
|
||||
|
||||
if new == "-1" and DISABLE_DOWNVOTES: return {"error": "forbidden."}, 403
|
||||
|
||||
if new not in ["-1", "0", "1"]: abort(400)
|
||||
|
||||
if request.headers.get("Authorization") and v.id != BBBB_ID: abort(403)
|
||||
|
||||
new = int(new)
|
||||
|
||||
post = get_post(post_id)
|
||||
|
||||
coin_delta = 1
|
||||
if v.id == post.author.id:
|
||||
coin_delta = 0
|
||||
|
||||
coin_mult = 1
|
||||
|
||||
g.db.flush()
|
||||
existing = g.db.query(Vote).filter_by(user_id=v.id, submission_id=post.id).one_or_none()
|
||||
|
||||
if DOUBLE_XP_ENABLED > 0:
|
||||
if not existing and int(time.time()) > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
elif existing and existing.created_utc > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
|
||||
if existing and existing.vote_type == new: return "", 204
|
||||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
post.author.coins += coin_delta * coin_mult
|
||||
post.author.truecoins += coin_delta
|
||||
g.db.add(post.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
post.author.coins -= coin_delta * coin_mult
|
||||
post.author.truecoins -= coin_delta
|
||||
g.db.add(post.author)
|
||||
g.db.delete(existing)
|
||||
else:
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif new != 0:
|
||||
post.author.coins += coin_delta * coin_mult
|
||||
post.author.truecoins += coin_delta
|
||||
g.db.add(post.author)
|
||||
|
||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||
else: real = True
|
||||
|
||||
vote = Vote(user_id=v.id,
|
||||
vote_type=new,
|
||||
submission_id=post_id,
|
||||
app_id=v.client.application.id if v.client else None,
|
||||
real = real
|
||||
)
|
||||
g.db.add(vote)
|
||||
|
||||
g.db.flush()
|
||||
post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count()
|
||||
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
post.realupvotes = g.db.query(Vote).filter_by(submission_id=post.id, real=True).count()
|
||||
|
||||
if post.author.progressivestack \
|
||||
or post.sub in ('space','istory','dinos') \
|
||||
or post.domain.endswith('.win'):
|
||||
post.realupvotes *= 2
|
||||
|
||||
g.db.add(post)
|
||||
return "", 204
|
||||
|
||||
@app.post("/vote/comment/<comment_id>/<new>")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@is_not_permabanned
|
||||
def vote_comment(comment_id, new, v):
|
||||
|
||||
if new == "-1" and DISABLE_DOWNVOTES: return {"error": "forbidden."}, 403
|
||||
|
||||
if new not in ["-1", "0", "1"]: abort(400)
|
||||
|
||||
if request.headers.get("Authorization") and v.id != BBBB_ID: abort(403)
|
||||
|
||||
new = int(new)
|
||||
comment = get_comment(comment_id)
|
||||
|
||||
coin_delta = 1
|
||||
if v.id == comment.author_id:
|
||||
coin_delta = 0
|
||||
|
||||
coin_mult = 1
|
||||
|
||||
g.db.commit()
|
||||
existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none()
|
||||
|
||||
if DOUBLE_XP_ENABLED > 0:
|
||||
if not existing and int(time.time()) > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
elif existing and existing.created_utc > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
|
||||
if existing and existing.vote_type == new: return "", 204
|
||||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
comment.author.coins += coin_delta * coin_mult
|
||||
comment.author.truecoins += coin_delta
|
||||
g.db.add(comment.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
comment.author.coins -= coin_delta * coin_mult
|
||||
comment.author.truecoins -= coin_delta
|
||||
g.db.add(comment.author)
|
||||
g.db.delete(existing)
|
||||
else:
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif new != 0:
|
||||
comment.author.coins += coin_delta * coin_mult
|
||||
comment.author.truecoins += coin_delta
|
||||
g.db.add(comment.author)
|
||||
|
||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||
else: real = True
|
||||
|
||||
vote = CommentVote(user_id=v.id,
|
||||
vote_type=new,
|
||||
comment_id=comment_id,
|
||||
app_id=v.client.application.id if v.client else None,
|
||||
real=real
|
||||
)
|
||||
|
||||
g.db.add(vote)
|
||||
|
||||
g.db.commit()
|
||||
comment.upvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=1).count()
|
||||
comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
comment.realupvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, real=True).count()
|
||||
if comment.author.progressivestack: comment.realupvotes *= 2
|
||||
g.db.add(comment)
|
||||
return "", 204
|
||||
from files.helpers.wrappers import *
|
||||
from files.helpers.get import *
|
||||
from files.helpers.const import *
|
||||
from files.classes import *
|
||||
from flask import *
|
||||
from files.__main__ import app, limiter, cache
|
||||
|
||||
@app.get("/votes/<link>")
|
||||
@admin_level_required(PERMS['VOTES_VISIBLE'])
|
||||
def vote_info_get(v, link):
|
||||
try:
|
||||
if "p_" in link: thing = get_post(int(link.split("p_")[1]), v=v)
|
||||
elif "c_" in link: thing = get_comment(int(link.split("c_")[1]), v=v)
|
||||
else: abort(400)
|
||||
except: abort(400)
|
||||
|
||||
if thing.ghost and v.id != AEVANN_ID: abort(403)
|
||||
|
||||
if isinstance(thing, Submission):
|
||||
if thing.author.shadowbanned and not (v and v.admin_level):
|
||||
thing_id = g.db.query(Submission.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Submission.id).first()[0]
|
||||
else: thing_id = thing.id
|
||||
|
||||
ups = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=1).order_by(Vote.created_utc).all()
|
||||
|
||||
downs = g.db.query(Vote).filter_by(submission_id=thing_id, vote_type=-1).order_by(Vote.created_utc).all()
|
||||
|
||||
elif isinstance(thing, Comment):
|
||||
if thing.author.shadowbanned and not (v and v.admin_level):
|
||||
thing_id = g.db.query(Comment.id).filter_by(upvotes=thing.upvotes, downvotes=thing.downvotes).order_by(Comment.id).first()[0]
|
||||
else: thing_id = thing.id
|
||||
|
||||
ups = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=1).order_by(CommentVote.created_utc).all()
|
||||
|
||||
downs = g.db.query(CommentVote).filter_by(comment_id=thing_id, vote_type=-1 ).order_by(CommentVote.created_utc).all()
|
||||
|
||||
else: abort(400)
|
||||
|
||||
return render_template("votes.html",
|
||||
v=v,
|
||||
thing=thing,
|
||||
ups=ups,
|
||||
downs=downs)
|
||||
|
||||
|
||||
@app.post("/vote/post/<post_id>/<new>")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@is_not_permabanned
|
||||
def vote_post(post_id, new, v):
|
||||
|
||||
if new == "-1" and DISABLE_DOWNVOTES: return {"error": "forbidden."}, 403
|
||||
|
||||
if new not in ["-1", "0", "1"]: abort(400)
|
||||
|
||||
if request.headers.get("Authorization") and v.id != BBBB_ID: abort(403)
|
||||
|
||||
new = int(new)
|
||||
|
||||
post = get_post(post_id)
|
||||
|
||||
coin_delta = 1
|
||||
if v.id == post.author.id:
|
||||
coin_delta = 0
|
||||
|
||||
coin_mult = 1
|
||||
|
||||
g.db.flush()
|
||||
existing = g.db.query(Vote).filter_by(user_id=v.id, submission_id=post.id).one_or_none()
|
||||
|
||||
if DOUBLE_XP_ENABLED > 0:
|
||||
if not existing and int(time.time()) > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
elif existing and existing.created_utc > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
|
||||
if existing and existing.vote_type == new: return "", 204
|
||||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
post.author.coins += coin_delta * coin_mult
|
||||
post.author.truecoins += coin_delta
|
||||
g.db.add(post.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
post.author.coins -= coin_delta * coin_mult
|
||||
post.author.truecoins -= coin_delta
|
||||
g.db.add(post.author)
|
||||
g.db.delete(existing)
|
||||
else:
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif new != 0:
|
||||
post.author.coins += coin_delta * coin_mult
|
||||
post.author.truecoins += coin_delta
|
||||
g.db.add(post.author)
|
||||
|
||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||
else: real = True
|
||||
|
||||
vote = Vote(user_id=v.id,
|
||||
vote_type=new,
|
||||
submission_id=post_id,
|
||||
app_id=v.client.application.id if v.client else None,
|
||||
real = real
|
||||
)
|
||||
g.db.add(vote)
|
||||
|
||||
g.db.flush()
|
||||
post.upvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=1).count()
|
||||
post.downvotes = g.db.query(Vote).filter_by(submission_id=post.id, vote_type=-1).count()
|
||||
post.realupvotes = g.db.query(Vote).filter_by(submission_id=post.id, real=True).count()
|
||||
|
||||
if post.author.progressivestack \
|
||||
or post.sub in ('space','istory','dinos') \
|
||||
or post.domain.endswith('.win'):
|
||||
post.realupvotes *= 2
|
||||
|
||||
g.db.add(post)
|
||||
return "", 204
|
||||
|
||||
@app.post("/vote/comment/<comment_id>/<new>")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day")
|
||||
@limiter.limit("5/second;60/minute;1000/hour;2000/day", key_func=lambda:f'{SITE}-{session.get("lo_user")}')
|
||||
@is_not_permabanned
|
||||
def vote_comment(comment_id, new, v):
|
||||
|
||||
if new == "-1" and DISABLE_DOWNVOTES: return {"error": "forbidden."}, 403
|
||||
|
||||
if new not in ["-1", "0", "1"]: abort(400)
|
||||
|
||||
if request.headers.get("Authorization") and v.id != BBBB_ID: abort(403)
|
||||
|
||||
new = int(new)
|
||||
comment = get_comment(comment_id)
|
||||
|
||||
coin_delta = 1
|
||||
if v.id == comment.author_id:
|
||||
coin_delta = 0
|
||||
|
||||
coin_mult = 1
|
||||
|
||||
g.db.commit()
|
||||
existing = g.db.query(CommentVote).filter_by(user_id=v.id, comment_id=comment.id).one_or_none()
|
||||
|
||||
if DOUBLE_XP_ENABLED > 0:
|
||||
if not existing and int(time.time()) > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
elif existing and existing.created_utc > DOUBLE_XP_ENABLED:
|
||||
coin_mult = 2
|
||||
|
||||
if existing and existing.vote_type == new: return "", 204
|
||||
|
||||
if existing:
|
||||
if existing.vote_type == 0 and new != 0:
|
||||
comment.author.coins += coin_delta * coin_mult
|
||||
comment.author.truecoins += coin_delta
|
||||
g.db.add(comment.author)
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif existing.vote_type != 0 and new == 0:
|
||||
comment.author.coins -= coin_delta * coin_mult
|
||||
comment.author.truecoins -= coin_delta
|
||||
g.db.add(comment.author)
|
||||
g.db.delete(existing)
|
||||
else:
|
||||
existing.vote_type = new
|
||||
g.db.add(existing)
|
||||
elif new != 0:
|
||||
comment.author.coins += coin_delta * coin_mult
|
||||
comment.author.truecoins += coin_delta
|
||||
g.db.add(comment.author)
|
||||
|
||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||
else: real = True
|
||||
|
||||
vote = CommentVote(user_id=v.id,
|
||||
vote_type=new,
|
||||
comment_id=comment_id,
|
||||
app_id=v.client.application.id if v.client else None,
|
||||
real=real
|
||||
)
|
||||
|
||||
g.db.add(vote)
|
||||
|
||||
g.db.commit()
|
||||
comment.upvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=1).count()
|
||||
comment.downvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, vote_type=-1).count()
|
||||
comment.realupvotes = g.db.query(CommentVote).filter_by(comment_id=comment.id, real=True).count()
|
||||
if comment.author.progressivestack: comment.realupvotes *= 2
|
||||
g.db.add(comment)
|
||||
return "", 204
|
||||
|
|
|
@ -480,9 +480,9 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if c.parent_submission and (c.author_id==v.id or v.admin_level > 1) %}
|
||||
<button id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Unmark +18</button>
|
||||
<button id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button>
|
||||
{% if c.parent_submission and (c.author_id==v.id or v.admin_level > 1 or (c.post.sub and v.mods(c.post.sub))) %}
|
||||
<button id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Unmark +18</button>
|
||||
<button id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}','d-md-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button>
|
||||
{% endif %}
|
||||
|
||||
{% if v.admin_level > 1 and v.id != c.author_id %}
|
||||
|
@ -636,9 +636,6 @@
|
|||
<a id="undelete2-{{c.id}}" class="{% if not c.deleted_utc %}d-none{% endif %} list-group-item text-success" role="button" onclick="post_toast(this,'/undelete/comment/{{c.id}}', 'delete2-{{c.id}}', 'undelete2-{{c.id}}','d-none');document.getElementById('comment-{{c.id}}').classList.remove('deleted')" data-bs-dismiss="modal"><i class="far fa-trash-alt text-success mr-2"></i>Undelete</a>
|
||||
|
||||
<a id="delete2-{{c.id}}" class="{% if c.deleted_utc %}d-none{% endif %} list-group-item text-danger" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="far fa-trash-alt text-danger mr-2"></i>Delete</a>
|
||||
|
||||
<a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a>
|
||||
<a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a>
|
||||
{% else %}
|
||||
{% if c.body %}
|
||||
<a role="button" data-bs-dismiss="modal" onclick="expandMarkdown('{{c.id}}','c')" class="list-group-item"><i class="fas text-expand-icon-{{c.id}} fa-expand-alt mr-2"></i><span class="expand-text-c-{{c.id}}">View source</span></a>
|
||||
|
@ -651,6 +648,11 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if c.author_id == v.id or (c.post.sub and v.mods(c.post.sub)) %}
|
||||
<a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a>
|
||||
<a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a>
|
||||
{% endif %}
|
||||
|
||||
{% if v.admin_level < 2 %}
|
||||
{% if c.post and v.id == c.post.author_id %}
|
||||
<a id="pin2-{{c.id}}" class="list-group-item {% if c.stickied %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
{% endif %}
|
||||
|
||||
|
||||
{% if v.id==p.author_id or v.admin_level > 1 %}
|
||||
{% if v.id==p.author_id or v.admin_level > 1 or (p.sub and v.mods(p.sub)) %}
|
||||
<a id="mark-{{p.id}}" class="dropdown-item {% if p.over_18 %}d-none{% endif %} list-inline-item text-danger" role="button" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Mark +18</a>
|
||||
<a id="unmark-{{p.id}}" class="dropdown-item {% if not p.over_18 %}d-none{% endif %} list-inline-item text-success" role="button" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}','d-none')"><i class="fas fa-eye-evil"></i>Unmark +18</a>
|
||||
{% endif %}
|
||||
|
|
|
@ -43,11 +43,7 @@
|
|||
<button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-2"></i>Mark club</button>
|
||||
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="post_toast(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="fas fa-eye mr-2"></i>Unmark club</button>
|
||||
{%- endif %}
|
||||
|
||||
<button id="mark3-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-2"></i>Mark +18</button>
|
||||
<button id="unmark3-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-2"></i>Unmark +18</button>
|
||||
{% else %}
|
||||
|
||||
{% if not p.ghost %}
|
||||
<button id="unblock2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left{% if not p.is_blocking %} d-none{% endif %}" data-bs-dismiss="modal" onclick="post_toast(this,'/settings/unblock?username={{p.author.username}}','block2-{{p.id}}','unblock2-{{p.id}}','d-none')"><i class="fas fa-eye mr-2 text-success"></i>Unblock user</button>
|
||||
<button id="prompt2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left d-none" data-bs-dismiss="modal" onclick="post_toast(this,'/settings/block?username={{p.author.username}}','prompt2-{{p.id}}','unblock2-{{p.id}}','d-none')"><i class="fas fa-eye-slash mr-2 text-danger"></i>Are you sure?</button>
|
||||
|
@ -55,6 +51,11 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if v.id==p.author_id or (p.sub and v.mods(p.sub)) %}
|
||||
<button id="mark3-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-2"></i>Mark +18</button>
|
||||
<button id="unmark3-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" onclick="post_toast(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}','d-none')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-2"></i>Unmark +18</button>
|
||||
{% endif %}
|
||||
|
||||
{% if p.sub and v.mods(p.sub) %}
|
||||
<button data-bs-dismiss="modal" class="nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast(this,'/kick/{{p.id}}')"><i class="fas fa-sign-out text-danger text-center mr-2"></i>Kick</button>
|
||||
|
||||
|
|
|
@ -1,429 +1,429 @@
|
|||
{%- import 'util/helpers.html' as help -%}
|
||||
|
||||
{% if v %}
|
||||
{% include "award_modal.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% if SITE == 'pcmemes.net' %}
|
||||
{% set cc='SPLASH MOUNTAIN' %}
|
||||
{% else %}
|
||||
{% set cc='COUNTRY CLUB' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not v or v.highlightcomments %}
|
||||
<script defer src="{{'js/new_comments_count.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% include "popover.html" %}
|
||||
|
||||
{% for p in listing if p.can_see(v) %}
|
||||
|
||||
{% set ups=p.upvotes %}
|
||||
{% set downs=p.downvotes %}
|
||||
{% set score=ups-downs %}
|
||||
|
||||
{% if v %}
|
||||
{% set voted= p.voted %}
|
||||
{% else %}
|
||||
{% set voted=-2 %}
|
||||
{% endif %}
|
||||
|
||||
{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= 2) and not (v and v.id == p.author_id) %}
|
||||
|
||||
{% if p.active_flags(v) %}
|
||||
<div id="flaggers-{{p.id}}" class="flaggers d-none">
|
||||
<strong><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
<pre></pre>
|
||||
<ul style="padding-left:20px; margin-bottom: 0;word-wrap:break-word">
|
||||
{% for f in p.filtered_flags(v) %}
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}<a role="button" onclick="post_toast(this,'/del_report/post/{{f.post_id}}/{{f.user_id}}')">[remove]</a>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="post-{{p.id}}" class="actual-post {% if p.unread %}unread{% else %}card{% endif %} {% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.over_18 %} nsfw{% endif %}">
|
||||
|
||||
<div class="d-flex flex-row-reverse flex-md-row flex-nowrap justify-content-end">
|
||||
|
||||
{% if not postembed %}
|
||||
<div class="voting my-2 d-none d-md-flex pr-2">
|
||||
{% if v and request.path.startswith('/@') and v.admin_level < 2 %}
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% else %}d-none{% endif %}"></div>
|
||||
|
||||
<span class="post-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% else %}d-none{% endif %}"></div>
|
||||
{% elif v %}
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% endif %}"></div>
|
||||
|
||||
<span class="post-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %}"></div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up" onclick="location.href='/login';"></div>
|
||||
|
||||
<span class="post-{{p.id}}-score-none score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down" onclick="location.href='/login';"></div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-header bg-transparent border-0 d-flex flex-row flex-nowrap pl-2 pl-md-0 p-0 mr-md-2">
|
||||
|
||||
{% if not v_forbid_deleted %}
|
||||
<div class="card-thumbnail">
|
||||
{% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %}
|
||||
<img alt="post thumnail" loading="lazy" src="/e/marseyglow.webp" class="post-img">
|
||||
{% elif not p.url %}
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_image %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="expandDesktopImage('{{p.realurl(v)}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_video or p.is_audio %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="togglevideo('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_youtube %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="toggleyoutube('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% else %}
|
||||
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
<i class="ext-link fas fa-external-link"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-block text-left x-scroll-parent my-md-auto w-100">
|
||||
|
||||
<div class="post-meta text-left x-scroll mb-md-2">
|
||||
{% if p.sub %}
|
||||
{% if not HOLE_STYLE_FLAIR -%}
|
||||
<a href='/h/{{p.sub}}'>/h/{{p.sub}}</a>
|
||||
{%- else -%}
|
||||
<a href='/h/{{p.sub}}' class="sub-flair">{{p.sub|capitalize}}</a>
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if p.sub and p.author.exiled_from(p.sub) %}
|
||||
<a><i class="fas fa-campfire text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User has been exiled from {% if not HOLE_STYLE_FLAIR %}/h/{% endif %}{{p.sub}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if p.bannedfor %}
|
||||
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post {{p.bannedfor}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% for a in p.awards %}
|
||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endfor %}
|
||||
|
||||
{% if v and v.admin_level > 1 and p.author.shadowbanned %}
|
||||
<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{p.author.shadowbanned}} for "{{p.author.ban_reason}}"'></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.stickied %}
|
||||
<i id='pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{p.stickied}}" {% if p.stickied_utc %}onmouseover="pinned_timestamp('pinned-{{p.id}}')" data-timestamp={{p.stickied_utc}} {% endif %}></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.hole_pinned %}
|
||||
<i id='hole-pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-blue" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to /h/{{p.sub}} by @{{p.hole_pinned}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{SITE_NAME}} Admin, speaking officially"></i>{% endif %}
|
||||
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.is_bot %} <i class="fas fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bot"></i>{% endif %}
|
||||
{% if p.is_blocking and not p.ghost %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="You're blocking this user, but you can see this post because you're an admin."></i>{% endif %}
|
||||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
|
||||
{% if p.active_flags(v) %}<a class="btn btn-primary" role="button" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{ help.plural(p.active_flags(v)) }}</a>{% endif %}
|
||||
|
||||
{% if p.ghost %}
|
||||
<span {% if p.distinguish_level %}class="mod"{% endif %}>👻</span>
|
||||
{% else %}
|
||||
{% if FEATURES['PATRON_ICONS'] and p.author.patron %}
|
||||
<img loading="lazy" src="/i/{{SITE_NAME}}/patron_badges/2{{p.author.patron}}.webp?v=1" height="20" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.patron_tooltip}}" alt="{{p.author.patron_tooltip}}">
|
||||
{% endif %}
|
||||
|
||||
{% if FEATURES['HOUSES'] and p.author.house %}
|
||||
<img loading="lazy" src="/i/{{SITE_NAME}}/houses/{{p.author.house}}.webp?v=2000" height="20" data-bs-toggle="tooltip" data-bs-placement="bottom" title="House {{p.author.house}}" alt="House {{p.author.house}}">
|
||||
{% endif %}
|
||||
|
||||
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1 {% if p.author.verified=='Glowiefied' %}glow{% endif %}" style="color:{% if p.author.verifiedcolor %}#{{p.author.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.verified}}"></i>
|
||||
{% endif %}
|
||||
<a class="user-name text-decoration-none" href="{{p.author.url}}" data-pop-info='{{p.author.json_popover(v) | tojson}}' onclick='popclick(event)' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="color: #{{p.author.name_color}}; font-weight: bold;">
|
||||
<div class="profile-pic-30-wrapper" style="margin-top:9px">
|
||||
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
||||
{% if p.author.hat_active -%}
|
||||
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
|
||||
{%- endif %}
|
||||
</div>
|
||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||
</a>
|
||||
{% if FEATURES['PRONOUNS'] %}
|
||||
<span class="pronouns" style="color:#{{p.author.titlecolor}};border-color:#{{p.author.titlecolor}}">{{p.author.pronouns}}</span>
|
||||
{% endif %}
|
||||
{% if p.author.customtitle %}
|
||||
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('timestamp-{{p.id}}','{{p.created_utc}}')" id="timestamp-{{p.id}}"> {{p.age_string}}</span>
|
||||
|
||||
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.is_audio %}audio post{% elif p.domain %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" class="post-meta-domain" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>{{p.domain|truncate(50, True)}}</a>{% else %}text post{% endif %})
|
||||
{% if p.edited_utc %}
|
||||
Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" onmouseover="timestamp('edited_timestamp-{{p.id}}','{{p.edited_utc}}')">{{p.edited_string}}</span>
|
||||
{% endif %}
|
||||
{{p.views}} thread views
|
||||
</div>
|
||||
|
||||
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
|
||||
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.sub %}sub{% endif %} stretched-link {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %}">
|
||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||
{{p.realtitle(v) | safe}}
|
||||
</a></h5>
|
||||
|
||||
<div class="post-actions mt-2 d-none d-md-block">
|
||||
<ul class="list-inline text-right d-flex">
|
||||
{% if p.realbody(v, True) %}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
<li class="list-inline-item">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<i class="fas fa-comment-dots"></i>{{p.comment_count}}
|
||||
<span class="text-info d-none {{p.id}}-new-comments"></span>
|
||||
</a>
|
||||
</li>
|
||||
{% include 'post_actions.html' %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-md-none mt-2">
|
||||
<div class="post-actions">
|
||||
<ul class="list-inline text-right d-flex">
|
||||
<li class="list-inline-item mr-auto">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<i class="fas fa-comment-dots"></i>{{p.comment_count}}
|
||||
<span class="text-info d-none {{p.id}}-new-comments"></span>
|
||||
</a>
|
||||
|
||||
{% if v and v.admin_level > 1 %}
|
||||
<a class="ml-2" role="button" data-bs-toggle="modal" data-bs-target="#adminModal-{{p.id}}">
|
||||
<i class="fas fa-broom"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
|
||||
{% if p.realbody(v, True) %}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
<li class="list-inline-item">
|
||||
<a role="button" data-bs-toggle="modal" data-bs-target="#actionsModal-{{p.id}}">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if not postembed %}
|
||||
{% if v and request.path.startswith('/@') and v.admin_level < 2 %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '1')" class="post-mobile-{{p.id}}-up mx-0 pr-1 arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% else %}d-none{% endif %}"></span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '-1')" class="post-mobile-{{p.id}}-down mx-0 pl-1 my-0 arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% else %}d-none{% endif %}"></span>
|
||||
</li>
|
||||
{% elif v %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '1')" class="post-mobile-{{p.id}}-up mx-0 pr-1 arrow-up upvote-button post-{{p.id}}-up {% if voted==1 or v.id == AEVANN_ID %}active{% endif %}"></span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 or v.id == AEVANN_ID %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '-1')" class="post-mobile-{{p.id}}-down mx-0 pl-1 my-0 arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %}"></span>
|
||||
|
||||
</li>
|
||||
{% else %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
<span tabindex="0" class="arrow-{{p.id}}-mobile-up mx-0 pr-1 arrow-mobile-up" onclick="location.href='/login';">
|
||||
<i class="fas fa-arrow-alt-up mx-0" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span tabindex="0" class="arrow-{{p.id}}-mobile-down arrow-mobile-down mx-0 pl-1 my-0" onclick="location.href='/login';">
|
||||
<i class="fas fa-arrow-alt-down mx-0" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if v %}
|
||||
<div class="modal fade d-md-none" id="actionsModal-{{p.id}}" tabindex="-1" role="dialog" aria-labelledby="actionsModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header p-3">
|
||||
<h5 class="col modal-title text-center h6">More options</h5>
|
||||
<button class="close position-absolute py-3" style="right: 1rem"data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fas fa-times-circle text-gray-500"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="list-group post-actions">
|
||||
{% include "post_actions_mobile.html" %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
{% if not v or v.highlightcomments %}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
showNewCommentCounts({{p.id}}, {{p.comment_count}})
|
||||
})
|
||||
{% endif %}
|
||||
</script>
|
||||
|
||||
|
||||
{% if v and v.admin_level > 1 %}
|
||||
{% include "post_admin_actions_mobile.html" %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if (not p.club or v and (v.paid_dues or v.id == p.author_id)) and not v_forbid_deleted %}
|
||||
{% if p.realbody(v, True) %}
|
||||
<div class="d-none card rounded border {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} post-preview" id="post-text-{{p.id}}">
|
||||
{{p.realbody(v, True) | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and CARD_VIEW)) %}
|
||||
<div style="text-align: center" class="mt-3 mb-4">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||
<img loading="lazy" data-src="{{p.realurl(v)}}" src="/i/l.webp" class="img-fluid" style="max-height:20rem" alt="Unable to load image">
|
||||
</a>
|
||||
</div>
|
||||
{% elif p.is_video %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<video id="video2-{{p.id}}" controls preload="none">
|
||||
<source src="{{p.realurl(v)}}">
|
||||
</video>
|
||||
</div>
|
||||
{% elif p.is_audio %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<audio id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></audio>
|
||||
</div>
|
||||
{% elif p.is_youtube %}
|
||||
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-3 mb-4 youtube_embed">
|
||||
{{p.embed_url | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if request.path.endswith('/admin/queue') %}
|
||||
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center py-7">
|
||||
<div class="h4 p-2">This queue is empty. (That's a good thing.)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% elif u %}
|
||||
{% if v and v.id == u.id %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-ghost fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
<h2 class="h5">You haven't {% if "/saved/" in request.path %}saved{% elif "/subscribed/" in request.path %}subscribed to{% else %}made{% endif %} a post yet</h2>
|
||||
<p class="text-muted mb-md-5">Your {% if "/saved/" in request.path %}saved posts{% elif "/subscribed/" in request.path %}subscribed posts{% else %}posting history{% endif %} will show here.</p>
|
||||
{% if "/saved/" not in request.path and "/subscribed/" not in request.path %}<a href="/submit" class="btn btn-primary">Create a post</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% else %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-scroll-old fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
<h2 class="h5">@{{u.username}} hasn't made a post yet</h2>
|
||||
<p class="text-muted">Their posting history will show here.</p>
|
||||
<pre>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% elif request.path != '/notifications/posts' %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-ghost fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
{% if request.path.startswith('/search') and error %}
|
||||
<h2 class="h5">{{error}}</h2>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% if v %}
|
||||
{% include "delete_post_modal.html" %}
|
||||
{% include "report_post_modal.html" %}
|
||||
{% if v.admin_level > 1 %}
|
||||
{% include "ban_modal.html" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
<script defer src="{{'js/clipboard.js' | asset}}"></script>
|
||||
<script defer src="{{'js/comments+submission_listing.js' | asset}}"></script>
|
||||
<script defer src="{{'js/submission_listing.js' | asset}}"></script>
|
||||
{%- import 'util/helpers.html' as help -%}
|
||||
|
||||
{% if v %}
|
||||
{% include "award_modal.html" %}
|
||||
{% endif %}
|
||||
|
||||
{% if SITE == 'pcmemes.net' %}
|
||||
{% set cc='SPLASH MOUNTAIN' %}
|
||||
{% else %}
|
||||
{% set cc='COUNTRY CLUB' %}
|
||||
{% endif %}
|
||||
|
||||
{% if not v or v.highlightcomments %}
|
||||
<script defer src="{{'js/new_comments_count.js' | asset}}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% include "popover.html" %}
|
||||
|
||||
{% for p in listing if p.can_see(v) %}
|
||||
|
||||
{% set ups=p.upvotes %}
|
||||
{% set downs=p.downvotes %}
|
||||
{% set score=ups-downs %}
|
||||
|
||||
{% if v %}
|
||||
{% set voted= p.voted %}
|
||||
{% else %}
|
||||
{% set voted=-2 %}
|
||||
{% endif %}
|
||||
|
||||
{% set v_forbid_deleted = (p.deleted_utc != 0 or p.is_banned) and not (v and v.admin_level >= 2) and not (v and v.id == p.author_id) %}
|
||||
|
||||
{% if p.active_flags(v) %}
|
||||
<div id="flaggers-{{p.id}}" class="flaggers d-none">
|
||||
<strong><i class="far fa-fw fa-flag"></i> Reported by:</strong>
|
||||
<pre></pre>
|
||||
<ul style="padding-left:20px; margin-bottom: 0;word-wrap:break-word">
|
||||
{% for f in p.filtered_flags(v) %}
|
||||
<li><a style="font-weight:bold" href="{{f.user.url}}">{{f.user.username}}</a>{% if f.reason %}: {{f.realreason(v) | safe}}{% endif %} {% if v and v.admin_level >= PERMS['FLAGS_REMOVE'] %}<a role="button" onclick="post_toast(this,'/del_report/post/{{f.post_id}}/{{f.user_id}}')">[remove]</a>{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="post-{{p.id}}" class="actual-post {% if p.unread %}unread{% else %}card{% endif %} {% if p.is_banned %} banned{% endif %}{% if p.deleted_utc %} deleted{% endif %}{% if p.stickied %} stickied{% endif %}{% if voted==1 %} upvoted{% elif voted==-1 %} downvoted{% endif %}{% if p.over_18 %} nsfw{% endif %}">
|
||||
|
||||
<div class="d-flex flex-row-reverse flex-md-row flex-nowrap justify-content-end">
|
||||
|
||||
{% if not postembed %}
|
||||
<div class="voting my-2 d-none d-md-flex pr-2">
|
||||
{% if v and request.path.startswith('/@') and v.admin_level < 2 %}
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% else %}d-none{% endif %}"></div>
|
||||
|
||||
<span class="post-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% else %}d-none{% endif %}"></div>
|
||||
{% elif v %}
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% endif %}"></div>
|
||||
|
||||
<span class="post-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %}"></div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '1')" class="post-{{p.id}}-up mx-auto arrow-up" onclick="location.href='/login';"></div>
|
||||
|
||||
<span class="post-{{p.id}}-score-none score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="right" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<div {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post', '{{p.id}}', '-1')" class="post-{{p.id}}-down text-muted mx-auto arrow-down" onclick="location.href='/login';"></div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-header bg-transparent border-0 d-flex flex-row flex-nowrap pl-2 pl-md-0 p-0 mr-md-2">
|
||||
|
||||
{% if not v_forbid_deleted %}
|
||||
<div class="card-thumbnail">
|
||||
{% if p.club and not (v and (v.paid_dues or v.id == p.author_id)) %}
|
||||
<img alt="post thumnail" loading="lazy" src="/e/marseyglow.webp" class="post-img">
|
||||
{% elif not p.url %}
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_image %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="expandDesktopImage('{{p.realurl(v)}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_video or p.is_audio %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="togglevideo('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% elif p.is_youtube %}
|
||||
<a href="{{p.realurl(v)}}" rel="nofollow noopener noreferrer">
|
||||
<img onclick="toggleyoutube('{{p.id}}')" alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
</a>
|
||||
{% else %}
|
||||
<a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||
<img alt="post thumnail" loading="lazy" src="{{p.thumb_url}}" class="post-img">
|
||||
<i class="ext-link fas fa-external-link"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card-block text-left x-scroll-parent my-md-auto w-100">
|
||||
|
||||
<div class="post-meta text-left x-scroll mb-md-2">
|
||||
{% if p.sub %}
|
||||
{% if not HOLE_STYLE_FLAIR -%}
|
||||
<a href='/h/{{p.sub}}'>/h/{{p.sub}}</a>
|
||||
{%- else -%}
|
||||
<a href='/h/{{p.sub}}' class="sub-flair">{{p.sub|capitalize}}</a>
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if p.sub and p.author.exiled_from(p.sub) %}
|
||||
<a><i class="fas fa-campfire text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User has been exiled from {% if not HOLE_STYLE_FLAIR %}/h/{% endif %}{{p.sub}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if p.bannedfor %}
|
||||
<i class="fas fa-hammer-crash text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="User was banned for this post {{p.bannedfor}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% for a in p.awards %}
|
||||
<i class="{{a.class_list}} px-1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{a.title}} Award given by @{{a.user.username}}"></i>
|
||||
{% endfor %}
|
||||
|
||||
{% if v and v.admin_level > 1 and p.author.shadowbanned %}
|
||||
<i class="fas fa-user-times text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title='Shadowbanned by @{{p.author.shadowbanned}} for "{{p.author.ban_reason}}"'></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.stickied %}
|
||||
<i id='pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned by @{{p.stickied}}" {% if p.stickied_utc %}onmouseover="pinned_timestamp('pinned-{{p.id}}')" data-timestamp={{p.stickied_utc}} {% endif %}></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.hole_pinned %}
|
||||
<i id='hole-pinned-{{p.id}}' class="fas fa-thumbtack fa-rotate--45 text-blue" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to /h/{{p.sub}} by @{{p.hole_pinned}}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if p.distinguish_level %}<i class="fas fa-broom text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{SITE_NAME}} Admin, speaking officially"></i>{% endif %}
|
||||
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack fa-rotate--45 text-admin" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Pinned to profile"></i>{% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.is_bot %} <i class="fas fa-robot text-info" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bot"></i>{% endif %}
|
||||
{% if p.is_blocking and not p.ghost %}<i class="fas fa-user-minus text-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="You're blocking this user, but you can see this post because you're an admin."></i>{% endif %}
|
||||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-bs-toggle="tooltip" data-bs-placement="bottom" title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">Draft</span>{% endif %}
|
||||
{% if p.active_flags(v) %}<a class="btn btn-primary" role="button" style="padding:1px 5px; font-size:10px"onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags(v)}} Report{{ help.plural(p.active_flags(v)) }}</a>{% endif %}
|
||||
|
||||
{% if p.ghost %}
|
||||
<span {% if p.distinguish_level %}class="mod"{% endif %}>👻</span>
|
||||
{% else %}
|
||||
{% if FEATURES['PATRON_ICONS'] and p.author.patron %}
|
||||
<img loading="lazy" src="/i/{{SITE_NAME}}/patron_badges/2{{p.author.patron}}.webp?v=1" height="20" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.patron_tooltip}}" alt="{{p.author.patron_tooltip}}">
|
||||
{% endif %}
|
||||
|
||||
{% if FEATURES['HOUSES'] and p.author.house %}
|
||||
<img loading="lazy" src="/i/{{SITE_NAME}}/houses/{{p.author.house}}.webp?v=2000" height="20" data-bs-toggle="tooltip" data-bs-placement="bottom" title="House {{p.author.house}}" alt="House {{p.author.house}}">
|
||||
{% endif %}
|
||||
|
||||
{% if p.author.verified %}<i class="fas fa-badge-check align-middle ml-1 {% if p.author.verified=='Glowiefied' %}glow{% endif %}" style="color:{% if p.author.verifiedcolor %}#{{p.author.verifiedcolor}}{% else %}#1DA1F2{% endif %}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.verified}}"></i>
|
||||
{% endif %}
|
||||
<a class="user-name text-decoration-none" href="{{p.author.url}}" data-pop-info='{{p.author.json_popover(v) | tojson}}' onclick='popclick(event)' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" role="button" tabindex="0" style="color: #{{p.author.name_color}}; font-weight: bold;">
|
||||
<div class="profile-pic-30-wrapper" style="margin-top:9px">
|
||||
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
|
||||
{% if p.author.hat_active -%}
|
||||
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
|
||||
{%- endif %}
|
||||
</div>
|
||||
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>
|
||||
</a>
|
||||
{% if FEATURES['PRONOUNS'] %}
|
||||
<span class="pronouns" style="color:#{{p.author.titlecolor}};border-color:#{{p.author.titlecolor}}">{{p.author.pronouns}}</span>
|
||||
{% endif %}
|
||||
{% if p.author.customtitle %}
|
||||
<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<span data-bs-toggle="tooltip" data-bs-placement="bottom" onmouseover="timestamp('timestamp-{{p.id}}','{{p.created_utc}}')" id="timestamp-{{p.id}}"> {{p.age_string}}</span>
|
||||
|
||||
({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.is_audio %}audio post{% elif p.domain %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" class="post-meta-domain" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>{{p.domain|truncate(50, True)}}</a>{% else %}text post{% endif %})
|
||||
{% if p.edited_utc %}
|
||||
Edited <span data-bs-toggle="tooltip" data-bs-placement="bottom" id="edited_timestamp-{{p.id}}" onmouseover="timestamp('edited_timestamp-{{p.id}}','{{p.edited_utc}}')">{{p.edited_string}}</span>
|
||||
{% endif %}
|
||||
{{p.views}} thread views
|
||||
</div>
|
||||
|
||||
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
|
||||
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if p.sub %}sub{% endif %} stretched-link {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %}">
|
||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||
{{p.realtitle(v) | safe}}
|
||||
</a></h5>
|
||||
|
||||
<div class="post-actions mt-2 d-none d-md-block">
|
||||
<ul class="list-inline text-right d-flex">
|
||||
{% if p.realbody(v, True) %}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
<li class="list-inline-item">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<i class="fas fa-comment-dots"></i>{{p.comment_count}}
|
||||
<span class="text-info d-none {{p.id}}-new-comments"></span>
|
||||
</a>
|
||||
</li>
|
||||
{% include 'post_actions.html' %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-md-none mt-2">
|
||||
<div class="post-actions">
|
||||
<ul class="list-inline text-right d-flex">
|
||||
<li class="list-inline-item mr-auto">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
|
||||
<i class="fas fa-comment-dots"></i>{{p.comment_count}}
|
||||
<span class="text-info d-none {{p.id}}-new-comments"></span>
|
||||
</a>
|
||||
|
||||
{% if v and v.admin_level > 1 %}
|
||||
<a class="ml-2" role="button" data-bs-toggle="modal" data-bs-target="#adminModal-{{p.id}}">
|
||||
<i class="fas fa-broom"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
|
||||
{% if p.realbody(v, True) %}
|
||||
<a class="list-inline-item" role="button" onclick="expandText('{{p.id}}')"><i class="fas fa-expand-alt mr-0 text-expand-icon-{{p.id}}"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
<li class="list-inline-item">
|
||||
<a role="button" data-bs-toggle="modal" data-bs-target="#actionsModal-{{p.id}}">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if not postembed %}
|
||||
{% if v and request.path.startswith('/@') and v.admin_level < 2 %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '1')" class="post-mobile-{{p.id}}-up mx-0 pr-1 arrow-up upvote-button post-{{p.id}}-up {% if voted==1 %}active{% else %}d-none{% endif %}"></span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '-1')" class="post-mobile-{{p.id}}-down mx-0 pl-1 my-0 arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% else %}d-none{% endif %}"></span>
|
||||
</li>
|
||||
{% elif v %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
|
||||
<span tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '1')" class="post-mobile-{{p.id}}-up mx-0 pr-1 arrow-up upvote-button post-{{p.id}}-up {% if voted==1 or v.id == AEVANN_ID %}active{% endif %}"></span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score post-score-{{p.id}} {% if voted==1 or v.id == AEVANN_ID %}score-up{% elif voted==-1%}score-down{% endif %}{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span {% if DISABLE_DOWNVOTES %}style="display:None!important"{% endif %} tabindex="0" role="button" onclick="vote('post-mobile', '{{p.id}}', '-1')" class="post-mobile-{{p.id}}-down mx-0 pl-1 my-0 arrow-down downvote-button post-{{p.id}}-down {% if voted==-1 %}active{% endif %}"></span>
|
||||
|
||||
</li>
|
||||
{% else %}
|
||||
<li id="voting-{{p.id}}-mobile" class="voting list-inline-item d-md-none">
|
||||
<span tabindex="0" class="arrow-{{p.id}}-mobile-up mx-0 pr-1 arrow-mobile-up" onclick="location.href='/login';">
|
||||
<i class="fas fa-arrow-alt-up mx-0" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
||||
<span class="post-mobile-score-{{p.id}} score{% if p.controversial %} controversial{% endif %}"{% if not p.is_banned %} data-bs-toggle="tooltip" data-bs-placement="top" title="+{{ups}} | -{{downs}}"{% endif %}>{{score}}</span>
|
||||
|
||||
<span tabindex="0" class="arrow-{{p.id}}-mobile-down arrow-mobile-down mx-0 pl-1 my-0" onclick="location.href='/login';">
|
||||
<i class="fas fa-arrow-alt-down mx-0" aria-hidden="true"></i>
|
||||
</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if v %}
|
||||
<div class="modal fade d-md-none" id="actionsModal-{{p.id}}" tabindex="-1" role="dialog" aria-labelledby="actionsModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header p-3">
|
||||
<h5 class="col modal-title text-center h6">More options</h5>
|
||||
<button class="close position-absolute py-3" style="right: 1rem"data-bs-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="fas fa-times-circle text-gray-500"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="list-group post-actions">
|
||||
{% include "post_actions_mobile.html" %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
{% if not v or v.highlightcomments %}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
showNewCommentCounts({{p.id}}, {{p.comment_count}})
|
||||
})
|
||||
{% endif %}
|
||||
</script>
|
||||
|
||||
|
||||
{% if v and v.admin_level > 1 %}
|
||||
{% include "post_admin_actions_mobile.html" %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if (not p.club or v and (v.paid_dues or v.id == p.author_id)) and not v_forbid_deleted %}
|
||||
{% if p.realbody(v, True) %}
|
||||
<div class="d-none card rounded border {% if p.author.agendaposter and p.sub != 'chudrama' %}agendaposter{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} post-preview" id="post-text-{{p.id}}">
|
||||
{{p.realbody(v, True) | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if p.is_image and not p.over_18 and ((v and v.cardview) or (not v and CARD_VIEW)) %}
|
||||
<div style="text-align: center" class="mt-3 mb-4">
|
||||
<a {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||
<img loading="lazy" data-src="{{p.realurl(v)}}" src="/i/l.webp" class="img-fluid" style="max-height:20rem" alt="Unable to load image">
|
||||
</a>
|
||||
</div>
|
||||
{% elif p.is_video %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<video id="video2-{{p.id}}" controls preload="none">
|
||||
<source src="{{p.realurl(v)}}">
|
||||
</video>
|
||||
</div>
|
||||
{% elif p.is_audio %}
|
||||
<div id="video-{{p.id}}" style="text-align: center" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-4">
|
||||
<audio id="video2-{{p.id}}" controls preload="none" src="{{p.realurl(v)}}"></audio>
|
||||
</div>
|
||||
{% elif p.is_youtube %}
|
||||
<div id="video-{{p.id}}" class="{% if p.over_18 or not ((v and v.cardview) or (not v and CARD_VIEW)) %}d-none{% endif %} mt-3 mb-4 youtube_embed">
|
||||
{{p.embed_url | safe}}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
{% if request.path.endswith('/admin/queue') %}
|
||||
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center py-7">
|
||||
<div class="h4 p-2">This queue is empty. (That's a good thing.)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% elif u %}
|
||||
{% if v and v.id == u.id %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-ghost fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
<h2 class="h5">You haven't {% if "/saved/" in request.path %}saved{% elif "/subscribed/" in request.path %}subscribed to{% else %}made{% endif %} a post yet</h2>
|
||||
<p class="text-muted mb-md-5">Your {% if "/saved/" in request.path %}saved posts{% elif "/subscribed/" in request.path %}subscribed posts{% else %}posting history{% endif %} will show here.</p>
|
||||
{% if "/saved/" not in request.path and "/subscribed/" not in request.path %}<a href="/submit" class="btn btn-primary">Create a post</a>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% else %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-scroll-old fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
<h2 class="h5">@{{u.username}} hasn't made a post yet</h2>
|
||||
<p class="text-muted">Their posting history will show here.</p>
|
||||
<pre>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% elif request.path != '/notifications/posts' %}
|
||||
<div class="row no-gutters">
|
||||
<div class="col">
|
||||
<div class="text-center px-3 my-3">
|
||||
<span class="fa-stack fa-2x text-muted mb-4">
|
||||
<i class="fas fa-square text-gray-500 opacity-25 fa-stack-2x"></i>
|
||||
<i class="fas text-gray-500 fa-ghost fa-stack-1x text-lg"></i>
|
||||
</span>
|
||||
{% if request.path.startswith('/search') and error %}
|
||||
<h2 class="h5">{{error}}</h2>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% if v %}
|
||||
{% include "delete_post_modal.html" %}
|
||||
{% include "report_post_modal.html" %}
|
||||
{% if v.admin_level > 1 %}
|
||||
{% include "ban_modal.html" %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "expanded_image_modal.html" %}
|
||||
|
||||
<script defer src="{{'js/clipboard.js' | asset}}"></script>
|
||||
<script defer src="{{'js/comments+submission_listing.js' | asset}}"></script>
|
||||
<script defer src="{{'js/submission_listing.js' | asset}}"></script>
|
||||
|
|
|
@ -3,10 +3,10 @@ server {
|
|||
client_max_body_size 100m;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_pass http://rDrama:5000/;
|
||||
proxy_pass http://localhost:5000/;
|
||||
}
|
||||
location /socket.io {
|
||||
proxy_set_header Host $http_host;
|
||||
|
@ -32,4 +32,9 @@ server {
|
|||
location /asset_submissions/ {
|
||||
include includes/serve-static;
|
||||
}
|
||||
|
||||
error_page 502 = /error_page/502.html;
|
||||
location /error_page/ {
|
||||
alias /rDrama/files/templates/errors/;
|
||||
}
|
||||
}
|
10
readme.md
10
readme.md
|
@ -16,11 +16,17 @@ git clone https://github.com/Aevann1/rDrama/
|
|||
|
||||
cd rDrama
|
||||
|
||||
docker-compose down --rmi all --remove-orphans --volumes
|
||||
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
3- That's it! Visit `localhost` in your browser and make an account (the first account to be made will have full admin rights)
|
||||
|
||||
4- Optional: to change the domain from "localhost" to something else and configure the site settings, as well as integrate it with the external services the website uses, edit the variables in the `env` file and then restart the docker container.
|
||||
|
||||
|
||||
------
|
||||
|
||||
For returning contributors, we have noticed the following issues (if you can help fix them, we will be very grateful!):
|
||||
|
||||
1. Docker doesn't know when we add a new Python dependency, `docker-compose build` is needed.
|
||||
2. DB schema changes are not applied automatically, the easiest way to deal with that is to delete the entire environment from the Docker GUI and do `docker-compose up`. Also wait five minutes for a "sneed" commit from Aevann meaning that the sql file was regenerated.
|
|
@ -0,0 +1,7 @@
|
|||
/etc/init.d/nginx start
|
||||
cd ./chat
|
||||
yarn install
|
||||
yarn chat
|
||||
cd ..
|
||||
gunicorn files.__main__:app load_chat -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 -b 0.0.0.0:5001 --max-requests 30000 --max-requests-jitter 30000 -D
|
||||
gunicorn files.__main__:app -k gevent -w 1 --reload -b 0.0.0.0:5000 --max-requests 30000 --max-requests-jitter 10000
|
|
@ -3,9 +3,9 @@ nodaemon=true
|
|||
pidfile=/tmp/supervisord.pid
|
||||
logfile=/tmp/supervisord.log
|
||||
|
||||
[program:service]
|
||||
directory=/service
|
||||
command=gunicorn files.__main__:app -k gevent -w 1 --reload -b 0.0.0.0:5000 --max-requests 30000 --max-requests-jitter 10000
|
||||
[program:rDrama]
|
||||
directory=/rDrama
|
||||
command=sh startup_docker.sh
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
# locale-gen "en_US.UTF-8"
|
||||
# update-locale LANG=en_US.utf8
|
||||
# update-locale LC_ALL=en_US.utf8
|
||||
# reboot
|
||||
apt -y update
|
||||
apt -y upgrade
|
||||
apt -y install git redis-server python3-pip ffmpeg imagemagick tmux nginx snapd ufw gpg-agent htop nano
|
||||
|
||||
git config --global credential.helper store
|
||||
cd /rDrama
|
||||
cp ./env /env
|
||||
sed -i 's/^/export /g;s/=/="/g;s/$/"/g' /env
|
||||
. /env
|
||||
|
||||
apt -y update
|
||||
apt -y upgrade
|
||||
apt -y install git redis-server python3-pip ffmpeg imagemagick tmux nginx snapd ufw gpg-agent htop
|
||||
|
||||
git config --global credential.helper store
|
||||
|
||||
mkdir /scripts
|
||||
cp ./startup.sh /scripts/s
|
||||
cp ./startup_chat.sh /scripts/s2
|
||||
|
@ -18,16 +21,17 @@ sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg
|
|||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
||||
apt -y update
|
||||
apt -y install postgresql-14
|
||||
sudo rm /etc/postgresql/14/main/pg_hba.conf
|
||||
sudo cp pg_hba.conf /etc/postgresql/14/main/pg_hba.conf
|
||||
rm /etc/postgresql/14/main/pg_hba.conf
|
||||
cp pg_hba.conf /etc/postgresql/14/main/pg_hba.conf
|
||||
service postgresql restart
|
||||
chown postgres:postgres /etc/postgresql/14/main/pg_hba.conf
|
||||
|
||||
sudo rm /etc/nginx/sites-available -r
|
||||
sudo rm /etc/nginx/sites-enabled/default
|
||||
sudo mkdir /etc/nginx/includes
|
||||
sudo cp nginx.txt /etc/nginx/sites-enabled/1
|
||||
sudo cp nginx-serve-static.txt /etc/nginx/includes/serve-static
|
||||
rm /etc/nginx/sites-available -r
|
||||
rm /etc/nginx/sites-enabled/default
|
||||
mkdir /etc/nginx/includes
|
||||
cp nginx.conf /etc/nginx/sites-enabled/1
|
||||
cp nginx-serve-static.conf /etc/nginx/includes/serve-static
|
||||
/etc/init.d/nginx reload
|
||||
|
||||
psql -U postgres -f schema.sql postgres
|
||||
psql -U postgres -f seed-db.sql postgres
|
||||
|
|
Loading…
Reference in New Issue