refactor bday event

master
Aevann 2024-04-17 17:53:49 +02:00
parent f768165190
commit 485d210373
81 changed files with 39 additions and 27 deletions

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 53 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 515 KiB

After

Width:  |  Height:  |  Size: 515 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

View File

Before

Width:  |  Height:  |  Size: 645 KiB

After

Width:  |  Height:  |  Size: 645 KiB

View File

Before

Width:  |  Height:  |  Size: 599 KiB

After

Width:  |  Height:  |  Size: 599 KiB

View File

Before

Width:  |  Height:  |  Size: 267 KiB

After

Width:  |  Height:  |  Size: 267 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -89,7 +89,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_EVENT() and SITE_NAME == "rDrama",
"enabled": IS_MUSICAL_EVENT() and SITE_NAME == "rDrama",
"negative": False,
"included_in_lootbox": False,
},
@ -392,7 +392,7 @@ AWARDS = {
"included_in_lootbox": False,
},
### Birthgay/Birthdead
### Birthday
"confetti": {
"kind": "confetti",
"title": "Confetti",
@ -403,7 +403,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_BIRTHGAY() or IS_BIRTHDEAD(),
"enabled": IS_BDAY(),
"negative": False,
"included_in_lootbox": False,
},

View File

@ -1042,15 +1042,15 @@ dkd_end = datetime.datetime.strptime(f'10/4/{t.year}', '%d/%m/%Y')
def IS_DKD():
return SITE_NAME == 'rDrama' and dkd_begin < datetime.datetime.now() < dkd_end
birthgay_begin = datetime.datetime.strptime(f'20/5/{t.year}', '%d/%m/%Y')
birthgay_end = datetime.datetime.strptime(f'22/5/{t.year}', '%d/%m/%Y')
def IS_BIRTHGAY():
return SITE_NAME == 'rDrama' and birthgay_begin < datetime.datetime.now() < birthgay_end
birthdead_begin = datetime.datetime.strptime(f'26/4/{t.year}', '%d/%m/%Y')
birthdead_end = datetime.datetime.strptime(f'28/4/{t.year}', '%d/%m/%Y')
def IS_BIRTHDEAD():
return SITE_NAME == 'WPD' and birthdead_begin < datetime.datetime.now() < birthdead_end
if SITE_NAME == 'rDrama':
bday_begin = datetime.datetime.strptime(f'20/5/{t.year}', '%d/%m/%Y')
bday_end = datetime.datetime.strptime(f'22/5/{t.year}', '%d/%m/%Y')
else:
bday_begin = datetime.datetime.strptime(f'26/4/{t.year}', '%d/%m/%Y')
bday_end = datetime.datetime.strptime(f'28/4/{t.year}', '%d/%m/%Y')
def IS_BDAY():
return bday_begin < datetime.datetime.now() < bday_end
def IS_EVENT():
if IS_FISTMAS():
@ -1059,12 +1059,14 @@ def IS_EVENT():
return "homoween"
elif IS_DKD():
return "DKD"
elif IS_BIRTHGAY():
return "birthgay"
elif IS_BIRTHDEAD():
return "birthdead"
elif IS_BDAY():
return "bday"
return None
def IS_MUSICAL_EVENT():
return IS_FISTMAS() or IS_HOMOWEEN() or IS_DKD()
fourth_begin = datetime.datetime.strptime(f'4/7/{t.year}', '%d/%m/%Y')
fourth_end = datetime.datetime.strptime(f'5/7/{t.year}', '%d/%m/%Y')
def IS_FOURTH():

View File

@ -89,6 +89,7 @@ def selected_tab(request):
@app.template_filter("seeded_random")
def seeded_random(choices, p):
choices = [x for x in choices if not x.startswith('.')]
if request.path.startswith('/post/') and p:
random.seed(p.id)
chosen = random.choice(choices)
@ -196,8 +197,8 @@ def inject_constants():
"git_head":git_head, "max_days":max_days, "EMOJI_KINDS":EMOJI_KINDS,
"BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT,
"SITE_FULL_IMAGES": SITE_FULL_IMAGES,
"IS_EVENT":IS_EVENT, "IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN,
"IS_DKD":IS_DKD, "IS_BIRTHGAY":IS_BIRTHGAY, "IS_BIRTHDEAD":IS_BIRTHDEAD, "IS_FOURTH":IS_FOURTH,
"IS_EVENT":IS_EVENT, "IS_MUSICAL_EVENT":IS_MUSICAL_EVENT, "IS_FISTMAS":IS_FISTMAS, "IS_HOMOWEEN":IS_HOMOWEEN,
"IS_DKD":IS_DKD, "IS_BDAY":IS_BDAY, "IS_FOURTH":IS_FOURTH,
"CHUD_PHRASES":CHUD_PHRASES, "hasattr":hasattr, "calc_users":calc_users, "HOLE_INACTIVITY_DELETION":HOLE_INACTIVITY_DELETION,
"LIGHT_THEMES":LIGHT_THEMES, "DARK_THEMES":DARK_THEMES, "NSFW_EMOJIS":NSFW_EMOJIS, "HOLES":HOLES, "CARP_ID":CARP_ID,
"MAX_IMAGE_AUDIO_SIZE_MB":MAX_IMAGE_AUDIO_SIZE_MB, "MAX_IMAGE_AUDIO_SIZE_MB_PATRON":MAX_IMAGE_AUDIO_SIZE_MB_PATRON,

View File

@ -199,7 +199,7 @@ def settings_personal_post(v):
updated = True
session["nsfw_warnings"] = int(request.values.get("nsfw_warnings") == 'true')
elif not updated and IS_EVENT() and request.values.get("event_music", v.event_music) != v.event_music:
elif not updated and IS_MUSICAL_EVENT() and request.values.get("event_music", v.event_music) != v.event_music:
if not v.grinch:
abort(403, "You need to award yourself the grinch award to be able to disable event music!")
updated = True

View File

@ -118,7 +118,7 @@ def get_logged_in_user():
g.is_tor = (request.headers.get("cf-ipcountry") == "T1" and not (v and v.truescore >= 1000))
if v and not IS_EVENT():
if v and not IS_MUSICAL_EVENT():
session.pop("event_music", None)
g.show_nsfw = SITE_NAME == 'WPD' or (v and not v.nsfw_warnings) or session.get('nsfw_cookies', 0) >= int(time.time())

View File

@ -29,7 +29,7 @@
{{stackable_award('firework')}}
{% endif %}
{% if p.award_count("confetti", v) and (IS_BIRTHGAY() or IS_BIRTHDEAD()) %}
{% if p.award_count("confetti", v) and IS_BDAY() %}
<div class="confetti w-100 h-100"></div>
{% endif %}

View File

@ -26,8 +26,10 @@
{% set src = macros.random_image("assets/images/" ~ SITE_NAME ~ "/orgy_banners") %}
{% set href = "/chat/1" %}
{% set expand = false %}
{% elif IS_DKD() or IS_BIRTHGAY() or IS_BIRTHDEAD() %}
{% elif IS_DKD() %}
{% set src = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/banners") %}
{% elif IS_BDAY() %}
{% set src = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/banners/" ~ SITE_NAME) %}
{% elif IS_FOURTH() %}
{% set src = SITE_FULL_IMAGES ~ '/i/rDrama/4th-of-july-banner.webp' %}
{% elif SITE_NAME == "rDrama" %}
@ -137,7 +139,7 @@
{% endif %}
{% endif %}
{% if IS_EVENT() and not (SITE_NAME == 'WPD' and not v) and (not v or v.event_music) and not (hole and hole.name == 'music') and not (u and u.song) and not (IS_HOMOWEEN() and p and p.award_count("haunt", v)) and not (p and p.embed and p.domain == 'twitter.com') %}
{% if IS_MUSICAL_EVENT() and not (SITE_NAME == 'WPD' and not v) and (not v or v.event_music) and not (hole and hole.name == 'music') and not (u and u.song) and not (IS_HOMOWEEN() and p and p.award_count("haunt", v)) and not (p and p.embed and p.domain == 'twitter.com') %}
{% set path = "assets/events/" ~ IS_EVENT() ~ "/music" %}
{% set song = SITE_FULL ~ "/" ~ path ~ "/" ~ listdir('files/'~path)|seeded_random(id) ~ '?x=45' %}
<audio id="event-song" hidden preload="none" src="{{song}}" loop></audio>

View File

@ -93,6 +93,13 @@
'marseypilgrim',
'carppilgrim',
] -%}
{% elif IS_BDAY() %}
{%- set icons = [
'marseyparty',
'marseyballoon3',
'marseyballoons',
'marseycupcake',
] -%}
{% elif IS_DKD() %}
{%- set icons = [
'diddykongstand',

View File

@ -7,7 +7,7 @@
<section id="site-settings-device-specific-section" class="settings-section-section"> {# note: not using the thing from common just because of how much stuff there is in here #}
<h5>Device-specific Settings</h5>
<div class="settings-section rounded">
{% if IS_EVENT() %}
{% if IS_MUSICAL_EVENT() %}
{{common.toggle_section('Event Music', 'event_music_switch', 'event_music', v.event_music, 'Toggle event music.', false)}}
{% endif %}

View File

@ -21,8 +21,8 @@
{% if hole and hole.sidebarurls %}
{% set image = hole.random_sidebar %}
{% elif IS_FISTMAS() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar/" ~ SITE_NAME ) %}
{% elif IS_FISTMAS() or IS_BDAY() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar/" ~ SITE_NAME) %}
{% elif IS_EVENT() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar") %}
{% else %}

View File

@ -17,8 +17,8 @@
{% if hole and hole.sidebarurls %}
{% set image = hole.random_sidebar %}
{% elif IS_FISTMAS() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar/" ~ SITE_NAME ) %}
{% elif IS_FISTMAS() or IS_BDAY() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar/" ~ SITE_NAME) %}
{% elif IS_EVENT() %}
{% set image = macros.random_image("assets/events/" ~ IS_EVENT() ~ "/images/sidebar") %}
{% elif v and v.chud %}