add global vars for version and url

This commit is contained in:
simon 2022-04-05 18:43:15 +07:00
parent e404bac7c3
commit 1ac92254ad
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
3 changed files with 18 additions and 4 deletions

View File

@ -151,3 +151,7 @@ CORS_ALLOWED_ORIGIN_REGEXES = [r"moz-extension://*", r"chrome-extension://*"]
CORS_ALLOW_HEADERS = list(default_headers) + [
"mode",
]
# TA application settings
TA_UPSTREAM = "https://github.com/bbilly1/tubearchivist"
TA_VERSION = "v0.1.3"

View File

@ -132,7 +132,7 @@
</div>
<div class="footer">
<div class="boxed-content">
<span>© 2021 - <script type="text/javascript">document.write(new Date().getFullYear());</script> TubeArchivist v0.1.3 </span><span><a href="{% url 'about' %}">About</a> | <a href="https://github.com/bbilly1/tubearchivist" target="_blank">GitHub</a> | <a href="https://hub.docker.com/r/bbilly1/tubearchivist" target="_blank">Docker Hub</a> | <a href="https://discord.gg/AFwz8nE7BK" target="_blank">Discord</a> | <a href="https://www.reddit.com/r/TubeArchivist/">Reddit</a></span>
<span>© 2021 - <script type="text/javascript">document.write(new Date().getFullYear());</script> TubeArchivist {{ version }} </span><span><a href="{% url 'about' %}">About</a> | <a href="https://github.com/bbilly1/tubearchivist" target="_blank">GitHub</a> | <a href="https://hub.docker.com/r/bbilly1/tubearchivist" target="_blank">Docker Hub</a> | <a href="https://discord.gg/AFwz8nE7BK" target="_blank">Discord</a> | <a href="https://www.reddit.com/r/TubeArchivist/">Reddit</a></span>
</div>
</div>
</body>

View File

@ -9,6 +9,7 @@ import urllib.parse
from time import sleep
from django import forms
from django.conf import settings
from django.contrib.auth import login
from django.contrib.auth.forms import AuthenticationForm
from django.http import JsonResponse
@ -122,6 +123,7 @@ class ArchivistViewConfig(View):
"hide_watched": self._get_hide_watched(),
"show_ignored_only": self._get_show_ignore_only(),
"show_subed_only": self._get_show_subed_only(),
"version": settings.TA_VERSION,
}
@ -329,8 +331,11 @@ class AboutView(View):
@staticmethod
def get(request):
"""handle http get"""
colors = AppConfig(request.user.id).colors
context = {"title": "About", "colors": colors}
context = {
"title": "About",
"colors": AppConfig(request.user.id).colors,
"version": settings.TA_VERSION,
}
return render(request, "home/about.html", context)
@ -690,6 +695,7 @@ class VideoView(View):
"title": video_title,
"colors": colors,
"cast": cast,
"version": settings.TA_VERSION,
}
return render(request, "home/video.html", context)
@ -746,7 +752,10 @@ class SearchView(ArchivistResultsView):
all_styles = self.get_all_view_styles()
self.context.update({"all_styles": all_styles})
self.context.update(
{"search_form": MultiSearchForm(initial=all_styles)}
{
"search_form": MultiSearchForm(initial=all_styles),
"version": settings.TA_VERSION,
}
)
return render(request, "home/search.html", self.context)
@ -778,6 +787,7 @@ class SettingsView(View):
"user_form": user_form,
"app_form": app_form,
"scheduler_form": scheduler_form,
"version": settings.TA_VERSION,
}
return render(request, "home/settings.html", context)