|
|
|
@ -281,6 +281,7 @@ class Settings(Base):
|
|
|
|
|
config_anonbrowse = Column(SmallInteger, default=0)
|
|
|
|
|
config_public_reg = Column(SmallInteger, default=0)
|
|
|
|
|
config_default_role = Column(SmallInteger, default=0)
|
|
|
|
|
config_default_show = Column(SmallInteger, default=2047)
|
|
|
|
|
config_columns_to_ignore = Column(String)
|
|
|
|
|
config_use_google_drive = Column(Boolean)
|
|
|
|
|
config_google_drive_client_id = Column(String)
|
|
|
|
@ -288,7 +289,6 @@ class Settings(Base):
|
|
|
|
|
config_google_drive_folder = Column(String)
|
|
|
|
|
config_google_drive_calibre_url_base = Column(String)
|
|
|
|
|
config_google_drive_watch_changes_response = Column(String)
|
|
|
|
|
#config_columns_to_ignore = Column(String)
|
|
|
|
|
config_remote_login = Column(Boolean)
|
|
|
|
|
config_use_goodreads = Column(Boolean)
|
|
|
|
|
config_goodreads_api_key = Column(String)
|
|
|
|
@ -337,6 +337,7 @@ class Config:
|
|
|
|
|
self.config_anonbrowse = data.config_anonbrowse
|
|
|
|
|
self.config_public_reg = data.config_public_reg
|
|
|
|
|
self.config_default_role = data.config_default_role
|
|
|
|
|
self.config_default_show = data.config_default_show
|
|
|
|
|
self.config_columns_to_ignore = data.config_columns_to_ignore
|
|
|
|
|
self.config_use_google_drive = data.config_use_google_drive
|
|
|
|
|
self.config_google_drive_client_id = data.config_google_drive_client_id
|
|
|
|
@ -400,6 +401,50 @@ class Config:
|
|
|
|
|
return bool((self.config_default_role is not None) and
|
|
|
|
|
(self.config_default_role & ROLE_DELETE_BOOKS == ROLE_DELETE_BOOKS))
|
|
|
|
|
|
|
|
|
|
def show_detail_random(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & DETAIL_RANDOM == DETAIL_RANDOM))
|
|
|
|
|
|
|
|
|
|
def show_language(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_LANGUAGE == SIDEBAR_LANGUAGE))
|
|
|
|
|
|
|
|
|
|
def show_series(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_SERIES == SIDEBAR_SERIES))
|
|
|
|
|
|
|
|
|
|
def show_category(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_CATEGORY == SIDEBAR_CATEGORY))
|
|
|
|
|
|
|
|
|
|
def show_hot_books(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_HOT == SIDEBAR_HOT))
|
|
|
|
|
|
|
|
|
|
def show_random_books(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_RANDOM == SIDEBAR_RANDOM))
|
|
|
|
|
|
|
|
|
|
def show_author(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_AUTHOR == SIDEBAR_AUTHOR))
|
|
|
|
|
|
|
|
|
|
def show_best_rated_books(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_BEST_RATED == SIDEBAR_BEST_RATED))
|
|
|
|
|
|
|
|
|
|
def show_read_and_unread(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_READ_AND_UNREAD == SIDEBAR_READ_AND_UNREAD))
|
|
|
|
|
|
|
|
|
|
def show_recent(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_RECENT == SIDEBAR_RECENT))
|
|
|
|
|
|
|
|
|
|
def show_sorted(self):
|
|
|
|
|
return bool((self.config_default_show is not None) and
|
|
|
|
|
(self.config_default_show & SIDEBAR_SORTED == SIDEBAR_SORTED))
|
|
|
|
|
|
|
|
|
|
def mature_content_tags(self):
|
|
|
|
|
if sys.version_info > (3, 0): # Python3 str, Python2 unicode
|
|
|
|
|
lstrip = str.lstrip
|
|
|
|
@ -532,6 +577,13 @@ def migrate_Database():
|
|
|
|
|
except exc.OperationalError:
|
|
|
|
|
conn = engine.connect()
|
|
|
|
|
conn.execute("ALTER TABLE Settings ADD column `config_mature_content_tags` String DEFAULT ''")
|
|
|
|
|
try:
|
|
|
|
|
session.query(exists().where(Settings.config_default_show)).scalar()
|
|
|
|
|
session.commit()
|
|
|
|
|
except exc.OperationalError: # Database is not compatible, some rows are missing
|
|
|
|
|
conn = engine.connect()
|
|
|
|
|
conn.execute("ALTER TABLE Settings ADD column `config_default_show` SmallInteger DEFAULT 2047")
|
|
|
|
|
session.commit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clean_database():
|
|
|
|
|