Rev480, Skip non-ascii files at signing, Fix gevent 1.1alpha compatibility

This commit is contained in:
HelloZeroNet 2015-10-24 13:57:46 +02:00
parent a8dae8dd85
commit b961a3fb0a
8 changed files with 22 additions and 18 deletions

View File

@ -8,7 +8,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.3.2"
self.rev = 477
self.rev = 480
self.argv = argv
self.action = None
self.createParser()

View File

@ -259,6 +259,9 @@ class ContentManager(object):
def hashFiles(self, dir_inner_path, ignore_pattern=None, optional_pattern=None):
files_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):
file_name = helper.getFilename(file_relative_path)
@ -270,6 +273,9 @@ class ContentManager(object):
ignored = True
elif file_name.startswith("."):
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):
optional = True

View File

@ -120,15 +120,15 @@
"signers_required": 1
}
},
"modified": 1443645832.748,
"modified": 1445621835.637,
"optional": "(data/img/zero.*|data/optional.txt)",
"sign": [
33155653220731268227776289017011639520872180216646876377169089096034035969487,
36744504416132878244552522451563313660303086381031784548929582417244124447603
47850243869989268528712520567298442290019403318054234291033274718437879648427,
27185986573270415412620789926197549872389185391900755638388274126359800685380
],
"signers_sign": "HDNmWJHM2diYln4pkdL+qYOvgE7MdwayzeG+xEUZBgp1HtOjBJS+knDEVQsBkjcOPicDG2it1r6R1eQrmogqSP0=",
"signs": {
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HP+qomOGy0hTFX1HjHv8iQIL6E22qNynb+IijEblL2lm8SgsyiOxKGaVkD6/eE6xYGeYHSnhSii2Gw/04z3okNM="
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G84Wz60kiTpSJJYR9CFyIVHEQVzVB7bCXk+G+v6w2Mkv3a/2R+XNkV26qn7Tj4DHYGs5Xxi7jeXgPHTXzAhsQ+s="
},
"signs_required": 1,
"title": "ZeroBlog",

View File

@ -14,9 +14,9 @@
"size": 1606
}
},
"modified": 1443645834.763,
"modified": 1445621840.488,
"optional": ".*\\.(jpg|png|gif)",
"signs": {
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HD+/5Jmew6BotfeWsfpTFKXUVIY5MyjKQx5KRnT6WO0nMBLxaI6/sTb+6ZXq0tXjXNkmlt36/UICYQcYQjCRhkY="
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G/I/c+fbVkmv79Bcok+QZU9E5P4ruG5mxrfQqbc+KmUcf6kYKWM5L/dZERMRGl3dUiTe4ueHnSbgG8HsTz9UmHI="
}
}

View File

@ -8,8 +8,8 @@
"size": 168
}
},
"modified": 1443645835.157,
"modified": 1445621840.892,
"signs": {
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HNIXDWV1kpqKtsJ+yrNKLvks/FDYIpVmx7xgkXPJ6NZiajCMHrgEwLH9QRiq6rs3nOCs0P08eRhlgZLvC+3U6ps="
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "HDPcGHXKRufZx3eo1u0mH0xzaF+Uf05dNApdT2l+7GhZHXUqGv0VMShyeGGpiGOO9U55wEgPQNSoh9YY/S0WXI8="
}
}

View File

@ -1,9 +1,9 @@
{
"files": {},
"ignore": ".*",
"modified": 1443645833.247,
"modified": 1445621836.165,
"signs": {
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G2EcaEKdzzfbpRITDcaBajNwjaIIJW3zp1YQGIMJcxfw3tLnn6uv/goImvbzvuTXKkl5fQKmBowK2Bg1xXJ3078="
"1TeSTvb4w2PWE81S2rEELgmX2GCCExQGT": "G1CD1I6FDKfI5iCtu3s5gNQZJYuy60a5fCa/iFTEiyjF2LFLo3dhndpodVksrdgE0NVRfEmVa9sKYQf5MjPtFPM="
},
"user_contents": {
"cert_signers": {

View File

@ -7,7 +7,11 @@ import logging
# Third party modules
import gevent
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
@ -56,8 +60,6 @@ if config.debug:
else:
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
from Plugin import PluginManager
PluginManager.plugin_manager.loadPlugins()
@ -80,8 +82,6 @@ if config.proxy:
SocksProxy.monkeyPath(*config.proxy.split(":"))
# -- Actions --
@PluginManager.acceptPlugins
@ -213,7 +213,6 @@ class Actions(object):
def sitePublish(self, address, peer_ip=None, peer_port=15441, inner_path="content.json"):
global file_server
from Site import Site
from Site import SiteManager
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)
raw_input("Check memory")
def peerCmd(self, peer_ip, peer_port, cmd, parameters):
logging.info("Opening a simple connection server")
global file_server