Merge pull request #201 from TheNain38/patch-3

If interface "*" is used open correctly on trayicon click
This commit is contained in:
ZeroNet 2015-10-25 22:37:37 +01:00
commit 638b9c2c2d
2 changed files with 5 additions and 3 deletions

View File

@ -37,6 +37,8 @@ class ActionsPlugin(object):
def hideIcon():
icon.die()
ui_ip = config.ui_ip if config.ui_ip != "*" else "127.0.0.1"
icon.items = (
(self.titleIp, False),
(self.titleConnections, False),
@ -49,13 +51,13 @@ class ActionsPlugin(object):
("ZeroNet Github", lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet")),
("Report bug/request feature", lambda: self.opensite("https://github.com/HelloZeroNet/ZeroNet/issues")),
"--",
("!Open ZeroNet", lambda: self.opensite("http://%s:%s" % (config.ui_ip, config.ui_port))),
("!Open ZeroNet", lambda: self.opensite("http://%s:%s" % (ui_ip, config.ui_port))),
"--",
("Quit", self.quit),
)
icon.clicked = lambda: self.opensite("http://%s:%s" % (config.ui_ip, config.ui_port))
icon.clicked = lambda: self.opensite("http://%s:%s" % (ui_ip, config.ui_port))
gevent.threadpool.start_new_thread(icon._run, ()) # Start in real thread (not gevent compatible)
super(ActionsPlugin, self).main()
icon._die = True

View File

@ -115,7 +115,7 @@ class UiServer:
browser = webbrowser.get()
else:
browser = webbrowser.get(config.open_browser)
browser.open("http://%s:%s" % (config.ui_ip, config.ui_port), new=2)
browser.open("http://%s:%s" % (config.ui_ip if config.ui_ip != "*" else "127.0.0.1", config.ui_port), new=2)
self.server = WSGIServer((self.ip.replace("*", ""), self.port), handler, handler_class=UiWSGIHandler, log=self.log)
self.server.sockets = {}