Explorer

html-ui.secrets-page

description
(en) The page /secrets of the secrets kept by this server (read_secrets), without the values
type
Fn(language: String, response: List<@definy.secret-info>) -> @definy.service-io
expression
fn(language$990, response$0) =>
  @html-ui.page(
    language: $990,
    title: @html-ui.text(language: $990, en: "Secrets", ja: "シークレット", eo: "Sekretoj"),
    body: @html.concat(
      lists: [
        [
          @html-ui.text-element(
            name: "h1",
            text: @html-ui.text(language: $990, en: "Secrets", ja: "シークレット", eo: "Sekretoj")
          ),
          @html.element(
            name: "p",
            attributes: [],
            children: @html-ui.text-nodes(
              language: $990,
              en: [
                @html.text(
                  text: "The secrets kept by this server (values of headers sent by programs that do I/O). The values are not shown. Enter or change them on the page of the secret part (a part whose expression is "
                ),
                @html-ui.text-element(name: "code", text: "secret(...)"),
                @html.text(text: ", e.g. "),
                @html-ui.text-element(name: "code", text: "definy.cloudflare-api-token"),
                @html.text(text: ").")
              ],
              ja: [
                @html.text(
                  text: "このサーバーに入れてあるシークレット (I/O をするプログラムが送るヘッダーの値)。値は表示しません。入れる・変えるのはシークレットのパーツ (式が "
                ),
                @html-ui.text-element(name: "code", text: "secret(...)"),
                @html.text(text: " のパーツ。例: "),
                @html-ui.text-element(name: "code", text: "definy.cloudflare-api-token"),
                @html.text(text: ") のページです。")
              ],
              eo: [
                @html.text(
                  text: "La sekretoj konservitaj de ĉi tiu servilo (valoroj de kapoj senditaj de programoj kun enigo/eligo). La valoroj ne estas montrataj. Enigu aŭ ŝanĝu ilin en la paĝo de la sekreta parto (parto kies esprimo estas "
                ),
                @html-ui.text-element(name: "code", text: "secret(...)"),
                @html.text(text: ", ekz. "),
                @html-ui.text-element(name: "code", text: "definy.cloudflare-api-token"),
                @html.text(text: ").")
              ]
            )
          )
        ],
        match @core.equal(left: @core.list-length(value: $0), right: 0) {
          true =>
            [
              @html.element(
                name: "p",
                attributes: [{name: "class", value: "muted"}],
                children: [
                  @html.text(
                    text: @html-ui.text(language: $990, en: "None yet", ja: "まだありません", eo: "Ankoraŭ neniu")
                  )
                ]
              )
            ],
          false =>
            []
        },
        [
          @html.element(
            name: "div",
            attributes: [{name: "class", value: "history"}],
            children: @html.concat(
              lists: @core.list-map(
                T: @definy.secret-info,
                U: List<@html.node>,
                f: fn(item$1) =>
                  @core.list-concat(
                    left: [
                      @html.element(
                        name: "div",
                        attributes: [{name: "class", value: "snapshot-head"}],
                        children: [
                          @html-ui.text-element(name: "b", text: $1.label),
                          @html.text(text: " "),
                          @html.element(name: "code", attributes: [{name: "class", value: "muted"}], children: [@html.text(text: $1.id)])
                        ]
                      ),
                      @html.element(
                        name: "div",
                        attributes: [{name: "class", value: "message"}],
                        children: [
                          @html.element(
                            name: "span",
                            attributes: [{name: "class", value: "muted"}],
                            children: [
                              @html.text(
                                text: @html-ui.text(language: $990, en: "Allowed destinations", ja: "送ってよい宛先", eo: "Permesitaj celoj")
                              )
                            ]
                          ),
                          @html.text(text: " "),
                          @html.text(text: @core.string-join(items: $1.allowed_url_prefixes, separator: ", "))
                        ]
                      ),
                      @html.element(
                        name: "div",
                        attributes: [{name: "class", value: "message"}],
                        children: [
                          @html.element(
                            name: "span",
                            attributes: [{name: "class", value: "muted"}],
                            children: [
                              @html.text(text: @html-ui.text(language: $990, en: "Saved at", ja: "入れた日時", eo: "Konservita je"))
                            ]
                          ),
                          @html.text(text: " "),
                          @html-ui.time-span(ms: @std.number-to-string(value: $1.updated_ms))
                        ]
                      )
                    ],
                    right: @html-ui.tool-form(
                      tool: "secret",
                      then: "/secrets",
                      confirm: @core.string-join(
                        items: [
                          @html-ui.text(
                            language: $990,
                            en: "Delete the value of the secret ",
                            ja: "シークレット ",
                            eo: "Ĉu forigi la valoron de la sekreto "
                          ),
                          $1.label,
                          @html-ui.text(language: $990, en: "?", ja: " の値を消しますか?", eo: "?")
                        ],
                        separator: ""
                      ),
                      fields: [
                        @html-ui.hidden(name: "id", value: $1.id),
                        @html-ui.hidden(name: "label", value: $1.label),
                        @html.element(
                          name: "input",
                          attributes: [
                            {name: "type", value: "hidden"},
                            {name: "name", value: "value"},
                            {name: "value", value: ""},
                            {name: "data-keep-empty", value: ""}
                          ],
                          children: []
                        )
                      ],
                      button: @html-ui.text(language: $990, en: "Delete the value", ja: "値を消す", eo: "Forigi la valoron")
                    )
                  ),
                xs: $0
              )
            )
          ),
          @html-ui.time-script
        ]
      ]
    )
  )
visibility
public
html-ui.secrets-page (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: vTly8ECbl2F3rxTNallHFuZr8aPH9VHZ8Iw4VR9J8zY
content hash: iFRXK5uf0FjPQwRdEZ1VFFccm1Dba6pqhU4JzpNs3dc