diff --git a/tubesync/sync/templates/sync/dashboard.html b/tubesync/sync/templates/sync/dashboard.html index 9ba8b91..d2f5523 100644 --- a/tubesync/sync/templates/sync/dashboard.html +++ b/tubesync/sync/templates/sync/dashboard.html @@ -19,7 +19,7 @@ {% endif %} -
+
+
+
+

Runtime infomation

+
+
+
+
+ + + + + + + + + + + + + + + + + +
User IDUser ID
{{ uid }}
Group IDGroup ID
{{ gid }}
Config directoryConfig directory
{{ config_dir }}
Downloads directoryDownloads directory
{{ downloads_dir }}
+
+
{% endblock %} diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 8f2bb2d..270e523 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -1,3 +1,4 @@ +import os import json from base64 import b64decode from django.conf import settings @@ -71,6 +72,12 @@ class DashboardView(TemplateView): data['largest_downloads'] = Media.objects.filter( downloaded=True, downloaded_filesize__isnull=False ).order_by('-downloaded_filesize')[:10] + # UID and GID + data['uid'] = os.getuid() + data['gid'] = os.getgid() + # Config and download locations + data['config_dir'] = str(settings.CONFIG_BASE_DIR) + data['downloads_dir'] = str(settings.DOWNLOAD_ROOT) return data diff --git a/tubesync/tubesync/local_settings.py.container b/tubesync/tubesync/local_settings.py.container index e8a82aa..9b3acd5 100644 --- a/tubesync/tubesync/local_settings.py.container +++ b/tubesync/tubesync/local_settings.py.container @@ -5,6 +5,8 @@ from binascii import hexlify BASE_DIR = Path(__file__).resolve().parent.parent ROOT_DIR = Path('/') +CONFIG_BASE_DIR = ROOT_DIR / 'config' +DOWNLOADS_BASE_DIR = ROOT_DIR / 'downloads' RANDOM_SECRET = hexlify(os.urandom(32)).decode() @@ -19,10 +21,10 @@ TIME_ZONE = os.getenv('TZ', 'UTC') DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ROOT_DIR / 'config' / 'db.sqlite3', + 'NAME': CONFIG_BASE_DIR / 'db.sqlite3', } } -MEDIA_ROOT = ROOT_DIR / 'config' / 'media' -DOWNLOAD_ROOT = ROOT_DIR / 'downloads' +MEDIA_ROOT = CONFIG_BASE_DIR / 'media' +DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR diff --git a/tubesync/tubesync/local_settings.py.example b/tubesync/tubesync/local_settings.py.example index dc511a6..c4195b7 100644 --- a/tubesync/tubesync/local_settings.py.example +++ b/tubesync/tubesync/local_settings.py.example @@ -2,6 +2,8 @@ from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent +CONFIG_BASE_DIR = BASE_DIR +DOWNLOADS_BASE_DIR = BASE_DIR SECRET_KEY = 'example-secret-key' @@ -11,9 +13,9 @@ DEBUG = False DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'NAME': CONFIG_BASE_DIR / 'db.sqlite3', } } -DOWNLOAD_ROOT = BASE_DIR / 'downloads' +DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR / 'downloads' diff --git a/tubesync/tubesync/settings.py b/tubesync/tubesync/settings.py index b57dcd6..be1fb43 100644 --- a/tubesync/tubesync/settings.py +++ b/tubesync/tubesync/settings.py @@ -2,6 +2,8 @@ from pathlib import Path BASE_DIR = Path(__file__).resolve().parent.parent +CONFIG_BASE_DIR = BASE_DIR +DOWNLOADS_BASE_DIR = BASE_DIR VERSION = 0.1 @@ -98,8 +100,8 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / 'static' #MEDIA_URL = '/media/' -MEDIA_ROOT = BASE_DIR / 'media' -DOWNLOAD_ROOT = BASE_DIR / 'downloads' +MEDIA_ROOT = CONFIG_BASE_DIR / 'media' +DOWNLOAD_ROOT = DOWNLOADS_BASE_DIR / 'downloads' DOWNLOAD_VIDEO_DIR = 'video' DOWNLOAD_AUDIO_DIR = 'audio' SASS_PROCESSOR_ROOT = STATIC_ROOT