adds an easy link to download all emojis
parent
f49bdb295c
commit
61d256eaaa
|
@ -5,3 +5,4 @@ __pycache__/
|
||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
emojis.zip
|
||||||
|
|
|
@ -203,6 +203,7 @@
|
||||||
.fa-images:before{content:"\f302"}
|
.fa-images:before{content:"\f302"}
|
||||||
.fa-lock:before{content:"\f023"}
|
.fa-lock:before{content:"\f023"}
|
||||||
.fa-lock-open:before{content:"\f3c1"}
|
.fa-lock-open:before{content:"\f3c1"}
|
||||||
|
.fa-down:before{content:"\f354"}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
background: none;
|
background: none;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
from shutil import make_archive
|
||||||
|
from hashlib import md5
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@ -41,6 +43,7 @@ def cron(every_5m, every_1h, every_1d, every_1mo):
|
||||||
_sub_inactive_purge_task()
|
_sub_inactive_purge_task()
|
||||||
site_stats = stats.stats(SITE_NAME)
|
site_stats = stats.stats(SITE_NAME)
|
||||||
cache.set(f'{SITE}_stats', site_stats)
|
cache.set(f'{SITE}_stats', site_stats)
|
||||||
|
_generate_emojis_zip()
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
g.db.close()
|
g.db.close()
|
||||||
|
@ -106,3 +109,13 @@ def _sub_inactive_purge_task():
|
||||||
g.db.delete(x)
|
g.db.delete(x)
|
||||||
|
|
||||||
return True
|
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':
|
if SITE_NAME != 'rDrama':
|
||||||
abort(404)
|
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")
|
@app.get("/api")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
{%- if SITE_NAME == 'rDrama' -%}
|
{%- if SITE_NAME == 'rDrama' -%}
|
||||||
{%- do MEGATHREAD_INDEX.extend([
|
{%- 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',
|
'Bugs / Suggestions',
|
||||||
'Something broken? Improvements?',
|
'Something broken? Improvements?',
|
||||||
|
|
Loading…
Reference in New Issue