Orgy Control

pull/165/head
Chuck Sneed 2023-07-02 18:31:12 -05:00
parent f2e04f0db5
commit 03537e6290
10 changed files with 164 additions and 7 deletions

View File

@ -0,0 +1,49 @@
import time
from math import floor
from random import randint
from urllib.parse import parse_qs, urlencode, urlparse
from flask import g
from sqlalchemy import Column, ForeignKey
from sqlalchemy.dialects.postgresql import TSVECTOR
from sqlalchemy.orm import relationship, scoped_session
from sqlalchemy.schema import FetchedValue
from sqlalchemy.sql.sqltypes import *
from files.classes import Base
from files.helpers.config.const import *
from files.helpers.lazy import lazy
from files.helpers.regex import *
from files.helpers.sorting_and_time import *
class Orgy(Base):
__tablename__ = "orgies"
youtube_id = Column(String, primary_key=True)
title = Column(String)
def __init__(self, **kwargs):
super().__init__(**kwargs)
def __repr__(self):
return f"<{self.__class__.__name__}(id={self.youtube_id}, title={self.title})>"
def get_orgy():
orgy = g.db.query(Orgy).one_or_none()
return orgy
def create_orgy(youtube_id, title):
assert not get_orgy()
assert re.match(yt_id_regex, youtube_id)
orgy = Orgy(title=title, youtube_id=youtube_id)
g.db.add(orgy)
g.db.flush()
g.db.commit()
def end_orgy():
assert get_orgy()
g.db.query(Orgy).delete()
g.db.flush()
g.db.commit()

View File

@ -519,6 +519,7 @@ PERMS = { # Minimum admin_level to perform action.
'LOTTERY_VIEW_PARTICIPANTS': 2,
'POST_COMMENT_INFINITE_PINGS': 2,
'IGNORE_1WEEk_EDITING_LIMIT': 2,
'ORGIES': 2,
'ADMIN_REMOVE': 3,
'ADMIN_ACTIONS_REVERT': 3,

View File

@ -9,6 +9,7 @@ from psycopg2.errors import UniqueViolation
from files.__main__ import app, cache, limiter
from files.classes import *
from files.classes.orgy import *
from files.helpers.actions import *
from files.helpers.alerts import *
from files.helpers.cloudflare import *
@ -1906,3 +1907,27 @@ def admin_reset_password(user_id, v):
send_repeatable_notification(user.id, text)
return {"message": f"@{user.username}'s password has been reset! The new password has been messaged to them!"}
@app.get("/admin/orgy")
@admin_level_required(PERMS['ORGIES'])
def orgy_control(v):
return render_template("admin/orgy_control.html", v=v, orgy=get_orgy())
@app.post("/admin/start_orgy")
@admin_level_required(PERMS['ORGIES'])
def start_orgy(v):
youtube_id = request.values.get("youtube_id")
title = request.values.get("title")
assert youtube_id
assert title
create_orgy(youtube_id, title)
return redirect("/chat")
@app.post("/admin/stop_orgy")
@admin_level_required(PERMS['ORGIES'])
def stop_orgy(v):
end_orgy()
return redirect("/chat")

View File

@ -13,6 +13,7 @@ from files.helpers.media import *
from files.helpers.sanitize import *
from files.helpers.alerts import push_notif
from files.routes.wrappers import *
from files.classes.orgy import *
from files.__main__ import app, cache, limiter
@ -35,7 +36,20 @@ messages = cache.get(f'messages') or {}
def chat(v):
if not v.admin_level and TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM:
abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat!")
return render_template("orgy.html", v=v, messages=messages)
orgy = get_orgy()
if orgy:
return render_template("orgy.html", v=v, messages=messages, orgy = orgy)
else:
return render_template("chat.html", v=v, messages=messages)
@app.get("/old_chat")
@limiter.limit(DEFAULT_RATELIMIT)
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@is_not_permabanned
def old_chat(v):
if not v.admin_level and TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM:
abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat!")
return render_template("chat.html", v=v, messages=messages)
@socketio.on('speak')
@is_not_permabanned

View File

@ -0,0 +1,52 @@
{% extends "default.html" %}
{% block pagetitle %}Edit {{SITE_NAME}}'s rules{% endblock %}
{% block content %}
{% if msg %}{{macros.alert(msg, false)}}{% endif %}
<div class="row my-5">
<div class="col">
<div class="settings mx-3">
<div id="description">
<h2>Orgy Control Panel</h2>
<br>
</div>
<div class="body d-lg-flex">
<div class="w-lg-100">
{%if not orgy%}
<form id="orgy" action="/admin/start_orgy" method="post">
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="title">Title</label>
</div>
<div class="body w-lg-100">
<input id="title" autocomplete="off" type="text" name="title" class="form-control">
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="youtube_id">Youtube ID</label>
</div>
<div class="body w-lg-100">
<input id="youtube_id" autocomplete="off" type="text" name="youtube_id" class="form-control">
</div>
</div>
<input hidden name="formkey" value="{{v|formkey}}">
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Start Orgy">
</div>
</form>
{%else%}
<form id="orgy" action="/admin/stop_orgy" method="post">
<input hidden name="formkey" value="{{v|formkey}}">
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Stop Orgy">
</div>
</form>
{%endif%}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -12,9 +12,9 @@
<div class="orgy-top-container">
<div class="col text-left d-none d-lg-block pt-3 orgy-info-window-item">
<h2>Deboonking Aliens with Style 'n' Grace</h1>
<h2>{{orgy.title}}</h1>
<div>
<lite-youtube videoid="xYXlak-APuA" params="autoplay=1&modestbranding=1"/>
<lite-youtube videoid="{{orgy.youtube_id}}" params="autoplay=1&modestbranding=1"/>
</div>
{{macros.chat_users_list()}}
</div>

View File

@ -1,6 +1,6 @@
<h3 style="filter: sepia(100%) saturate(500%) hue-rotate(60deg) drop-shadow(-4px 4px 10px lime);">CURRENT EVENTS:</h3>
<h4 style="filter: sepia(50%) saturate(500%) hue-rotate(10deg) drop-shadow(-1px 1px 5px pink);"><a href="https://rdrama.net/h/vidya/post/182848/contest-photoshop-your-pet-as-a" rel="nofollow">Bing Bing Wahoo Pet Contest</a></h4><sup>Dramacoin prizes!</sup><br>
<h4 style="filter: sepia(50%) saturate(500%) hue-rotate(10deg) drop-shadow(-1px 1px 5px pink);"><a href="https://rdrama.net/post/184174" rel="nofollow">Independence Gay Grill-Off</a></h4><sup>BADGE</sup><br>
<h4 style="filter: sepia(50%) saturate(500%) hue-rotate(10deg) drop-shadow(-1px 1px 5px pink);"><a href="https://rdrama.net/h/vidya/post/182848/contest-photoshop-your-pet-as-a" rel="nofollow noopener" target="_blank">Bing Bing Wahoo Pet Contest</a></h4><sup>Dramacoin prizes!</sup><br>
<h4 style="filter: sepia(50%) saturate(500%) hue-rotate(10deg) drop-shadow(-1px 1px 5px pink);"><a href="https://rdrama.net/post/184174" rel="nofollow noopener" target="_blank">Independence Gay Grill-Off</a></h4><sup>BADGE</sup><br>
<hr>
<hr>
<hr>
@ -10,7 +10,7 @@
<ul>
<li><p>Asking to see who saved comments/posts=1 day ban</p></li>
<li><p>You must be over 18 to view this site.</p></li>
<li><p><strong><a href="https://rdrama.net//post/19711/a-short-guide-on-how-to" rel="nofollow">NO RIGHTWING AGENDAPOSTING.</a></strong></p></li>
<li><p><strong><a href="https://rdrama.net//post/19711/a-short-guide-on-how-to" rel="nofollow noopener" target="_blank">NO RIGHTWING AGENDAPOSTING.</a></strong></p></li>
<li><p>Discord users will be banned on sight.</p></li>
<li><p>Don't post anything illegal.</p></li>
<li><p>No sexualizing minors, even as a joke. This includes cartoons.</p></li>
@ -45,4 +45,5 @@
<li><p><a href="https://old.reddit.com/r/Egg_IRL" rel="nofollow noopener" target="_blank">/r/Egg_IRL</a></p></li>
</ul>
<br>
<p style="color: hotpink;">𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞</p>
<p style="color: hotpink;">𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞</p>
<p>gaming!</p>

View File

@ -0,0 +1,4 @@
CREATE TABLE public.orgies (
youtube_id character varying(12) NOT NULL,
title character varying(1000) NOT NULL
);

View File

@ -24,6 +24,10 @@ server {
proxy_pass http://localhost:5001/chat;
include includes/headers;
}
location /old_chat {
proxy_pass http://localhost:5001/old_chat;
include includes/headers;
}
location =/offline.html {
alias /rDrama/files/assets/offline.html;
include includes/headers;

View File

@ -1126,6 +1126,13 @@ CREATE TABLE public.votes (
coins smallint DEFAULT 1 NOT NULL
);
--
-- Name: orgies, Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.orgies (
youtube_id character varying(12) NOT NULL,
title character varying(1000) NOT NULL
);
--
-- Name: award_relationships id; Type: DEFAULT; Schema: public; Owner: -