aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-12-27 16:42:44 +0000
committerBobby <[email protected]>2024-12-27 16:42:44 +0000
commit490582485e34b337645ea6a30f23116164cb0a8d (patch)
tree65b770d6681d641972fb04d7a3952240c8f42544
parent6df9f0dc40501e8f55bcc883dfe5be65e60d3c3d (diff)
downloadthatcomputerscientist-490582485e34b337645ea6a30f23116164cb0a8d.tar.xz
thatcomputerscientist-490582485e34b337645ea6a30f23116164cb0a8d.zip
crazy transformations bring some refactoring
-rw-r--r--apps/blog/urls.py1
-rw-r--r--apps/blog/views.py13
-rw-r--r--services/stream/views.py3
-rw-r--r--templates/en/core/home.html4
-rw-r--r--templates/en/pagoda/home.html2
-rw-r--r--templates/en/pagoda/site_dashboard.html2
-rw-r--r--templates/en/pagoda/site_verification.html2
-rw-r--r--templates/ja/core/home.html4
-rw-r--r--templates/ja/pagoda/home.html2
-rw-r--r--templates/ja/pagoda/site_verification.html2
-rw-r--r--templates/partials/_footer.html (renamed from templates/shared/footer.html)0
-rw-r--r--templates/partials/_header.html (renamed from templates/shared/header.html)0
-rw-r--r--templates/partials/_left_sidebar.html (renamed from templates/shared/left_sidebar.html)0
-rw-r--r--templates/partials/_right_sidebar.html (renamed from templates/shared/right_sidebar.html)0
-rw-r--r--templates/partials/_weblog_list.html (renamed from templates/partials/weblog_list.html)4
-rw-r--r--templates/shared/administration/manage_storage_buckets_bucket.html (renamed from templates/en/administration/manage_storage_buckets_bucket.html)2
-rw-r--r--templates/shared/administration/manage_storage_buckets_home.html (renamed from templates/en/administration/manage_storage_buckets_home.html)2
-rw-r--r--templates/shared/anime/anime.html (renamed from templates/en/anime/anime.html)2
-rw-r--r--templates/shared/anime/home.html (renamed from templates/en/anime/home.html)2
-rw-r--r--templates/shared/anime/search.html (renamed from templates/en/anime/search.html)2
-rw-r--r--templates/shared/blog/single_weblog.html1
-rw-r--r--templates/shared/core/base.html (renamed from templates/shared/base.html)8
-rw-r--r--templates/shared/journals/single.html (renamed from templates/en/journals/single.html)2
-rw-r--r--templates/shared/my/journals.html (renamed from templates/en/core/my/journals.html)2
24 files changed, 40 insertions, 22 deletions
diff --git a/apps/blog/urls.py b/apps/blog/urls.py
index 226fb9d9..093b745a 100644
--- a/apps/blog/urls.py
+++ b/apps/blog/urls.py
@@ -5,6 +5,7 @@ from .feed import RSSFeed
app_name = "weblog"
urlpatterns = [
+ path("<str:slug>/", views.single_post, name="single_post"),
# path("", views.home, name="home"),
# path("account", views.account, name="account"),
# path("register", views.register, name="register"),
diff --git a/apps/blog/views.py b/apps/blog/views.py
index 2ea99457..41610927 100644
--- a/apps/blog/views.py
+++ b/apps/blog/views.py
@@ -1,3 +1,16 @@
+from django.http import HttpResponseNotFound
+from django.shortcuts import render
+from apps.blog.models import Post
+
+
+def single_post(request, slug):
+ try:
+ post = Post.objects.get(slug=slug)
+ return render(request, "shared/blog/single_weblog.html", {"post": post})
+ except Post.DoesNotExist:
+ return HttpResponseNotFound()
+
+
# import hashlib
# import os
# import random
diff --git a/services/stream/views.py b/services/stream/views.py
index a646d185..04a21961 100644
--- a/services/stream/views.py
+++ b/services/stream/views.py
@@ -69,6 +69,9 @@ def stream_song(request, song_id: int) -> HttpResponse:
def anime_stream(request):
+ if not request.user.is_authenticated:
+ return HttpResponseForbidden("Access not allowed")
+
if not request.COOKIES.get("csrftoken"):
return HttpResponseForbidden("Invalid request")
diff --git a/templates/en/core/home.html b/templates/en/core/home.html
index 8075b6b1..5ecb7a2e 100644
--- a/templates/en/core/home.html
+++ b/templates/en/core/home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/core/home.css' %}">
@@ -48,7 +48,7 @@
<div class="pamphlet pamphlet-banner"></div>
<h1 class="section-title">Contemplations of Late</h1>
<div class="recent-weblogs">
- {% include 'partials/weblog_list.html' with posts=recent_weblogs %}
+ {% include 'partials/_weblog_list.html' with posts=recent_weblogs %}
</div>
<h1 class="section-title">Recent Weeb Degenerecy</h1>
<div class="recent-anime">
diff --git a/templates/en/pagoda/home.html b/templates/en/pagoda/home.html
index 306dfe44..3a4d7dc9 100644
--- a/templates/en/pagoda/home.html
+++ b/templates/en/pagoda/home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/pagoda/pagoda.css' %}">
diff --git a/templates/en/pagoda/site_dashboard.html b/templates/en/pagoda/site_dashboard.html
index a4344c26..ff8c24d0 100644
--- a/templates/en/pagoda/site_dashboard.html
+++ b/templates/en/pagoda/site_dashboard.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
{% endblock head %}
diff --git a/templates/en/pagoda/site_verification.html b/templates/en/pagoda/site_verification.html
index dd5e661d..3944859c 100644
--- a/templates/en/pagoda/site_verification.html
+++ b/templates/en/pagoda/site_verification.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<style>
diff --git a/templates/ja/core/home.html b/templates/ja/core/home.html
index 6d566a93..3cd42785 100644
--- a/templates/ja/core/home.html
+++ b/templates/ja/core/home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/core/home.css' %}">
@@ -48,7 +48,7 @@
<div class="pamphlet pamphlet-banner"></div>
<h1 class="section-title">最近の考察</h1>
<div class="recent-weblogs">
- {% include 'partials/weblog_list.html' with posts=recent_weblogs %}
+ {% include 'partials/_weblog_list.html' with posts=recent_weblogs %}
</div>
<h1 class="section-title">最近のアニメ活動</h1>
<div class="recent-anime">
diff --git a/templates/ja/pagoda/home.html b/templates/ja/pagoda/home.html
index e3388994..f64a1a14 100644
--- a/templates/ja/pagoda/home.html
+++ b/templates/ja/pagoda/home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/pagoda/pagoda.css' %}">
diff --git a/templates/ja/pagoda/site_verification.html b/templates/ja/pagoda/site_verification.html
index 789b8372..0e1a3b5a 100644
--- a/templates/ja/pagoda/site_verification.html
+++ b/templates/ja/pagoda/site_verification.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<style>
diff --git a/templates/shared/footer.html b/templates/partials/_footer.html
index 73dc174c..73dc174c 100644
--- a/templates/shared/footer.html
+++ b/templates/partials/_footer.html
diff --git a/templates/shared/header.html b/templates/partials/_header.html
index 13e2ab6d..13e2ab6d 100644
--- a/templates/shared/header.html
+++ b/templates/partials/_header.html
diff --git a/templates/shared/left_sidebar.html b/templates/partials/_left_sidebar.html
index 878fb399..878fb399 100644
--- a/templates/shared/left_sidebar.html
+++ b/templates/partials/_left_sidebar.html
diff --git a/templates/shared/right_sidebar.html b/templates/partials/_right_sidebar.html
index 1c9375cd..1c9375cd 100644
--- a/templates/shared/right_sidebar.html
+++ b/templates/partials/_right_sidebar.html
diff --git a/templates/partials/weblog_list.html b/templates/partials/_weblog_list.html
index f166610e..75817b3d 100644
--- a/templates/partials/weblog_list.html
+++ b/templates/partials/_weblog_list.html
@@ -9,7 +9,7 @@
</div>
<div class="post-content">
<h2>
- <a href="#">{% if request.LANGUAGE_CODE == 'ja' %}{{ post.title_ja }}{% else %}{{ post.title }}{% endif %}</a>
+ <a href="{% url "weblog:single_post" post.slug %}">{% if request.LANGUAGE_CODE == 'ja' %}{{ post.title_ja }}{% else %}{{ post.title }}{% endif %}</a>
</h2>
<div class="author-info">
{% with post.author.userprofile_set.first as authorprofile %}
@@ -26,7 +26,7 @@
</div>
<div class="post-actions">
<div class="post-links">
- <a href="#">{% if request.LANGUAGE_CODE == 'ja' %}続きを読む{% else %}Continue Reading{% endif %}</a> |
+ <a href="{% url "weblog:single_post" post.slug %}">{% if request.LANGUAGE_CODE == 'ja' %}続きを読む{% else %}Continue Reading{% endif %}</a> |
<a href="##comments">{{ post.num_comments }}
{% if request.LANGUAGE_CODE == 'ja' %}
コメント
diff --git a/templates/en/administration/manage_storage_buckets_bucket.html b/templates/shared/administration/manage_storage_buckets_bucket.html
index 13ce36a5..0c6f9268 100644
--- a/templates/en/administration/manage_storage_buckets_bucket.html
+++ b/templates/shared/administration/manage_storage_buckets_bucket.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/shared/directory.css' %}">
diff --git a/templates/en/administration/manage_storage_buckets_home.html b/templates/shared/administration/manage_storage_buckets_home.html
index 90bed85b..ceffea44 100644
--- a/templates/en/administration/manage_storage_buckets_home.html
+++ b/templates/shared/administration/manage_storage_buckets_home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/shared/directory.css' %}">
diff --git a/templates/en/anime/anime.html b/templates/shared/anime/anime.html
index 2f9d5cf3..8cacd20a 100644
--- a/templates/en/anime/anime.html
+++ b/templates/shared/anime/anime.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
diff --git a/templates/en/anime/home.html b/templates/shared/anime/home.html
index a35c8b82..17741ed7 100644
--- a/templates/en/anime/home.html
+++ b/templates/shared/anime/home.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<link rel="stylesheet" href="{% static 'css/anime/anime.css' %}">
diff --git a/templates/en/anime/search.html b/templates/shared/anime/search.html
index 9b489e25..7bd7ffcf 100644
--- a/templates/en/anime/search.html
+++ b/templates/shared/anime/search.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% load pagination %}
{% block head %}
diff --git a/templates/shared/blog/single_weblog.html b/templates/shared/blog/single_weblog.html
new file mode 100644
index 00000000..b82c7f24
--- /dev/null
+++ b/templates/shared/blog/single_weblog.html
@@ -0,0 +1 @@
+{% extends "shared/core/base.html" %} \ No newline at end of file
diff --git a/templates/shared/base.html b/templates/shared/core/base.html
index c943cfa6..f1c5f2cd 100644
--- a/templates/shared/base.html
+++ b/templates/shared/core/base.html
@@ -30,10 +30,10 @@
</video>
<div id="video-overlay"></div>
<div id="body-wrapper">
- {% include 'shared/header.html' %}
+ {% include 'partials/_header.html' %}
<div id="content-wrapper">
<div id="left-sidebar" {% if user.is_authenticated %}style="border-top-left-radius: 0px;"{% endif %}>
- {% include 'shared/left_sidebar.html' %}
+ {% include 'partials/_left_sidebar.html' %}
</div>
<div id="main-content">
{% block content %}
@@ -41,11 +41,11 @@
{% endblock %}
</div>
<div id="right-sidebar">
- {% include 'shared/right_sidebar.html' %}
+ {% include 'partials/_right_sidebar.html' %}
</div>
</div>
<div id="footer">
- {% include 'shared/footer.html' %}
+ {% include 'partials/_footer.html' %}
</div>
</div>
<div id="scanlines"></div>
diff --git a/templates/en/journals/single.html b/templates/shared/journals/single.html
index 084fea44..045c33df 100644
--- a/templates/en/journals/single.html
+++ b/templates/shared/journals/single.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<style>
diff --git a/templates/en/core/my/journals.html b/templates/shared/my/journals.html
index b265aed8..846d9cad 100644
--- a/templates/en/core/my/journals.html
+++ b/templates/shared/my/journals.html
@@ -1,4 +1,4 @@
-{% extends 'shared/base.html' %}
+{% extends 'shared/core/base.html' %}
{% load static %}
{% block head %}
<style>