forked from MarseyWorld/MarseyWorld
enable emoji form on WPD
parent
e05ad064d0
commit
3524b7f0e9
|
@ -40,7 +40,8 @@ services:
|
|||
- "./seed-users.sql:/docker-entrypoint-initdb.d/01-seed-users.sql"
|
||||
- "./seed-badges.sql:/docker-entrypoint-initdb.d/02-seed-badges.sql"
|
||||
- "./seed-hats.sql:/docker-entrypoint-initdb.d/03-seed-hats.sql"
|
||||
- "./seed-emojis.sql:/docker-entrypoint-initdb.d/04-seed-emojis.sql"
|
||||
- "./seed-emojis-rDrama.sql:/docker-entrypoint-initdb.d/04-seed-emojis-rDrama.sql"
|
||||
- "./seed-emojis-WPD.sql:/docker-entrypoint-initdb.d/04-seed-emojis-WPD.sql"
|
||||
environment:
|
||||
- POSTGRES_HOST_AUTH_METHOD=trust
|
||||
ports:
|
||||
|
|
|
@ -404,7 +404,8 @@ FEATURES = {
|
|||
'MARKUP_COMMANDS': True,
|
||||
'REPOST_DETECTION': True,
|
||||
'PATRON_ICONS': False,
|
||||
'ASSET_SUBMISSIONS': False,
|
||||
'EMOJI_SUBMISSIONS': True,
|
||||
'HAT_SUBMISSIONS': True,
|
||||
'NSFW_MARKING': True,
|
||||
'PING_GROUPS': True,
|
||||
'BOTS': True,
|
||||
|
@ -604,7 +605,6 @@ if SITE in {'rdrama.net', 'staging.rdrama.net'}:
|
|||
FEATURES['PRONOUNS'] = True
|
||||
FEATURES['HOUSES'] = True
|
||||
FEATURES['USERS_PERMANENT_WORD_FILTERS'] = True
|
||||
FEATURES['ASSET_SUBMISSIONS'] = True
|
||||
|
||||
BUG_THREAD = 18459
|
||||
|
||||
|
@ -692,6 +692,7 @@ elif SITE == 'watchpeopledie.tv':
|
|||
FEATURES['PATRON_ICONS'] = True
|
||||
FEATURES['NSFW_MARKING'] = False
|
||||
FEATURES['BOTS'] = False
|
||||
FEATURES['HAT_SUBMISSIONS'] = False
|
||||
|
||||
PERMS['POST_COMMENT_EDITING'] = 3
|
||||
PERMS['MODS_EVERY_HOLE'] = 3
|
||||
|
@ -778,14 +779,12 @@ elif SITE == 'watchpeopledie.tv':
|
|||
|
||||
elif SITE == 'devrama.net':
|
||||
AEVANN_ID = 7
|
||||
FEATURES['ASSET_SUBMISSIONS'] = True
|
||||
FEATURES['PRONOUNS'] = True
|
||||
FEATURES['HOUSES'] = True
|
||||
FEATURES['USERS_PERMANENT_WORD_FILTERS'] = True
|
||||
PERMS["SITE_SETTINGS"] = 4
|
||||
PERMS["ORGIES"] = 4
|
||||
else: # localhost or testing environment implied
|
||||
FEATURES['ASSET_SUBMISSIONS'] = True
|
||||
FEATURES['PRONOUNS'] = True
|
||||
FEATURES['HOUSES'] = True
|
||||
FEATURES['USERS_PERMANENT_WORD_FILTERS'] = True
|
||||
|
|
|
@ -70,7 +70,7 @@ def cron_fn(every_5m, every_1d, every_fri_12, every_fri_23, every_sat_03, every_
|
|||
_generate_emojis_zip()
|
||||
g.db.commit()
|
||||
|
||||
if FEATURES['ASSET_SUBMISSIONS']:
|
||||
if FEATURES['EMOJI_SUBMISSIONS']:
|
||||
_generate_emojis_original_zip()
|
||||
g.db.commit()
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ from .polls import *
|
|||
from .notifications import *
|
||||
if FEATURES['HATS']:
|
||||
from .hats import *
|
||||
if FEATURES['ASSET_SUBMISSIONS']:
|
||||
if FEATURES['EMOJI_SUBMISSIONS'] or FEATURES['HAT_SUBMISSIONS']:
|
||||
from .asset_submissions import *
|
||||
from .special import *
|
||||
from .push_notifs import *
|
||||
|
|
|
@ -15,10 +15,12 @@ from files.__main__ import app, cache, limiter
|
|||
ASSET_TYPES = (Emoji, HatDef)
|
||||
|
||||
@app.get("/submit/marseys")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
def submit_marseys_redirect():
|
||||
return redirect("/submit/emojis")
|
||||
|
||||
@app.get("/submit/emojis")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
|
@ -37,6 +39,7 @@ def submit_emojis(v):
|
|||
emoji_modifiers = ('pat', 'talking', 'genocide', 'love')
|
||||
|
||||
@app.post("/submit/emojis")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -120,6 +123,7 @@ def verify_permissions_and_get_asset(cls, asset_type, v, name, make_lower=False)
|
|||
return asset
|
||||
|
||||
@app.post("/admin/approve/emoji/<name>")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -283,6 +287,7 @@ def remove_asset(cls, type_name, v, name):
|
|||
return {"message": f"'{name}' removed!"}
|
||||
|
||||
@app.post("/remove/emoji/<name>")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -292,6 +297,7 @@ def remove_emoji(v, name):
|
|||
return remove_asset(Emoji, "emoji", v, name)
|
||||
|
||||
@app.get("/submit/hats")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@auth_required
|
||||
|
@ -302,6 +308,7 @@ def submit_hats(v):
|
|||
|
||||
|
||||
@app.post("/submit/hats")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -354,6 +361,7 @@ def submit_hat(v):
|
|||
|
||||
|
||||
@app.post("/admin/approve/hat/<name>")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit("120/minute;200/hour;1000/day", deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -435,6 +443,7 @@ def approve_hat(v, name):
|
|||
return {"message": f"'{hat.name}' approved!"}
|
||||
|
||||
@app.post("/remove/hat/<name>")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -444,6 +453,7 @@ def remove_hat(v, name):
|
|||
return remove_asset(HatDef, 'hat', v, name)
|
||||
|
||||
@app.get("/admin/update/emojis")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@admin_level_required(PERMS['UPDATE_ASSETS'])
|
||||
|
@ -452,6 +462,7 @@ def update_emojis(v):
|
|||
|
||||
|
||||
@app.post("/admin/update/emojis")
|
||||
@feature_required('EMOJI_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
@ -553,6 +564,7 @@ def update_emoji(v):
|
|||
return {"message": f"'{name}' updated successfully!"}
|
||||
|
||||
@app.get("/admin/update/hats")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||
@admin_level_required(PERMS['UPDATE_ASSETS'])
|
||||
|
@ -561,6 +573,7 @@ def update_hats(v):
|
|||
|
||||
|
||||
@app.post("/admin/update/hats")
|
||||
@feature_required('HAT_SUBMISSIONS')
|
||||
@limiter.limit('1/second', scope=rpath)
|
||||
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||
|
|
|
@ -51,7 +51,7 @@ def get_emoji_list(kind, nsfw):
|
|||
|
||||
emojis = []
|
||||
for emoji, author in li:
|
||||
emoji.author = author.username if FEATURES['ASSET_SUBMISSIONS'] else None
|
||||
emoji.author = author.username if FEATURES['EMOJI_SUBMISSIONS'] else None
|
||||
emojis.append(emoji)
|
||||
return emojis
|
||||
|
||||
|
@ -68,7 +68,7 @@ def emoji_list(v, kind):
|
|||
emojis = get_emoji_list(kind, g.show_nsfw)
|
||||
authors = get_accounts_dict([e.author_id for e in emojis], v=v, graceful=True)
|
||||
|
||||
if FEATURES['ASSET_SUBMISSIONS']:
|
||||
if FEATURES['EMOJI_SUBMISSIONS']:
|
||||
original = os.listdir("/asset_submissions/emojis/original")
|
||||
for emoji in emojis:
|
||||
emoji.user = authors.get(emoji.author_id)
|
||||
|
@ -99,7 +99,7 @@ def get_emojis(nsfw):
|
|||
|
||||
collected = []
|
||||
for emoji, author in emojis:
|
||||
if FEATURES['ASSET_SUBMISSIONS']:
|
||||
if FEATURES['EMOJI_SUBMISSIONS']:
|
||||
emoji.author_username = author.username
|
||||
emoji.author_original_username = author.original_username
|
||||
emoji.author_prelock_username = author.prelock_username
|
||||
|
|
|
@ -36,13 +36,19 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if SITE_NAME == 'rDrama' %}
|
||||
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}
|
||||
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] -%}
|
||||
<li><a href="/submit/emojis">Approve or Reject Emojis</a></li>
|
||||
{% endif %}
|
||||
{% if FEATURES['HAT_SUBMISSIONS'] -%}
|
||||
<li><a href="/submit/hats">Approve or Reject Hats</a></li>
|
||||
{% endif %}
|
||||
{% if v.admin_level >= PERMS['UPDATE_ASSETS'] %}
|
||||
{% endif %}
|
||||
{% if v.admin_level >= PERMS['UPDATE_ASSETS'] %}
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] -%}
|
||||
<li><a href="/admin/update/emojis">Update Emojis</a></li>
|
||||
{% endif %}
|
||||
{% if FEATURES['HAT_SUBMISSIONS'] -%}
|
||||
<li><a href="/admin/update/hats">Update Hats</a></li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -2,62 +2,72 @@
|
|||
{% block pagetitle %}Emojis{% endblock %}
|
||||
{% block pagetype %}emojis{% endblock %}
|
||||
{% block content %}
|
||||
<a class="btn btn-primary btn-block mt-3" href="/assets/emojis.zip?x={{emojis_hash}}"><i class="fas fa-down mr-2"></i>Download All Emojis</a>
|
||||
|
||||
<a class="btn btn-primary btn-block mt-3" href="/assets/emojis.zip?x={{emojis_hash}}"><i class="fas fa-down mr-2"></i>Download All Emojis</a>
|
||||
<a class="btn btn-primary btn-block mt-3" href="/assets/emojis_original.zip?x={{emojis_hash}}"><i class="fas fa-down mr-2"></i>Download All Original Files</a>
|
||||
|
||||
<a class="btn btn-primary btn-block mt-3" href="https://rdrama.net/assets/emojis_original.zip?x={{emojis_hash}}"><i class="fas fa-down mr-2"></i>Download All Original Files</a>
|
||||
|
||||
<div class="d-flex align-items-center my-4">
|
||||
<div class="dropdown dropdown-actions mx-auto">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-bs-toggle="dropdown" data-bs-display="static" style="width:min(95vw, 900px)">
|
||||
<img loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{kind.lower()}}.webp" alt=":{{kind.lower()}}:" class="mr-2">{{kind}}
|
||||
</button>
|
||||
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px); max-height: 50vh;overflow: auto;width:min(95vw, 900px)">
|
||||
{% for kind in EMOJI_KINDS %}
|
||||
<a class="dropdown-item" href="/emojis/{{kind}}"><img loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{kind.lower()}}.webp" alt=":{{kind.lower()}}:" class="mr-2">{{kind}}</a>
|
||||
{% endfor %}
|
||||
<div class="d-flex align-items-center my-4">
|
||||
<div class="dropdown dropdown-actions mx-auto">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" id="dropdownMenuButton" data-bs-toggle="dropdown" data-bs-display="static" style="width:min(95vw, 900px)">
|
||||
<img loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{kind.lower()}}.webp" alt=":{{kind.lower()}}:" class="mr-2">{{kind}}
|
||||
</button>
|
||||
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 31px, 0px); max-height: 50vh;overflow: auto;width:min(95vw, 900px)">
|
||||
{% for kind in EMOJI_KINDS %}
|
||||
<a class="dropdown-item" href="/emojis/{{kind}}"><img loading="lazy" src="{{SITE_FULL_IMAGES}}/e/{{kind.lower()}}.webp" alt=":{{kind.lower()}}:" class="mr-2">{{kind}}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto mt-3"><table class="table table-striped mb-5">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th>Emoji</th>
|
||||
<th>Usage</th>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<th>Author</th>
|
||||
{% endif %}
|
||||
<th>Added on</th>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<th class="disable-sort-click">Original File</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="emojis-table">
|
||||
{% for emoji in emojis %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{{emoji.name}}</td>
|
||||
<td><img class="emoji" loading="lazy" data-bs-toggle="tooltip" alt=":#{{emoji.name}}:" title=":{{emoji.name}}:" src="{{SITE_FULL_IMAGES}}/e/{{emoji.name}}.webp"></td>
|
||||
<td>{{emoji.count}}</td>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
{% set user = emoji.user %}
|
||||
<td>{% include "user_in_table.html" %}</td>
|
||||
{% endif %}
|
||||
<td data-sort-key="{{emoji.created_utc or 0}}" {% if emoji.created_utc != None %}data-time="{{emoji.created_utc}}"{% endif %}></td>
|
||||
{% if FEATURES['ASSET_SUBMISSIONS'] %}
|
||||
<td>
|
||||
{% if emoji.og %}
|
||||
<a href="{{SITE_FULL_IMAGES}}/asset_submissions/emojis/original/{{emoji.og}}">{{emoji.og}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="overflow-x-auto mt-3">
|
||||
<table class="table table-striped mb-5">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Name</th>
|
||||
<th>Emoji</th>
|
||||
<th>Usage</th>
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] %}
|
||||
<th>Author</th>
|
||||
{% endif %}
|
||||
<th>Added on</th>
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] %}
|
||||
<th class="disable-sort-click">Original File</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="emojis-table">
|
||||
{% for emoji in emojis %}
|
||||
<tr>
|
||||
<td>{{loop.index}}</td>
|
||||
<td>{{emoji.name}}</td>
|
||||
<td><img class="emoji" loading="lazy" data-bs-toggle="tooltip" alt=":#{{emoji.name}}:" title=":{{emoji.name}}:" src="{{SITE_FULL_IMAGES}}/e/{{emoji.name}}.webp"></td>
|
||||
<td>{{emoji.count}}</td>
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] %}
|
||||
<td>
|
||||
{% if emoji.author_id == 2 %}
|
||||
{% if SITE_NAME == 'WPD' %}
|
||||
an rDrama user
|
||||
{% else %}
|
||||
a WPD user
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set user = emoji.user %}
|
||||
{% include "user_in_table.html" %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td data-sort-key="{{emoji.created_utc or 0}}" {% if emoji.created_utc != None %}data-time="{{emoji.created_utc}}"{% endif %}></td>
|
||||
{% if FEATURES['EMOJI_SUBMISSIONS'] %}
|
||||
<td>
|
||||
{% if emoji.og %}
|
||||
<a href="{{SITE_FULL_IMAGES}}/asset_submissions/emojis/original/{{emoji.og}}">{{emoji.og}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -99,12 +99,10 @@
|
|||
<label class="mt-3" for="{{emoji.name}}-tags">Tags</label>
|
||||
<input autocomplete="off" type="text" id="{{emoji.name}}-tags" class="form-control" name="tags" maxlength="200" value="{{emoji.tags}}" pattern='[a-z0-9: ]{1,200}' placeholder="Required" required {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %}>
|
||||
|
||||
{% if FEATURES['NSFW_MARKING'] %}
|
||||
<div class="custom-control custom-checkbox mt-4 pt-1 ml-1">
|
||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{emoji.name}}-nsfw" name="nsfw" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %} {% if emoji.nsfw %}checked{% endif %}>
|
||||
<label class="custom-control-label" for="{{emoji.name}}-nsfw">NSFW</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="custom-control custom-checkbox mt-4 pt-1 ml-1">
|
||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="{{emoji.name}}-nsfw" name="nsfw" {% if v.admin_level < PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] %}readonly{% endif %} {% if emoji.nsfw %}checked{% endif %}>
|
||||
<label class="custom-control-label" for="{{emoji.name}}-nsfw">NSFW</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if v.admin_level >= PERMS['MODERATE_PENDING_SUBMITTED_ASSETS'] or v.id == emoji.submitter_id %}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#apply env vars
|
||||
. /e
|
||||
|
||||
#generate schema.sql
|
||||
|
@ -10,12 +11,3 @@ pg_dump -O -x --data-only --inserts -t 'badge_defs' "$DATABASE_URL" > "/d/seed-b
|
|||
pg_dump -O -x --data-only --inserts -t 'hat_defs' "$DATABASE_URL" > "/d/seed-hats.sql"
|
||||
sed -i -E "s/(INSERT INTO public.hat_defs VALUES \(.*', )[0-9]{2,}?,/\12,/g" "/d/seed-hats.sql"
|
||||
sed -i -E "s/INSERT INTO public.hat_defs VALUES \(.*, [0-9]{1,6}, [0-9]{10}\);//g" "/d/seed-hats.sql"
|
||||
|
||||
#generate seed-emojis.sql
|
||||
EXPORT_EMOJIS=$(psql --csv --tuples-only -P "null=NULL" -c \
|
||||
"SELECT ''''||name||'''', ''''||kind||'''', 2, ''''||tags||'''', ''||nsfw||'' FROM emojis WHERE submitter_id IS NULL ORDER BY name" \
|
||||
"$DATABASE_URL")
|
||||
EXPORT_EMOJIS=$(sed 's/.*/\(&\),/' <<< "$EXPORT_EMOJIS")
|
||||
echo "INSERT INTO public.emojis (name, kind, author_id, tags, nsfw) VALUES" > "/d/seed-emojis.sql"
|
||||
echo "${EXPORT_EMOJIS%?}" >> "/d/seed-emojis.sql"
|
||||
echo "ON CONFLICT (name) DO UPDATE SET tags = EXCLUDED.tags;" >> "/d/seed-emojis.sql"
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
#apply env vars
|
||||
. /e
|
||||
|
||||
#generate seed-emojis-$SITE_NAME.sql
|
||||
EXPORT_EMOJIS=$(psql --csv --tuples-only -P "null=NULL" -c \
|
||||
"SELECT ''''||name||'''', ''''||kind||'''', 2, ''''||tags||'''', ''||nsfw||'', ''||created_utc||'' FROM emojis WHERE submitter_id IS NULL and author_id != 2 ORDER BY name" \
|
||||
"$DATABASE_URL")
|
||||
EXPORT_EMOJIS=$(sed 's/.*/\(&\),/' <<< "$EXPORT_EMOJIS")
|
||||
echo "INSERT INTO public.emojis (name, kind, author_id, tags, nsfw, created_utc) VALUES" > "/d/seed-emojis-$SITE_NAME.sql"
|
||||
echo "${EXPORT_EMOJIS%?}" >> "/d/seed-emojis-$SITE_NAME.sql"
|
||||
echo "ON CONFLICT (name) DO UPDATE SET tags = EXCLUDED.tags;" >> "/d/seed-emojis-$SITE_NAME.sql"
|
||||
|
||||
#pull and push
|
||||
/d/scripts/g
|
||||
|
||||
#execute seed-emojis.sql of other site
|
||||
if [ $SITE_NAME == "rDrama" ]; then
|
||||
psql "$DATABASE_URL" -f /d/seed-emojis-WPD.sql
|
||||
else
|
||||
psql "$DATABASE_URL" -f /d/seed-emojis-rDrama.sql
|
||||
fi
|
||||
|
||||
#clear cache for ppl who have NSFW warnings enabled
|
||||
redis-cli del "${SITE}_flask_cache_emojis_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Platy_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Wolf_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Donkey Kong_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Tay_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Capy_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Carp_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey Flags_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey Alphabet_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Classic_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Rage_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Wojak_False"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Misc_False"
|
||||
|
||||
#clear cache for ppl who have NSFW warnings disabled
|
||||
redis-cli del "${SITE}_flask_cache_emojis_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Platy_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Wolf_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Donkey Kong_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Tay_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Capy_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Carp_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey Flags_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Marsey Alphabet_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Classic_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Rage_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Wojak_True"
|
||||
redis-cli del "${SITE}_flask_cache_emoji_list_Misc_True"
|
||||
|
||||
#sync original files
|
||||
rclone -P -L copy /asset_submissions/emojis/original yes:emojis-original
|
||||
rclone -P -L copy yes:emojis-original /asset_submissions/emojis/original
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO public.emojis (name, kind, author_id, tags, nsfw, created_utc) VALUES
|
||||
()
|
||||
ON CONFLICT (name) DO UPDATE SET tags = EXCLUDED.tags;
|
File diff suppressed because it is too large
Load Diff
|
@ -309,7 +309,7 @@ INSERT INTO public.emojis (name, kind, author_id, tags, nsfw) VALUES
|
|||
('carpchud','Carp',2,'smug carpathianflorist poljak fish glasses soyjak',false),
|
||||
('carpclapping','Carp',2,'applaud',false),
|
||||
('carpclapping2','Carp',2,'applause applaud yay cheering goodjob',false),
|
||||
('carpcleffa','Carp',2,'pokemon pkmn cleffa baby 0173',false),
|
||||
('carpcleffa','Carp',2,'pokemon pkmn cleffa baby 173',false),
|
||||
('carpclueless','Carp',2,'oblivious stupid',false),
|
||||
('carpcoingold','Carp',2,'money currency',false),
|
||||
('carpcoinsilver','Carp',2,'money currency',false),
|
||||
|
|
Loading…
Reference in New Issue