Make whoami return "user,<user>" instead of "<user>", to prevent collisions with other returns.
This commit is contained in:
parent
399efeb320
commit
0d7d59d7fe
@ -18,7 +18,7 @@ A valid request contains a 4-byte (32-bit) big endian unsigned integer denoting
|
|||||||
- **req**
|
- **req**
|
||||||
Execute a command with an associated request ID. Returns with the same ID, and the command's return value(s).
|
Execute a command with an associated request ID. Returns with the same ID, and the command's return value(s).
|
||||||
*Arguments:* `req,<ID>,<command>,[argument 1],[argument 2],[...]`
|
*Arguments:* `req,<ID>,<command>,[argument 1],[argument 2],[...]`
|
||||||
*Return:* `<req>,<ID>,[return value 1],[return value 2],[...]`
|
*Return:* `req,<ID>,[return value 1],[return value 2],[...]`
|
||||||
- **register**
|
- **register**
|
||||||
Register a new user on the server.
|
Register a new user on the server.
|
||||||
*Arguments:* `<user>,<password>`
|
*Arguments:* `<user>,<password>`
|
||||||
@ -27,7 +27,7 @@ Log into an existing server.
|
|||||||
*Arguments:* `<user>,<password>`
|
*Arguments:* `<user>,<password>`
|
||||||
- **whoami**
|
- **whoami**
|
||||||
Check which user this session is using.
|
Check which user this session is using.
|
||||||
*Return:* `<user>`
|
*Return:* `user,<user>`
|
||||||
- **send**
|
- **send**
|
||||||
Sends command to another user's clients. The command will arrive as-is, with the user switched to be the sender instead of the receiver. So if you are fier, and you execute `send,fier2,text,hello`, fier2 will get `send,fier,text,hello`
|
Sends command to another user's clients. The command will arrive as-is, with the user switched to be the sender instead of the receiver. So if you are fier, and you execute `send,fier2,text,hello`, fier2 will get `send,fier,text,hello`
|
||||||
*Arguments:* `<user>,<command>,[argument 1],[argument 2],[...]`
|
*Arguments:* `<user>,<command>,[argument 1],[argument 2],[...]`
|
||||||
|
@ -83,5 +83,5 @@ def textUserGet(self,command,args):
|
|||||||
if not user:
|
if not user:
|
||||||
return ["error","nonfatal","not_logged_in"]
|
return ["error","nonfatal","not_logged_in"]
|
||||||
|
|
||||||
return [user]
|
return ["user",user]
|
||||||
textCommandAddHandler("whoami",textUserGet)
|
textCommandAddHandler("whoami",textUserGet)
|
@ -1,7 +1,7 @@
|
|||||||
global textTimeout
|
global textTimeout
|
||||||
textTimeout = 30
|
textTimeout = 30
|
||||||
global textKeepAliveTimeout
|
global textKeepAliveTimeout
|
||||||
textKeepAliveTimeout = 600 # set to 0 for infinite time (not recommended)
|
textKeepAliveTimeout = 600 # set to None for infinite time (not recommended)
|
||||||
|
|
||||||
global textOnConnect
|
global textOnConnect
|
||||||
def textOnConnect(event,connection,address):
|
def textOnConnect(event,connection,address):
|
||||||
@ -13,7 +13,7 @@ global textOnPreRequest
|
|||||||
def textOnPreRequest(event,self,requestLength):
|
def textOnPreRequest(event,self,requestLength):
|
||||||
global textTimeout
|
global textTimeout
|
||||||
self.connection.settimeout(textTimeout)
|
self.connection.settimeout(textTimeout)
|
||||||
if requestLength <= 128: return
|
if requestLength <= 100000: return
|
||||||
try:
|
try:
|
||||||
sendResponse(self.connection,textListToCommand(["error","fatal","request_too_long"]).encode("utf-8"))
|
sendResponse(self.connection,textListToCommand(["error","fatal","request_too_long"]).encode("utf-8"))
|
||||||
except threading.timeout:
|
except threading.timeout:
|
||||||
|
Loading…
Reference in New Issue
Block a user