Get rid of using old-style revision everywhere
This commit is contained in:
parent
1a8c6aaa93
commit
15dddc27c6
8 changed files with 13 additions and 16 deletions
|
@ -31,7 +31,7 @@ class LocalAnnouncer(BroadcastServer.BroadcastServer):
|
|||
self.sender_info["peer_id"] = self.server.peer_id
|
||||
self.sender_info["port"] = self.server.port
|
||||
self.sender_info["broadcast_port"] = listen_port
|
||||
self.sender_info["rev"] = config.rev
|
||||
self.sender_info["rev"] = config.user_agent_rev
|
||||
|
||||
self.known_peers = {}
|
||||
self.last_discover = 0
|
||||
|
|
|
@ -41,7 +41,7 @@ class UiRequestPlugin(object):
|
|||
from Crypt import CryptConnection
|
||||
|
||||
# Memory
|
||||
yield "rev%s | " % config.rev
|
||||
yield f'{config.version_full} | '
|
||||
yield "%s | " % main.file_server.ip_external_list
|
||||
yield "Port: %s | " % main.file_server.port
|
||||
yield "Network: %s | " % main.file_server.supported_ip_types
|
||||
|
@ -579,7 +579,7 @@ class ActionsPlugin:
|
|||
yield "\n"
|
||||
|
||||
yield from self.formatTable(
|
||||
["ZeroNet version:", "%s rev%s" % (config.version, config.rev)],
|
||||
["zeronet-conservancy version:", config.version_full],
|
||||
["Python:", "%s" % sys.version],
|
||||
["Platform:", "%s" % sys.platform],
|
||||
["Crypt verify lib:", "%s" % CryptBitcoin.lib_verify_best],
|
||||
|
|
|
@ -26,9 +26,9 @@ class Config:
|
|||
self.branch = Build.branch
|
||||
self.commit = Build.commit
|
||||
self.version = "0.7.10+"
|
||||
self.version_full = f'{self.version} ({self.build_type} from {self.branch}-{self.commit})'
|
||||
self.user_agent = "conservancy"
|
||||
# DEPRECATED ; replace with git-generated commit
|
||||
self.rev = 5140
|
||||
# for compatibility
|
||||
self.user_agent_rev = 8192
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
|
@ -319,8 +319,7 @@ class Config:
|
|||
self.parser.add_argument('--tor-hs-port', help='Hidden service port in Tor always mode', metavar='limit', type=int, default=15441)
|
||||
|
||||
self.parser.add_argument('--repl', help='Instead of printing logs in console, drop into REPL after initialization', action='store_true')
|
||||
self.parser.add_argument('--version', action='version',
|
||||
version=f'zeronet-conservancy {self.version} ({self.build_type} from {self.branch}-{self.commit})')
|
||||
self.parser.add_argument('--version', action='version', version=f'zeronet-conservancy {self.version_full}')
|
||||
self.parser.add_argument('--end', help='Stop multi value argument parsing', action='store_true')
|
||||
|
||||
return self.parser
|
||||
|
|
|
@ -22,7 +22,6 @@ class PluginManager:
|
|||
self.pluggable = {}
|
||||
self.plugin_names = [] # Loaded plugin names
|
||||
self.plugins_updated = {} # List of updated plugins since restart
|
||||
self.plugins_rev = {} # Installed plugins revision numbers
|
||||
self.after_load = [] # Execute functions after loaded plugins
|
||||
self.function_flags = {} # Flag function for permissions
|
||||
self.reloading = False
|
||||
|
@ -88,7 +87,6 @@ class PluginManager:
|
|||
plugin["dir_path"] = dir_path
|
||||
plugin["inner_path"] = plugin_name
|
||||
plugin["enabled"] = is_enabled
|
||||
plugin["rev"] = config.rev
|
||||
plugin["loaded"] = plugin_name in self.plugin_names
|
||||
plugins.append(plugin)
|
||||
|
||||
|
@ -101,7 +99,6 @@ class PluginManager:
|
|||
for plugin in self.listPlugins():
|
||||
self.log.debug("Loading plugin: %s (%s)" % (plugin["name"], plugin["source"]))
|
||||
if plugin["source"] != "builtin":
|
||||
self.plugins_rev[plugin["name"]] = plugin["rev"]
|
||||
site_plugin_dir = os.path.dirname(plugin["dir_path"])
|
||||
if site_plugin_dir not in sys.path:
|
||||
sys.path.append(site_plugin_dir)
|
||||
|
|
|
@ -600,7 +600,6 @@ class Site(object):
|
|||
num_connected_peers = len(peers)
|
||||
|
||||
random.shuffle(peers)
|
||||
peers = sorted(peers, key=lambda peer: peer.connection.handshake.get("rev", 0) < config.rev - 100) # Prefer newer clients
|
||||
|
||||
if len(peers) < limit * 2 and len(self.peers) > len(peers): # Add more, non-connected peers if necessary
|
||||
peers += self.getRecentPeers(limit * 2)
|
||||
|
|
|
@ -660,7 +660,7 @@ class UiRequest:
|
|||
permissions=json.dumps(site.settings["permissions"]),
|
||||
show_loadingscreen=json.dumps(show_loadingscreen),
|
||||
sandbox_permissions=sandbox_permissions,
|
||||
rev=config.rev,
|
||||
rev=config.commit,
|
||||
lang=config.language,
|
||||
homepage=homepage,
|
||||
themeclass=themeclass,
|
||||
|
@ -1038,7 +1038,7 @@ class UiRequest:
|
|||
|
||||
if details and config.debug:
|
||||
details = {key: val for key, val in list(self.env.items()) if hasattr(val, "endswith") and "COOKIE" not in key}
|
||||
details["version_zeronet"] = "%s r%s" % (config.version, config.rev)
|
||||
details["version_zeronet"] = config.version_full
|
||||
details["version_python"] = sys.version
|
||||
details["version_gevent"] = gevent.__version__
|
||||
details["plugins"] = PluginManager.plugin_manager.plugin_names
|
||||
|
|
|
@ -328,13 +328,15 @@ class UiWebsocket(object):
|
|||
'ui_ip' : config.ui_ip,
|
||||
'ui_port' : config.ui_port,
|
||||
'version' : config.version,
|
||||
'rev' : config.rev,
|
||||
# The only place this is used is in dashboard so we shorten it for now
|
||||
'rev' : config.commit[:8],
|
||||
'timecorrection' : file_server.timecorrection,
|
||||
'language' : config.language,
|
||||
'debug' : config.debug,
|
||||
'offline' : config.offline,
|
||||
'plugins' : PluginManager.plugin_manager.plugin_names,
|
||||
'plugins_rev' : PluginManager.plugin_manager.plugins_rev,
|
||||
# For compat only
|
||||
'plugins_rev' : {},
|
||||
'user_settings' : self.user.settings,
|
||||
'lib_verify_best' : CryptBitcoin.lib_verify_best
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ elif config.bind:
|
|||
@PluginManager.acceptPlugins
|
||||
class Actions:
|
||||
def call(self, function_name, kwargs):
|
||||
logging.info("Version: %s r%s, Python %s, Gevent: %s" % (config.version, config.rev, sys.version, gevent.__version__))
|
||||
logging.info(f'zeronet-conservancy {config.version_full} on Python {sys.version} Gevent {gevent.__version__}')
|
||||
|
||||
func = getattr(self, function_name, None)
|
||||
back = func(**kwargs)
|
||||
|
|
Loading…
Reference in a new issue