Some cleanup

- Removed CLOSEDVERSE_PROD.
- Removed duplicate settings in settings.py.
- Removed static exclusion when forcing the user to log in. Nginx should handle this anyways...
- Removed old unused HTML pages.
- Changed the way time is shown on profiles and in my_data.
- Additional HTML changes.
This commit is contained in:
some weird guy
2023-09-01 20:00:03 -07:00
parent a2e607fff3
commit 33fe45bc60
8 changed files with 16 additions and 84 deletions
+1 -13
View File
@@ -36,8 +36,6 @@ DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
STATIC_URL = '/s/' STATIC_URL = '/s/'
MEDIA_URL = '/i/' MEDIA_URL = '/i/'
CLOSEDVERSE_PROD = True
IMAGE_DELETE_SETTING = 2
# Application definition # Application definition
@@ -231,7 +229,6 @@ LOGIN_EXEMPT_URLS = {
r'^help/rules$', r'^help/rules$',
r'^help/contact$', r'^help/contact$',
r'^help/login$', r'^help/login$',
r'^s/.*$',
} }
# Action to perform on images belonging to posts/ # Action to perform on images belonging to posts/
@@ -248,7 +245,7 @@ invite_only = False
# Minimum level required to view IP addresses and user agents. (default: 10) # Minimum level required to view IP addresses and user agents. (default: 10)
# Mods under this level will still be able to manage users, however will not be able to view any sensitive data. # Mods under this level will still be able to manage users, however will not be able to view any sensitive data.
# Set this to 0 to prevent anyone from viewing data. # Set this to 0 to prevent anyone from viewing data.
min_lvl_metadata_perms = 0 min_lvl_metadata_perms = 10
# if someone's level is equal or above this, they can edit the most communities on your clone. # if someone's level is equal or above this, they can edit the most communities on your clone.
level_needed_to_man_communities = 5 level_needed_to_man_communities = 5
@@ -265,10 +262,6 @@ DATA_UPLOAD_MAX_MEMORY_SIZE = 52428800
# TODO, make this work for users who aren't logged in. # TODO, make this work for users who aren't logged in.
site_wide_theme_hex = 'ff4159' site_wide_theme_hex = 'ff4159'
# Option to delete image if it's local
# 0 - keep, 1 - move to 'rm' folder, 2 - DELETE
image_delete_opt = 0
# age (minimal 13 due to C.O.P.P.A) # age (minimal 13 due to C.O.P.P.A)
age_allowed = "13" age_allowed = "13"
@@ -283,11 +276,6 @@ memo_msg = """
<p>im bored</p> <p>im bored</p>
""" """
# This option enables some production-specific pages
# and routines, such as HTTPS scheme redirection and
# proxy detection via IPHub.
CLOSEDVERSE_PROD = True
XFF_TRUSTED_PROXY_DEPTH = 1 XFF_TRUSTED_PROXY_DEPTH = 1
XFF_STRICT = True XFF_STRICT = True
XFF_NO_SPOOFING = True XFF_NO_SPOOFING = True
@@ -158,14 +158,14 @@
<div class="data-content"> <div class="data-content">
<h4><span>Date Joined</span></h4> <h4><span>Date Joined</span></h4>
<div class="note"> <div class="note">
<span>{% time user.created True %}</span> <span>{% time user.created %}</span>
</div> </div>
</div> </div>
{% if not user.hide_online %} {% if not user.hide_online %}
<div class="data-content"> <div class="data-content">
<h4><span>Last Seen</span></h4> <h4><span>Last Seen</span></h4>
<div class="note"> <div class="note">
<span>{% time user.last_login True %}</span> <span>{% time user.last_login %}</span>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@@ -1,27 +0,0 @@
{% extends "closedverse_main/layout.html" %}
{% block main-body %}{% load closedverse_user %}
{% user_sidebar request user user.profile 0 True %}
<div class="main-column" id="help">
<!--
{% if user.is_staff and user.is_authenticated %}
<div class="notice" style="border: 1px solid #75ff7b;background-color: #c0ffc2;">
<p><b>Notice</b>: You are a staff member, you have permission to view redacted URLs.
</p></div>
{% endif %}
-->
<div class="notice">
<p><b>Notice</b>: Your IP and email are both viewable in MySQL. Use caution when using clones that are hosted by untrusted users.
</div>
<div class="post-list-outline">
<h2 class="label">Active clones</h2>
<div id="guide" class="help-content">
<div class="faq">
<h1>this clone</h1>
<p>uhh uhh youre using it now and its good enough</p>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -1,14 +0,0 @@
{% extends "closedverse_main/layout.html" %}
{% block main-body %}{% load closedverse_user %}
{% user_sidebar request user user.profile 0 True %}
<div class="main-column" id="help">
<div class="post-list-outline">
<h2 class="label">Our new approval system</h2>
<div id="guide" class="help-content">
<div class="faq">
<p>Placeholder</p>
</div>
</div>
</div>
</div>
{% endblock %}
@@ -11,7 +11,7 @@
<p>Signup IP address: <span>{% if user.signup_addr %}{{ user.signup_addr }}{% else %}Data missing{% endif %}</p> <p>Signup IP address: <span>{% if user.signup_addr %}{{ user.signup_addr }}{% else %}Data missing{% endif %}</p>
<p>Rank: <span>{% if user.staff %}You are a staff member.{% elif not user.level <= 0 %}You are a moderator. (Level {{ user.level }}){% else %}You are a regular user.{% endif %} <p>Rank: <span>{% if user.staff %}You are a staff member.{% elif not user.level <= 0 %}You are a moderator. (Level {{ user.level }}){% else %}You are a regular user.{% endif %}
<h3>My content:</h3> <h3>My content:</h3>
<p>Your account has existed for {{ age }} days! During that time, we've collected:</p> <p>Your account has existed for {{ user.created|timesince }}! During that time, we've collected:</p>
<ul> <ul>
<li>My posts: <span> {{ posts }} <li>My posts: <span> {{ posts }}
<li>My comments: <span> {{ comments }} <li>My comments: <span> {{ comments }}
@@ -33,18 +33,18 @@
<h3>Collected data:</h3> <h3>Collected data:</h3>
<div class="user-data"> <div class="user-data">
<p class="label">Account login history:</p> <p class="label">Account login history:</p>
<p>Each time you try and sign in to your account, we grab the <strong>IP</strong> and <strong>User agent</strong> from the device used. If you see any login attempts that you don't recognize as your own, you may want to change your password.</p> <p>Each time you sign in to your account, we grab the <strong>IP</strong> and <strong>User agent</strong> from the device used. If you see any login attempts that you don't recognize as your own, you may want to change your password.</p>
<table style="width:100%"> <table style="width:100%">
<tr> <tr>
<th>Time</th> <th>Time</th>
<th>Success</th> <!--<th>Success</th> not working right now -->
<th class="ip">IP</th> <th class="ip">IP</th>
<th>User agent</th> <th>User agent</th>
</tr> </tr>
{% for log_attempt in log_attempt %} {% for log_attempt in log_attempt %}
<tr> <tr>
<td>{{ log_attempt.created }}</td> <td>{{ log_attempt.created }}</td>
<td{% if not log_attempt.success %} style="border: #f44336 2px solid;"{% endif %}>{{ log_attempt.success }}</td> <!--<td{% if not log_attempt.success %} style="border: #f44336 2px solid;"{% endif %}>{{ log_attempt.success }}</td>-->
<td class="ip">{% if log_attempt.success %}{{ log_attempt.addr }}{% else %}REDACTED{% endif %}</td> <td class="ip">{% if log_attempt.success %}{{ log_attempt.addr }}{% else %}REDACTED{% endif %}</td>
<td>{{ log_attempt.user_agent }} <td>{{ log_attempt.user_agent }}
</tr> </tr>
@@ -6,11 +6,11 @@
<form class="setting-form" method="post" action={% url "main:user-tools-bans" user.username %}> <form class="setting-form" method="post" action={% url "main:user-tools-bans" user.username %}>
{% if not banned %} {% if not banned %}
<li class="setting"> <li class="setting">
<p class="settings-label">Reasoning:</p> <p class="settings-label">Why this user is banned:</p>
{{ form.reason }} {{ form.reason }}
<p class="settings-label">Expiry:</p> <p class="settings-label">Ban this user for:</p>
{{ form.expiry_date }} {{ form.expiry_date }}
<p class='note'>{{ user.username }} will be banned from {{ brand_name }} until the time is right.</p> <p class='note'>{{ user.username }} will be banned from {{ brand_name }} until the time runs out.</p>
</li> </li>
{% csrf_token %} {% csrf_token %}
<div class="form-buttons"> <div class="form-buttons">
@@ -24,7 +24,7 @@
<li class="setting"> <li class="setting">
<p class="settings-label">Edit Reasoning:</p> <p class="settings-label">Edit Reasoning:</p>
{{ form.reason }} {{ form.reason }}
<p class="settings-label">Change Expiry:</p> <p class="settings-label">Change Expiry date:</p>
{{ form.expiry_date }} {{ form.expiry_date }}
<p class="settings-label">Active:</p> <p class="settings-label">Active:</p>
{{ form.active }} {{ form.active }}
@@ -7,15 +7,15 @@
<li class="setting"> <li class="setting">
<p class="settings-label">Reasoning:</p> <p class="settings-label">Reasoning:</p>
{{ form.reason }} {{ form.reason }}
<p class='note'>Warnings will show as notifications. {{ user.username }} will not be able to post, comment, or message another user until this notification is seen. {{ user.username }} will not see who sent this warning.</p> <p class='note'>Warnings will show as notifications. {{ user.username }} will not be able to post, comment, or message another user until this notification is seen. {{ user.username }} will not see who sent this warning. Please add important details and context when specifying a reason.</p>
</li> </li>
<div class="user-data"> <div class="user-data">
{% if unread_warnings %}<li> {% if unread_warnings %}<li>
<p class='setting'>Warnings that have not been read yet:<p> <p class='setting'>Warnings notifications that have not been read yet:<p>
<table style="width:100%"> <table style="width:100%">
<tr> <tr>
<th>Time</th> <th>Time</th>
<th>Incident</th> <th>Reasoning</th>
</tr> </tr>
{% for Notifications in unread_warnings %} {% for Notifications in unread_warnings %}
<tr> <tr>
@@ -25,12 +25,12 @@
{% endfor %} {% endfor %}
</table>{% endif %} </table>{% endif %}
</li>{% if all_warnings %} </li>{% if all_warnings %}
<p class='setting'>Incident history:<p> <p class='setting'>Warning history:<p>
<table style="width:100%"> <table style="width:100%">
<tr> <tr>
<th>Time</th> <th>Time</th>
<th>Issued by</th> <th>Issued by</th>
<th>Incident</th> <th>Reasoning</th>
</tr> </tr>
{% for Warning in all_warnings %} {% for Warning in all_warnings %}
<tr> <tr>
-15
View File
@@ -1299,15 +1299,6 @@ def poll_unvote(request, poll):
@login_required @login_required
def user_follow(request, username): def user_follow(request, username):
user = get_object_or_404(User, username=username) user = get_object_or_404(User, username=username)
"""
if settings.CLOSEDVERSE_PROD:
# Issue 69420: PF2M is getting more follows than me.
if user.username == 'PF2M':
try:
User.objects.get(id=1).follow(request.user)
except:
pass
"""
if user.follow(request.user): if user.follow(request.user):
# Give the notification! # Give the notification!
Notification.give_notification(request.user, 4, user) Notification.give_notification(request.user, 4, user)
@@ -1898,9 +1889,6 @@ def my_data(request):
user = request.user user = request.user
log_attempt = LoginAttempt.objects.filter(user=user).order_by('-id')[:10] log_attempt = LoginAttempt.objects.filter(user=user).order_by('-id')[:10]
history = ProfileHistory.objects.filter(user=user).order_by('-id')[:10] history = ProfileHistory.objects.filter(user=user).order_by('-id')[:10]
creation_date = user.created.date()
datenow = timezone.now().date()
age = datenow - creation_date
return render(request, 'closedverse_main/help/my-data.html', { return render(request, 'closedverse_main/help/my-data.html', {
'user': user, 'user': user,
'log_attempt': log_attempt, 'log_attempt': log_attempt,
@@ -1910,7 +1898,6 @@ def my_data(request):
'messages': Message.objects.filter(creator=user).count(), 'messages': Message.objects.filter(creator=user).count(),
'yeahs': Yeah.objects.filter(by=user).count(), 'yeahs': Yeah.objects.filter(by=user).count(),
'notifications': Notification.objects.filter(to=user).count(), 'notifications': Notification.objects.filter(to=user).count(),
'age': round(age.days),
'title': 'My data', 'title': 'My data',
}) })
@login_required @login_required
@@ -1942,8 +1929,6 @@ def help_rules(request):
def help_faq(request): def help_faq(request):
return render(request, 'closedverse_main/help/faq.html', {'title': 'FAQ'}) return render(request, 'closedverse_main/help/faq.html', {'title': 'FAQ'})
def help_legal(request): def help_legal(request):
if not settings.CLOSEDVERSE_PROD:
return HttpResponseForbidden()
return render(request, 'closedverse_main/help/legal.html', {'title': "Legal Information"}) return render(request, 'closedverse_main/help/legal.html', {'title': "Legal Information"})
def help_contact(request): def help_contact(request):
return render(request, 'closedverse_main/help/contact.html', {'title': "Contact info"}) return render(request, 'closedverse_main/help/contact.html', {'title': "Contact info"})