Skip to content

Commit 271b949

Browse files
oliv3rclaude
andcommitted
Fixed: Allow Vault.set_setting() to pre-fill the keyboard prompt
Without a default, each retry in a login loop forces the user to re-type the same value from scratch, which is frustrating enough already, but even more so on a TV remote. Callers that need pre-fill can now pass it explicitly; existing callers are unaffected. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
1 parent 5815480 commit 271b949

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

resources/lib/vault.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def get_setting(self, setting_id):
172172

173173
return decrypted_value
174174

175-
def set_setting(self, setting_id, setting_name=None, setting_action_id=None):
175+
def set_setting(self, setting_id, setting_name=None, setting_action_id=None, default=""):
176176
""" Reads a value for a setting from the keyboard and encrypts it in the Kodi
177177
Add-on settings.
178178
@@ -182,14 +182,15 @@ def set_setting(self, setting_id, setting_name=None, setting_action_id=None):
182182
:param str setting_name: The name to display in the keyboard.
183183
:param str setting_action_id: The name of setting that shows the ***** if an value was
184184
encrypted.
185+
:param str default: Optional value to pre-fill in the keyboard.
185186
186187
:rtype: None
187188
188189
"""
189190

190191
Logger.info("Encrypting value for setting '%s'", setting_id)
191192
input_value = XbmcWrapper.show_key_board(
192-
"", LanguageHelper.get_localized_string(
193+
default, LanguageHelper.get_localized_string(
193194
LanguageHelper.VaultSpecifySetting
194195
) % (setting_name or setting_id,)
195196
)

0 commit comments

Comments
 (0)