From 490582485e34b337645ea6a30f23116164cb0a8d Mon Sep 17 00:00:00 2001 From: Bobby <30593201+luciferreeves@users.noreply.github.com> Date: Fri, 27 Dec 2024 16:42:44 +0000 Subject: crazy transformations bring some refactoring --- apps/blog/urls.py | 1 + apps/blog/views.py | 13 + services/stream/views.py | 3 + .../manage_storage_buckets_bucket.html | 257 ----------------- .../manage_storage_buckets_home.html | 26 -- templates/en/anime/anime.html | 307 --------------------- templates/en/anime/home.html | 44 --- templates/en/anime/search.html | 75 ----- templates/en/core/home.html | 4 +- templates/en/core/my/journals.html | 88 ------ templates/en/journals/single.html | 137 --------- templates/en/pagoda/home.html | 2 +- templates/en/pagoda/site_dashboard.html | 2 +- templates/en/pagoda/site_verification.html | 2 +- templates/ja/core/home.html | 4 +- templates/ja/pagoda/home.html | 2 +- templates/ja/pagoda/site_verification.html | 2 +- templates/partials/_footer.html | 33 +++ templates/partials/_header.html | 27 ++ templates/partials/_left_sidebar.html | 215 +++++++++++++++ templates/partials/_right_sidebar.html | 129 +++++++++ templates/partials/_weblog_list.html | 44 +++ templates/partials/weblog_list.html | 44 --- .../manage_storage_buckets_bucket.html | 257 +++++++++++++++++ .../manage_storage_buckets_home.html | 26 ++ templates/shared/anime/anime.html | 307 +++++++++++++++++++++ templates/shared/anime/home.html | 44 +++ templates/shared/anime/search.html | 75 +++++ templates/shared/base.html | 60 ---- templates/shared/blog/single_weblog.html | 1 + templates/shared/core/base.html | 60 ++++ templates/shared/footer.html | 33 --- templates/shared/header.html | 27 -- templates/shared/journals/single.html | 137 +++++++++ templates/shared/left_sidebar.html | 215 --------------- templates/shared/my/journals.html | 88 ++++++ templates/shared/right_sidebar.html | 129 --------- 37 files changed, 1469 insertions(+), 1451 deletions(-) delete mode 100644 templates/en/administration/manage_storage_buckets_bucket.html delete mode 100644 templates/en/administration/manage_storage_buckets_home.html delete mode 100644 templates/en/anime/anime.html delete mode 100644 templates/en/anime/home.html delete mode 100644 templates/en/anime/search.html delete mode 100644 templates/en/core/my/journals.html delete mode 100644 templates/en/journals/single.html create mode 100644 templates/partials/_footer.html create mode 100644 templates/partials/_header.html create mode 100644 templates/partials/_left_sidebar.html create mode 100644 templates/partials/_right_sidebar.html create mode 100644 templates/partials/_weblog_list.html delete mode 100644 templates/partials/weblog_list.html create mode 100644 templates/shared/administration/manage_storage_buckets_bucket.html create mode 100644 templates/shared/administration/manage_storage_buckets_home.html create mode 100644 templates/shared/anime/anime.html create mode 100644 templates/shared/anime/home.html create mode 100644 templates/shared/anime/search.html delete mode 100644 templates/shared/base.html create mode 100644 templates/shared/blog/single_weblog.html create mode 100644 templates/shared/core/base.html delete mode 100644 templates/shared/footer.html delete mode 100644 templates/shared/header.html create mode 100644 templates/shared/journals/single.html delete mode 100644 templates/shared/left_sidebar.html create mode 100644 templates/shared/my/journals.html delete mode 100644 templates/shared/right_sidebar.html 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("/", 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/administration/manage_storage_buckets_bucket.html b/templates/en/administration/manage_storage_buckets_bucket.html deleted file mode 100644 index 13ce36a5..00000000 --- a/templates/en/administration/manage_storage_buckets_bucket.html +++ /dev/null @@ -1,257 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% block head %} - -{% endblock head %} -{% block content %} -

Viewing Bucket: {{ bucket_name }}/{{ object_path }}

-
-
- - -
-
-
- {% if up_url %} -
- {% else %} -
- {% endif %} -
- Folder -
-
-
..
-
- {% for object in objects %} - {% if object.type == "file" and object.file_type != object.name %} -
- {% else %} -
- {% endif %} -
- {% if object.type == "file" and object.file_type != object.name %} - {% if object.file_type == "mp3" %} - Music - {% elif object.file_type == "jpg" or object.file_type == "png" %} - Image - {% else %} - File - {% endif %} - {% else %} - Folder - {% endif %} -
-
-
{{ object.name }}
-
- {% endfor %} -
-
-{% endblock content %} -{% block scripts %} - - -{% endblock scripts %} \ No newline at end of file diff --git a/templates/en/administration/manage_storage_buckets_home.html b/templates/en/administration/manage_storage_buckets_home.html deleted file mode 100644 index 90bed85b..00000000 --- a/templates/en/administration/manage_storage_buckets_home.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% block head %} - -{% endblock head %} -{% block content %} -

Manage Storage Buckets

-
-
-
- {% for bucket in buckets %} -
-
- Folder -
-
-
{{ bucket.name }}
-
- {% endfor %} -
- -
-{% endblock content %} -{% block scripts %} - -{% endblock scripts %} \ No newline at end of file diff --git a/templates/en/anime/anime.html b/templates/en/anime/anime.html deleted file mode 100644 index 2f9d5cf3..00000000 --- a/templates/en/anime/anime.html +++ /dev/null @@ -1,307 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} - -{% block head %} - - - -{% endblock head %} - -{% block content %} -
-
-
-
-
-
{{ anime.title.english|default:anime.title.romaji }}
-
-
- {% if user.is_authenticated %} -
- Loading... -
- -
- {% else %} -
-
-
- - - - -
-
-
Authentication Required
-
No undeserving lackeys allowed among these parts of the internet. Either register or login to access this content.
-
-
-
- {% endif %} -
Episode {{ anime.current_episode.number }}. {{ anime.current_episode.title }}
-
-
- 00:00 -
- -
-
-
-
-
-
- 00:00 -
-
-
- - - - - - -
- -
- -
-
-
- -
- - -
-
-
-
- -
- -
-
-
-
-
- {% if streaming_data.data.tracks %} -
- -
- -
-
- {% endif %} -
-
-
-
-
-
-
- -
-
-
- {{ anime.title.english }} -
-
- Status: - {{ anime.status }} -
-
- Type: - {{ anime.type }} -
-
- Episodes: - {{ anime.totalEpisodes }} -
- {% if anime.duration %} -
- Duration: - {{ anime.duration }} min -
- {% endif %} - {% if anime.rating %} -
- Rating: - ★ {{ anime.rating }}% -
- {% endif %} -
- Studios: - {{ anime.studios|join:", " }} -
-
-
- -
-
-
-

Episodes

- {{ anime.totalEpisodes }} Total -
-
- {% for episode in anime.episodes %} - -
- Episode {{ episode.number }} -
-
- {{ episode.number }}. - {{ episode.title }} -
-
- {% endfor %} -
-
-
-

- {{ anime.title.english|default:anime.title.romaji }} -

-

{{ anime.description|safe }}

-
- Genres: - {% for genre in anime.genres %} - {{ genre }} - {% endfor %} -
-
-
-
- - -
-

Characters

-
- {% for character in anime.characters %} -
-
- {{ character.name.full }} -
-
- {{ character.name.full }} - {{ character.role }} -
-
- {% endfor %} -
-
- - -
- {% include 'partials/_anime_list.html' with anime_list=anime.relations title="Related Anime" %} -
-
- {% include 'partials/_anime_list.html' with anime_list=anime.recommendations title="Recommended Anime" %} -
-
-
-{% endblock content %} -{% block scripts %} -{% if user.is_authenticated %} - - -{{ streaming_data.data.tracks|json_script:"tracks-data" }} - -{% endif %} -{% endblock scripts %} diff --git a/templates/en/anime/home.html b/templates/en/anime/home.html deleted file mode 100644 index a35c8b82..00000000 --- a/templates/en/anime/home.html +++ /dev/null @@ -1,44 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% block head %} - -{% endblock head %} -{% block content %} -
-
-
-

Anime

-
- - - - - - -
- - - - -
- -
-
-
-{% include 'partials/_anime_list.html' with anime_list=top_airing_anime title="Currently Top Airing" %} -{% include 'partials/_anime_list.html' with anime_list=popular_anime title="Most Popular Among Folks" %} -{% include 'partials/_anime_list.html' with anime_list=top_anime title="Highly Rated Stuff" %} -{% include 'partials/_anime_list.html' with anime_list=trending_anime title="The Trending Section" %} -{% include "partials/_anime_footer.html" %} -{% endblock content %} - - diff --git a/templates/en/anime/search.html b/templates/en/anime/search.html deleted file mode 100644 index 9b489e25..00000000 --- a/templates/en/anime/search.html +++ /dev/null @@ -1,75 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% load pagination %} -{% block head %} - -{% endblock head %} - -{% block content %} -
-
-
-

Search Anime

-
- - - - - - -
- - - - -
- -
-
-
- -
-
- Found {{ total_results }} results - {% if request.GET.q %} for "{{ request.GET.q }}"{% endif %} - {% if request.GET.genre %} in {{ request.GET.genre }}{% endif %} -
-
- -{% include 'partials/_anime_list.html' with anime_list=search_results.results %} - -{% if total_pages > 1 %} - -{% endif %} -{% include "partials/_anime_footer.html" %} -{% endblock content %} 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 %} @@ -48,7 +48,7 @@

Contemplations of Late

- {% include 'partials/weblog_list.html' with posts=recent_weblogs %} + {% include 'partials/_weblog_list.html' with posts=recent_weblogs %}

Recent Weeb Degenerecy

diff --git a/templates/en/core/my/journals.html b/templates/en/core/my/journals.html deleted file mode 100644 index b265aed8..00000000 --- a/templates/en/core/my/journals.html +++ /dev/null @@ -1,88 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% block head %} - -{% endblock head %} -{% block content %} -
-
-

My Journals

- Create a Journal -
-
-
-
Title
-
Private
-
Entries
-
Actions
-
- {% for journal in journals %} -
-
{{ journal.name }}
-
{{ journal.private }}
-
{{ journal.entries.all|length }}
-
- View - Manage -
-
- {% endfor %} -
-
-{% endblock content %} diff --git a/templates/en/journals/single.html b/templates/en/journals/single.html deleted file mode 100644 index 084fea44..00000000 --- a/templates/en/journals/single.html +++ /dev/null @@ -1,137 +0,0 @@ -{% extends 'shared/base.html' %} -{% load static %} -{% block head %} - -{% endblock head %} -{% block content %} -
-

{{ journal.name }}

-

-
-
-
- {% with journal.owner.userprofile_set.first as journal_holder_profile %} - {{ journal.owner.first_name }}'s Avatar -
-

Author

-

{{ journal.owner.first_name }} {{ journal.owner.last_name }}

-
-
-

Bio

-

{{ journal_holder_profile.bio|linebreaksbr }}

-
- {% endwith %} -
-
-
-

Journal

-

{{ journal.name }}

-
-
-

Journal Entries

-

{{ journal.entries.all|length }}

-
-
-

Journal Streak

-

0 days

-
-
-
-
- {% for entry in journal.entries.all %} -
-

{{ entry.title }}

-

Posted on {{ entry.created_at|date:"F j, Y" }}

-
-

{{ entry.body|linebreaksbr }}

-
- {% endfor %} -
-
-{% endblock content %} \ No newline at end of file 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 %} 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 %} +{% endblock head %} +{% block content %} +
+

{{ journal.name }}

+

+
+
+
+ {% with journal.owner.userprofile_set.first as journal_holder_profile %} + {{ journal.owner.first_name }}'s Avatar +
+

Author

+

{{ journal.owner.first_name }} {{ journal.owner.last_name }}

+
+
+

Bio

+

{{ journal_holder_profile.bio|linebreaksbr }}

+
+ {% endwith %} +
+
+
+

Journal

+

{{ journal.name }}

+
+
+

Journal Entries

+

{{ journal.entries.all|length }}

+
+
+

Journal Streak

+

0 days

+
+
+
+
+ {% for entry in journal.entries.all %} +
+

{{ entry.title }}

+

Posted on {{ entry.created_at|date:"F j, Y" }}

+
+

{{ entry.body|linebreaksbr }}

+
+ {% endfor %} +
+
+{% endblock content %} \ No newline at end of file diff --git a/templates/shared/left_sidebar.html b/templates/shared/left_sidebar.html deleted file mode 100644 index 878fb399..00000000 --- a/templates/shared/left_sidebar.html +++ /dev/null @@ -1,215 +0,0 @@ -{% load static %} - - - - diff --git a/templates/shared/my/journals.html b/templates/shared/my/journals.html new file mode 100644 index 00000000..846d9cad --- /dev/null +++ b/templates/shared/my/journals.html @@ -0,0 +1,88 @@ +{% extends 'shared/core/base.html' %} +{% load static %} +{% block head %} + +{% endblock head %} +{% block content %} +
+
+

My Journals

+ Create a Journal +
+
+
+
Title
+
Private
+
Entries
+
Actions
+
+ {% for journal in journals %} +
+
{{ journal.name }}
+
{{ journal.private }}
+
{{ journal.entries.all|length }}
+
+ View + Manage +
+
+ {% endfor %} +
+
+{% endblock content %} diff --git a/templates/shared/right_sidebar.html b/templates/shared/right_sidebar.html deleted file mode 100644 index 1c9375cd..00000000 --- a/templates/shared/right_sidebar.html +++ /dev/null @@ -1,129 +0,0 @@ -{% load static %} - -{% block head %} - -{% endblock head %} - - - -{% block scripts %} - -{% endblock scripts %} \ No newline at end of file -- cgit v1.2.3