From 38b8deeecf7d6452b3447d1108aa7fb93b36b7dd Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Fri, 15 Mar 2024 03:12:28 +0100 Subject: [PATCH] Token explanations. --- src/App/Page/Zone.purs | 4 +-- src/App/Text/Explanations.purs | 48 +++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/App/Page/Zone.purs b/src/App/Page/Zone.purs index afeec9b..50758f7 100644 --- a/src/App/Page/Zone.purs +++ b/src/App/Page/Zone.purs @@ -305,7 +305,7 @@ render state [ fancy_tab , case state.current_tab of Zone -> render_zone - TokenExplanation -> render_token_explanation + TokenExplanation -> Explanations.tokens ] where fancy_tab = @@ -315,8 +315,6 @@ render state ] is_tab_active tab = state.current_tab == tab - render_token_explanation = Bulma.explanation Explanations.token_introduction - render_zone = case state.wsUp, state.rr_modal of false, _ -> Bulma.p "You are disconnected." diff --git a/src/App/Text/Explanations.purs b/src/App/Text/Explanations.purs index 820f98e..c5faa1c 100644 --- a/src/App/Text/Explanations.purs +++ b/src/App/Text/Explanations.purs @@ -2,11 +2,51 @@ module App.Text.Explanations where import Halogen.HTML as HH import Bulma as Bulma -token_introduction :: forall w i. Array (HH.HTML w i) -token_introduction = - [ Bulma.p """ - Tokens are a way to update a resource record (A or AAAA) in a very simple way. +expl :: forall w i. Array (HH.HTML w i) -> HH.HTML w i +expl content = Bulma.div_content [ Bulma.explanation content ] + +tokens :: forall w i. HH.HTML w i +tokens = HH.div_ + [ Bulma.h3 "What are tokens?" + , expl [ Bulma.p """ + Tokens are a simple way to update a resource record (A or AAAA) with your current IP address. + """ + ] + , HH.p_ [ HH.text "Let's take an example: you have a A record (IPv4) pointing to your web server at home, " + , HH.text "but your ISP changes your IP address from time to time. " + , HH.text "You can ask for a token (which looks like " + , HH.u_ [HH.text "53be0c45-61c4-4d29-8ae9-c2cc8767603d"] + , HH.text ") for this specific entry, then make your server regularly visit the following website." + ] + , expl [ HH.p_ [ HH.text "https://beta.netlib.re/token-update/" + , HH.u_ [HH.text ""] + ] + ] + , Bulma.p "For example: https://beta.netlib.re/token-update/53be0c45-61c4-4d29-8ae9-c2cc8767603d" + , Bulma.hr + , Bulma.h3 "How to automate the update of my IP address?" + , Bulma.p "On Linux, you can make your computer access the update link with the following command." + , expl [ Bulma.strong "wget https://beta.netlib.re/token-update/" ] + , Bulma.p """ + No need for a more complex program. This works just fine. + And you can run this command every hour. + For example, in your crontab (Linux and Unix related): """ + , expl [ Bulma.strong "0 * * * * wget " ] + , Bulma.p """ + Commands for other operating systems may differ, but you get the idea. + """ + , Bulma.hr + , Bulma.h3 "The obvious trap ⚠" + , Bulma.p """ + Make sure to access the website using the related IP address. + To update an IPv6 address (AAAA), force your application to access the URL using an IPv6 address. + """ + , expl [ HH.p_ [ Bulma.strong "wget -6 " ] + , HH.p_ [ HH.text "To force the use of an IPv6 address." ] + , HH.p_ [ Bulma.strong "wget -4 " ] + , HH.p_ [ HH.text "To force the use of an IPv4 address." ] + ] ] dkim_introduction :: forall w i. Array (HH.HTML w i)