splash
This commit is contained in:
parent
155a3744ac
commit
3975e10dc7
9 changed files with 63 additions and 29 deletions
|
@ -207,7 +207,7 @@ class Comment(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def shortlink(self):
|
def shortlink(self):
|
||||||
return f"http://{site}/comment/{self.id}"
|
return f"http://{site}/comment/{self.id}#context"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
|
@ -302,7 +302,7 @@ class Comment(Base):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def realbody(self, v):
|
def realbody(self, v):
|
||||||
if self.post and self.post.club and not (v and v.paid_dues): return "<p>COUNTRY CLUB ONLY</p>"
|
if self.post and self.post.club and not (v and v.paid_dues): return f"<p>{cc} ONLY</p>"
|
||||||
|
|
||||||
body = self.body_html
|
body = self.body_html
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ class Comment(Base):
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def plainbody(self, v):
|
def plainbody(self, v):
|
||||||
if self.post and self.post.club and not (v and v.paid_dues): return "<p>COUNTRY CLUB ONLY</p>"
|
if self.post and self.post.club and not (v and v.paid_dues): return f"<p>{cc} ONLY</p>"
|
||||||
|
|
||||||
body = self.body
|
body = self.body
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,11 @@ from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
import time
|
import time
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
|
from os import environ
|
||||||
|
|
||||||
|
site = environ.get("DOMAIN").strip()
|
||||||
|
if site == 'pcmemes.net': cc = "splash mountain"
|
||||||
|
else: cc = "country club"
|
||||||
|
|
||||||
class ModAction(Base):
|
class ModAction(Base):
|
||||||
__tablename__ = "modactions"
|
__tablename__ = "modactions"
|
||||||
|
@ -77,7 +82,7 @@ class ModAction(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def string(self):
|
def string(self):
|
||||||
|
|
||||||
output = ACTIONTYPES[self.kind]["str"].format(self=self)
|
output = ACTIONTYPES[self.kind]["str"].format(self=self).format(cc=cc)
|
||||||
|
|
||||||
if self.note: output += f" <i>({self.note})</i>"
|
if self.note: output += f" <i>({self.note})</i>"
|
||||||
|
|
||||||
|
@ -160,12 +165,12 @@ ACTIONTYPES={
|
||||||
"color": "bg-muted",
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
"club_allow":{
|
"club_allow":{
|
||||||
"str":'allowed user {self.target_link} into the country club',
|
"str":'allowed user {self.target_link} into the {cc}',
|
||||||
"icon":"fa-user-slash",
|
"icon":"fa-user-slash",
|
||||||
"color": "bg-danger",
|
"color": "bg-danger",
|
||||||
},
|
},
|
||||||
"club_ban":{
|
"club_ban":{
|
||||||
"str":'disallowed user {self.target_link} from the country club',
|
"str":'disallowed user {self.target_link} from the {cc}',
|
||||||
"icon": "fa-user-slash",
|
"icon": "fa-user-slash",
|
||||||
"color": "bg-muted",
|
"color": "bg-muted",
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,6 +15,8 @@ from flask import g
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
site_name = environ.get("SITE_NAME").strip()
|
site_name = environ.get("SITE_NAME").strip()
|
||||||
|
if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN"
|
||||||
|
else: cc = "COUNTRY CLUB"
|
||||||
|
|
||||||
class Submission(Base):
|
class Submission(Base):
|
||||||
__tablename__ = "submissions"
|
__tablename__ = "submissions"
|
||||||
|
@ -317,7 +319,7 @@ class Submission(Base):
|
||||||
else: return ""
|
else: return ""
|
||||||
|
|
||||||
def realbody(self, v):
|
def realbody(self, v):
|
||||||
if self.club and not (v and v.paid_dues): return "<p>COUNTRY CLUB ONLY</p>"
|
if self.club and not (v and v.paid_dues): return f"<p>{cc} ONLY</p>"
|
||||||
|
|
||||||
body = self.body_html
|
body = self.body_html
|
||||||
body = censor_slurs(body, v)
|
body = censor_slurs(body, v)
|
||||||
|
@ -335,7 +337,7 @@ class Submission(Base):
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def plainbody(self, v):
|
def plainbody(self, v):
|
||||||
if self.club and not (v and v.paid_dues): return "<p>COUNTRY CLUB ONLY</p>"
|
if self.club and not (v and v.paid_dues): return f"<p>{cc} ONLY</p>"
|
||||||
|
|
||||||
body = self.body
|
body = self.body
|
||||||
body = censor_slurs(body, v)
|
body = censor_slurs(body, v)
|
||||||
|
@ -348,7 +350,7 @@ class Submission(Base):
|
||||||
def realtitle(self, v):
|
def realtitle(self, v):
|
||||||
if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1):
|
if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1):
|
||||||
if v: return random.choice(TROLLTITLES).format(username=v.username)
|
if v: return random.choice(TROLLTITLES).format(username=v.username)
|
||||||
else: return 'COUNTRY CLUB MEMBERS ONLY'
|
else: return f'{cc} MEMBERS ONLY'
|
||||||
elif self.title_html: title = self.title_html
|
elif self.title_html: title = self.title_html
|
||||||
else: title = self.title
|
else: title = self.title
|
||||||
|
|
||||||
|
@ -360,7 +362,7 @@ class Submission(Base):
|
||||||
def plaintitle(self, v):
|
def plaintitle(self, v):
|
||||||
if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1):
|
if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1):
|
||||||
if v: return random.choice(TROLLTITLES).format(username=v.username)
|
if v: return random.choice(TROLLTITLES).format(username=v.username)
|
||||||
else: return 'COUNTRY CLUB MEMBERS ONLY'
|
else: return f'{cc} MEMBERS ONLY'
|
||||||
else: title = self.title
|
else: title = self.title
|
||||||
|
|
||||||
title = censor_slurs(title, v)
|
title = censor_slurs(title, v)
|
||||||
|
|
|
@ -18,6 +18,8 @@ from .front import frontlist
|
||||||
from files.helpers.discord import add_role
|
from files.helpers.discord import add_role
|
||||||
|
|
||||||
SITE_NAME = environ.get("SITE_NAME", "").strip()
|
SITE_NAME = environ.get("SITE_NAME", "").strip()
|
||||||
|
if SITE_NAME == 'PCM': cc = "splash mountain"
|
||||||
|
else: cc = "country club"
|
||||||
|
|
||||||
@app.get("/name/<id>/<name>")
|
@app.get("/name/<id>/<name>")
|
||||||
@admin_level_required(2)
|
@admin_level_required(2)
|
||||||
|
@ -104,7 +106,7 @@ def club_allow(v, username):
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": f"@{username} has been allowed into the country club!"}
|
return {"message": f"@{username} has been allowed into the {cc}!"}
|
||||||
|
|
||||||
@app.post("/@<username>/club_ban")
|
@app.post("/@<username>/club_ban")
|
||||||
@limiter.limit("1/second")
|
@limiter.limit("1/second")
|
||||||
|
@ -133,7 +135,7 @@ def club_ban(v, username):
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": f"@{username} has been kicked from the country club. Deserved."}
|
return {"message": f"@{username} has been kicked from the {cc}. Deserved."}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/@<username>/make_admin")
|
@app.post("/@<username>/make_admin")
|
||||||
|
@ -993,15 +995,17 @@ def api_sticky_post(post_id, v):
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
|
|
||||||
if post.stickied:
|
if post.stickied:
|
||||||
message = f"@{v.username} has pinned your [post](/post/{post_id})!"
|
if v.id != post.author_id:
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
message = f"@{v.username} has pinned your [post](/post/{post_id})!"
|
||||||
if not existing: send_notification(post.author_id, message)
|
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
||||||
|
if not existing: send_notification(post.author_id, message)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Post pinned!"}
|
return {"message": "Post pinned!"}
|
||||||
else:
|
else:
|
||||||
message = f"@{v.username} has unpinned your [post](/post/{post_id})!"
|
if v.id != post.author_id:
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
message = f"@{v.username} has unpinned your [post](/post/{post_id})!"
|
||||||
if not existing: send_notification(post.author_id, message)
|
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
||||||
|
if not existing: send_notification(post.author_id, message)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Post unpinned!"}
|
return {"message": "Post unpinned!"}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,9 @@ from flask import *
|
||||||
from files.__main__ import app, limiter
|
from files.__main__ import app, limiter
|
||||||
from files.helpers.sanitize import filter_title
|
from files.helpers.sanitize import filter_title
|
||||||
|
|
||||||
|
|
||||||
site = environ.get("DOMAIN").strip()
|
site = environ.get("DOMAIN").strip()
|
||||||
|
if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN"
|
||||||
|
else: cc = "COUNTRY CLUB"
|
||||||
|
|
||||||
beams_client = PushNotifications(
|
beams_client = PushNotifications(
|
||||||
instance_id=PUSHER_INSTANCE_ID,
|
instance_id=PUSHER_INSTANCE_ID,
|
||||||
|
@ -862,15 +863,17 @@ def toggle_pin_comment(cid, v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if comment.is_pinned:
|
if comment.is_pinned:
|
||||||
message = f"@{v.username} has pinned your [comment]({comment.permalink})!"
|
if v.id != comment.author_id:
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
message = f"@{v.username} has pinned your [comment]({comment.permalink})!"
|
||||||
if not existing: send_notification(comment.author_id, message)
|
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
||||||
|
if not existing: send_notification(comment.author_id, message)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Comment pinned!"}
|
return {"message": "Comment pinned!"}
|
||||||
else:
|
else:
|
||||||
message = f"@{v.username} has unpinned your [comment]({comment.permalink})!"
|
if v.id != comment.author_id:
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
message = f"@{v.username} has unpinned your [comment]({comment.permalink})!"
|
||||||
if not existing: send_notification(comment.author_id, message)
|
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ACCOUNT, Comment.body == message).first()
|
||||||
|
if not existing: send_notification(comment.author_id, message)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
return {"message": "Comment unpinned!"}
|
return {"message": "Comment unpinned!"}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ def admin_vote_info_get(v):
|
||||||
else: abort(400)
|
else: abort(400)
|
||||||
except: abort(400)
|
except: abort(400)
|
||||||
|
|
||||||
|
if thing.author.shadowbanned and not (v and v.admin_level): return render_template('errors/500.html', v=v), 500
|
||||||
|
|
||||||
if isinstance(thing, Submission):
|
if isinstance(thing, Submission):
|
||||||
|
|
||||||
ups = g.db.query(Vote
|
ups = g.db.query(Vote
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
|
|
||||||
|
{% if request.host == 'pcmemes.net' %}
|
||||||
|
{% set cc='SPLASH MOUNTAIN' %}
|
||||||
|
{% else %}
|
||||||
|
{% set cc='COUNTRY CLUB' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if p.award_count("train") %}
|
{% if p.award_count("train") %}
|
||||||
<style>
|
<style>
|
||||||
@keyframes train {
|
@keyframes train {
|
||||||
|
@ -466,12 +472,12 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if p.realurl(v) %}
|
{% if p.realurl(v) %}
|
||||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
<h1 id="post-title" class="card-title post-title text-left mb-md-3"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">>{{cc}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
</a></h1>
|
</a></h1>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3">
|
<h1 id="post-title" class="card-title post-title text-left mb-md-3">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">>{{cc}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
</h1>
|
</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -32,6 +32,12 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{% if request.host == 'pcmemes.net' %}
|
||||||
|
{% set cc='SPLASH MOUNTAIN' %}
|
||||||
|
{% else %}
|
||||||
|
{% set cc='COUNTRY CLUB' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% for p in listing %}
|
{% for p in listing %}
|
||||||
|
|
||||||
<div style="display:none" id="popover-{{p.id}}">
|
<div style="display:none" id="popover-{{p.id}}">
|
||||||
|
@ -225,7 +231,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5 class="card-title post-title text-left w-lg-75 mb-0 pb-0 pb-md-1"><a {% if v and v.newtab %}target="_blank"{% endif %} {% if v %}href="{{p.permalink}}"{% else %}href="/logged_out{{p.permalink}}"{% endif %} class="stretched-link">
|
<h5 class="card-title post-title text-left w-lg-75 mb-0 pb-0 pb-md-1"><a {% if v and v.newtab %}target="_blank"{% endif %} {% if v %}href="{{p.permalink}}"{% else %}href="/logged_out{{p.permalink}}"{% endif %} class="stretched-link">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">COUNTRY CLUB</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:10px; line-height:2;">{{cc}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
</a></h5>
|
</a></h5>
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,12 @@
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
<link rel="icon" type="image/png" href="/assets/images/{{'SITE_NAME' | app_config}}/icon.webp?v=1">
|
<link rel="icon" type="image/png" href="/assets/images/{{'SITE_NAME' | app_config}}/icon.webp?v=1">
|
||||||
|
|
||||||
|
{% if request.host == 'pcmemes.net' %}
|
||||||
|
{% set cc='Splash Mountain' %}
|
||||||
|
{% else %}
|
||||||
|
{% set cc='Country Club' %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% include "emoji_modal.html" %}
|
{% include "emoji_modal.html" %}
|
||||||
{% include "gif_modal.html" %}
|
{% include "gif_modal.html" %}
|
||||||
|
|
||||||
|
@ -135,7 +141,7 @@
|
||||||
{% if v.paid_dues %}
|
{% if v.paid_dues %}
|
||||||
<div class="custom-control custom-checkbox">
|
<div class="custom-control custom-checkbox">
|
||||||
<input type="checkbox" class="custom-control-input" id="clubCheck" name="club">
|
<input type="checkbox" class="custom-control-input" id="clubCheck" name="club">
|
||||||
<label class="custom-control-label" for="clubCheck">Country Club thread</label>
|
<label class="custom-control-label" for="clubCheck">{{cc}} thread</label>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<pre>
|
<pre>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue