mirror of
https://github.com/Mistake35/Cedar-Django.git
synced 2026-07-17 16:11:14 +10:00
Discord video support and more cleaning up
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
from django.contrib import admin
|
||||
from .models import UsersBan
|
||||
|
||||
# Register your models here.
|
||||
|
||||
class UsersBanModel(admin.ModelAdmin):
|
||||
list_display = ['user', 'ban', ]
|
||||
list_filter = ('ban', )
|
||||
search_fields = ('user__username', 'user__id', 'user__first_name', 'user__last_name')
|
||||
|
||||
'''
|
||||
admin.site.register(UsersBan, UsersBanModel)
|
||||
'''
|
||||
@@ -1,5 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BanConfig(AppConfig):
|
||||
name = 'ban'
|
||||
@@ -1,22 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponseForbidden
|
||||
from .models import UsersBan
|
||||
|
||||
class BanManagement():
|
||||
"""Users Management"""
|
||||
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
response = self.get_response(request)
|
||||
|
||||
if(UsersBan.objects.all().filter(ban=True, user_id=request.user.id)):
|
||||
return HttpResponseForbidden('Commit suicide')
|
||||
elif request.user.is_authenticated:
|
||||
if not request.user.is_active():
|
||||
return HttpResponseForbidden(request.user.warned_reason)
|
||||
else:
|
||||
return response
|
||||
else:
|
||||
return response
|
||||
@@ -1,29 +0,0 @@
|
||||
# Generated by Django 3.2.3 on 2022-02-28 20:18
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='UsersBan',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ban', models.BooleanField(default=False, help_text='Users Bans', verbose_name='Ban')),
|
||||
('user', models.ForeignKey(help_text='Choose Username', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User name')),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Ban Management',
|
||||
'ordering': ('user',),
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
# Generated by Django 3.2.3 on 2022-09-03 21:00
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ban', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='usersban',
|
||||
name='reason',
|
||||
field=models.CharField(blank=True, max_length=1024, null=True),
|
||||
),
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
# Generated by Django 3.2.3 on 2022-09-03 21:03
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('ban', '0002_usersban_reason'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='usersban',
|
||||
name='reason',
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,16 +0,0 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class UsersBan(models.Model):
|
||||
user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name="User name", help_text="Choose Username", on_delete=models.CASCADE)
|
||||
|
||||
ban = models.BooleanField(default=False, verbose_name="Ban", help_text="Users Bans")
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Ban Management"
|
||||
ordering = ('user', )
|
||||
|
||||
def __str__(self):
|
||||
return '{}'.format(self.user)
|
||||
@@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<p>commit suicide</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
@@ -59,9 +59,7 @@ MIDDLEWARE = [
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
'ban.middleware.BanManagement',
|
||||
'closedverse_main.middleware.ClosedMiddleware',
|
||||
'maintenance.middleware.MaintenanceManagement',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware'
|
||||
]
|
||||
|
||||
|
||||
@@ -812,6 +812,15 @@ class Post(models.Model):
|
||||
except:
|
||||
return False
|
||||
return thing
|
||||
def discord_vid(self):
|
||||
try:
|
||||
thing = re.search('(https?://)?(www\.)?(cdn)?(discordapp)\.(com)/attachments/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/(.+)', self.url).group(8)
|
||||
if thing.endswith(".mp4") or thing.endswith(".webm"):
|
||||
return thing
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
def has_line_trun(self):
|
||||
if self.body and len(self.body.splitlines()) > 10:
|
||||
return True
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
<div class="body post-content">
|
||||
{% if post.yt_vid %}
|
||||
<a href="{% url "main:post-view" post.id %}" class="screenshot-container video"><img height="48" src="https://i.ytimg.com/vi/{{ post.yt_vid }}/default.jpg"></a>
|
||||
{% elif post.discord_vid %}
|
||||
<div class="DiscordCDN-container video">
|
||||
<video class="discord-player" src="{{ post.url }}" controls></video>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if post.drawing %}
|
||||
<p class="post-content-memo"><img src="{{ post.drawing }}" class="post-memo"></p>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
|
||||
{% if user.has_freedom %}
|
||||
<input type="text" class="textarea-line url-form" name="url" placeholder="URL/YT video" maxlength="1024">
|
||||
<input type="text" class="textarea-line url-form" name="url" placeholder="URL/YT/Discord video" maxlength="1024">
|
||||
{% file_button %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
</p>
|
||||
{% if post.yt_vid %}
|
||||
<a href="{% url "main:post-view" post.id %}" class="screenshot-container video"><img height="48" src="https://i.ytimg.com/vi/{{ post.yt_vid }}/default.jpg"></a>
|
||||
{% elif post.discord_vid %}
|
||||
<div class="screenshot-container video"><video src="{{ post.url }}" width="50" height="48"></video></div>
|
||||
{% endif %}
|
||||
{% if post.screenshot %}
|
||||
<a href="{% url "main:post-view" post.id %}" class="screenshot-container still-image"><img src="{{ post.screenshot }}"></a>
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
|
||||
{% if post.yt_vid %}
|
||||
<div class="screenshot-container video"><iframe class="youtube-player" type="text/html" width="490" height="276" src="https://www.youtube.com/embed/{{ post.yt_vid }}?rel=0&modestbranding=1&iv_load_policy=3" frameborder="0"></iframe></div>
|
||||
{% elif post.discord_vid %}
|
||||
<div class="DiscordCDN-container video">
|
||||
<video class="discord-player" src="{{ post.url }}" controls></video>
|
||||
</div>
|
||||
<a>Discord embedded video</a>
|
||||
{% elif post.url %}
|
||||
<p class="url-link"><a class="link-confirm" href="{{ post.url }}" target="_blank">{{ post.url }}</a></p>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -157,12 +157,6 @@ def filterchars(str=""):
|
||||
for char in forbid:
|
||||
if char in str:
|
||||
str = str.replace(char, " ")
|
||||
if str.isspace():
|
||||
try:
|
||||
girls = json.load(open(settings.BASE_DIR + '/girls.json'))
|
||||
except:
|
||||
girls = ['None']
|
||||
return choice(girls)
|
||||
return str
|
||||
|
||||
# Check IP for proxy.
|
||||
@@ -173,12 +167,3 @@ def iphub(addr):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
# NNID blacklist check
|
||||
def nnid_blacked(nnid):
|
||||
blacklist = json.load(open(settings.nnid_forbiddens))
|
||||
# The NNID server omits dashes and dots from NNIDs, gotta make sure nobody gets through this
|
||||
nnid = nnid.lower().replace('-', '').replace('.', '')
|
||||
if nnid in blacklist:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -287,9 +287,6 @@ def signup_page(request):
|
||||
else:
|
||||
spamuser = True
|
||||
if request.POST['origin_id']:
|
||||
if settings.nnid_forbiddens:
|
||||
if nnid_blacked(request.POST['origin_id']):
|
||||
return HttpResponseForbidden("You are very funny. Unfortunately, your funniness blah blah blah fuck off.")
|
||||
if User.nnid_in_use(request.POST['origin_id']):
|
||||
return HttpResponseBadRequest("That Nintendo Network ID is already in use, that would cause confusion.")
|
||||
mii = get_mii(request.POST['origin_id'])
|
||||
@@ -408,9 +405,6 @@ def user_view(request, username):
|
||||
return json_response("Your e-mail address is invalid. Input an e-mail address, or input nothing.")
|
||||
if User.nnid_in_use(request.POST.get('origin_id'), request):
|
||||
return json_response("That Nintendo Network ID is already in use, that would cause confusion.")
|
||||
if settings.nnid_forbiddens:
|
||||
if nnid_blacked(request.POST['origin_id']):
|
||||
return json_response("You are very funny. Unfortunately, your funniness blah blah blah fuck off.")
|
||||
if user.has_plain_avatar():
|
||||
user.avatar = request.POST.get('avatar') or ''
|
||||
if request.POST.get('avatar') == '1':
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
[
|
||||
|
||||
]
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
[
|
||||
"Abigail",
|
||||
"Addison",
|
||||
"Alexa",
|
||||
"Alexis",
|
||||
"Alice",
|
||||
"Alyssa",
|
||||
"Amelia",
|
||||
"Amy",
|
||||
"Anna",
|
||||
"Annabelle",
|
||||
"Aubrey",
|
||||
"Audrey",
|
||||
"Aurelie",
|
||||
"Aurora",
|
||||
"Autumn",
|
||||
"Ava",
|
||||
"Avery",
|
||||
"Blake",
|
||||
"Brooke",
|
||||
"Brooklyn",
|
||||
"Callie",
|
||||
"Charlie",
|
||||
"Charlotte",
|
||||
"Chloe",
|
||||
"Claire",
|
||||
"Clara",
|
||||
"Eleanor",
|
||||
"Elena",
|
||||
"Elisabeth",
|
||||
"Elise",
|
||||
"Elizabeth",
|
||||
"Ella",
|
||||
"Ellie",
|
||||
"Eloise",
|
||||
"Emilia",
|
||||
"Emilie",
|
||||
"Emily",
|
||||
"Emma",
|
||||
"Eva",
|
||||
"Eve",
|
||||
"Evelyn",
|
||||
"Everly",
|
||||
"Florence",
|
||||
"Gabrielle",
|
||||
"Georgia",
|
||||
"Hannah",
|
||||
"Hazel",
|
||||
"Isabella",
|
||||
"Isabelle",
|
||||
"Isla",
|
||||
"Ivy",
|
||||
"Jade",
|
||||
"Jeanne",
|
||||
"Jessie",
|
||||
"Julie",
|
||||
"Juliette",
|
||||
"Kate",
|
||||
"Laura",
|
||||
"Layla",
|
||||
"Leah",
|
||||
"Leanne",
|
||||
"Lexie",
|
||||
"Lila",
|
||||
"Lillian",
|
||||
"Lily",
|
||||
"Lucy",
|
||||
"Luna",
|
||||
"Mackenzie",
|
||||
"Madelyn",
|
||||
"Madison",
|
||||
"Maely",
|
||||
"Maika",
|
||||
"Malika",
|
||||
"Maria",
|
||||
"Maya",
|
||||
"Megan",
|
||||
"Melodie",
|
||||
"Mia",
|
||||
"Mila",
|
||||
"Mya",
|
||||
"Naomi",
|
||||
"Natalie",
|
||||
"Nora",
|
||||
"Norah",
|
||||
"Nova",
|
||||
"Olivia",
|
||||
"Paige",
|
||||
"Paisley",
|
||||
"Penelope",
|
||||
"Peyton",
|
||||
"Piper",
|
||||
"Quinn",
|
||||
"Riley",
|
||||
"Rosalie",
|
||||
"Rose",
|
||||
"Ruby",
|
||||
"Samantha",
|
||||
"Sara",
|
||||
"Sarah",
|
||||
"Scarlett",
|
||||
"Sienna",
|
||||
"Simone",
|
||||
"Sophia",
|
||||
"Sophie",
|
||||
"Stella",
|
||||
"Taylor",
|
||||
"Victoria",
|
||||
"Violet",
|
||||
"Willow",
|
||||
"Zoe",
|
||||
"Zoey"
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MaintenanceConfig(AppConfig):
|
||||
name = 'maintenance'
|
||||
@@ -1,37 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
from closedverse_main.models import User
|
||||
from django.conf import settings
|
||||
|
||||
in_maintenance = False
|
||||
|
||||
class MaintenanceManagement():
|
||||
"""Maintenance Management"""
|
||||
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
response = self.get_response(request)
|
||||
current_url = request.path_info
|
||||
SURL = settings.STATIC_URL
|
||||
|
||||
if(in_maintenance):
|
||||
if SURL in current_url:
|
||||
return response
|
||||
else:
|
||||
return render(request, 'mv.html')
|
||||
else:
|
||||
return response
|
||||
'''
|
||||
try:
|
||||
if SURL in current_url:
|
||||
return response
|
||||
elif not(User.is_staff(request.user)):
|
||||
return render(request, 'mv.html')
|
||||
else:
|
||||
return response
|
||||
except:
|
||||
return render(request, 'mv.html')
|
||||
else:
|
||||
return response
|
||||
'''
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
@@ -1 +0,0 @@
|
||||
<p>down for a few fixing stuffs rn brb i guess</p>
|
||||
@@ -1,5 +0,0 @@
|
||||
{% extends "closedverse_main/layout.html" %}
|
||||
{% load static %}
|
||||
{% load closedverse_tags %}{% block main-body %}
|
||||
{% nocontent "Website SUSpended by Cloudflare for (extreme) bullying and harassment!" %}
|
||||
{% endblock %}
|
||||
@@ -1,42 +0,0 @@
|
||||
<html lang="en" data-lt-installed="true"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" type="text/css" href="cid:[email protected]">
|
||||
|
||||
<title>Cedar</title>
|
||||
<link href="https://web.archive.org/web/20190311224941im_/https://i.miiverse.nintendo.net/favicon.ico" rel="shortcut icon">
|
||||
<link href="https://web.archive.org/web/20190311224941cs_/https://miiverse.nintendo.net/css/miiverse.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body class="simple-wrapper simple-wrapper-content">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="main-body">
|
||||
<div class="closed-container">
|
||||
<div class="closed-content">
|
||||
<img alt="Cedar" class="logo" src="https://cedar.doctor/s/img/menu-logo.png">
|
||||
<p>Thank you to everyone who used Cedar! Cedar service was hacked.</p>
|
||||
|
||||
<div class="mosaic">
|
||||
<a href="https://web.archive.org/web/20190311224941/https://i.miiverse.nintendo.net/thank_you.png">
|
||||
<img src="https://web.archive.org/web/20190311224941im_/https://i.miiverse.nintendo.net/thank_you_thumbnail.jpg">
|
||||
</a>
|
||||
<p>This mosaic was created with handwritten posts from Miiverse users. You can enlarge the image by clicking on it.</p>
|
||||
</div>
|
||||
<div class="notice">
|
||||
<h2>For users who requested their downloadable post history:</h2>
|
||||
<ul>
|
||||
<li>I have the Cedar database. Not even Cedar was safe from us!</li>
|
||||
<li>Death to all Miiverse clones!</li>
|
||||
{% if request.user.is_authenticated %}<li>{{ request.user.username }}, You're next!</li>{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Reference in New Issue
Block a user