From c7da6a3b4fd0d05da2eb5130786998dd1c273408 Mon Sep 17 00:00:00 2001 From: Sisi Date: Sun, 19 Apr 2026 22:19:23 +0200 Subject: [PATCH] fix deelevation of connection, update client --- machine-client/index.html | 12 ++++++++++-- main.go | 3 ++- packages/httpRequest/connectionsAndDms.go | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/machine-client/index.html b/machine-client/index.html index 3284a98..3742cd1 100644 --- a/machine-client/index.html +++ b/machine-client/index.html @@ -74,6 +74,7 @@ + @@ -107,9 +108,8 @@ fields: [ { id: 'nu-username', label: 'username', ph: 'min 4 chars' }, { id: 'nu-password', label: 'password', ph: 'min 8 chars' }, - { id: 'nu-color', label: 'color', ph: '255,100,50', hint: 'R,G,B' }, ], - submit: () => httpPost('/new/user', { username:'nu-username', password:'nu-password', color:'nu-color' }) + submit: () => httpPost('/new/user', { username:'nu-username', password:'nu-password' }) }, 'new-token': { title: 'POST /new/token — login / get token', @@ -165,6 +165,14 @@ ], submit: () => httpPost('/mod/connection/elevate', { token:'mce-token', connectionid:'mce-connectionid' }) }, + 'mod-connection-deelevate': { + title: 'POST /mod/connection/deelevate — de-elevate connection', + fields: [ + { id: 'mcde-token', label: 'token', ph: '' }, + { id: 'mcde-connectionid', label: 'connectionid', ph: 'UUID' }, + ], + submit: () => httpPost('/mod/connection/deelevate', { token:'mcde-token', connectionid:'mcde-connectionid' }) + }, 'get-user': { title: 'POST /get/user — get user info', fields: [ diff --git a/main.go b/main.go index f85e219..6a4466c 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ func main() { http.HandleFunc("/mod/user/avatar", withCORS(httpRequest.HandleUserModAvatar)) http.HandleFunc("/mod/user/profilebg", withCORS(httpRequest.HandleUserModProfileBg)) http.HandleFunc("/mod/connection/elevate", withCORS(httpRequest.HandleUserElevateConnection)) + http.HandleFunc("/mod/connection/deelevate", withCORS(httpRequest.HandleUserDeElevateConnection)) http.HandleFunc("/get/user", withCORS(httpRequest.HandleUserGetUser)) http.HandleFunc("/get/connections", withCORS(httpRequest.HandleUserGetConnections)) @@ -50,6 +51,6 @@ func main() { http.HandleFunc("/msg/user", withCORS(httpRequest.HandleDm)) http.HandleFunc("/ws", wsServer.ServeWsConnection) - log.Println("listening on :8080") + log.Println("beep boop; server server started") log.Fatal(http.ListenAndServe(":8080", nil)) } diff --git a/packages/httpRequest/connectionsAndDms.go b/packages/httpRequest/connectionsAndDms.go index 70ed7a0..0b7edb7 100644 --- a/packages/httpRequest/connectionsAndDms.go +++ b/packages/httpRequest/connectionsAndDms.go @@ -362,7 +362,7 @@ func HandleUserDeElevateConnection(response http.ResponseWriter, request *http.R } wsServer.WsSendMessageCloseIfTimeout(user2, types.WsEventMessage{ - Type: WsEventType.ConnectionElevated, + Type: WsEventType.ConnectionDeElevated, Event: types.ConnectionStatusChangeData{ Id: conn.Id, NewState: conn.State,