fix deelevation of connection, update client

This commit is contained in:
2026-04-19 22:19:23 +02:00
parent b8b1b4a0bc
commit c7da6a3b4f
3 changed files with 13 additions and 4 deletions
+10 -2
View File
@@ -74,6 +74,7 @@
<button data-form="mod-user-avatar" onclick="showForm('mod-user-avatar')">POST /mod/user/avatar</button>
<button data-form="mod-user-profilebg" onclick="showForm('mod-user-profilebg')">POST /mod/user/profilebg</button>
<button data-form="mod-connection-elevate" onclick="showForm('mod-connection-elevate')">POST /mod/connection/elevate</button>
<button data-form="mod-connection-deelevate" onclick="showForm('mod-connection-deelevate')">POST /mod/connection/deelevate</button>
<button data-form="get-user" onclick="showForm('get-user')">POST /get/user</button>
<button data-form="get-connections" onclick="showForm('get-connections')">POST /get/connections</button>
<button data-form="get-connection-messages" onclick="showForm('get-connection-messages')">POST /get/connection/messages</button>
@@ -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: [
+2 -1
View File
@@ -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))
}
+1 -1
View File
@@ -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,