forked from rDrama/rDrama
adds an easy link to download all emojis
parent
f49bdb295c
commit
61d256eaaa
|
@ -5,3 +5,4 @@ __pycache__/
|
|||
.idea/
|
||||
.vscode/
|
||||
.DS_Store
|
||||
emojis.zip
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
.fa-images:before{content:"\f302"}
|
||||
.fa-lock:before{content:"\f023"}
|
||||
.fa-lock-open:before{content:"\f3c1"}
|
||||
.fa-down:before{content:"\f354"}
|
||||
|
||||
button {
|
||||
background: none;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import datetime
|
||||
import time
|
||||
from sys import stdout
|
||||
|
||||
from shutil import make_archive
|
||||
from hashlib import md5
|
||||
|
||||
import click
|
||||
import requests
|
||||
|
||||
|
@ -41,6 +43,7 @@ def cron(every_5m, every_1h, every_1d, every_1mo):
|
|||
_sub_inactive_purge_task()
|
||||
site_stats = stats.stats(SITE_NAME)
|
||||
cache.set(f'{SITE}_stats', site_stats)
|
||||
_generate_emojis_zip()
|
||||
|
||||
g.db.commit()
|
||||
g.db.close()
|
||||
|
@ -106,3 +109,13 @@ def _sub_inactive_purge_task():
|
|||
g.db.delete(x)
|
||||
|
||||
return True
|
||||
|
||||
def _generate_emojis_zip():
|
||||
make_archive('files/assets/emojis', 'zip', 'files/assets/images/emojis')
|
||||
|
||||
m = md5()
|
||||
with open('files/assets/emojis.zip', "rb") as f:
|
||||
data = f.read()
|
||||
|
||||
m.update(data)
|
||||
cache.set('emojis_hash', m.hexdigest())
|
||||
|
|
|
@ -204,7 +204,8 @@ def static_megathread_index(v:User):
|
|||
if SITE_NAME != 'rDrama':
|
||||
abort(404)
|
||||
|
||||
return render_template("megathread_index.html", v=v)
|
||||
emojis_hash = cache.get('emojis_hash') or ''
|
||||
return render_template("megathread_index.html", v=v, emojis_hash=emojis_hash)
|
||||
|
||||
@app.get("/api")
|
||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
{%- if SITE_NAME == 'rDrama' -%}
|
||||
{%- do MEGATHREAD_INDEX.extend([
|
||||
(
|
||||
'Download All Emojis',
|
||||
'Download a zip file containing all emojis.',
|
||||
'fa-down', '#38a169',
|
||||
'/assets/emojis.zip?v=' + emojis_hash,
|
||||
),
|
||||
(
|
||||
'Bugs / Suggestions',
|
||||
'Something broken? Improvements?',
|
||||
|
|
Loading…
Reference in New Issue