From ab654ddbe724f97f7b9a0599011f14b71708d0fe Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Thu, 17 Aug 2023 23:52:21 +0200 Subject: [PATCH] Comments. --- src/App/Container.purs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/App/Container.purs b/src/App/Container.purs index 63f8bf2..63eda3e 100644 --- a/src/App/Container.purs +++ b/src/App/Container.purs @@ -32,10 +32,23 @@ data Action | AuthenticationDaemonEvent WS.Output | DNSManagerDaemonEvent WS.Output | ZoneInterfaceEvent ZoneInterface.Output + + -- | Disconnect from both `authd` and `dnsmanagerd` (remove sockets). | Disconnection + + -- | Try to authenticate the user to `dnsmanagerd`. | AuthenticateToDNSManager + + -- | Change the displayed page. | Routing Page - | DNSMessageReceived DNSManager.AnswerMessage + + -- | DispatchDNSMessage: a DNS message (from `dnsmanagerd`) was received and decoded through the + -- | `DNSRawMessageReceived` action. + -- | The message is provided to the right component. + | DispatchDNSMessage DNSManager.AnswerMessage + + -- | DNSRawMessageReceived is the action when receiving a message, which is decoded in the handler. + -- | Then, the message will be provided to the `DispatchDNSMessage` action. | DNSRawMessageReceived ArrayBuffer type State = { token :: Maybe String @@ -96,7 +109,6 @@ render state ] where - -- TODO render_home = Bulma.box [ HH.slot_ _ho unit HomeInterface.component unit] render_zone domain = Bulma.box [ HH.slot _zi unit ZoneInterface.component domain ZoneInterfaceEvent] @@ -258,10 +270,10 @@ handleAction = case _ of handleAction Log $ SimpleLog $ "Failed! The domain already exists." m@(DNSManager.MkUnacceptableDomain _) -> do handleAction Log $ SimpleLog $ "Failed! The domain is not acceptable (not in the list of accepted domains)." - handleAction $ DNSMessageReceived m + handleAction $ DispatchDNSMessage m m@(DNSManager.MkAcceptedDomains _) -> do handleAction Log $ SimpleLog $ "Received the list of accepted domains!" - handleAction $ DNSMessageReceived m + handleAction $ DispatchDNSMessage m (DNSManager.MkLogged _) -> do handleAction Log $ SimpleLog $ "[TODO] Authenticated to dnsmanagerd!" (DNSManager.MkDomainAdded response) -> do @@ -288,7 +300,7 @@ handleAction = case _ of handleAction Log $ SimpleLog $ "[🎉] Success!" -- Send a received DNS manager message to a component. - DNSMessageReceived message -> do + DispatchDNSMessage message -> do handleAction Log $ SimpleLog "should send a DNS message to a component" --{ current_page } <- H.get --case current_page of