diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html
index 4b8aefde..84e95847 100644
--- a/cps/templates/config_edit.html
+++ b/cps/templates/config_edit.html
@@ -203,6 +203,10 @@
+
+
+
+
diff --git a/cps/ub.py b/cps/ub.py
index 0d0f78e0..324196c6 100644
--- a/cps/ub.py
+++ b/cps/ub.py
@@ -41,7 +41,7 @@ SIDEBAR_BEST_RATED = 128
SIDEBAR_READ_AND_UNREAD = 256
SIDEBAR_RECENT = 512
SIDEBAR_SORTED = 1024
-
+MATURE_CONTENT = 2048
DEFAULT_PASS = "admin123"
DEFAULT_PORT = int(os.environ.get("CALIBRE_PORT", 8083))
@@ -458,6 +458,10 @@ class Config:
return bool((self.config_default_show is not None) and
(self.config_default_show & SIDEBAR_SORTED == SIDEBAR_SORTED))
+ def show_mature_content(self):
+ return bool((self.config_default_show is not None) and
+ (self.config_default_show & MATURE_CONTENT == MATURE_CONTENT))
+
def mature_content_tags(self):
if sys.version_info > (3, 0): # Python3 str, Python2 unicode
lstrip = str.lstrip
@@ -665,7 +669,7 @@ def create_admin_user():
user.role = ROLE_USER + ROLE_ADMIN + ROLE_DOWNLOAD + ROLE_UPLOAD + ROLE_EDIT + ROLE_DELETE_BOOKS + ROLE_PASSWD
user.sidebar_view = DETAIL_RANDOM + SIDEBAR_LANGUAGE + SIDEBAR_SERIES + SIDEBAR_CATEGORY + SIDEBAR_HOT + \
SIDEBAR_RANDOM + SIDEBAR_AUTHOR + SIDEBAR_BEST_RATED + SIDEBAR_READ_AND_UNREAD + SIDEBAR_RECENT + \
- SIDEBAR_SORTED
+ SIDEBAR_SORTED + MATURE_CONTENT
user.password = generate_password_hash(DEFAULT_PASS)
diff --git a/cps/web.py b/cps/web.py
index 33f1e4a9..a74f5f91 100755
--- a/cps/web.py
+++ b/cps/web.py
@@ -2601,6 +2601,9 @@ def configuration_helper(origin):
content.config_default_show = content.config_default_show + ub.SIDEBAR_RECENT
if "show_sorted" in to_save:
content.config_default_show = content.config_default_show + ub.SIDEBAR_SORTED
+ if "show_mature_content" in to_save:
+ content.config_default_show = content.config_default_show + ub.MATURE_CONTENT
+
if content.config_logfile != to_save["config_logfile"]:
# check valid path, only path or file
if os.path.dirname(to_save["config_logfile"]):
@@ -2724,6 +2727,7 @@ def new_user():
else:
content.role = config.config_default_role
content.sidebar_view = config.config_default_show
+ content.mature_content = bool(config.config_default_show & ub.MATURE_CONTENT)
return render_title_template("user_edit.html", new_user=1, content=content, translations=translations,
languages=languages, title=_(u"Add new user"))