v 0.7.6-internal

- Added `access_key` variable in Config, this used to access restrited plugins when multiuser plugin is enabled. When MultiUserPlugin is enabled we cannot access some pages like /Stats, this key will remove such restriction with access key.
- Added `last_connection_id_current_version` to ConnectionServer, helpful to estimate no of connection from current client version.
- Added current version:  connections to /Stats page. see the previous point.
This commit is contained in:
canewsin 2021-12-11 16:35:02 +05:30
parent 0bbf19aab9
commit 0e48004563
3 changed files with 25 additions and 10 deletions

View file

@ -73,14 +73,15 @@ class UiRequestPlugin(object):
import main
# Connections
yield "<b>Connections</b> (%s, total made: %s, in: %s, out: %s):<br>" % (
len(main.file_server.connections), main.file_server.last_connection_id,
yield "<b>Connections</b> (%s, current version: %s, total made: %s, in: %s, out: %s):<br>" % (
len(main.file_server.connections), main.file_server.last_connection_id_current_version, main.file_server.last_connection_id,
main.file_server.num_incoming, main.file_server.num_outgoing
)
yield "<table class='connections'><tr> <th>id</th> <th>type</th> <th>ip</th> <th>open</th> <th>crypt</th> <th>ping</th>"
yield "<th>buff</th> <th>bad</th> <th>idle</th> <th>open</th> <th>delay</th> <th>cpu</th> <th>out</th> <th>in</th> <th>last sent</th>"
yield "<th>wait</th> <th>version</th> <th>time</th> <th>sites</th> </tr>"
for connection in main.file_server.connections:
connections = sorted(main.file_server.connections, key=lambda connection: connection.handshake.get("rev", 0), reverse=True)
for connection in connections:
if "cipher" in dir(connection.sock):
cipher = connection.sock.cipher()[0]
tls_version = connection.sock.version()
@ -364,8 +365,14 @@ class UiRequestPlugin(object):
self.sendHeader()
if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
yield "This function is disabled on this proxy"
return
if 'access_key' not in self.get.keys():
yield "This function is disabled on this proxy"
return
else:
access_key = self.get["access_key"]
if access_key != config.access_key:
yield "This function is disabled on this proxy"
return
s = time.time()