Rev480, Skip non-ascii files at signing, Fix gevent 1.1alpha compatibility
This commit is contained in:
parent
a8dae8dd85
commit
b961a3fb0a
8 changed files with 22 additions and 18 deletions
|
@ -8,7 +8,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.3.2"
|
self.version = "0.3.2"
|
||||||
self.rev = 477
|
self.rev = 480
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.createParser()
|
self.createParser()
|
||||||
|
|
|
@ -259,6 +259,9 @@ class ContentManager(object):
|
||||||
def hashFiles(self, dir_inner_path, ignore_pattern=None, optional_pattern=None):
|
def hashFiles(self, dir_inner_path, ignore_pattern=None, optional_pattern=None):
|
||||||
files_node = {}
|
files_node = {}
|
||||||
files_optional_node = {}
|
files_optional_node = {}
|
||||||
|
if not re.match("^[a-zA-Z0-9_\.\+-/]*$", dir_inner_path):
|
||||||
|
ignored = True
|
||||||
|
self.log.error("- [ERROR] Only ascii encoded directories allowed: %s" % dir_inner_path)
|
||||||
|
|
||||||
for file_relative_path in self.site.storage.list(dir_inner_path):
|
for file_relative_path in self.site.storage.list(dir_inner_path):
|
||||||
file_name = helper.getFilename(file_relative_path)
|
file_name = helper.getFilename(file_relative_path)
|
||||||
|
@ -270,6 +273,9 @@ class ContentManager(object):
|
||||||
ignored = True
|
ignored = True
|
||||||
elif file_name.startswith("."):
|
elif file_name.startswith("."):
|
||||||
ignored = True
|
ignored = True
|
||||||
|
elif not re.match("^[a-zA-Z0-9_\.\+\-/]+$", file_relative_path):
|
||||||
|
ignored = True
|
||||||
|
self.log.error("- [ERROR] Only ascii encodes filenames allowed: %s" % file_relative_path)
|
||||||
elif optional_pattern and re.match(optional_pattern, file_relative_path):
|
elif optional_pattern and re.match(optional_pattern, file_relative_path):
|
||||||
optional = True
|
optional = True
|
||||||
|
|
||||||
|
|
|
@ -120,15 +120,15 @@
|
||||||
"signers_required": 1
|
"signers_required": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modified": 1443645832.748,
|
"modified": 1445621835.637,
|
||||||
"optional": "(data/img/zero.*|data/optional.txt)",
|
"optional": "(data/img/zero.*|data/optional.txt)",
|
||||||
"sign": [
|
"sign": [
|
||||||
33155653220731268227776289017011639520872180216646876377169089096034035969487,
|
47850243869989268528712520567298442290019403318054234291033274718437879648427,
|
||||||
36744504416132878244552522451563313660303086381031784548929582417244124447603
|
27185986573270415412620789926197549872389185391900755638388274126359800685380
|
||||||
],
|
],
|
||||||
"signers_sign": "HDNmWJHM2diYln4pkdL+qYOvgE7MdwayzeG+xEUZBgp1HtOjBJS+knDEVQsBkjcOPicDG2it1r6R1eQrmogqSP0=",
|
"signers_sign": "HDNmWJHM2diYln4pkdL+qYOvgE7MdwayzeG+xEUZBgp1HtOjBJS+knDEVQsBkjcOPicDG2it1r6R1eQrmogqSP0=",
|
||||||
"signs": {
|
"signs": {
|
||||||
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HP+qomOGy0hTFX1HjHv8iQIL6E22qNynb+IijEblL2lm8SgsyiOxKGaVkD6/eE6xYGeYHSnhSii2Gw/04z3okNM="
|
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G84Wz60kiTpSJJYR9CFyIVHEQVzVB7bCXk+G+v6w2Mkv3a/2R+XNkV26qn7Tj4DHYGs5Xxi7jeXgPHTXzAhsQ+s="
|
||||||
},
|
},
|
||||||
"signs_required": 1,
|
"signs_required": 1,
|
||||||
"title": "ZeroBlog",
|
"title": "ZeroBlog",
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
"size": 1606
|
"size": 1606
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modified": 1443645834.763,
|
"modified": 1445621840.488,
|
||||||
"optional": ".*\\.(jpg|png|gif)",
|
"optional": ".*\\.(jpg|png|gif)",
|
||||||
"signs": {
|
"signs": {
|
||||||
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HD+/5Jmew6BotfeWsfpTFKXUVIY5MyjKQx5KRnT6WO0nMBLxaI6/sTb+6ZXq0tXjXNkmlt36/UICYQcYQjCRhkY="
|
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G/I/c+fbVkmv79Bcok+QZU9E5P4ruG5mxrfQqbc+KmUcf6kYKWM5L/dZERMRGl3dUiTe4ueHnSbgG8HsTz9UmHI="
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,8 @@
|
||||||
"size": 168
|
"size": 168
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"modified": 1443645835.157,
|
"modified": 1445621840.892,
|
||||||
"signs": {
|
"signs": {
|
||||||
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HNIXDWV1kpqKtsJ+yrNKLvks/FDYIpVmx7xgkXPJ6NZiajCMHrgEwLH9QRiq6rs3nOCs0P08eRhlgZLvC+3U6ps="
|
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HDPcGHXKRufZx3eo1u0mH0xzaF+Uf05dNApdT2l+7GhZHXUqGv0VMShyeGGpiGOO9U55wEgPQNSoh9YY/S0WXI8="
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"files": {},
|
"files": {},
|
||||||
"ignore": ".*",
|
"ignore": ".*",
|
||||||
"modified": 1443645833.247,
|
"modified": 1445621836.165,
|
||||||
"signs": {
|
"signs": {
|
||||||
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G2EcaEKdzzfbpRITDcaBajNwjaIIJW3zp1YQGIMJcxfw3tLnn6uv/goImvbzvuTXKkl5fQKmBowK2Bg1xXJ3078="
|
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G1CD1I6FDKfI5iCtu3s5gNQZJYuy60a5fCa/iFTEiyjF2LFLo3dhndpodVksrdgE0NVRfEmVa9sKYQf5MjPtFPM="
|
||||||
},
|
},
|
||||||
"user_contents": {
|
"user_contents": {
|
||||||
"cert_signers": {
|
"cert_signers": {
|
||||||
|
|
Binary file not shown.
12
src/main.py
12
src/main.py
|
@ -7,7 +7,11 @@ import logging
|
||||||
# Third party modules
|
# Third party modules
|
||||||
import gevent
|
import gevent
|
||||||
from gevent import monkey
|
from gevent import monkey
|
||||||
|
if "patch_subprocess" in dir(monkey):
|
||||||
|
monkey.patch_all(thread=False, subprocess=False)
|
||||||
|
else:
|
||||||
|
monkey.patch_all(thread=False)
|
||||||
|
# Not thread: pyfilesystem and systray icon, Not subprocess: Gevent 1.1+
|
||||||
|
|
||||||
update_after_shutdown = False # If set True then update and restart zeronet after main loop ended
|
update_after_shutdown = False # If set True then update and restart zeronet after main loop ended
|
||||||
|
|
||||||
|
@ -56,8 +60,6 @@ if config.debug:
|
||||||
else:
|
else:
|
||||||
console_log.setLevel(logging.INFO) # Display only important info to console
|
console_log.setLevel(logging.INFO) # Display only important info to console
|
||||||
|
|
||||||
monkey.patch_all(thread=False) # Not thread: pyfilesystem and system tray icon not compatible
|
|
||||||
|
|
||||||
# Load plugins
|
# Load plugins
|
||||||
from Plugin import PluginManager
|
from Plugin import PluginManager
|
||||||
PluginManager.plugin_manager.loadPlugins()
|
PluginManager.plugin_manager.loadPlugins()
|
||||||
|
@ -80,8 +82,6 @@ if config.proxy:
|
||||||
SocksProxy.monkeyPath(*config.proxy.split(":"))
|
SocksProxy.monkeyPath(*config.proxy.split(":"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -- Actions --
|
# -- Actions --
|
||||||
|
|
||||||
@PluginManager.acceptPlugins
|
@PluginManager.acceptPlugins
|
||||||
|
@ -213,7 +213,6 @@ class Actions(object):
|
||||||
|
|
||||||
def sitePublish(self, address, peer_ip=None, peer_port=15441, inner_path="content.json"):
|
def sitePublish(self, address, peer_ip=None, peer_port=15441, inner_path="content.json"):
|
||||||
global file_server
|
global file_server
|
||||||
from Site import Site
|
|
||||||
from Site import SiteManager
|
from Site import SiteManager
|
||||||
from File import FileServer # We need fileserver to handle incoming file requests
|
from File import FileServer # We need fileserver to handle incoming file requests
|
||||||
|
|
||||||
|
@ -285,7 +284,6 @@ class Actions(object):
|
||||||
print "Response time: %.3fs" % (time.time() - s)
|
print "Response time: %.3fs" % (time.time() - s)
|
||||||
raw_input("Check memory")
|
raw_input("Check memory")
|
||||||
|
|
||||||
|
|
||||||
def peerCmd(self, peer_ip, peer_port, cmd, parameters):
|
def peerCmd(self, peer_ip, peer_port, cmd, parameters):
|
||||||
logging.info("Opening a simple connection server")
|
logging.info("Opening a simple connection server")
|
||||||
global file_server
|
global file_server
|
||||||
|
|
Loading…
Reference in a new issue