Controller: hide Root CA download until drive is ready

During onboarding the media drive is not mounted and ca.crt does not exist
yet (or still holds only a throwaway pre-drive state). The cert banner still
offered Download WROLPi Root CA, which 404'd. Gate the button and HTTPS
cert-setup banner on drive mounted, ca.crt present, and repair not running
so an existing CA on the drive can be served after mount/repair.
This commit is contained in:
Roland 2026-07-18 13:40:23 -06:00
parent a3a712ead1
commit 46ba804a1b
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 161 additions and 7 deletions

View file

@ -81,6 +81,24 @@ def is_primary_drive_mounted() -> bool:
return CONFIG_PATH_ON_DRIVE.exists()
def get_ca_certificate_path() -> Path:
"""Path to the persistent WROLPi Root CA on the media directory."""
return get_media_directory() / "config" / "ssl" / "ca.crt"
def is_ca_certificate_available() -> bool:
"""True when the Root CA file is present on the media directory.
On native installs the primary drive must be mounted first so a CA that
already lives on the drive is visible (and so we never advertise a
transient CA written onto the root filesystem during onboarding).
Docker always has its media volume available.
"""
if not is_docker_mode() and not is_primary_drive_mounted():
return False
return get_ca_certificate_path().is_file()
def reload_config_from_drive() -> bool:
"""
Load config from the mounted WROLPi drive and merge with defaults.