From 330d63ebd8a4e04fb97fa90af6a8d543782905cc Mon Sep 17 00:00:00 2001 From: 2mal3 <56305732+2mal3@users.noreply.github.com> Date: Mon, 18 Aug 2025 12:10:02 +0200 Subject: [PATCH] feat(display): ping route --- display/main.go | 9 +++++++++ requests/ping.bru | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 requests/ping.bru diff --git a/display/main.go b/display/main.go index 0274cc0..b9e13b8 100644 --- a/display/main.go +++ b/display/main.go @@ -53,6 +53,8 @@ var supportedExtensions = map[string]bool{ ".odp": true, } +const Version = "0.1.0" + func main() { var err error @@ -87,6 +89,7 @@ func main() { e.GET("/sse", sseRoute) apiGroup := e.Group("/api") + apiGroup.GET("/ping", pingRoute) apiGroup.PATCH("/shellCommand", shellCommandRoute) apiGroup.PATCH("/keyboardInput", keyboardInputRoute) apiGroup.PATCH("/showHTML", showHTMLRoute) @@ -430,6 +433,12 @@ func showHTMLRoute(ctx echo.Context) error { return ctx.NoContent(http.StatusOK) } +func pingRoute(ctx echo.Context) error { + return ctx.JSON(http.StatusOK, struct { + Version string `json:"version"` + }{Version: Version}) +} + // Reset previous file views so they dont collide with the new one func resetView() error { err := keyboardInput(keybd_event.VK_ESC) diff --git a/requests/ping.bru b/requests/ping.bru new file mode 100644 index 0000000..a26d058 --- /dev/null +++ b/requests/ping.bru @@ -0,0 +1,15 @@ +meta { + name: ping + type: http + seq: 7 +} + +get { + url: 127.0.0.1:1323/api/ping + body: none + auth: inherit +} + +settings { + encodeUrl: true +}