diff --git a/mediator/src/main/resources/application.conf b/mediator/src/main/resources/application.conf index 0e4517ef..ce6f84ad 100644 --- a/mediator/src/main/resources/application.conf +++ b/mediator/src/main/resources/application.conf @@ -16,7 +16,7 @@ mediator = { x = "MBjnXZxkMcoQVVL21hahWAw43RuAG-i64ipbeKKqwoA" x = ${?KEY_AUTHENTICATION_X} } - endpoint = "https://k8s-int.atalaprism.io/mediator" + endpoint = "https://mediator-test-env.atalaprism.io/mediator" endpoint = ${?SERVICE_ENDPOINT} } server.http.port = 8080 diff --git a/mediator/src/main/resources/public/index.html b/mediator/src/main/resources/public/index.html deleted file mode 100644 index 108dfffe..00000000 --- a/mediator/src/main/resources/public/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - IOHK Mediator - - - - - - - - - - - - - - - - - - -
- - - \ No newline at end of file diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/app/IndexHtml.scala b/mediator/src/main/scala/io/iohk/atala/mediator/app/IndexHtml.scala new file mode 100644 index 00000000..f5923e5e --- /dev/null +++ b/mediator/src/main/scala/io/iohk/atala/mediator/app/IndexHtml.scala @@ -0,0 +1,31 @@ +package io.iohk.atala.mediator.app + +import zio.http.Response +import fmgp.did.DID + +object IndexHtml { + // TODO use the html.Html.fromDomElement() + def html(identity: DID) = Response.html(s""" + | + | + | IOHK Mediator + | + | + | + | + | + | + | + | + | + | + | + |
+ | + | + |""".stripMargin) +} diff --git a/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorAgent.scala b/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorAgent.scala index 9204d3ee..432506a0 100644 --- a/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorAgent.scala +++ b/mediator/src/main/scala/io/iohk/atala/mediator/app/MediatorAgent.scala @@ -261,8 +261,11 @@ object MediatorAgent { .setStatus(Status.BadRequest) ) case req @ Method.GET -> !! => { // html.Html.fromDomElement() - val data = Source.fromResource(s"public/index.html").mkString("") - ZIO.log("index.html") *> ZIO.succeed(Response.html(data)) + for { + agent <- ZIO.service[MediatorAgent] + _ <- ZIO.log("index.html") + ret <- ZIO.succeed(IndexHtml.html(agent.id)) + } yield ret } }: Http[ Operations & Resolver & MessageDispatcher & MediatorAgent & MessageItemRepo & UserAccountRepo, diff --git a/webapp/src/main/scala/fmgp/webapp/Global.scala b/webapp/src/main/scala/fmgp/webapp/Global.scala index 1ecc97b2..90963d88 100644 --- a/webapp/src/main/scala/fmgp/webapp/Global.scala +++ b/webapp/src/main/scala/fmgp/webapp/Global.scala @@ -13,9 +13,11 @@ import fmgp.did.comm._ object Global { - def mediatorDID = FROM( - "did:peer:2.Ez6LSghwSE437wnDE1pt3X6hVDUQzSjsHzinpX3XFvMjRAm7y.Vz6Mkhh1e5CEYYq6JBUcTZ6Cp2ranCWRrv7Yax3Le4N59R6dd.SeyJ0IjoiZG0iLCJzIjoiaHR0cHM6Ly9rOHMtaW50LmF0YWxhcHJpc20uaW8vbWVkaWF0b3IiLCJyIjpbXSwiYSI6WyJkaWRjb21tL3YyIl19" - ) + var mediatorDID = { + val didSTR = dom.document.querySelector("""meta[name="did"]""") + FROM(didSTR.getAttribute("content")) + } + def clipboardSideEffect(text: => String): Any => Unit = (_: Any) => { dom.window.navigator.clipboard.writeText(text) } diff --git a/webapp/src/main/scala/fmgp/webapp/MediatorInfo.scala b/webapp/src/main/scala/fmgp/webapp/MediatorInfo.scala index f8b67aab..f6937e82 100644 --- a/webapp/src/main/scala/fmgp/webapp/MediatorInfo.scala +++ b/webapp/src/main/scala/fmgp/webapp/MediatorInfo.scala @@ -31,7 +31,7 @@ object MediatorInfo { div( h1("Invite for the DID Comm Mediator:"), h3("Plaintext out of band invitation:"), - p(code(qrCodeData)), + p(a(href := qrCodeData, target := "_blank", code(qrCodeData))), // FIXME make it a link to the mobile app pre(code(invitation.toPlaintextMessage.toJsonPretty)), divQRCode, h3("Signed out of band invitation:"),