fix deelevation of connection, update client
This commit is contained in:
@@ -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-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-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-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-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-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>
|
<button data-form="get-connection-messages" onclick="showForm('get-connection-messages')">POST /get/connection/messages</button>
|
||||||
@@ -107,9 +108,8 @@
|
|||||||
fields: [
|
fields: [
|
||||||
{ id: 'nu-username', label: 'username', ph: 'min 4 chars' },
|
{ id: 'nu-username', label: 'username', ph: 'min 4 chars' },
|
||||||
{ id: 'nu-password', label: 'password', ph: 'min 8 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': {
|
'new-token': {
|
||||||
title: 'POST /new/token — login / get token',
|
title: 'POST /new/token — login / get token',
|
||||||
@@ -165,6 +165,14 @@
|
|||||||
],
|
],
|
||||||
submit: () => httpPost('/mod/connection/elevate', { token:'mce-token', connectionid:'mce-connectionid' })
|
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': {
|
'get-user': {
|
||||||
title: 'POST /get/user — get user info',
|
title: 'POST /get/user — get user info',
|
||||||
fields: [
|
fields: [
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ func main() {
|
|||||||
http.HandleFunc("/mod/user/avatar", withCORS(httpRequest.HandleUserModAvatar))
|
http.HandleFunc("/mod/user/avatar", withCORS(httpRequest.HandleUserModAvatar))
|
||||||
http.HandleFunc("/mod/user/profilebg", withCORS(httpRequest.HandleUserModProfileBg))
|
http.HandleFunc("/mod/user/profilebg", withCORS(httpRequest.HandleUserModProfileBg))
|
||||||
http.HandleFunc("/mod/connection/elevate", withCORS(httpRequest.HandleUserElevateConnection))
|
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/user", withCORS(httpRequest.HandleUserGetUser))
|
||||||
http.HandleFunc("/get/connections", withCORS(httpRequest.HandleUserGetConnections))
|
http.HandleFunc("/get/connections", withCORS(httpRequest.HandleUserGetConnections))
|
||||||
@@ -50,6 +51,6 @@ func main() {
|
|||||||
http.HandleFunc("/msg/user", withCORS(httpRequest.HandleDm))
|
http.HandleFunc("/msg/user", withCORS(httpRequest.HandleDm))
|
||||||
http.HandleFunc("/ws", wsServer.ServeWsConnection)
|
http.HandleFunc("/ws", wsServer.ServeWsConnection)
|
||||||
|
|
||||||
log.Println("listening on :8080")
|
log.Println("beep boop; server server started")
|
||||||
log.Fatal(http.ListenAndServe(":8080", nil))
|
log.Fatal(http.ListenAndServe(":8080", nil))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ func HandleUserDeElevateConnection(response http.ResponseWriter, request *http.R
|
|||||||
}
|
}
|
||||||
|
|
||||||
wsServer.WsSendMessageCloseIfTimeout(user2, types.WsEventMessage{
|
wsServer.WsSendMessageCloseIfTimeout(user2, types.WsEventMessage{
|
||||||
Type: WsEventType.ConnectionElevated,
|
Type: WsEventType.ConnectionDeElevated,
|
||||||
Event: types.ConnectionStatusChangeData{
|
Event: types.ConnectionStatusChangeData{
|
||||||
Id: conn.Id,
|
Id: conn.Id,
|
||||||
NewState: conn.State,
|
NewState: conn.State,
|
||||||
|
|||||||
Reference in New Issue
Block a user