Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-03 03:10:27 +00:00
commit f5d9926a35
16 changed files with 57 additions and 45 deletions

View File

@ -4876,7 +4876,7 @@ code {
.noshadow {
box-shadow: none !important;
}
[role="button"] {
[role="button"], [onclick] {
cursor: pointer !important;
}

View File

@ -1,6 +1,8 @@
from sqlalchemy import *
from sqlalchemy.orm import relationship
from files.__main__ import Base
from files.helpers.lazy import lazy
from flask import g
class HatDef(Base):
__tablename__ = "hat_defs"
@ -13,6 +15,11 @@ class HatDef(Base):
author = relationship("User", primaryjoin="HatDef.author_id == User.id")
@property
@lazy
def number_sold(self):
return g.db.query(Hat).filter_by(hat_id=self.id).count()
class Hat(Base):
__tablename__ = "hats"

View File

@ -30,7 +30,20 @@ def badge_grant(user, badge_id, description=None, url=None):
def archiveorg(url):
x = requests.get(f'https://web.archive.org/save/{url}', headers={'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}, timeout=100)
print(x, flush=True)
def archive_url(url):
if url.startswith(SITE_FULL): return
gevent.spawn(archiveorg, url)
if url.startswith('https://twitter.com/'):
url = url.replace('https://twitter.com/', 'https://nitter.42l.fr/')
gevent.spawn(archiveorg, url)
if url.startswith('https://instagram.com/'):
url = newposturl.replace('https://instagram.com/', 'https://imginn.com/')
gevent.spawn(archiveorg, url)
def execute_snappy(post, v):
snappy = get_account(SNAPPY_ID)
@ -95,15 +108,7 @@ def execute_snappy(post, v):
newposturl = post.url
if newposturl.startswith('/'): newposturl = f"{SITE_FULL}{newposturl}"
body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n* [ghostarchive.org](https://ghostarchive.org/search?term={quote(newposturl)}) (click to archive)\n\n"
gevent.spawn(archiveorg, newposturl)
if newposturl.startswith('https://twitter.com/'):
newposturl = newposturl.replace('https://twitter.com/', 'https://nitter.42l.fr/')
gevent.spawn(archiveorg, newposturl)
if newposturl.startswith('https://instagram.com/'):
newposturl = newposturl.replace('https://instagram.com/', 'https://imginn.com/')
gevent.spawn(archiveorg, newposturl)
archive_url(newposturl)
captured = []
body_for_snappy = post.body_html.replace(' data-src="', ' src="')
@ -137,15 +142,7 @@ def execute_snappy(post, v):
addition += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n'
if len(f'{body}{addition}') > 10000: break
body += addition
gevent.spawn(archiveorg, href)
if href.startswith('https://twitter.com/'):
href = href.replace('https://twitter.com/', 'https://nitter.42l.fr/')
gevent.spawn(archiveorg, href)
if href.startswith('https://instagram.com/'):
href = href.replace('https://instagram.com/', 'https://imginn.com/')
gevent.spawn(archiveorg, href)
archive_url(href)
body = body.strip()
body_html = sanitize(body)

View File

@ -13,8 +13,8 @@
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)" style="text-align:right;">Truescore</th>
<th role="button" onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
<th onclick="sort_table(2)" style="text-align:right;">Truescore</th>
<th onclick="sort_table(3)" style="text-align:right;">Mod actions</th>
</tr>
</thead>

View File

@ -14,12 +14,12 @@
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">
<tr>
<th role="button" onclick="sort_table(0)">#</th>
<th onclick="sort_table(0)">#</th>
<th>Name</th>
<th>Image</th>
<th>Description</th>
<th role="button" onclick="sort_table(4)">#</th>
<th role="button" onclick="sort_table(4)">Rarity</th>
<th onclick="sort_table(4)">#</th>
<th onclick="sort_table(4)">Rarity</th>
</tr>
</thead>

View File

@ -212,7 +212,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
{% if c.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{c.author.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{c.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip}}">
{%- endif %}
</div>
<span {% if c.author.patron and not c.distinguish_level %}class="patron" style="background-color:#{{c.author.name_color}};"{% elif c.distinguish_level %}class="mod"{% endif %}>{{c.author_name}}</span>

View File

@ -8,7 +8,7 @@
{% block Banner %}
<header class="container pb-1 text-center">
<img class="mt-5" alt="hats banner" src="/i/hats.webp" width="50%">
<img class="mt-5" alt="hats banner" src="/i/hats.webp?v=1" width="50%">
<h5 class="mt-4">Number of hats you bought: {{v.num_of_hats_bought}}</h5>
<h5 class="mt-4">Number of hats you designed: {{v.num_of_hats_designed}}</h5>
<h5 class="mt-4">Coins you spent on hats: {{v.coins_spent_on_hats}}</h5>
@ -27,8 +27,12 @@
<th scope="col">Description</th>
{% if SITE == 'rdrama.net' %}
<th scope="col">Author</th>
<th scope="col" onclick="sort_table(4)">Number Sold</th>
<th scope="col" onclick="sort_table(5)">Price</th>
{% else %}
<th scope="col" onclick="sort_table(3)">Number Sold</th>
<th scope="col" onclick="sort_table(4)">Price</th>
{% endif %}
<th scope="col">Price</th>
<th scope="col">Actions</th>
</tr>
</thead>
@ -36,12 +40,13 @@
<tbody>
{% for hat, user in owned %}
<tr>
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp"></td>
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
<td>{{hat.name}}</td>
<td>{{hat.description}}</td>
{% if SITE == 'rdrama.net' %}
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
{% endif %}
<td>{{hat.number_sold}}</td>
<td>{{hat.price}}</td>
<td class="shop-table-actions">
{% if hat.id == v.equipped_hat.id %}
@ -55,12 +60,13 @@
{% for hat, user in not_owned %}
<tr>
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp"></td>
<td><img loading="lazy" alt="{{hat.name}}" src="/i/hats/{{hat.name}}.webp?v=1"></td>
<td>{{hat.name}}</td>
<td>{{hat.description}}</td>
{% if SITE == 'rdrama.net' %}
<td><a style="color:#{{user.name_color}}" href="/@{{user.username}}"><img loading="lazy" src="{{user.profile_url}}" class="pp20"><span {% if user.patron %}class="patron" style="background-color:#{{user.name_color}}"{% endif %}>{{user.username}}</span></a></td>
{% endif %}
<td>{{hat.number_sold}}</td>
<td>{{hat.price}}</td>
<td class="shop-table-actions">
<a id="buy1-{{hat.id}}" class="btn btn-success {% if v.coins < hat.price %}disabled{% endif %}" role="button" onclick="this.classList.add('d-none');document.getElementById('buy1-go-{{hat.id}}').classList.remove('d-none')"><span class="m-auto">Buy</span></a>
@ -84,4 +90,5 @@
</pre>
{% endblock %}
<script src="/assets/js/sort_table.js?v=244"></script>
{% endblock %}

View File

@ -207,7 +207,7 @@
<div class="profile-pic-35-wrapper">
<img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
{% if v.hat_active -%}
<img class="profile-pic-35-hat hat" loading="lazy" src="/i/hats/{{v.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip}}">
<img class="profile-pic-35-hat hat" loading="lazy" src="/i/hats/{{v.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{v.hat_tooltip}}">
{%- endif %}
</div>
<div class="text-left pl-2">

View File

@ -19,8 +19,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>

View File

@ -38,7 +38,7 @@
<th scope="col">Icon</th>
<th scope="col">Title</th>
<th scope="col">Price</th>
<th scope="col">Owned</th>
<th scope="col" onclick="sort_table(3)">Owned</th>
<th scope="col">Buy</th>
<th scope="col">Description</th>
</tr>
@ -80,4 +80,5 @@
</pre>
<script src="/assets/js/sort_table.js?v=244"></script>
{% endblock %}

View File

@ -12,7 +12,7 @@
<tr>
<th>#</th>
<th>Name</th>
<th role="button" onclick="sort_table(2)">Posts</th>
<th onclick="sort_table(2)">Posts</th>
</tr>
</thead>

View File

@ -677,7 +677,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
{%- endif %}
</div>
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>

View File

@ -213,7 +213,7 @@
<div class="profile-pic-30-wrapper">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
<img class="profile-pic-30-hat hat" loading="lazy" src="/i/hats/{{p.author.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip}}">
{%- endif %}
</div>
<span {% if p.author.patron and not p.distinguish_level %}class="patron" style="background-color:#{{p.author.name_color}};"{% elif p.distinguish_level %}class="mod"{% endif %}>{{p.author_name}}</span>

View File

@ -42,7 +42,7 @@
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-100-wrapper">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
{%- endif %}
</a>
</div>
@ -407,7 +407,7 @@
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-65-wrapper">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white border-2 border-white mb-2">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="/i/hats/{{u.hat_active}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip}}">
{%- endif %}
</a>
</div>

View File

@ -1,6 +1,6 @@
{%-
set CACHE_VER = {
'css/main.css': 502,
'css/main.css': 503,
'css/catalog.css': 2,
'css/4chan.css': 61,

View File

@ -31,8 +31,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>
@ -59,8 +59,8 @@
<thead class="bg-primary text-white">
<tr>
<th>User</th>
<th role="button" onclick="sort_table(1)">User Truescore</th>
<th role="button" onclick="sort_table(2)">Vote Time</th>
<th onclick="sort_table(1)">User Truescore</th>
<th onclick="sort_table(2)">Vote Time</th>
</tr>
</thead>