defmodule PhoenixKitWeb.Live.Settings do @moduledoc """ Admin settings management LiveView for PhoenixKit. Provides interface for managing system-wide settings including timezone, date/time formats. """ use PhoenixKitWeb, :live_view use Gettext, backend: PhoenixKitWeb.Gettext alias PhoenixKit.Config.EndpointUrlSync alias PhoenixKit.Modules.Storage.URLSigner alias PhoenixKit.Settings alias PhoenixKit.Settings.Events, as: SettingsEvents alias PhoenixKit.Users.OAuthConfig alias PhoenixKit.Utils.Date, as: UtilsDate alias PhoenixKit.Utils.Routes alias PhoenixKit.Utils.TimeZone require Logger def mount(_params, _session, socket) do # Subscribe to settings changes for live updates (like entities does) if connected?(socket) do SettingsEvents.subscribe_to_settings() end # Load current settings from database. S007: this page never renders the # OAuth login secrets or AWS keys (that's the Authorization page's job), # so it has no reason to hold their real values in socket state at all — # list_public_settings/0 (an explicit allow list, not a redaction of # list_all_settings/0) leaves them out entirely. current_settings = Settings.list_public_settings() defaults = Settings.get_defaults() # The saved site timezone has to be one of the offered options, or the #