Rev3173, Don't display Cors permission ask if already has, Fix error on Cors request on non-existent site

This commit is contained in:
shortcutme 2017-12-18 02:37:09 +01:00
parent b5452bce6b
commit c9c1d10ee4
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 6 additions and 1 deletions

View file

@ -31,6 +31,8 @@ class UiWebsocketPlugin(object):
req_self = copy.copy(self)
req_self.site = self.server.sites.get(cors_address) # Change the site to the merged one
if not req_self.site:
return {"error": "No site found"}
func = getattr(super(UiWebsocketPlugin, req_self), func_name)
back = func(to, cors_inner_path, *args, **kwargs)
@ -57,6 +59,9 @@ class UiWebsocketPlugin(object):
site_name = address
button_title = _["Grant & Add"]
if site and "Cors:"+address in self.permissions:
return "ignored"
self.cmd(
"confirm",
[_["This site requests <b>read</b> permission to: <b>%s</b>"] % cgi.escape(site_name), button_title],

View file

@ -10,7 +10,7 @@ class Config(object):
def __init__(self, argv):
self.version = "0.6.0"
self.rev = 3171
self.rev = 3173
self.argv = argv
self.action = None
self.config_file = "zeronet.conf"