Revert "blizzard submodule"

This reverts commit eae0715c10.

Sorry @geese_suck, looks like more of a pain to deploy than I thought
it'd be. Was a good idea though.
master
Snakes 2022-11-30 16:10:20 -05:00
parent eae0715c10
commit 5b7572af64
Signed by: Snakes
GPG Key ID: E745A82778055C7E
24 changed files with 199 additions and 4 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "files/events"]
path = files/events
url = https://fsdfsd.net/retards/Blizzard

@ -1 +0,0 @@
Subproject commit 883cedfa0364673621d4bc63af91bb23f59847b7

View File

@ -0,0 +1,28 @@
from sqlalchemy import inspect
from files.helpers.const import AWARDS2, AWARDS_DISABLED
from files.__main__ import engine
from files.events.classes import *
from files.events.helpers import *
from files.events.routes import *
def _build_table():
if not inspect(engine).has_table(EventUser.__table__.name, schema="public"):
print("[EVENT] Building event table...")
EventUser.__table__.create(bind=engine, checkfirst=True)
def _populate_awards():
temp = {x: AWARDS2[x] for x in AWARDS2 if x not in EVENT_AWARDS}
AWARDS2.clear()
AWARDS2.update(EVENT_AWARDS)
AWARDS2.update(temp)
for award in EVENT_AWARDS:
if award in AWARDS_DISABLED:
AWARDS_DISABLED.remove(award)
def event_init():
_build_table()
_populate_awards()

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

View File

@ -0,0 +1 @@
from .eventuser import EventUser

View File

@ -0,0 +1,20 @@
from sqlalchemy import *
from sqlalchemy.orm import relationship
from files.classes import Base
class EventUser(Base):
__tablename__ = "event_users"
id = Column(Integer, ForeignKey("users.id"), primary_key=True)
user = relationship("User", primaryjoin="EventUser.id == User.id")
event_music = Column(Boolean, default=True, nullable=False)
# start event specific columns
# end event specific columns
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def __repr__(self):
return f"<{self.__class__.__name__}(id={self.id})>"

View File

@ -0,0 +1,2 @@
from .const import *
from .jinja import *

View File

@ -0,0 +1,3 @@
EVENT_AWARDS = {
}

View File

@ -0,0 +1,15 @@
from typing import Optional, Union
from sqlalchemy.orm import scoped_session
from files.events.classes.eventuser import EventUser
from files.classes.user import User
def get_or_create_event_user(target:Union[int, User], db:scoped_session) -> Optional[EventUser]:
if target is None: return None
if isinstance(target, User): target = target.id # type: ignore
user = db.get(EventUser, target)
if not user:
user = EventUser(id=target)
db.add(user)
db.flush()
return user

View File

@ -0,0 +1,8 @@
EVENT_JINJA_CONST = {
"EVENT_BANNER": "banner_rDrama.html",
"EVENT_SIDEBAR": True,
"EVENT_STYLES": "spooky.css",
"EVENT_AWARDS": True,
"EVENT_MUSIC": "music.html",
}

View File

@ -0,0 +1,2 @@
from .awards import *
from .jinja import *

View File

@ -0,0 +1,9 @@
from flask import g
from files.events.helpers.get import get_or_create_event_user
def award_thing_event(v, kind, author):
event_author = get_or_create_event_user(author, g.db)
event_v = get_or_create_event_user(v, g.db)
g.db.add(event_author)

View File

@ -0,0 +1,6 @@
from files.__main__ import app
from files.events import EVENT_JINJA_CONST
@app.context_processor
def event_constants():
return EVENT_JINJA_CONST

View File

View File

@ -0,0 +1,3 @@
<a rel="nofollow noopener noreferrer" href="{% if 'rama' in request.host %}https://youtu.be/3l7X94GLqSQ?t=16{% else %}/{% endif %}" style="text-decoration: none !important">
</a>

View File

@ -0,0 +1,24 @@
{% if not (v and v.poor) and (not g.event_v or g.event_v.event_music) and not (sub and sub.name == 'music') %}
{% if not song %}
{% set path = "assets/media/event/music" %}
{% set song = "/" + path + "/" + listdir('files/' + path)|random() + '?v=45' %}
{% endif %}
<script>
const audio = new Audio("{{song}}");
audio.loop=true;
function play() {
audio.play();
}
audio.loop=true;
window.addEventListener('load', function() {
audio.play();
document.getElementById('frontpage').addEventListener('click', () => {
if (audio.paused) audio.play();
}, {once : true});
prepare_to_pause(audio)
});
</script>
{% endif %}

View File

@ -0,0 +1,78 @@
<div class="col sidebar text-left {% if '/sidebar' not in request.path %}d-none d-lg-block{% endif %} pt-3 pb-5" {% if request.path != '/sidebar' %}id="sidebar-content"{% endif %}>
{% if sub %}
{% set image = sub.sidebar_url %}
{% else %}
{% set sidebar_path = "assets/images/event/sidebar" %}
{% set selected_image = listdir('files/' + sidebar_path)|random() %}
{% set image = "/" + sidebar_path + "/" + selected_image + '?v=45' %}
{% endif %}
{% if request.path != '/sidebar' %}
<a href="{{image}}" style="text-decoration:none">
<img class="mb-4" alt="sidebar image" onclick="expandDesktopImage()" loading="lazy" src="{{image}}" width=100%>
</a>
{% endif %}
<p class="text-center text-md mb-4">
<a class="sidebar-link" href="/marseys" data-bs-toggle="tooltip" data-bs-placement="top" title="Marseys"><i class="fas fa-cat"></i></a>
<a class="sidebar-link" href="/badges" data-bs-toggle="tooltip" data-bs-placement="top" title="Badges"><i class="fas fa-hexagon"></i></a>
<a class="sidebar-link" href="/admins" data-bs-toggle="tooltip" data-bs-placement="top" title="Admins"><i class="fas fa-crown"></i></a>
<a class="sidebar-link" href="/log" data-bs-toggle="tooltip" data-bs-placement="top" title="Moderation Log"><i class="fas fa-scroll-old"></i></a>
<a class="sidebar-link" href="/transfers" data-bs-toggle="tooltip" data-bs-placement="top" title="Transfers"><i class="fas fa-arrow-right-arrow-left"></i></a>
<a class="sidebar-link" href="/random_post" data-bs-toggle="tooltip" data-bs-placement="top" title="Random Post"><i class="fas fa-random"></i></a>
<span class="sidebar-link" onclick="if(localStorage.getItem('setting_upsidedown')=='true'){localStorage.setItem('setting_upsidedown', 'false')}else{localStorage.setItem('setting_upsidedown', 'true')};location.reload()" style="display:inline" data-bs-toggle="tooltip" data-bs-placement="top" title="???"><i class="fas fa-trees"></i></span>
</p>
{% if sub %}
{% if sub.sidebar_html %}
<div class="mb-4">{{sub.sidebar_html|safe}}</div>
{% endif %}
{% if v %}
<a class="btn btn-primary btn-block mb-3" href="/holes">BROWSE {{HOLE_NAME|upper}}S</a>
{% if v.can_create_hole -%}
<a class="btn btn-primary btn-block mb-3" href="/create_hole">CREATE {{HOLE_NAME|upper}}</a>
{%- endif %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/log">{{HOLE_NAME|upper}} LOG</a>
{% if v.mods(sub.name) %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/settings">{{HOLE_NAME|upper}} SETTINGS</a>
{% endif %}
{% endif %}
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/mods">{{HOLE_NAME|upper}} MODS</a>
<a class="btn btn-primary btn-block mb-3" href="/h/{{sub}}/exilees">{{HOLE_NAME|upper}} EXILEES</a>
{% else %}
<a id="sidebar--directory--btn" class="btn btn-primary btn-block mb-3" href="/directory">
<span id="sidebar--directory--head">DIRECTORY</span>
<span id="sidebar--directory--subhead">Submit Marseys & Art | Info Megathreads</span>
</a>
<a class="btn btn-primary btn-block mb-3" href="/holes">BROWSE {{HOLE_NAME|upper}}S</a>
{% if v and v.can_create_hole -%}
<a class="btn btn-primary btn-block mb-3" href="/create_hole">CREATE {{HOLE_NAME|upper}}</a>
{%- endif %}
<div class="sidebar--rules">
<h3 class="sidebar--rules-head mt-4 mb-3">Rules</h3>
<ol class="sidebar--rules-list sidebar--rules-list--rdrama">
<li class="font-weight-bold" style="color: red"><a href="/post/19711/a-short-guide-on-how-to" style="color: inherit">NO RIGHTWING AGENDAPOSTING.</a></li>
<li>Don't post anything illegal.</li>
<li>No sexualizing minors even as a β€œjoke”.</li>
<li>No doxing.</li>
<li>Using alts to game dramacoin will get you banned.</li>
<li>Supporting free speech is an immediate ban.</li>
<li class="font-weight-bold">Absolutely NO anti-CCP sentiment.</li>
</ol>
<p>All rules can and likely will be ignored at the discretion of the janitorial staff. Be funny, or at least compelling, and pretty much anything legal is welcome.</p>
<p style="color: hotpink">𝐜𝐚𝐫𝐩 𝐰𝐨𝐳 𝐞𝐫𝐞</p>
</div>
{% endif %}
<pre>
</pre>
</div>