forked from rDrama/rDrama
rename dm_images to dm_media
parent
6116fdceb4
commit
519fbef9a7
|
@ -20,7 +20,7 @@ RUN pip3 install -r /requirements.txt
|
|||
|
||||
RUN mkdir /images
|
||||
RUN mkdir /chat_images
|
||||
RUN mkdir /dm_images
|
||||
RUN mkdir /dm_media
|
||||
RUN mkdir /songs
|
||||
RUN mkdir /temp_songs
|
||||
RUN mkdir /videos
|
||||
|
|
|
@ -495,7 +495,7 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'VIEW_PATRONS': 5,
|
||||
'BLACKJACK_NOTIFICATIONS': 5,
|
||||
'IGNORE_BADGE_BLACKLIST': 5,
|
||||
'ENABLE_DM_IMAGES': 5,
|
||||
'ENABLE_DM_MEDIA': 5,
|
||||
'SEE_GHOST_VOTES': 5,
|
||||
'SITE_OFFLINE_MODE': 5,
|
||||
'MODS_EVERY_HOLE': 5,
|
||||
|
|
|
@ -96,7 +96,7 @@ MODACTION_TYPES = {
|
|||
"icon": 'fa-shield',
|
||||
"color": 'bg-muted'
|
||||
},
|
||||
'disable_dm_images': {
|
||||
'disable_dm_media': {
|
||||
"str": 'disabled DM images',
|
||||
"icon": 'fa-images',
|
||||
"color": 'bg-muted'
|
||||
|
@ -166,7 +166,7 @@ MODACTION_TYPES = {
|
|||
"icon": 'fa-shield',
|
||||
"color": 'bg-success',
|
||||
},
|
||||
'enable_dm_images': {
|
||||
'enable_dm_media': {
|
||||
"str": 'enabled DM images',
|
||||
"icon": 'fa-images',
|
||||
"color": 'bg-success',
|
||||
|
|
|
@ -60,7 +60,7 @@ def process_files(files, v, body, is_dm=False, dm_user=None):
|
|||
body = body.replace(f'[{file.filename}]', f' {url} ', 1)
|
||||
|
||||
if is_dm:
|
||||
with open(f"{LOG_DIRECTORY}/dm_images.log", "a+", encoding="utf-8") as f:
|
||||
with open(f"{LOG_DIRECTORY}/dm_media.log", "a+", encoding="utf-8") as f:
|
||||
if dm_user:
|
||||
f.write(f'{url}, {v.username}, {v.id}, {dm_user.username}, {dm_user.id}, {int(time.time())}\n')
|
||||
else:
|
||||
|
|
|
@ -15,7 +15,7 @@ _SETTINGS = {
|
|||
"offline_mode": False,
|
||||
"signups": True,
|
||||
"under_siege": False,
|
||||
"dm_images": True,
|
||||
"dm_media": True,
|
||||
"ddos_detected": False
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ def loggedout_list(v):
|
|||
users = sorted([val[1] for x,val in cache.get('loggedout').items() if time.time()-val[0] < LOGGEDIN_ACTIVE_TIME])
|
||||
return render_template("admin/loggedout.html", v=v, users=users)
|
||||
|
||||
@app.get('/admin/dm_images')
|
||||
@app.get('/admin/dm_media')
|
||||
@limiter.limit(DEFAULT_RATELIMIT)
|
||||
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
|
||||
@admin_level_required(PERMS['ENABLE_DM_IMAGES'])
|
||||
def dm_images(v):
|
||||
with open(f"{LOG_DIRECTORY}/dm_images.log", "r", encoding="utf-8") as f:
|
||||
@admin_level_required(PERMS['ENABLE_DM_MEDIA'])
|
||||
def dm_media(v):
|
||||
with open(f"{LOG_DIRECTORY}/dm_media.log", "r", encoding="utf-8") as f:
|
||||
items=f.read().split("\n")[:-1]
|
||||
|
||||
total = len(items)
|
||||
|
@ -61,7 +61,7 @@ def dm_images(v):
|
|||
secondrange = firstrange + PAGE_SIZE
|
||||
items = items[firstrange:secondrange]
|
||||
|
||||
return render_template("admin/dm_images.html", v=v, items=items, total=total, page=page)
|
||||
return render_template("admin/dm_media.html", v=v, items=items, total=total, page=page)
|
||||
|
||||
@app.get('/admin/edit_rules')
|
||||
@limiter.limit(DEFAULT_RATELIMIT)
|
||||
|
|
|
@ -541,7 +541,7 @@ def message2(v:User, username:str):
|
|||
|
||||
body = sanitize_raw_body(request.values.get("message"), False)
|
||||
|
||||
if not g.is_tor and get_setting("dm_images"):
|
||||
if not g.is_tor and get_setting("dm_media"):
|
||||
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] #process_files potentially adds characters to the post
|
||||
|
||||
|
@ -618,7 +618,7 @@ def messagereply(v:User):
|
|||
and hasattr(user, 'is_blocked') and user.is_blocked):
|
||||
abort(403, f"You're blocked by @{user.username}")
|
||||
|
||||
if not g.is_tor and get_setting("dm_images"):
|
||||
if not g.is_tor and get_setting("dm_media"):
|
||||
body = process_files(request.files, v, body, is_dm=True, dm_user=user)
|
||||
body = body.strip()[:COMMENT_BODY_LENGTH_LIMIT] #process_files potentially adds characters to the post
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
<h4>Content</h4>
|
||||
<ul>
|
||||
{% if v.admin_level >= PERMS['ENABLE_DM_IMAGES'] %}
|
||||
<li><a href="/admin/dm_images">DM Images</a></li>
|
||||
{% if v.admin_level >= PERMS['ENABLE_DM_MEDIA'] %}
|
||||
<li><a href="/admin/dm_media">DM Images</a></li>
|
||||
{% endif %}
|
||||
<li><a href="/log">Moderation Log</a></li>
|
||||
{% if v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}
|
||||
|
|
|
@ -545,7 +545,7 @@
|
|||
<div class="comment-format" id="comment-format-bar-{{c.id}}">
|
||||
<button type="button" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('reply-form-body-{{c.id}}')" class="btn btn-secondary format m-0" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"><i class="fas fa-smile-beam"></i></button>
|
||||
|
||||
{{macros.file_input('file-upload-reply-' ~ c.fullname, False, not get_setting('dm_images'))}}
|
||||
{{macros.file_input('file-upload-reply-' ~ c.fullname, False, not get_setting('dm_media'))}}
|
||||
</div>
|
||||
|
||||
<div class="ml-auto">
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
|
||||
<button type="button" class="btn btn-secondary format d-inline-block m-0 py-2 fas fa-smile-beam" data-nonce="{{g.nonce}}" data-onclick="loadEmojis('input-message')" data-bs-toggle="modal" data-bs-target="#emojiModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add Emoji"></button>
|
||||
|
||||
{{macros.file_input('file-upload-macro', False, not get_setting('dm_images'))}}
|
||||
{{macros.file_input('file-upload-macro', False, not get_setting('dm_media'))}}
|
||||
|
||||
<input type="submit" data-nonce="{{g.nonce}}" data-onclick="remove_dialog()" value="Submit" class="btn btn-primary fl-r">
|
||||
</form>
|
||||
|
|
|
@ -40,7 +40,7 @@ pip3 install -r requirements.txt
|
|||
|
||||
mkdir /images
|
||||
mkdir /chat_images
|
||||
mkdir /dm_images
|
||||
mkdir /dm_media
|
||||
mkdir /songs
|
||||
mkdir /temp_songs
|
||||
mkdir /videos
|
||||
|
|
Loading…
Reference in New Issue