mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-10-22 17:22:09 +03:00
[2232] Fix Missing Preferences
Fixes an issue that could present on clean installs where the EDSM keys weren't generated properly. When the heck did this bug get introduced???
This commit is contained in:
1 file changed
+14
@@ -491,6 +491,20 @@ def credentials(cmdr: str) -> tuple[str, str] | None:
|
||||
edsm_usernames = config.get_list('edsm_usernames')
|
||||
edsm_apikeys = config.get_list('edsm_apikeys')
|
||||
|
||||
if not edsm_usernames: # https://github.com/EDCD/EDMarketConnector/issues/2232
|
||||
edsm_usernames = ["" for _ in range(len(cmdrs))]
|
||||
config.set('edsm_usernames', edsm_usernames)
|
||||
else: # Check for Mismatched Length - fill with null values.
|
||||
if len(edsm_usernames) < len(cmdrs):
|
||||
edsm_usernames.extend(["" for _ in range(len(cmdrs) - len(edsm_usernames))])
|
||||
|
||||
if not edsm_apikeys:
|
||||
edsm_apikeys = ["" for _ in range(len(cmdrs))]
|
||||
config.set('edsm_apikeys', edsm_apikeys)
|
||||
else: # Check for Mismatched Length - fill with null values.
|
||||
if len(edsm_apikeys) < len(cmdrs):
|
||||
edsm_apikeys.extend(["" for _ in range(len(cmdrs) - len(edsm_apikeys))])
|
||||
|
||||
if cmdr in cmdrs and len(cmdrs) == len(edsm_usernames) == len(edsm_apikeys):
|
||||
idx = cmdrs.index(cmdr)
|
||||
if idx < len(edsm_usernames) and idx < len(edsm_apikeys):
|
||||
|
||||
Reference in new issue
Block a user