Merge branch 'main' into dev

This commit is contained in:
JackDandy 2024-08-13 12:29:15 +01:00
commit 176abcdd4d
6 changed files with 40 additions and 10 deletions

View file

@ -5,6 +5,12 @@
* Update urllib3 2.2.1 (54d6edf) to 2.2.2 (27e2a5c)
### 3.32.7 (2024-08-13 11:30:00 UTC)
* Change to prevent saving config.ini before it's fully loaded
* Change login form to be more password manager friendly
### 3.32.6 (2024-08-12 17:10:00 UTC)
* Fix saving config.ini after restart and startup

View file

@ -46,7 +46,7 @@
</head>
<body><div class="login"><form action="" method="post">$xsrf_form_html<div class="login-img center-block form-group"></div>
<div class="login-error"><div class="#if 'authfailed'==$resp then 'showme' else 'hide' #"><i class="error16"></i><span class="red-text">Authentication failed, please retry</span></div></div>
<div class="form-group input-group"><span class="input-group-addon"><i class="icons icons-user" style=""></i></span><input name="username" class="form-control" placeholder="Username" type="text" autofocus></div>
<div class="form-group input-group"><span class="input-group-addon"><i class="icons icons-lock" style=""></i></span><input name="password" class="form-control" placeholder="Password" type="password"></div>
<div class="form-group input-group"><span class="input-group-addon"><i class="icons icons-user" style=""></i></span><input name="username" class="form-control" placeholder="Username" type="text" autocomplete="username" autofocus></div>
<div class="form-group input-group"><span class="input-group-addon"><i class="icons icons-lock" style=""></i></span><input name="password" class="form-control" placeholder="Password" type="password" autocomplete="current-password"></div>
<div class="form-group"><label for="remember_me" class="login-remember"><input id="remember_me" name="remember_me" type="checkbox" value="1" checked="checked"><span>Remember me</span></label><input class="btn pull-right" name="submit" type="submit" value="Login"></div>
</form></div></body></html>

View file

@ -76,6 +76,7 @@ CFG = None # type: ConfigObj
CONFIG_FILE = ''
CONFIG_VERSION = None
CONFIG_OLD = None
CONFIG_LOADED = False
# Default encryption version (0 for None)
ENCRYPTION_VERSION = 0
@ -671,7 +672,7 @@ def init_stage_1(console_logging):
WEB_HOST, WEB_ROOT, ACTUAL_CACHE_DIR, CACHE_DIR, ZONEINFO_DIR, ADD_SHOWS_WO_DIR, ADD_SHOWS_METALANG, \
CREATE_MISSING_SHOW_DIRS, SHOW_DIRS_WITH_DOTS, \
RECENTSEARCH_STARTUP, NAMING_FORCE_FOLDERS, SOCKET_TIMEOUT, DEBUG, TVINFO_DEFAULT, \
CONFIG_FILE, CONFIG_VERSION, CONFIG_OLD, \
CONFIG_FILE, CONFIG_VERSION, CONFIG_OLD, CONFIG_LOADED, \
REMOVE_FILENAME_CHARS, IMPORT_DEFAULT_CHECKED_SHOWS, WANTEDLIST_CACHE, MODULE_UPDATE_STRING, EXT_UPDATES
# Add Show Search
global RESULTS_SORTBY
@ -1479,6 +1480,7 @@ def init_stage_1(console_logging):
header = callable(getattr(cur_provider, '_init_api', False)) and False is cur_provider._init_api() \
and header or {}
cur_provider.headers.update(header)
update_config |= cur_provider.should_save_config()
# current commit hash
CUR_COMMIT_HASH = check_setting_str(CFG, 'General', 'cur_commit_hash', '')
@ -1510,6 +1512,10 @@ def init_stage_1(console_logging):
# Get expected config version
CONFIG_VERSION = max(ConfigMigrator(CFG).migration_names)
# we have fully loaded all config settings into vars
CONFIG_LOADED = True
if update_config:
_save_config(force=True)
@ -1896,7 +1902,9 @@ def save_config(force=False):
:param force: force save config even if unchanged
"""
global config_events
global config_events, CONFIG_LOADED
if not CONFIG_LOADED:
return
# use queue if it's available, otherwise, call save_config directly
hasattr(config_events, 'put') and config_events.put(force) or _save_config(force)
@ -1904,7 +1912,10 @@ def save_config(force=False):
def _save_config(force=False, **kwargs):
# type: (bool, ...) -> None
global CONFIG_OLD
global CONFIG_OLD, CONFIG_LOADED
if not CONFIG_LOADED:
return
new_config = ConfigObj()
new_config.filename = CONFIG_FILE

View file

@ -275,6 +275,19 @@ class GenericProvider(object):
self.scene_rej_nuked = False # type: bool
self.scene_nuked_active = False # type: bool
self._save_config = False # type: bool
def save_main_config(self):
self._save_config = True
sickgear.save_config()
def should_save_config(self):
# type: (...) -> bool
_s_c = self._save_config
self._save_config = False
return _s_c
def _load_fail_values(self):
if hasattr(sickgear, 'DATA_DIR'):
my_db = db.DBConnection('cache.db')
@ -1957,7 +1970,7 @@ class TorrentProvider(GenericProvider):
if last_url != cur_url or (expire and not (expire > int(time.time()))):
sickgear.PROVIDER_HOMES[self.get_id()] = (cur_url, int(time.time()) + (60*60))
sickgear.save_config()
self.save_main_config()
return cur_url
seen_attr = 'PROVIDER_SEEN'
@ -1975,7 +1988,7 @@ class TorrentProvider(GenericProvider):
if not hasattr(self, 'url_api'):
self.urls = {}
sickgear.PROVIDER_HOMES[self.get_id()] = ('site down', int(time.time()) + (5 * 60))
sickgear.save_config()
self.save_main_config()
return None
def is_valid_mod(self, url):
@ -2088,7 +2101,7 @@ class TorrentProvider(GenericProvider):
if maxed_out(response) and hasattr(self, 'password'):
self.password = None
sickgear.save_config()
self.save_main_config()
msg = failed_msg(response)
if msg:
logger.error(msg % self.name)

View file

@ -56,7 +56,7 @@ class ImmortalSeedProvider(generic.TorrentProvider):
if secret_key != self.api_key:
self.api_key = secret_key
sickgear.save_config()
self.save_main_config()
return True

View file

@ -92,7 +92,7 @@ class SpeedCDProvider(generic.TorrentProvider):
self.digest = None
if self.session.cookies.get('inSpeed_speedian'):
self.digest = 'inSpeed_speedian=%s' % self.session.cookies.get('inSpeed_speedian')
sickgear.save_config()
self.save_main_config()
result = True
logger.debug('Cookie details for %s updated.' % self.name)
elif not self.failure_count: