mirror of
https://github.com/getAlby/hub.git
synced 2026-08-13 12:33:39 +02:00
feat: allow setting LDK node alias (#1398)
* feat: add node alias customization for LDK nodes with public channels - Add new NodeAlias field to InfoResponse in API - Add SetNodeAlias method to API with config storage - Add HTTP endpoint POST /node/alias for setting node alias - Add corresponding Wails endpoint support - Create new Node settings page in frontend - Add conditional navigation item for LDK nodes with public channels - Include upgrade dialog and paid subscription check - Display success message prompting node restart after alias change - Show error toast for non-paid users attempting to change alias * chore: use node alias from config in LDK init * fix: make upgrade button non-absolute, remove disabled attribute * chore: move node alias page to be consistent with other node management pages * chore: remove redundant comment * chore: show upgrade dialog when clicking node alias option, show also for private channels --------- Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
This commit is contained in:
parent
4619781eaa
commit
8a0a432985
9 changed files with 194 additions and 1 deletions
|
|
@ -164,6 +164,7 @@ func (httpSvc *HttpService) RegisterSharedRoutes(e *echo.Echo) {
|
|||
restrictedApiGroup.GET("/settings/swaps", httpSvc.getAutoSwapsConfigHandler)
|
||||
restrictedApiGroup.POST("/settings/swaps", httpSvc.enableAutoSwapsHandler)
|
||||
restrictedApiGroup.DELETE("/settings/swaps", httpSvc.disableAutoSwapsHandler)
|
||||
restrictedApiGroup.POST("/node/alias", httpSvc.setNodeAliasHandler)
|
||||
|
||||
httpSvc.albyHttpSvc.RegisterSharedRoutes(restrictedApiGroup, e)
|
||||
}
|
||||
|
|
@ -1236,3 +1237,21 @@ func (httpSvc *HttpService) disableAutoSwapsHandler(c echo.Context) error {
|
|||
|
||||
return c.NoContent(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (httpSvc *HttpService) setNodeAliasHandler(c echo.Context) error {
|
||||
var setNodeAliasRequest api.SetNodeAliasRequest
|
||||
if err := c.Bind(&setNodeAliasRequest); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, ErrorResponse{
|
||||
Message: fmt.Sprintf("Bad request: %s", err.Error()),
|
||||
})
|
||||
}
|
||||
|
||||
err := httpSvc.api.SetNodeAlias(setNodeAliasRequest.NodeAlias)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
Message: fmt.Sprintf("Failed to set node alias: %s", err.Error()),
|
||||
})
|
||||
}
|
||||
|
||||
return c.NoContent(http.StatusNoContent)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue