From b94219512f8ce500463a647b09552a5185520732 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 25 Mar 2023 14:42:28 -0300 Subject: [PATCH] do not act on input blank. --- src/main/scala/Main.scala | 2 +- src/main/scala/Parser.scala | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/Main.scala b/src/main/scala/Main.scala index 3a6007b..0881c0e 100644 --- a/src/main/scala/Main.scala +++ b/src/main/scala/Main.scala @@ -85,7 +85,7 @@ object Main extends IOWebApp { cls := "w-full max-h-96 p-3 rounded", styleAttr := "min-height: 280px; font-family: monospace", spellCheck := false, - placeholder := "paste something nostric", + placeholder := "paste something nostric (event JSON, nprofile, npub, nevent etc or hex key or id)", onInput --> (_.foreach(_ => self.value.get.flatMap(store.input.set) )), diff --git a/src/main/scala/Parser.scala b/src/main/scala/Parser.scala index 2de17f4..adf0090 100644 --- a/src/main/scala/Parser.scala +++ b/src/main/scala/Parser.scala @@ -12,7 +12,8 @@ type Result = Either[ ] object Parser { - def parseInput(input: String): Result = + def parseInput(input: String): Result = if input == "" then Left("") + else ByteVector .fromHex(input) .flatMap(b => Try(Right(ByteVector32(b))).toOption)