Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Improve profile management #467

Merged
merged 2 commits into from
Dec 21, 2022

Conversation

jacobjmarks
Copy link
Contributor

This PR aims to improve the current profile management and add support for developers to be able to add additional information to a profile.

Changes

  • Move the profile logic within _api.py to util.py
  • Add some basic sanitisation to values being passed from _api to util
  • Alleviate the need to write a "Default" .profile file when no profile is in-use
    • When no .profile file is found within the mods directory, the UI appropriately indicates "Current Profile: None"
  • When deleting the profile that is currently in-use, the .profile file within the mods directory will also be removed - essentially un-setting the current profile - such that no stale profile reference is present.
  • Added ability for developers to extend profiles with additional information
    • This has been achieved by simply interpreting and writing .profile files as TSV files (very much open to feedback/alternatives); such that this change is backwards-compatible with little to no effort.
  • Improve UI loading titles when saving/setting/deleting profiles
  • Update the _api interfaces for set_profile and delete_profile such that they simply pass the name of the profile in which they wish to action (and not the profile path directly); the util functions will appropriately lookup the profile path.
    • Improves overall security, especially with delete_profile in which user (UI) input is no longer directly passed to rmtree

Considerations

The follows existing traits of profile management have been considered and have been kept functional in this PR:

  • Resiliency against profile folder renaming
    • If a user renames a profile folder (those within {bcml data}/profiles) profile path references are appropriately updated (when re-fetching the profile list); this is ultimately due to the existing logic within the get_profiles() function.

@GingerAvalanche GingerAvalanche merged commit ac86b2b into NiceneNerd:master Dec 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants