diff --git a/cps/admin.py b/cps/admin.py index f104aa29..2c32431f 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -1186,11 +1186,20 @@ def _db_configuration_update_helper(): if not calibre_db.setup_db(to_save['config_calibre_dir'], ub.app_DB_path): return _db_configuration_result(_('DB Location is not Valid, Please Enter Correct Path'), gdrive_error) + # if db changed -> delete shelfs, delete download books, delete read books, kobo sync... + ub.session.query(ub.Downloads).delete() + ub.session.query(ub.ArchivedBook).delete() + ub.session.query(ub.ArchivedBook).delete() + ub.session.query(ub.ReadBook).delete() + ub.session.query(ub.BookShelf).delete() + ub.session.query(ub.Bookmark).delete() + ub.session.query(ub.KoboReadingState).delete() + ub.session.query(ub.KoboStatistics).delete() + ub.session.query(ub.KoboSyncedBooks).delete() _config_string(to_save, "config_calibre_dir") calibre_db.update_config(config) if not os.access(os.path.join(config.config_calibre_dir, "metadata.db"), os.W_OK): flash(_(u"DB is not Writeable"), category="warning") - # warning = {'type': "warning", 'message': _(u"DB is not Writeable")} config.save() return _db_configuration_result(None, gdrive_error) diff --git a/cps/db.py b/cps/db.py index 70da9108..4b0a7ac7 100644 --- a/cps/db.py +++ b/cps/db.py @@ -550,11 +550,8 @@ class CalibreDB(): @classmethod def setup_db(cls, config_calibre_dir, app_db_path): - # cls.config = config cls.dispose() - # toDo: if db changed -> delete shelfs, delete download books, delete read boks, kobo sync?? - if not config_calibre_dir: cls.config.invalidate() return False diff --git a/cps/static/js/main.js b/cps/static/js/main.js index 7a59b172..cf6fbe0d 100644 --- a/cps/static/js/main.js +++ b/cps/static/js/main.js @@ -284,11 +284,7 @@ $(function() { } function fillFileTable(path, type, folder, filt) { - if (window.location.pathname.endsWith("/basicconfig")) { - var request_path = "/../basicconfig/pathchooser/"; - } else { - var request_path = "/../../ajax/pathchooser/"; - } + var request_path = "/../../ajax/pathchooser/"; $.ajax({ dataType: "json", data: { diff --git a/cps/web.py b/cps/web.py index 2cb92a09..13c56f11 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1525,9 +1525,6 @@ def register(): @web.route('/login', methods=['GET', 'POST']) def login(): - #if not config.db_configured: - # log.debug(u"Redirect to initial configuration") - # return redirect(url_for('admin.basic_configuration')) if current_user is not None and current_user.is_authenticated: return redirect(url_for('web.index')) if config.config_login_type == constants.LOGIN_LDAP and not services.ldap: