Fixing broken CSS, HTML changes, invite page is hidden if turned off, mods can revoke invite privileges.

This commit is contained in:
some weird guy
2023-08-03 17:15:00 -07:00
parent 22b6a8f81f
commit a7828ce97c
12 changed files with 57 additions and 21 deletions
+10 -4
View File
@@ -1,5 +1,4 @@
# About # About
Cedar-Django is a fork of Closedverse with custom features added to it. Cedar-Django is a fork of Closedverse with custom features added to it.
### Theme changing ### Theme changing
@@ -14,8 +13,12 @@ You can have your users make communities. Each user by default can make one comm
### Password resetting within the settings page ### Password resetting within the settings page
**This should've been a thing since day one.** Instead of being forced to reset your password through your email, you can now change it via settings. **This should've been a thing since day one.** Instead of being forced to reset your password through your email, you can now change it via settings.
### Invite only features
**You can set `invite_only` to `True` if you want your site to be invite only** If you choose to make your website invite only, users can create invite codes and send them to others as a means of inviting new people to the website. Upon signing up, users are required to input a valid invite code in order to create an account. This can be useful for closed off communities or as a ditch effort to stop raids or whatever.
Moderators and staff will be able to revoke a user's ability to add new users if need be.
### Announcements appear on the side of the main page. ### Announcements appear on the side of the main page.
If you have an announcements community, each post will appear there. If you have an announcement community, each post will appear there.
`welcomemsgs` are visible on the front page when you aren't signed in. `welcomemsgs` are visible on the front page when you aren't signed in.
@@ -36,6 +39,9 @@ Can you rewrite this?
- Python 3 - Python 3
# Install time # Install time
Should probably say that this is a lazy way to do it. You should use a reverse proxy to deploy the server up for prod.
1. 1.
SSH into your server. SSH into your server.
@@ -49,7 +55,7 @@ You need Pip
4. 4.
Get everything else you need. Get everything else you need.
`pip3 install Django==3.2.2 urllib3 lxml passlib bcrypt pillow django-markdown-deux django-markdown2 whitenoise django-colorfield django-admin-interface` `pip3 install Django==3.2.2 urllib3 lxml passlib bcrypt pillow django-markdown-deux django-markdown2 whitenoise`
5. 5.
Clone the clone! Clone the clone!
@@ -146,4 +152,4 @@ sudo systemctl status django
18. 18.
The final stretch! The final stretch!
Set up your server with Cloudflare. You need a domain name, and you need patience, as this can take some time to take effect. Set up your server with Cloudflare. You need a domain name, and you need patience, as this can take some time to take effect.
If you do this final step right, Cedar should be working fine, and it should have HTTPS working too! If you do this final step right, Cedar should be working fine, and it should have HTTPS working too!
+1 -1
View File
@@ -239,7 +239,7 @@ inactive_redirect = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
# Option to delete image if it's local # Option to delete image if it's local
# 0 - keep, 1 - move to 'rm' folder, 2 - DELETE # 0 - keep, 1 - move to 'rm' folder, 2 - DELETE
image_delete_opt = 0 IMAGE_DELETE_SETTING = 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"
+1 -1
View File
@@ -1,4 +1,4 @@
{% extends "closedverse_main/layout.html" %} {% extends "closedverse_main/layout.html" %}
{% load closedverse_tags %}{% block main-body %} {% load closedverse_tags %}{% block main-body %}
{% nocontent "If you're not careful and you noclip out of reality in the wrong areas, you'll end up in the Backrooms, where it's nothing but the stink of old moist carpet, the madness of mono-yellow, the endless background noise of fluorescent lights at maximum hum-buzz, and approximately six hundred million square miles of randomly segmented empty rooms to be trapped in. God save you if you hear something wandering around nearby, because it sure as hell has heard you." %} {% nocontent "There's nothing here." %}
{% endblock %} {% endblock %}
@@ -84,12 +84,16 @@
<div id="guide-menu"> <div id="guide-menu">
<a class="arrow-button" href="{% url "main:help-why" %}"><span>Why join?</span></a> <a class="arrow-button" href="{% url "main:help-why" %}"><span>Why join?</span></a>
<a class="arrow-button" href="{% url "main:help-rules" %}"><span>{{ brand_name }} Rules</span></a> <a class="arrow-button" href="{% url "main:help-rules" %}"><span>{{ brand_name }} Rules</span></a>
{% if request.user.is_authenticated %}
<a class="arrow-button" href="{% url "main:my-data" %}"><span>My Data</span></a>
{% endif %}
<a class="arrow-button" href="{% url "main:help-faq" %}"><span>Frequently Asked Questions (FAQ)</span></a> <a class="arrow-button" href="{% url "main:help-faq" %}"><span>Frequently Asked Questions (FAQ)</span></a>
<a class="arrow-button" href="{% url "main:what-ads" %}"><span>What are user-generated ads?</span></a> <a class="arrow-button" href="{% url "main:what-ads" %}"><span>What are user-generated ads?</span></a>
{% if settings.CLOSEDVERSE_PROD %} {% if settings.CLOSEDVERSE_PROD %}
<a class="arrow-button" href="{% url "main:help-contact" %}"><span>Contact information</span></a> <a class="arrow-button" href="{% url "main:help-contact" %}"><span>Contact information</span></a>
{% endif %} {% endif %}
<a class="arrow-button" href="https://pf2m.com/openverse/"><span>Info about Openverse</span></a> <a class="arrow-button" href="https://github.com/ariankordi/closedverse"><span>Closedverse Github</span></a>
<a class="arrow-button" href="https://github.com/Mistake35/Cedar-Django"><span>Cedar-Django Github</span></a>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
@@ -104,6 +104,7 @@
<menu id="global-menu"> <menu id="global-menu">
<li id="global-menu-logo"><h1><a href="/"><img src="{% static "img/menu-logo.svg" %}" alt="Cedar"></a></h1></li> <li id="global-menu-logo"><h1><a href="/"><img src="{% static "img/menu-logo.svg" %}" alt="Cedar"></a></h1></li>
{% if request.user.unique_id %} {% if request.user.unique_id %}
{% invite_only request as inv %}
<li id="global-menu-list"> <li id="global-menu-list">
<ul> <ul>
<li id="global-menu-mymenu"><a href="{% url "main:user-view" request.user.username %}"><span class="icon-container {% user_class request.user %}"><img src="{% avatar request.user %}" alt="My Profile"></span><span>My Profile</span></a></li> <li id="global-menu-mymenu"><a href="{% url "main:user-view" request.user.username %}"><span class="icon-container {% user_class request.user %}"><img src="{% avatar request.user %}" alt="My Profile"></span><span>My Profile</span></a></li>
@@ -115,7 +116,7 @@
<menu id="global-my-menu" class="invisible none"> <menu id="global-my-menu" class="invisible none">
<li><a href="{% url "main:profile-settings" %}" class="symbol my-menu-profile-setting"><span>Profile settings</span></a></li> <li><a href="{% url "main:profile-settings" %}" class="symbol my-menu-profile-setting"><span>Profile settings</span></a></li>
<li><a href="#" class="symbol my-menu-account-setting"><span>Account preferences</span></a></li> <li><a href="#" class="symbol my-menu-account-setting"><span>Account preferences</span></a></li>
<li><a href="{% url "main:invites" %}" class="symbol my-menu-guide"><span>Invites</span></a></li> {% if inv %}<li><a href="{% url "main:invites" %}" class="symbol my-menu-guide"><span>Invites</span></a></li>{% endif %}
<li><a href="{% url "main:special-community-tag" "announcements" %}" class="symbol my-menu-openman"><span>Cedar Announcements</span></a></li> <li><a href="{% url "main:special-community-tag" "announcements" %}" class="symbol my-menu-openman"><span>Cedar Announcements</span></a></li>
<li><a href="{% url "main:help-faq" %}" class="symbol my-menu-guide"><span>Frequently Asked Questions (FAQ)</span></a></li> <li><a href="{% url "main:help-faq" %}" class="symbol my-menu-guide"><span>Frequently Asked Questions (FAQ)</span></a></li>
<li><a href="{% url "main:help-rules" %}" class="symbol my-menu-guide"><span>Cedar Rules</span></a></li> <li><a href="{% url "main:help-rules" %}" class="symbol my-menu-guide"><span>Cedar Rules</span></a></li>
@@ -43,6 +43,8 @@
<p class="note">If you need to set a post limit for someone, you can do that here, Set this back to "0" to remove the restriction.</p> <p class="note">If you need to set a post limit for someone, you can do that here, Set this back to "0" to remove the restriction.</p>
<input type="checkbox" name="let_freedom" {% if not profile.let_freedom %}checked{% endif %}>Restrict image posting: <input type="checkbox" name="let_freedom" {% if not profile.let_freedom %}checked{% endif %}>Restrict image posting:
<p class="note">If you need to prevent someone from posting images and URLs, you can do that here. This will also prevent this user from making new accounts on the same IP address.</p> <p class="note">If you need to prevent someone from posting images and URLs, you can do that here. This will also prevent this user from making new accounts on the same IP address.</p>
<input type="checkbox" name="can_invite" {% if not user.can_invite %}checked{% endif %}>Restrict invite creation:
<p class="note">This site has an invitation function. If this invite function is active, users will need a code to sign up. Every user can make a code as long as they are allowed to do so. Check this box to prevent this user from making invites.</p>
</li> </li>
<ul> <ul>
<li class="setting"> <li class="setting">
@@ -59,11 +61,27 @@
<li class="setting"> <li class="setting">
<div class="center center-input"> <div class="center center-input">
<p class="settings-label">Metadata:</p> <p class="settings-label">Metadata:</p>
<div class="user-data">
<p>User agent: <span>{% if user.user_agent %}{{ user.user_agent }}{% else %}Data missing{% endif %}
<p>Rank: <span>{% if user.staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %}
<p>&nbsp;</p>
</div>
{% if request.user.level >= min_lvl_metadata_perms %} {% if request.user.level >= min_lvl_metadata_perms %}
<p class='red'>Each time you view someone's private info, a log is created.</p> <a class='button' href="{% url "main:user-tools-meta" user.username %}">View private info</a>
<a href="{% url "main:user-tools-meta" user.username %}">View private info</a>
{% endif %} {% endif %}
</div> </div>
{% if accountmatch %}
<h3>Account(s) found with the same IP address.</h3>
<div class="user-data">
<table style="width:100%">
{% for accountmatch in accountmatch %}
<tr>
<td><a href={% url "main:user-view" accountmatch.username %}>{{ accountmatch.username }}</a></td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
{% if seen_by %} {% if seen_by %}
<h3>Account viewed by:</h3> <h3>Account viewed by:</h3>
<div class="user-data"> <div class="user-data">
@@ -5,13 +5,13 @@
<h2 class="label">View info for {{ user.username }}</h2> <h2 class="label">View info for {{ user.username }}</h2>
<div class="help-content"> <div class="help-content">
<p class="settings-label">Account metadata: Mods under level {{ min_lvl_metadata_perms }} can't see this.</p> <p class="settings-label">Account metadata: Mods under level {{ min_lvl_metadata_perms }} can't see this.</p>
<p class='red'>Each time you view someone's metadata, a log is created.</p>
<div class="user-data"> <div class="user-data">
<p>Like any other site, we collect small bits of information from accounts for security reasons. <p>Like any other site, we collect small bits of information from accounts for security reasons.
<h3>General account information:</h3> <h3>General account information:</h3>
<p>IP address: <span>{% if user.addr %}{{ user.addr }}{% else %}Data missing{% endif %} <p>IP address: <span>{% if user.addr %}{{ user.addr }}{% else %}Data missing{% endif %}
<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>User agent: <span>{% if user.user_agent %}{{ user.user_agent }}{% else %}Data missing{% endif %} <p>User agent: <span>{% if user.user_agent %}{{ user.user_agent }}{% else %}Data missing{% endif %}
<p>Email: <span>{% if user.email %}{{ user.email }}{% else %}Data missing{% endif %}
<p>Rank: <span>{% if user.staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %} <p>Rank: <span>{% if user.staff %}Staff member.{% elif not user.level <= 0 %}Moderator. (Level {{ user.level }}){% else %}Regular user.{% endif %}
</div> </div>
{% if accountmatch %} {% if accountmatch %}
@@ -24,7 +24,7 @@
</tr> </tr>
{% for accountmatch in accountmatch %} {% for accountmatch in accountmatch %}
<tr> <tr>
<td>{{ accountmatch.username }}</td> <td><a href={% url "main:user-view" accountmatch.username %}>{{ accountmatch.username }}</a></td>
<td>{{ accountmatch.created }}</td> <td>{{ accountmatch.created }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -179,7 +179,7 @@
<li class="setting-background"> <li class="setting-background">
<p class="settings-label">Change your password:</p> <p class="settings-label">Change your password:</p>
<div class="center center-input"> <div class="center center-input">
<p class="note">You can now <a href="{% url "main:change-password" %}">change your password</a>.</p> <a class="button" href={% url "main:change-password" %}>Change password</a>
</div> </div>
</li> </li>
<li class="setting-nnid"> <li class="setting-nnid">
@@ -11,7 +11,7 @@ register = template.Library()
def avatar(user, feeling=0): def avatar(user, feeling=0):
return user.do_avatar(feeling) return user.do_avatar(feeling)
@register.simple_tag @register.simple_tag
def invite_only(settings): def invite_only(request):
if settings.invite_only: if settings.invite_only:
return True return True
else: else:
+7 -5
View File
@@ -1680,11 +1680,9 @@ def user_tools(request, username):
seen_by = MetaViews.objects.filter(target_user=user).distinct().order_by('-id')[:10] seen_by = MetaViews.objects.filter(target_user=user).distinct().order_by('-id')[:10]
has_seen = MetaViews.objects.filter(from_user=user).distinct().order_by('-id')[:10] has_seen = MetaViews.objects.filter(from_user=user).distinct().order_by('-id')[:10]
''' accountmatch = User.objects.filter(
findattempt = LoginAttempt.objects.filter(user=user).order_by('-id')[:1] Q(addr=user.addr) | Q(addr=user.signup_addr)
for findattempt in findattempt: ).exclude(username=user.username)
accountmatch = LoginAttempt.objects.filter(addr__in=[findattempt.addr])
'''
return render(request, 'closedverse_main/man/usertools.html', { return render(request, 'closedverse_main/man/usertools.html', {
'title': 'Admin tools', 'title': 'Admin tools',
@@ -1692,6 +1690,7 @@ def user_tools(request, username):
'seen_by': seen_by, 'seen_by': seen_by,
'has_seen': has_seen, 'has_seen': has_seen,
'profile': profile, 'profile': profile,
'accountmatch': accountmatch,
'min_lvl_metadata_perms': settings.min_lvl_metadata_perms, 'min_lvl_metadata_perms': settings.min_lvl_metadata_perms,
}) })
@@ -1772,6 +1771,7 @@ def user_tools_set(request, username):
user.warned = False if request.POST.get('warned') is None else True user.warned = False if request.POST.get('warned') is None else True
profile.let_freedom = True if request.POST.get('let_freedom') is None else False profile.let_freedom = True if request.POST.get('let_freedom') is None else False
profile.cannot_edit = False if request.POST.get('cannot_edit') is None else True profile.cannot_edit = False if request.POST.get('cannot_edit') is None else True
user.can_invite = True if request.POST.get('can_invite') is None else False
purge_posts = False if request.POST.get('purge_posts') is None else True purge_posts = False if request.POST.get('purge_posts') is None else True
purge_comments = False if request.POST.get('purge_comments') is None else True purge_comments = False if request.POST.get('purge_comments') is None else True
@@ -1796,6 +1796,8 @@ def user_tools_set(request, username):
raise Http404() raise Http404()
def invites(request): def invites(request):
if not settings.invite_only:
raise Http404()
if not request.user.is_authenticated: if not request.user.is_authenticated:
raise Http404() raise Http404()
invites_list = Invites.objects.filter(creator=request.user, used=False, void=False) invites_list = Invites.objects.filter(creator=request.user, used=False, void=False)
+4
View File
@@ -414,6 +414,10 @@ form.search {
background: #fff; background: #fff;
border: 2px solid #000; border: 2px solid #000;
} }
.Announcement-content {
background: var(--theme-dark, #202030);
border: #000 solid 1px;
}
.sidebar-setting a { .sidebar-setting a {
color: #ccc; color: #ccc;
border-top: 1px solid #000; border-top: 1px solid #000;
+3 -2
View File
@@ -82,13 +82,14 @@ button {
width: 175px; width: 175px;
} }
.Announcement-content { .Announcement-content {
background: var(--theme-dark, #202030); border: 1px solid #00000045;
border: 1px solid black;
border-radius: 6px; border-radius: 6px;
padding: 6px; padding: 6px;
padding-bottom: 6px;
margin-bottom: 12px; margin-bottom: 12px;
text-align: left; text-align: left;
padding-bottom: 22px; padding-bottom: 22px;
background: white;
} }
.Announcement-content .Announcement-image { .Announcement-content .Announcement-image {
padding-top: 6px; padding-top: 6px;