diff options
| author | Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> | 2025-12-06 23:52:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-06 23:52:24 -0500 |
| commit | 97a70cd68813f2174fe145ee79784e509d11a742 (patch) | |
| tree | 4176c752516ebdb7a4a8841dbe29adee7d6c5774 /py_modules/lsfg_vk/configuration.py | |
| parent | 56c493184fc3960e3b33aa789fad618962c339ae (diff) | |
| parent | a9c560d66f55e96f1143ad3a310fac8148c0cdd6 (diff) | |
| download | decky-lsfg-vk-97a70cd68813f2174fe145ee79784e509d11a742.tar.gz decky-lsfg-vk-97a70cd68813f2174fe145ee79784e509d11a742.zip | |
fix: normalize spaces in profile names w dashes for conf requirements…
Diffstat (limited to 'py_modules/lsfg_vk/configuration.py')
| -rw-r--r-- | py_modules/lsfg_vk/configuration.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/py_modules/lsfg_vk/configuration.py b/py_modules/lsfg_vk/configuration.py index 9f8b028..74a3694 100644 --- a/py_modules/lsfg_vk/configuration.py +++ b/py_modules/lsfg_vk/configuration.py @@ -235,11 +235,11 @@ class ConfigurationService(BaseService): """Create a new profile Args: - profile_name: Name for the new profile + profile_name: Name for the new profile (spaces will be converted to dashes) source_profile: Optional source profile to copy from (default: current profile) Returns: - ProfileResponse with success status + ProfileResponse with success status and the normalized profile name """ try: profile_data = self._get_profile_data() @@ -247,15 +247,19 @@ class ConfigurationService(BaseService): if not source_profile: source_profile = profile_data["current_profile"] + # Get the normalized name that will be used for storage + normalized_name = ConfigurationManager.normalize_profile_name(profile_name) + new_profile_data = ConfigurationManager.create_profile(profile_data, profile_name, source_profile) self._save_profile_data(new_profile_data) - self.log.info(f"Created profile '{profile_name}' from '{source_profile}'") + self.log.info(f"Created profile '{normalized_name}' from '{source_profile}'") + # Return the normalized name so frontend can use the actual stored name return self._success_response(ProfileResponse, - f"Profile '{profile_name}' created successfully", - profile_name=profile_name) + f"Profile '{normalized_name}' created successfully", + profile_name=normalized_name) except ValueError as e: error_msg = f"Invalid profile operation: {str(e)}" @@ -306,14 +310,17 @@ class ConfigurationService(BaseService): Args: old_name: Current profile name - new_name: New profile name + new_name: New profile name (spaces will be converted to dashes) Returns: - ProfileResponse with success status + ProfileResponse with success status and the normalized profile name """ try: profile_data = self._get_profile_data() + # Get the normalized name that will be used for storage + normalized_name = ConfigurationManager.normalize_profile_name(new_name) + new_profile_data = ConfigurationManager.rename_profile(profile_data, old_name, new_name) self._save_profile_data(new_profile_data) @@ -322,11 +329,12 @@ class ConfigurationService(BaseService): if not script_result["success"]: self.log.warning(f"Failed to update launch script: {script_result['error']}") - self.log.info(f"Renamed profile '{old_name}' to '{new_name}'") + self.log.info(f"Renamed profile '{old_name}' to '{normalized_name}'") + # Return the normalized name so frontend can use the actual stored name return self._success_response(ProfileResponse, - f"Profile renamed from '{old_name}' to '{new_name}' successfully", - profile_name=new_name) + f"Profile renamed from '{old_name}' to '{normalized_name}' successfully", + profile_name=normalized_name) except ValueError as e: error_msg = f"Invalid profile operation: {str(e)}" |
