Updated features in readme, Connectable peer stats, Start ZeroNet when Windows starts option, ZeroName updater invalid key fix, Add peer ping to timeout on publish, Make sure the passive peers get the updated files
This commit is contained in:
parent
b39b6904e7
commit
f1a885b0ef
8 changed files with 79 additions and 17 deletions
|
@ -104,7 +104,11 @@ class UiRequestPlugin(object):
|
|||
yield self.formatTableRow([
|
||||
("<a href='#ShowPeers' onclick='document.getElementById(\"peers_%s\").style.display=\"initial\"; return false'>%s</a>", (site.address, site.address)),
|
||||
("%s", [peer.connection.id for peer in site.peers.values() if peer.connection and peer.connection.connected]),
|
||||
("%s/%s", ( len([peer for peer in site.peers.values() if peer.connection and peer.connection.connected]), len(site.peers) ) ),
|
||||
("%s/%s/%s", (
|
||||
len([peer for peer in site.peers.values() if peer.connection and peer.connection.connected]),
|
||||
len(site.getConnectablePeers(100)),
|
||||
len(site.peers)
|
||||
) ),
|
||||
("%s", len(site.content_manager.contents)),
|
||||
])
|
||||
yield "<tr><td id='peers_%s' style='display: none; white-space: pre'>" % site.address
|
||||
|
|
|
@ -32,6 +32,7 @@ class ActionsPlugin(object):
|
|||
(self.titleConnections, False),
|
||||
(self.titleTransfer, False),
|
||||
(self.titleConsole, self.toggleConsole),
|
||||
(self.titleAutorun, self.toggleAutorun),
|
||||
"--",
|
||||
("ZeroNet Twitter", lambda: self.opensite("https://twitter.com/HelloZeroNet") ),
|
||||
("ZeroNet Reddit", lambda: self.opensite("http://www.reddit.com/r/zeronet/") ),
|
||||
|
@ -51,6 +52,7 @@ class ActionsPlugin(object):
|
|||
super(ActionsPlugin, self).main()
|
||||
icon._die = True
|
||||
|
||||
|
||||
def quit(self):
|
||||
self.icon.die()
|
||||
time.sleep(0.1)
|
||||
|
@ -58,10 +60,12 @@ class ActionsPlugin(object):
|
|||
self.main.file_server.stop()
|
||||
#sys.exit()
|
||||
|
||||
|
||||
def opensite(self, url):
|
||||
import webbrowser
|
||||
webbrowser.open(url, new=2)
|
||||
|
||||
|
||||
def titleIp(self):
|
||||
title = "!IP: %s" % config.ip_external
|
||||
if self.main.file_server.port_opened:
|
||||
|
@ -70,18 +74,22 @@ class ActionsPlugin(object):
|
|||
title += " (passive)"
|
||||
return title
|
||||
|
||||
|
||||
def titleConnections(self):
|
||||
title = "Connections: %s" % len(self.main.file_server.connections)
|
||||
return title
|
||||
|
||||
|
||||
def titleTransfer(self):
|
||||
title = "Received: %.2f MB | Sent: %.2f MB" % (float(self.main.file_server.bytes_recv)/1024/1024, float(self.main.file_server.bytes_sent)/1024/1024)
|
||||
return title
|
||||
|
||||
|
||||
def titleConsole(self):
|
||||
if self.console: return "+Show console window"
|
||||
else: return "Show console window"
|
||||
|
||||
|
||||
def toggleConsole(self):
|
||||
if self.console:
|
||||
notificationicon.hideConsole()
|
||||
|
@ -89,3 +97,34 @@ class ActionsPlugin(object):
|
|||
else:
|
||||
notificationicon.showConsole()
|
||||
self.console = True
|
||||
|
||||
|
||||
def getAutorunPath(self):
|
||||
return "%s\\zeronet.cmd" % winfolders.get(winfolders.STARTUP)
|
||||
|
||||
|
||||
def formatAutorun(self):
|
||||
args = sys.argv[:]
|
||||
args.insert(0, sys.executable)
|
||||
if sys.platform == 'win32':
|
||||
args = ['"%s"' % arg for arg in args]
|
||||
cmd = " ".join(args)
|
||||
cmd = cmd.replace("start.py", "zeronet.py").replace('"--open_browser"', "").replace('"default_browser"', "") # Dont open browser on autorun
|
||||
return "cd /D %s \n%s" % (os.getcwd(), cmd)
|
||||
|
||||
|
||||
def isAutorunEnabled(self):
|
||||
path = self.getAutorunPath()
|
||||
return os.path.isfile(path) and open(path).read() == self.formatAutorun()
|
||||
|
||||
|
||||
def titleAutorun(self):
|
||||
if self.isAutorunEnabled(): return "+Start ZeroNet when Windows starts"
|
||||
else: return "Start ZeroNet when Windows starts"
|
||||
|
||||
|
||||
def toggleAutorun(self):
|
||||
if self.isAutorunEnabled():
|
||||
os.unlink(self.getAutorunPath())
|
||||
else:
|
||||
open(self.getAutorunPath(), "w").write(self.formatAutorun())
|
||||
|
|
|
@ -632,9 +632,8 @@ class NotificationIcon(object):
|
|||
Shell_NotifyIcon(NIM_ADD, ctypes.pointer(iconinfo))
|
||||
|
||||
iconinfo.union.uVersion = NOTIFYICON_VERSION
|
||||
self.iconinfo = ctypes.pointer(iconinfo)
|
||||
|
||||
Shell_NotifyIcon(NIM_SETVERSION, ctypes.pointer(iconinfo))
|
||||
self.iconinfo = iconinfo
|
||||
|
||||
PostMessage(self._hwnd, WM_NULL, 0, 0)
|
||||
|
||||
|
|
|
@ -46,3 +46,8 @@ def get(intFolder):
|
|||
exit_code=_SHGetFolderPath(0, intFolder, 0, 0, auPathBuffer)
|
||||
return auPathBuffer.value
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import os
|
||||
print get(STARTUP)
|
||||
open(get(STARTUP)+"\\zeronet.cmd", "w").write("cd /D %s\r\nzeronet.py" % os.getcwd())
|
|
@ -20,6 +20,9 @@ def processNameOp(domain, value):
|
|||
if "zeronet" not in data:
|
||||
print "No zeronet in ", data.keys()
|
||||
return False
|
||||
if type(data["zeronet"]) != type({}):
|
||||
print "Bad type: ", data["zeronet"]
|
||||
return False
|
||||
|
||||
if "slave" in sys.argv:
|
||||
print "Waiting for master update arrive"
|
||||
|
@ -96,7 +99,7 @@ print "Processing block from #%s to #%s..." % (config["lastprocessed"], last_blo
|
|||
for block_id in range(config["lastprocessed"], last_block+1):
|
||||
processBlock(block_id)
|
||||
|
||||
#processBlock(223911) # Testing
|
||||
# processBlock(223911) # Testing
|
||||
|
||||
while 1:
|
||||
print "Waiting for new block",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue