diff --git a/go-socket b/go-socket index 7af15e3..8d1d71e 100755 Binary files a/go-socket and b/go-socket differ diff --git a/http.go b/http.go index ae0e7e4..7f48e63 100644 --- a/http.go +++ b/http.go @@ -113,6 +113,8 @@ func HttpHandleLogin(response http.ResponseWriter, request *http.Request) { client, err = CacheGetClientByName(username) if err != nil { + client = &Client{Name: username} + err := DbSetClientByName(ctx, client) if err != nil { http.Error(response, "bad login", http.StatusUnauthorized) diff --git a/machine-client/index.html b/machine-client/index.html index 01cdde3..ea69602 100644 --- a/machine-client/index.html +++ b/machine-client/index.html @@ -43,23 +43,65 @@ #send-row input { flex: 1; margin: 0; } #send-row button { margin: 0; } - .hint { margin-top: 20px; font-size: 12px; color: #666; border-top: 1px solid #2a2a2a; padding-top: 12px; } - .hint code { background: #2a2a2a; padding: 2px 5px; border-radius: 3px; color: #ccc; } + input[type="password"] { + width: 100%; padding: 8px; background: #2a2a2a; border: 1px solid #444; + color: #e0e0e0; font-family: monospace; font-size: 13px; border-radius: 4px; + } + .tabs { display: flex; gap: 8px; margin-bottom: 16px; } + .tab-btn { + padding: 6px 16px; background: #2a2a2a; border: 1px solid #444; + color: #aaa; border-radius: 4px; cursor: pointer; font-family: monospace; font-size: 13px; + } + .tab-btn.active { background: #4a90d9; color: #fff; border-color: #4a90d9; } + .tab { display: none; } + .tab.active { display: block; } + #form-status { + margin-top: 10px; font-size: 13px; padding: 6px 10px; + border-radius: 4px; background: #2a2a2a; border-left: 3px solid #555; display: none; + } + #form-status.ok { border-color: #4caf50; color: #81c784; display: block; } + #form-status.err { border-color: #f44336; color: #e57373; display: block; }

WebSocket Client

- - - -
Not connected
-
- Register: curl -X POST localhost:8080/register -d "username=alice&password=password123"

- Login: curl -X POST localhost:8080/login -d "username=alice&password=password123" +
+ + +
+ +
+ + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + +
+ +
+
Not connected
@@ -75,6 +117,64 @@