remotes/1693045480750635534/spooky-22
Aevann1 2022-01-23 21:51:56 +02:00
parent 76679ce4b4
commit c8e3be1c39
12 changed files with 119 additions and 319 deletions

View File

@ -1,262 +0,0 @@
{
"1": {
"name": "Alpha User",
"description": "Joined during open alpha"
},
"2": {
"name": "Verified Email",
"description": "Verified Email"
},
"3": {
"name": "Code Contributor",
"description": "Contributed to the site's source code"
},
"4": {
"name": "White Hat",
"description": "Responsibly reported a security issue"
},
"6": {
"name": "Beta User",
"description": "Joined during open beta"
},
"7": {
"name": "Bug Chaser",
"description": "Found a bug"
},
"10": {
"name": "Bronze Recruiter",
"description": "Recruited 1 friend to join the site"
},
"11": {
"name": "Silver Recruiter",
"description": "Recruited 10 friends to join the site"
},
"12": {
"name": "Gold Recruiter",
"description": "Recruited 100 friends to join the site"
},
"15": {
"name": "Idea Maker",
"description": "Had a good idea for the site which was implemented by the developers"
},
"16": {
"name": "Marsey Master",
"description": "Contributed 10 (or more!!!!) Marsey emojis ✨"
},
"17": {
"name": "Marsey Artisan",
"description": "Contributed a Marsey emoji ✨"
},
"18": {
"name": "Artisan",
"description": "Contributed to site artwork"
},
"21": {
"name": "Paypig",
"description": "Contributed at least $5"
},
"22": {
"name": "Renthog",
"description": "Contributed at least $10"
},
"23": {
"name": "Landchad",
"description": "Contributed at least $20"
},
"24": {
"name": "Terminally online turboautist",
"description": "Contributed at least $50"
},
"25": {
"name": "Rich Bich",
"description": "Contributed at least $100"
},
"26": {
"name": "Rightoid",
"description": "Forced to use the rightoid theme"
},
"27": {
"name": "Lolcow",
"description": "Beautiful and valid milk provider"
},
"60": {
"name": "Unironically Retarded",
"description": "Demonstrated a wholesale inability to read the room"
},
"61": {
"name": "Lab Rat",
"description": "Helped test features in development"
},
"62": {
"name": "Master Baiter",
"description": "For outstanding achievement in the field of catching fish"
},
"63": {
"name": "Balls",
"description": "I wrote carp on my balls as a sign of submission"
},
"64": {
"name": "The Other Kind Of Good Journalist",
"description": "Contributed positive media attention to the site"
},
"65": {
"name": "2021 Spooooooky Marsey Artist",
"description": "Contributed a VERY SCARY Marsey for Halloween 2021!"
},
"66": {
"name": "Sk8r Boi",
"description": "Certifies that this user is NOT a poser"
},
"67": {
"name": "Unpausable",
"description": "Spent 40,000 coins on an unpausable profile anthem"
},
"68": {
"name": "Pause Button",
"description": "Spent 20,000 coins on a profile anthem pause button"
},
"69": {
"name": "Little Big Spender",
"description": "Dropped 10,000 coins at the shop"
},
"70": {
"name": "Big Spender",
"description": "Dropped 100,000 coins at the shop"
},
"71": {
"name": "Big Big Spender",
"description": "Dropped 250,000 coins at the shop"
},
"72": {
"name": "Big Big Big Spender",
"description": "Dropped 500,000 coins at the shop"
},
"73": {
"name": "Le Rich Gentlesir",
"description": "Spent a fucking million coins at the shop"
},
"74": {
"name": "Grass Toucher",
"description": "Awarded for molesting plant life"
},
"75": {
"name": "Halloween 21",
"description": "Awarded for surviving Homoween 2021"
},
"76": {
"name": "Low Roller",
"description": "Bought 10 lootboxes"
},
"77": {
"name": "Middle Roller",
"description": "Bought 50 lootboxes"
},
"78": {
"name": "High Roller",
"description": "Bought 150 lootboxes"
},
"79": {
"name": "Merchant",
"description": "Contributed a new line of product to Marsey's Coin Emporium"
},
"80": {
"name": "Artist Laureate",
"description": ""
},
"81": {
"name": "Patron of the Arts",
"description": "Sponsored the creation of an approved Marsey"
},
"83": {
"name": "All-Seeing Eye",
"description": "Can view private profiles"
},
"84": {
"name": "Alt-Seeing Eye",
"description": "Can see alts"
},
"85": {
"name": "Sigma User",
"description": ""
},
"86": {
"name": "Holly Jolly Marsey Artist",
"description": "Contributed a VERY JOLLY Marsey for Christmas 2021!"
},
"87": {
"name": "Unblockable",
"description": "This user is unblockable"
},
"88": {
"name": "Provider",
"description": "This user provided a bountiful feast for Thanksgiving"
},
"89": {
"name": "Dinner",
"description": "Yes, it is edible"
},
"90": {
"name": "Fish",
"description": "This user cannot be unfollowed"
},
"91": {
"name": "Grinch",
"description": "This user is a joyless grinch who pays money to avoid having fun"
},
"92": {
"name": "NFT Artist",
"description": "Drew a marsey that was used as an NFT"
},
"93": {
"name": "NFT Owner",
"description": "Bought a marsey NFT"
},
"94": {
"name": "Progressive Stack Award",
"description": "Upvotes/downvotes on this user's posts and comments have double the ranking effect"
},
"95": {
"name": "Bird Site Award",
"description": "This user is limited to 140 characters"
},
"96": {
"name": "Flairlock Award",
"description": "This user's flair has been locked by someone else"
},
"97": {
"name": "Pizzashill Award",
"description": "This user has to make their posts and comments more than 280 characters"
},
"98": {
"name": "Marsey Award",
"description": "This user is limited to posting marseys"
},
"99": {
"name": "Sidebar Artist",
"description": "Contributed artwork featured on the sidebar"
},
"100": {
"name": "True Believer",
"description": "This user sees through communist lies"
},
"101": {
"name": "Banner Artist",
"description": "Contributed a banner image to the site"
},
"102": {
"name": "Christmas 21",
"description": "Awarded for surviving Fistmas 2021"
},
"103": {
"name": "Benefactor",
"description": "Gave the Benefactor award to someone"
},
"104": {
"name": "BADASS OUTLAW",
"description": "Bad boy who does not play by the rules"
},
"105": {
"name": "SCAM",
"description": "lmao get fucked retard"
}
}

View File

@ -1,12 +0,0 @@
from sqlalchemy import *
from files.__main__ import Base
class BadgeDef(Base):
__tablename__ = "badge_defs"
id = Column(Integer, primary_key=True)
name = Column(String)
description = Column(String)
def __repr__(self):
return f"<BadgeDef(id={self.id})>"

View File

@ -7,6 +7,17 @@ from files.helpers.const import *
from datetime import datetime
from json import loads
class BadgeDef(Base):
__tablename__ = "badge_defs"
id = Column(Integer, ForeignKey("badges.id"), primary_key=True, autoincrement=True)
name = Column(String)
description = Column(String)
def __repr__(self):
return f"<BadgeDef(id={self.id})>"
class Badge(Base):
__tablename__ = "badges"
@ -18,39 +29,34 @@ class Badge(Base):
description = Column(String)
url = Column(String)
user = relationship("User", viewonly=True)
badge = relationship("BadgeDef", viewonly=True)
def __repr__(self):
return f"<Badge(user_id={self.user_id}, badge_id={self.badge_id})>"
@property
@lazy
def badge(self):
with open("badges.json", 'r') as f:
return loads(f.read())[str(self.badge_id)]
@property
@lazy
def text(self):
if self.name == "Agendaposter":
ti = self.user.agendaposter_expires_utc
if ti: text = self.badge["description"] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
else: text = self.badge["description"] + " permanently"
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
else: text = self.badge.description + " permanently"
elif self.badge_id in (94,95,96,97,98):
if self.badge_id == 94: ti = self.user.progressivestack
elif self.badge_id == 95: ti = self.user.bird
elif self.badge_id == 96: ti = self.user.flairchanged
elif self.badge_id == 97: ti = self.user.longpost
else: ti = self.user.marseyawarded
text = self.badge["description"] + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
elif self.description: text = self.description
elif self.badge["description"]: text = self.badge["description"]
elif self.badge.description: text = self.badge.description
else: return ''
return f' - {text}'
@property
@lazy
def name(self):
return self.badge["name"]
return self.badge.name
@property
@lazy

View File

@ -424,25 +424,25 @@ def under_attack(v):
@app.get("/admin/badge_grant")
@admin_level_required(2)
def badge_grant_get(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read())
return render_template("admin/badge_grant.html", v=v, badge_types=BADGES)
badges = g.db.query(BadgeDef).all()
return render_template("admin/badge_grant.html", v=v, badge_types=badges)
@app.post("/admin/badge_grant")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_grant_post(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read())
badges = g.db.query(BadgeDef).all()
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:
return render_template("admin/badge_grant.html", v=v, badge_types=BADGES, error="User not found.")
return render_template("admin/badge_grant.html", v=v, badge_types=badges, error="User not found.")
try: badge_id = int(request.values.get("badge_id"))
except: abort(400)
if user.has_badge(badge_id):
return render_template("admin/badge_grant.html", v=v, badge_types=BADGES, error="User already has that badge.")
return render_template("admin/badge_grant.html", v=v, badge_types=badges, error="User already has that badge.")
new_badge = Badge(badge_id=badge_id, user_id=user.id)
@ -459,27 +459,27 @@ def badge_grant_post(v):
send_notification(user.id, text)
g.db.commit()
return render_template("admin/badge_grant.html", v=v, badge_types=BADGES, msg="Badge granted!")
return render_template("admin/badge_grant.html", v=v, badge_types=badges, msg="Badge granted!")
@app.get("/admin/badge_remove")
@admin_level_required(2)
def badge_remove_get(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read())
badges = g.db.query(BadgeDef).all()
return render_template("admin/badge_remove.html", v=v, badge_types=BADGES)
return render_template("admin/badge_remove.html", v=v, badge_types=badges)
@app.post("/admin/badge_remove")
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_remove_post(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read())
badges = g.db.query(BadgeDef).all()
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:
return render_template("admin/badge_remove.html", v=v, badge_types=BADGES, error="User not found.")
return render_template("admin/badge_remove.html", v=v, badge_types=badges, error="User not found.")
try: badge_id = int(request.values.get("badge_id"))
except: abort(400)
@ -489,7 +489,7 @@ def badge_remove_post(v):
g.db.delete(badge)
g.db.commit()
return render_template("admin/badge_remove.html", v=v, badge_types=BADGES, msg="Badge removed!")
return render_template("admin/badge_remove.html", v=v, badge_types=badges, msg="Badge removed!")
@app.get("/admin/users")

View File

@ -8,6 +8,7 @@ from os import path
import calendar
import matplotlib.pyplot as plt
from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2
from files.classes.badges import BadgeDef
@app.get("/privacy")
@auth_required
@ -366,9 +367,9 @@ def settings_profile(v):
@app.get("/badges")
@auth_required
def badges(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read())
badges = g.db.query(BadgeDef).all()
return render_template("badges.html", v=v, badges=BADGES)
return render_template("badges.html", v=v, badges=badges)
@app.get("/marsey_list")
@auth_required

View File

@ -52,17 +52,17 @@
</tr>
</thead>
<tbody>
{% for k, v in badge_types.items() %}
{% for badge in badge_types %}
<tr>
<td>
<div class="custom-control">
<input autocomplete="off" checked="" class="custom-control-input" type="radio" id="{{k}}" name="badge_id" value="{{k}}">
<label class="custom-control-label" for="{{k}}"></label>
<input autocomplete="off" checked="" class="custom-control-input" type="radio" id="{{badge.id}}" name="badge_id" value="{{badge.id}}">
<label class="custom-control-label" for="{{badge.id}}"></label>
</div>
</td>
<td><label for="badge-{{k}}"><img alt="{{v['name']}}" loading="lazy" src="/static/assets/images/badges/{{k}}.webp?a=6" width=64.16 height=70></label></td>
<td>{{v['name']}}</td>
<td>{{v['description']}}</td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=6" width=64.16 height=70></label></td>
<td>{{badge.name}}</td>
<td>{{badge.description}}</td>
</tr>
{% endfor %}
</table>

View File

@ -52,17 +52,17 @@
</tr>
</thead>
<tbody>
{% for k, v in badge_types.items() %}
{% for badge in badge_types %}
<tr>
<td>
<div class="custom-control">
<input autocomplete="off" checked="" class="custom-control-input" type="radio" id="{{k}}" name="badge_id" value="{{k}}">
<label class="custom-control-label" for="{{k}}"></label>
<input autocomplete="off" checked="" class="custom-control-input" type="radio" id="{{badge.id}}" name="badge_id" value="{{badge.id}}">
<label class="custom-control-label" for="{{badge.id}}"></label>
</div>
</td>
<td><label for="badge-{{k}}"><img alt="{{v['name']}}" loading="lazy" src="/static/assets/images/badges/{{k}}.webp?a=6" width=64.16 height=70></label></td>
<td>{{v['name']}}</td>
<td>{{v['description']}}</td>
<td><label for="badge-{{badge.id}}"><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=6" width=64.16 height=70></label></td>
<td>{{badge.name}}</td>
<td>{{badge.description}}</td>
</tr>
{% endfor %}
</table>

View File

@ -18,11 +18,11 @@
<th>Description</th>
</tr>
</thead>
{% for k,v in badges.items() %}
{% for badge in badges %}
<tr>
<td>{{v['name']}}</td>
<td><img alt="{{v['name']}}" loading="lazy" src="/static/assets/images/badges/{{k}}.webp?a=6" width=45.83 height=50>
<td>{{v['description']}}</td>
<td>{{badge.name}}</td>
<td><img alt="{{badge.name}}" loading="lazy" src="/static/assets/images/badges/{{badge.id}}.webp?a=6" width=45.83 height=50>
<td>{{badge.description}}</td>
</tr>
{% endfor %}
</table>

View File

@ -54,7 +54,7 @@ source setup
5- 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, please run this command and edit the variables:
```
nano /env
nano /env.sh
```
then run `source /drama/restart` to apply the changes.

View File

@ -1,3 +1,3 @@
source /env
source /env.sh
killall gunicorn
gunicorn files.__main__:app -k gevent -w 2 --reload -b localhost:80 --max-requests 1000 --max-requests-jitter 500

View File

@ -34,4 +34,71 @@ INSERT INTO public.users (
'', 'dark', '30409f', false, false, '', '', 0, false, 0,
0, 0, '', true, 0);
SELECT pg_catalog.setval('public.users_id_seq', 7, true);
SELECT pg_catalog.setval('public.users_id_seq', 7, true);
INSERT INTO public.badge_defs VALUES
(1,'Alpha User','Joined during open alpha'),
(2,'Verified Email','Verified Email'),
(3,'Code Contributor','Contributed to the site''s source code'),
(4,'White Hat','Responsibly reported a security issue'),
(6,'Beta User','Joined during open beta'),
(7,'Bug Chaser','Found a bug'),
(10,'Bronze Recruiter','Recruited 1 friend to join the site'),
(11,'Silver Recruiter','Recruited 10 friends to join the site'),
(12,'Gold Recruiter','Recruited 100 friends to join the site'),
(15,'Idea Maker','Had a good idea for the site which was implemented by the developers'),
(16,'Marsey Master','Contributed 10 (or more!!!!) Marsey emojis ✨'),
(17,'Marsey Artisan','Contributed a Marsey emoji ✨'),
(18,'Artisan','Contributed to site artwork'),
(21,'Paypig','Contributed at least $5'),
(22,'Renthog','Contributed at least $10'),
(23,'Landchad','Contributed at least $20'),
(24,'Terminally online turboautist','Contributed at least $50'),
(25,'Rich Bich','Contributed at least $100'),
(26,'Rightoid','Forced to use the rightoid theme'),
(27,'Lolcow','Beautiful and valid milk provider'),
(60,'Unironically Retarded','Demonstrated a wholesale inability to read the room'),
(61,'Lab Rat','Helped test features in development'),
(62,'Master Baiter','For outstanding achievement in the field of catching fish'),
(63,'Balls','I wrote carp on my balls as a sign of submission'),
(64,'The Other Kind Of Good Journalist','Contributed positive media attention to the site'),
(65,'2021 Spooooooky Marsey Artist','Contributed a VERY SCARY Marsey for Halloween 2021!'),
(66,'Sk8r Boi','Certifies that this user is NOT a poser'),
(67,'Unpausable','Spent 40,000 coins on an unpausable profile anthem'),
(68,'Pause Button','Spent 20,000 coins on a profile anthem pause button'),
(69,'Little Big Spender','Dropped 10,000 coins at the shop'),
(70,'Big Spender','Dropped 100,000 coins at the shop'),
(71,'Big Big Spender','Dropped 250,000 coins at the shop'),
(72,'Big Big Big Spender','Dropped 500,000 coins at the shop'),
(73,'Le Rich Gentlesir','Spent a fucking million coins at the shop'),
(74,'Grass Toucher','Awarded for molesting plant life'),
(75,'Halloween 21','Awarded for surviving Homoween 2021'),
(76,'Low Roller','Bought 10 lootboxes'),
(77,'Middle Roller','Bought 50 lootboxes'),
(78,'High Roller','Bought 150 lootboxes'),
(79,'Merchant','Contributed a new line of product to Marsey''s Coin Emporium'),
(80,'Artist Laureate',''),
(81,'Patron of the Arts','Sponsored the creation of an approved Marsey'),
(83,'All-Seeing Eye','Can view private profiles'),
(84,'Alt-Seeing Eye','Can see alts'),
(85,'Sigma User',''),
(86,'Holly Jolly Marsey Artist','Contributed a VERY JOLLY Marsey for Christmas 2021!'),
(87,'Unblockable','This user is unblockable'),
(88,'Provider','This user provided a bountiful feast for Thanksgiving'),
(89,'Dinner','Yes, it is edible'),
(90,'Fish','This user cannot be unfollowed'),
(91,'Grinch','This user is a joyless grinch who pays money to avoid having fun'),
(92,'NFT Artist','Drew a marsey that was used as an NFT'),
(93,'NFT Owner','Bought a marsey NFT'),
(94,'Progressive Stack Award','Upvotes/downvotes on this user''s posts and comments have double the ranking effect'),
(95,'Bird Site Award','This user is limited to 140 characters'),
(96,'Flairlock Award','This user''s flair has been locked by someone else'),
(97,'Pizzashill Award','This user has to make their posts and comments more than 280 characters'),
(98,'Marsey Award','This user is limited to posting marseys'),
(99,'Sidebar Artist','Contributed artwork featured on the sidebar'),
(100,'True Believer','This user sees through communist lies'),
(101,'Banner Artist','Contributed a banner image to the site'),
(102,'Christmas 21','Awarded for surviving Fistmas 2021'),
(103,'Benefactor','Gave the Benefactor award to someone'),
(104,'BADASS OUTLAW','Bad boy who does not play by the rules'),
(105,'SCAM','lmao get fucked retard');

4
setup
View File

@ -13,6 +13,6 @@ sudo apt -y install gunicorn
sudo apt -y install ffmpeg
mkdir /songs
mkdir /images
cp ./env /env
. /env
cp ./env.sh /env.sh
. /env.sh
sudo -E gunicorn files.__main__:app -k gevent -w 2 --reload -b localhost:80 --max-requests 1000 --max-requests-jitter 500