mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-04 12:00:21 +00:00
* Add version API and add local_version function. * Minor adjustments for linting. * Add missing newlines for linter. * Add missing comma to `urls.py`. * Remove `version/` endpoint. * Remove the `VersionView`. * Prepare `PingView` for removal of the `is_static` response. * Remove the `is_unstable` response from `ReleaseVersion`. * Readd missing class instantiation for first call of `ReleaseVersion`.
This commit is contained in:
parent
061c653bce
commit
1be80b24c2
@ -11,7 +11,7 @@ from home.src.index.channel import YoutubeChannel
|
||||
from home.src.index.generic import Pagination
|
||||
from home.src.index.reindex import ReindexProgress
|
||||
from home.src.index.video import SponsorBlock, YoutubeVideo
|
||||
from home.src.ta.config import AppConfig
|
||||
from home.src.ta.config import AppConfig, ReleaseVersion
|
||||
from home.src.ta.ta_redis import RedisArchivist
|
||||
from home.src.ta.task_manager import TaskCommand, TaskManager
|
||||
from home.src.ta.urlparser import Parser
|
||||
@ -535,7 +535,11 @@ class PingView(ApiBaseView):
|
||||
@staticmethod
|
||||
def get(request):
|
||||
"""get pong"""
|
||||
data = {"response": "pong", "user": request.user.id}
|
||||
data = {
|
||||
"response": "pong",
|
||||
"user": request.user.id,
|
||||
"version": ReleaseVersion().get_local_version(),
|
||||
}
|
||||
return Response(data)
|
||||
|
||||
|
||||
|
@ -326,6 +326,10 @@ class ReleaseVersion:
|
||||
RedisArchivist().set_message(self.NEW_KEY, message)
|
||||
print(f"[{self.local_version}]: found new version {new_version}")
|
||||
|
||||
def get_local_version(self):
|
||||
"""read version from local"""
|
||||
return self.local_version
|
||||
|
||||
def get_remote_version(self):
|
||||
"""read version from remote"""
|
||||
self.response = requests.get(self.REMOTE_URL, timeout=20).json()
|
||||
|
Loading…
Reference in New Issue
Block a user