master
Aevann1 2021-11-18 22:02:26 +02:00
parent 2f91300ae5
commit fceedfe94c
15 changed files with 91 additions and 186 deletions

View File

@ -82,6 +82,7 @@ class User(Base):
mute = Column(Boolean)
unmutable = Column(Boolean)
eye = Column(Boolean)
alt = Column(Boolean)
frontsize = Column(Integer, default=25)
controversial = Column(Boolean, default=False)
bio = deferred(Column(String))

View File

@ -322,6 +322,15 @@ AWARDS = {
"color": "text-silver",
"price": 10000
},
"alt": {
"kind": "alt",
"title": "Alt-Seeing Eye",
"description": "Gives the recipient the ability to view alts.",
"icon": "fas fa-eye",
"color": "text-gold",
"price": 50000
},
}
AWARDS2 = {
@ -437,6 +446,14 @@ AWARDS2 = {
"color": "text-success",
"price": 40000
},
"alt": {
"kind": "alt",
"title": "Alt-Seeing Eye",
"description": "Gives the recipient the ability to view alts.",
"icon": "fas fa-eye",
"color": "text-gold",
"price": 50000
},
}
TROLLTITLES = [

View File

@ -188,6 +188,16 @@ def shop(v):
"price": 40000,
"MB": False
},
"alt": {
"kind": "alt",
"title": "Alt-Seeing Eye",
"description": "Gives the recipient the ability to view alts.",
"icon": "fas fa-eye",
"color": "text-gold",
"owned": 0,
"price": 50000,
"MB": False
},
}
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all():
@ -326,6 +336,14 @@ def buy(v, award):
"color": "text-success",
"price": 40000
},
"alt": {
"kind": "alt",
"title": "Alt-Seeing Eye",
"description": "Gives the recipient the ability to view alts.",
"icon": "fas fa-eye",
"color": "text-gold",
"price": 50000
},
}
if award not in AWARDS: abort(400)
@ -499,13 +517,18 @@ def award_post(pid, v):
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "eye":
author.eye = True
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "alt":
author.alt = True
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
post.author.received_award_count += 1
g.db.add(post.author)
@ -623,13 +646,18 @@ def award_comment(cid, v):
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "eye":
author.eye = True
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
elif kind == "marsey":
author.marseyawarded = time.time() + 86400
elif kind == "alt":
author.alt = True
send_notification(995, f"@{v.username} bought {kind} award!")
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
c.author.received_award_count += 1
g.db.add(c.author)
@ -691,152 +719,3 @@ def admin_userawards_post(v):
if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v)
return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v)
@app.get("/api/shop/items")
@auth_required
def items(v):
AWARDS = {
"shit": {
"kind": "shit",
"title": "Shit",
"description": "Makes flies swarm the post.",
"icon": "fas fa-poop",
"color": "text-black-50",
"owned": 0,
"price": 500
},
"fireflies": {
"kind": "fireflies",
"title": "Fireflies",
"description": "Makes fireflies swarm the post.",
"icon": "fas fa-sparkles",
"color": "text-warning",
"owned": 0,
"price": 500
},
"train": {
"kind": "train",
"title": "Train",
"description": "Summons a train on the post.",
"icon": "fas fa-train",
"color": "text-pink",
"owned": 0,
"price": 500
},
"pin": {
"kind": "pin",
"title": "1-Hour Pin",
"description": "Pins the post/comment.",
"icon": "fas fa-thumbtack fa-rotate--45",
"color": "text-warning",
"owned": 0,
"price": 750
},
"unpin": {
"kind": "unpin",
"title": "1-Hour Unpin",
"description": "Removes 1 hour from the pin duration of the post/comment.",
"icon": "fas fa-thumbtack fa-rotate--45",
"color": "text-black",
"owned": 0,
"price": 1000
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",
"description": "Sets a flair for the recipient and locks it or 24 hours.",
"icon": "fas fa-lock",
"color": "text-black",
"owned": 0,
"price": 1250
},
"agendaposter": {
"kind": "agendaposter",
"title": "Agendaposter",
"description": "Forces the agendaposter theme on the recipient for 24 hours.",
"icon": "fas fa-snooze",
"color": "text-purple",
"owned": 0,
"price": 2500
},
"marsey": {
"kind": "marsey",
"title": "Marsey",
"description": "Makes the recipient unable to post/comment anything but marsey emojis for 24 hours.",
"icon": "fas fa-cat",
"color": "text-orange",
"owned": 0,
"price": 3000
},
"ban": {
"kind": "ban",
"title": "1-Day Ban",
"description": "Bans the recipient for a day.",
"icon": "fas fa-gavel",
"color": "text-danger",
"owned": 0,
"price": 3000
},
"unban": {
"kind": "unban",
"title": "1-Day Unban",
"description": "Removes 1 day from the ban duration of the recipient.",
"icon": "fas fa-gavel",
"color": "text-success",
"owned": 0,
"price": 3500
},
"grass": {
"kind": "grass",
"title": "Grass",
"description": "Ban the recipient permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)",
"icon": "fas fa-seedling",
"color": "text-success",
"owned": 0,
"price": 10000
},
"eye": {
"kind": "eye",
"title": "All-Seeing Eye",
"description": "Gives the recipient the ability to view private profiles.",
"icon": "fas fa-eye",
"color": "text-silver",
"owned": 0,
"price": 10000
},
"pause": {
"kind": "pause",
"title": "Pause",
"description": "Gives the recipient the ability to pause profile anthems.",
"icon": "fas fa-volume-mute",
"color": "text-danger",
"owned": 0,
"price": 20000
},
"unpausable": {
"kind": "unpausable",
"title": "Unpausable",
"description": "Makes the profile anthem of the recipient unpausable.",
"icon": "fas fa-volume",
"color": "text-success",
"owned": 0,
"price": 40000
},
}
for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): AWARDS[useraward.kind]["owned"] += 1
if v.patron == 1: discount = 0.10
elif v.patron == 2: discount = 0.15
elif v.patron == 3: discount = 0.20
elif v.patron == 4: discount = 0.25
elif v.patron == 5: discount = 0.30
else: discount = 0
for badge in [69,70,71,72,73]:
if v.has_badge(badge): discount += discounts[badge]
for val in AWARDS.values(): val["discount"] = discount
return AWARDS

View File

@ -92,11 +92,11 @@ def searchposts(v):
)
)
if not(v and v.admin_level > 1):
posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False, Submission.deleted_utc == 0, Submission.is_banned == False)
if not (v and v.admin_level > 1):
posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False)
if not (v and v.eye): posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False)
if v and v.admin_level > 1:
pass
if v and v.admin_level > 1: pass
elif v:
blocking = [x[0] for x in g.db.query(
UserBlock.target_id).filter_by(

View File

@ -15,11 +15,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=116">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
</head>

View File

@ -23,6 +23,11 @@
<div class="text-muted">{{award.owned}} owned</div>
</a>
{% endfor %}
<a class="card disabled d-md-none" style="border:none">
<i class="fas fa-volume-mute" style="opacity:0"></i>
<div class="pt-2" style="font-weight: bold; font-size: 14px; color:#E1E1E1">&nbsp;</div>
<div class="text-muted">&nbsp;</div>
</a>
</div>
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
<input id="kind" name="kind" value="" hidden>
@ -72,7 +77,7 @@
@media (min-width: 767.98px) {
.award-columns {
column-count: 7 !important;
column-count: 8 !important;
}
}
</style>

View File

@ -254,12 +254,12 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=116">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=117">
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
{% endblock %}

View File

@ -17,11 +17,11 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=116">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
<div class="row justify-content-around">

View File

@ -12,7 +12,7 @@
<title>2-Step Login - {{'SITE_NAME' | app_config}}</title>
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</head>

View File

@ -55,8 +55,8 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=116">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link href="/assets/css/fa.css?v=52" rel="stylesheet">
</head>

View File

@ -40,10 +40,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
<link href="/assets/css/fa.css?v=52" rel="stylesheet">

View File

@ -36,7 +36,7 @@
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</head>

View File

@ -31,7 +31,7 @@
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600&display=swap" rel="stylesheet">
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
</head>

View File

@ -31,12 +31,12 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=116">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=116">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
<link rel="stylesheet" href="/assets/css/main.css?v=117"><link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=117">
{% if v.agendaposter %}<link rel="stylesheet" href="/assets/css/agendaposter.css?v=117">{% elif v.css %}<link rel="stylesheet" href="/@{{v.username}}/css">{% endif %}
{% else %}
<style>:root{--primary:#{{'DEFAULT_COLOR' | app_config}}</style>
<link rel="stylesheet" href="/assets/css/main.css?v=116">
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=116">
<link rel="stylesheet" href="/assets/css/main.css?v=117">
<link rel="stylesheet" href="/assets/css/{{'DEFAULT_THEME' | app_config}}.css?v=117">
{% endif %}
{% endblock %}

View File

@ -394,18 +394,20 @@
{% endif %}
<pre></pre>
<p>User ID: {{u.id}}</p>
<p>Coins spent: {{u.coins_spent}}</p>
{% if v and v.admin_level > 1 %}
<p>True score: {{u.truecoins}}</p>
{% if u.is_private %}
<p>User has private mode enabled.</p>
{% endif %}
{% endif %}
{% if v and (v.admin_level > 1 or v.alt) %}
<span>Alts:</span>
<ul>
{% for account in u.alts_unique %}
<li><a href="{{account.url}}">@{{account.username}}</a>{% if account._is_manual %} [m]{% endif %}</li>
{% endfor %}
</ul>
True score: {{u.truecoins}} &nbsp;
Coins spent: {{u.coins_spent}}
{% endif %}
{% if u.is_suspended %}
<p>Banned by: <a href="{{u.banned_by.url}}">@{{u.banned_by.username}}</a></p>
@ -688,23 +690,24 @@
{% endif %}
<pre></pre>
<p>User ID: {{u.id}}</p>
<p>Coins spent: {{u.coins_spent}}</p>
{% if v and v.admin_level > 1 %}
<p>True score: {{u.truecoins}}</p>
{% if u.is_private %}
<p>User has private mode enabled.</p>
{% endif %}
{% endif %}
{% if v and (v.admin_level > 1 or v.alt) %}
<span>Alts:</span>
<ul>
{% for account in u.alts_unique %}
<li><a href="{{account.url}}">@{{account.username}}</a>{% if account._is_manual %} [m]{% endif %}</li>
<li><a href="{{account.url}}">@{{account.username}}</a>{% if account._is_manual %} [m]{% endif %}</li>
{% endfor %}
</ul>
True score: {{u.truecoins}} &nbsp;
Coins spent: {{u.coins_spent}}
{% endif %}
{% if u.is_suspended %}
<p>Banned by: <a href="{{u.banned_by.url}}">@{{u.banned_by.username}}</a></p>
{% endif %}
</div>
</div>
</div>