add new version notification to UI

pull/395/head
simon 2 years ago
parent ae6bb4e757
commit ef44cb852c
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

@ -326,10 +326,18 @@ class ReleaseVersion:
def is_updated(self): def is_updated(self):
"""check if update happened in the mean time""" """check if update happened in the mean time"""
message = RedisArchivist().get_message(self.NEW_KEY) message = self.get_update()
if not message.get("status"): if not message:
return return
if self._parse_version(message.get("version")) == self.local_version: if self._parse_version(message.get("version")) == self.local_version:
print(f"[{self.local_version}]: update completed") print(f"[{self.local_version}]: update completed")
RedisArchivist().del_message(self.NEW_KEY) RedisArchivist().del_message(self.NEW_KEY)
def get_update(self):
"""return new version dict if available"""
message = RedisArchivist().get_message(self.NEW_KEY)
if not message.get("status"):
return False
return message

@ -132,7 +132,14 @@
</div> </div>
<div class="footer"> <div class="footer">
<div class="boxed-content"> <div class="boxed-content">
<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/tubearchivist/tubearchivist" target="_blank">GitHub</a> | <a href="https://hub.docker.com/r/bbilly1/tubearchivist" target="_blank">Docker Hub</a> | <a href="https://www.tubearchivist.com/discord" 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></span>
<span>TubeArchivist</span>
<span>{{ version }}</span>
{% if ta_update %}
<span class="danger-zone">{{ ta_update.version }} available{% if ta_update.is_breaking %}<span class="danger-zone">Breaking Changes!</span>{% endif %}</span>
<span><a href="https://github.com/tubearchivist/tubearchivist/releases/tag/{{ ta_update.version }}" target="_blank">Release Page</a> | </span>
{% endif %}
<span><a href="{% url 'about' %}">About</a> | <a href="https://github.com/tubearchivist/tubearchivist" target="_blank">GitHub</a> | <a href="https://hub.docker.com/r/bbilly1/tubearchivist" target="_blank">Docker Hub</a> | <a href="https://www.tubearchivist.com/discord" target="_blank">Discord</a> | <a href="https://www.reddit.com/r/TubeArchivist/">Reddit</a></span>
</div> </div>
</div> </div>
</body> </body>

@ -36,7 +36,7 @@ from home.src.index.channel import YoutubeChannel, channel_overwrites
from home.src.index.generic import Pagination from home.src.index.generic import Pagination
from home.src.index.playlist import YoutubePlaylist from home.src.index.playlist import YoutubePlaylist
from home.src.index.reindex import ReindexProgress from home.src.index.reindex import ReindexProgress
from home.src.ta.config import AppConfig, ScheduleBuilder from home.src.ta.config import AppConfig, ReleaseVersion, ScheduleBuilder
from home.src.ta.helper import UrlListParser, time_parser from home.src.ta.helper import UrlListParser, time_parser
from home.src.ta.ta_redis import RedisArchivist from home.src.ta.ta_redis import RedisArchivist
from home.tasks import extrac_dl, index_channel_playlists, subscribe_to from home.tasks import extrac_dl, index_channel_playlists, subscribe_to
@ -138,6 +138,7 @@ class ArchivistViewConfig(View):
"show_ignored_only": self._get_show_ignore_only(), "show_ignored_only": self._get_show_ignore_only(),
"show_subed_only": self._get_show_subed_only(), "show_subed_only": self._get_show_subed_only(),
"version": settings.TA_VERSION, "version": settings.TA_VERSION,
"ta_update": ReleaseVersion().get_update(),
} }
@ -266,6 +267,7 @@ class MinView(View):
return { return {
"colors": AppConfig(request.user.id).colors, "colors": AppConfig(request.user.id).colors,
"version": settings.TA_VERSION, "version": settings.TA_VERSION,
"ta_update": ReleaseVersion().get_update(),
} }

Loading…
Cancel
Save