v0.8.0 wasm client added, cli client and makefile updated

This commit is contained in:
2025-11-14 05:57:37 -05:00
parent 2a2e82a162
commit ef60cfaac5
22 changed files with 1073 additions and 36 deletions

View File

@ -3,8 +3,6 @@ package command
import (
"fmt"
"os"
"os/exec"
"strings"
"time"
@ -37,14 +35,6 @@ func (r *Registry) registerDebugCommands() {
Usage: "raw <method> <path> [json-body]",
Handler: rawRequestHandler,
})
r.Register(&Command{
Name: "clear",
ShortName: "-",
Description: "Clear screen",
Usage: "clear",
Handler: clearHandler,
})
}
func healthHandler(s *session.Session, args []string) error {
@ -54,7 +44,7 @@ func healthHandler(s *session.Session, args []string) error {
return err
}
display.Println(display.Cyan, "%sServer Health:%s")
display.Println(display.Cyan, "Server Health:")
fmt.Printf(" Status: %s\n", resp.Status)
// Convert Unix timestamp to readable time
t := time.Unix(resp.Time, 0)
@ -100,10 +90,4 @@ func rawRequestHandler(s *session.Session, args []string) error {
c := s.GetClient().(*api.Client)
return c.RawRequest(method, path, body)
}
func clearHandler(s *session.Session, args []string) error {
cmd := exec.Command("clear")
cmd.Stdout = os.Stdout
return cmd.Run()
}

View File

@ -1,4 +1,4 @@
// FILE: internal/client/command/auth_unix.go
// FILE: lixenwraith/chess/internal/client/command/pass_native.go
//go:build !js && !wasm
package command

View File

@ -1,4 +1,4 @@
// FILE: lixenwraith/chess/internal/client/command/auth_wasm.go
// FILE: lixenwraith/chess/internal/client/command/pass_wasm.go
//go:build js && wasm
package command

View File

@ -141,7 +141,6 @@ func (r *Registry) helpHandler(s *session.Session, args []string) error {
{"health", ".", ""},
{"url", "/", ""},
{"raw", ":", ""},
{"clear", "-", ""},
{"help", "?", ""},
{"exit", "x", ""},
}

View File

@ -13,7 +13,7 @@ import (
"github.com/gofiber/fiber/v2/middleware/logger"
)
//go:embed web
//go:embed chess-client-web
var webFS embed.FS
// Start initializes and starts the web UI server
@ -58,8 +58,8 @@ func Start(host string, port int, apiURL string) error {
// Try to read the file
data, err := fs.ReadFile(webContent, fsPath)
if err != nil {
// If the file isn't found, serve index.html for SPA-style routing.
// This handles client-side routes that don't correspond to a file.
// If the file isn't found, serve index.html for SPA-style routing
// This handles client-side routes that don't correspond to a file
data, err = fs.ReadFile(webContent, "index.html")
if err != nil {
return c.Status(fiber.StatusInternalServerError).SendString("index.html not found")