From 6be8c413f13f4cff285aa5ffde57be9ae5c867fb Mon Sep 17 00:00:00 2001 From: Roland <33993199+rolznz@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:22:39 +0800 Subject: [PATCH] chore: rename app name parameter (#154) * chore: rename app name parameter * doc: replace all instances of `c` parameter with `name` in README --- README.md | 8 ++++---- echo_handlers.go | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 21bc4d5b..c2eb2bba 100644 --- a/README.md +++ b/README.md @@ -67,17 +67,17 @@ The default option is that the NWC app creates a secret and the user uses the no ##### Query parameter options -- `c`: the name of the client app +- `name`: the name of the client app Example: -`/apps/new?c=myapp` +`/apps/new?name=myapp` #### Client created secret If the client creates the secret the client only needs to share the public key of that secret for authorization. The user authorized that pubkey and no sensitivate data needs to be shared. ##### Query parameter options for /new -- `c`: the name of the client app +- `name`: the name of the client app - `pubkey`: the public key of the client's secret for the user to authorize - `return_to`: (optional) if a `return_to` URL is provided the user will be redirected to that URL after authorization. The `lud16`, `relay` and `pubkey` query parameters will be added to the URL. - `expires_at` (optional) connection cannot be used after this date. Unix timestamp in seconds. @@ -88,7 +88,7 @@ If the client creates the secret the client only needs to share the public key o Example: -`/apps/new?c=myapp&pubkey=47c5a21...&return_to=https://example.com` +`/apps/new?name=myapp&pubkey=47c5a21...&return_to=https://example.com` #### Web-flow: client created secret Web clients can open a new prompt popup to load the authorization page. diff --git a/echo_handlers.go b/echo_handlers.go index 493256c3..30ae8ff1 100644 --- a/echo_handlers.go +++ b/echo_handlers.go @@ -237,7 +237,11 @@ func getEndOfBudgetString(endOfBudget time.Time) (result string) { } func (svc *Service) AppsNewHandler(c echo.Context) error { - appName := c.QueryParam("c") // c - for client + appName := c.QueryParam("name") + if (appName == "") { + // c - for client (deprecated) + appName = c.QueryParam("c") + } pubkey := c.QueryParam("pubkey") returnTo := c.QueryParam("return_to") maxAmount := c.QueryParam("max_amount")