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

@ -13,7 +13,7 @@ import time
class Config(object):
def __init__(self, argv):
self.version = "0.7.5"
self.version = "0.7.6-internal"
self.rev = 4560
self.argv = argv
self.action = None
@ -79,6 +79,8 @@ class Config(object):
# Create command line arguments
def createArguments(self):
from Crypt import CryptHash
access_key_default = CryptHash.random(24, "base64") # Used to allow restrited plugins when multiuser plugin is enabled
trackers = [
"zero://boot3rdez4rzn36x.onion:15441",
"http://open.acgnxtracker.com:80/announce", # DE
@ -97,9 +99,6 @@ class Config(object):
"udp://tracker.0x.tf:6969/announce",
"udp://tracker.zerobytes.xyz:1337/announce",
"udp://vibe.sleepyinternetfun.xyz:1738/announce",
"udp://tracker.bitsearch.to:1337/announce",
"udp://jeremylee.sh:6969/announce",
"udp://tracker.pomf.se:80/announce",
"udp://www.torrent.eu.org:451/announce",
"zero://k5w77dozo3hy5zualyhni6vrh73iwfkaofa64abbilwyhhd3wgenbjqd.onion:15441",
"zero://2kcb2fqesyaevc4lntogupa4mkdssth2ypfwczd2ov5a3zo6ytwwbayd.onion:15441",
@ -271,6 +270,7 @@ class Config(object):
metavar='address')
self.parser.add_argument('--updatesite', help='Source code update site', default='1Update8crprmciJHwp2WXqkx2c4iYp18',
metavar='address')
self.parser.add_argument('--access_key', help='Plugin access key default: Random key generated at startup', default=access_key_default, metavar='key')
self.parser.add_argument('--dist_type', help='Type of installed distribution', default='source')
self.parser.add_argument('--size_limit', help='Default site size limit in MB', default=10, type=int, metavar='limit')

View file

@ -30,7 +30,8 @@ class ConnectionServer(object):
port = 15441
self.ip = ip
self.port = port
self.last_connection_id = 1 # Connection id incrementer
self.last_connection_id = 0 # Connection id incrementer
self.last_connection_id_current_version = 0 # Connection id incrementer for current client version
self.log = logging.getLogger("ConnServer")
self.port_opened = {}
self.peer_blacklist = SiteManager.peer_blacklist
@ -155,6 +156,9 @@ class ConnectionServer(object):
connection = Connection(self, ip, port, sock)
self.connections.append(connection)
rev = connection.handshake.get("rev", 0)
if rev > 0 and rev == config.rev:
self.last_connection_id_current_version += 1
if ip not in config.ip_local:
self.ips[ip] = connection
connection.handleIncomingConnection(sock)
@ -219,6 +223,10 @@ class ConnectionServer(object):
if not succ:
connection.close("Connection event return error")
raise Exception("Connection event return error")
else:
rev = connection.handshake.get("rev", 0)
if rev > 0 and rev == config.rev:
self.last_connection_id_current_version += 1
except Exception as err:
connection.close("%s Connect error: %s" % (ip, Debug.formatException(err)))