diff --git a/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc b/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc deleted file mode 100644 index 20b35ca..0000000 Binary files a/CalibreWebCompanion/CalibreWebCompanion/__pycache__/settings.cpython-38.pyc and /dev/null differ diff --git a/CalibreWebCompanion/CalibreWebCompanion/settings.py b/CalibreWebCompanion/CalibreWebCompanion/settings.py index e25b9fa..bdbf8b4 100644 --- a/CalibreWebCompanion/CalibreWebCompanion/settings.py +++ b/CalibreWebCompanion/CalibreWebCompanion/settings.py @@ -11,13 +11,48 @@ https://docs.djangoproject.com/en/3.0/ref/settings/ """ import os +import json + +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + +with open( BASE_DIR + "/settings.json", "r") as userfile: + usersettings = json.load(userfile) + CALIBRE_DIR = os.path.abspath(usersettings["CALIBRE_DIR"]) + SECRET_KEY = usersettings["SECRET_KEY"] + ALLOWED_HOSTS = usersettings["ALLOWED_HOSTS"] + INTERNAL_IPS = usersettings["INTERNAL_IPS"] + + +# CALIBRE_DIR = os.path.abspath( +# "C:\\Users\\MassiveAtoms\\Documents\\Calibre Library") +# SECRET_KEY = 'u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+' +# ALLOWED_HOSTS = ['127.0.0.1', ] +# INTERNAL_IPS = ['127.0.0.1', ] + + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) -BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -CALIBRE_DIR = os.path.abspath( - "C:\\Users\\MassiveAtoms\\Documents\\Calibre Library") + + + EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +# optimisation stuff ###############################################3 +# # +CONN_MAX_AGE = 60 * 5 + +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'LOCATION': 'unique-snowflake', + "TIMEOUT" : 60 * 5, + + } +} + +## ## +######################################################################## +## STATIC FILES ## # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.0/howto/static-files/ @@ -28,23 +63,9 @@ STATICFILES_DIRS = [ ] STATIC_URL = '/static/' - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+' - - -ALLOWED_HOSTS = ['127.0.0.1', ] -INTERNAL_IPS = [ - # ... - '127.0.0.1', - # ... -] -# Don't change things beyond this - +## ## +######################################################################## +## DERUG ## # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -62,9 +83,9 @@ DEBUG_TOOLBAR_PANELS = [ ] - - - +## ## +######################################################################## +## DERUG ## LOGIN_REDIRECT_URL = '/books' @@ -83,6 +104,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'debug_toolbar.middleware.DebugToolbarMiddleware', # DEBUG purposes + 'django.middleware.cache.UpdateCacheMiddleware', # cache 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', @@ -90,6 +112,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.cache.FetchFromCacheMiddleware', # cache ] ROOT_URLCONF = 'CalibreWebCompanion.urls' diff --git a/CalibreWebCompanion/db.sqlite3 b/CalibreWebCompanion/db.sqlite3 deleted file mode 100644 index 67f7a65..0000000 Binary files a/CalibreWebCompanion/db.sqlite3 and /dev/null differ diff --git a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc index 4daacd3..adcae8b 100644 Binary files a/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/models.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc index 9f84413..199ec70 100644 Binary files a/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/urls.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc index 8fe7e25..bde1878 100644 Binary files a/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc and b/CalibreWebCompanion/library/__pycache__/views.cpython-38.pyc differ diff --git a/CalibreWebCompanion/library/models.py b/CalibreWebCompanion/library/models.py index d4a0545..744829b 100644 --- a/CalibreWebCompanion/library/models.py +++ b/CalibreWebCompanion/library/models.py @@ -382,26 +382,4 @@ class BookTagLink(models.Model): # # class Meta: # managed = False -# db_table = 'feeds' -# -# -# class LastReadPositions(models.Model): -# book = models.IntegerField() -# format = models.TextField() -# user = models.TextField() -# device = models.TextField() -# cfi = models.TextField() -# epoch = models.FloatField() -# pos_frac = models.FloatField() -# -# class Meta: -# managed = False -# db_table = 'last_read_positions' - - -# class MetadataDirtied(models.Model): -# book = models.IntegerField() - -# class Meta: -# managed = False -# db_table = 'metadata_dirtied' +# db_table = 'feeds' \ No newline at end of file diff --git a/CalibreWebCompanion/library/templates/base.html b/CalibreWebCompanion/library/templates/base.html index e0ff2e6..c4c8eaa 100644 --- a/CalibreWebCompanion/library/templates/base.html +++ b/CalibreWebCompanion/library/templates/base.html @@ -19,7 +19,7 @@ background-color: #515151; border: 1px #303030; border-radius: 0.5rem; - padding: .2rem .25rem ; + padding: .2rem .25rem; margin: 0.1rem 0.1rem .1rem; } @@ -48,6 +48,7 @@ .tags { width: 25%; } + .added { width: 10%; } @@ -55,12 +56,13 @@ .published { width: 10%; } -
+ + - {% if user.is_authenticated %} {% block content %} {% endblock %} {% else %} diff --git a/CalibreWebCompanion/library/templates/library/book_detail.html b/CalibreWebCompanion/library/templates/library/book_detail.html index 99750c7..ea795ac 100644 --- a/CalibreWebCompanion/library/templates/library/book_detail.html +++ b/CalibreWebCompanion/library/templates/library/book_detail.html @@ -6,46 +6,47 @@