Typos and formatting
This commit is contained in:
parent
9bb0a0d91b
commit
5720f74669
1 changed files with 11 additions and 11 deletions
|
@ -124,7 +124,7 @@ class UiWebsocket(object):
|
||||||
def send(self, message, cb=None):
|
def send(self, message, cb=None):
|
||||||
message["id"] = self.next_message_id # Add message id to allow response
|
message["id"] = self.next_message_id # Add message id to allow response
|
||||||
self.next_message_id += 1
|
self.next_message_id += 1
|
||||||
if cb: # Callback after client responsed
|
if cb: # Callback after client responded
|
||||||
self.waiting_cb[message["id"]] = cb
|
self.waiting_cb[message["id"]] = cb
|
||||||
if self.sending:
|
if self.sending:
|
||||||
return # Already sending
|
return # Already sending
|
||||||
|
@ -169,7 +169,7 @@ class UiWebsocket(object):
|
||||||
self.response(req["id"], {"error": "Unknown command: %s" % cmd})
|
self.response(req["id"], {"error": "Unknown command: %s" % cmd})
|
||||||
return
|
return
|
||||||
|
|
||||||
# Support calling as named, unnamed paramters and raw first argument too
|
# Support calling as named, unnamed parameters and raw first argument too
|
||||||
if type(params) is dict:
|
if type(params) is dict:
|
||||||
func(req["id"], **params)
|
func(req["id"], **params)
|
||||||
elif type(params) is list:
|
elif type(params) is list:
|
||||||
|
@ -254,7 +254,7 @@ class UiWebsocket(object):
|
||||||
def actionSiteInfo(self, to, file_status=None):
|
def actionSiteInfo(self, to, file_status=None):
|
||||||
ret = self.formatSiteInfo(self.site)
|
ret = self.formatSiteInfo(self.site)
|
||||||
if file_status: # Client queries file status
|
if file_status: # Client queries file status
|
||||||
if self.site.storage.isFile(file_status): # File exits, add event done
|
if self.site.storage.isFile(file_status): # File exist, add event done
|
||||||
ret["event"] = ("file_done", file_status)
|
ret["event"] = ("file_done", file_status)
|
||||||
self.response(to, ret)
|
self.response(to, ret)
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ class UiWebsocket(object):
|
||||||
def cbSitePublish(self, to, thread, notification=True, callback=True):
|
def cbSitePublish(self, to, thread, notification=True, callback=True):
|
||||||
site = self.site
|
site = self.site
|
||||||
published = thread.value
|
published = thread.value
|
||||||
if published > 0: # Successfuly published
|
if published > 0: # Successfully published
|
||||||
if notification:
|
if notification:
|
||||||
self.cmd("notification", ["done", "Content published to %s peers." % published, 5000])
|
self.cmd("notification", ["done", "Content published to %s peers." % published, 5000])
|
||||||
site.updateWebsocket() # Send updated site data to local websocket clients
|
site.updateWebsocket() # Send updated site data to local websocket clients
|
||||||
|
@ -526,8 +526,8 @@ class UiWebsocket(object):
|
||||||
else:
|
else:
|
||||||
title = "<b>%s</b>" % account
|
title = "<b>%s</b>" % account
|
||||||
body += "<a href='#Select+account' class='select select-close cert %s' title='%s'>%s</a>" % (css_class, domain, title)
|
body += "<a href='#Select+account' class='select select-close cert %s' title='%s'>%s</a>" % (css_class, domain, title)
|
||||||
# More avalible providers
|
# More available providers
|
||||||
more_domains = [domain for domain in accepted_domains if domain not in self.user.certs] # Domainains we not displayed yet
|
more_domains = [domain for domain in accepted_domains if domain not in self.user.certs] # Domains we not displayed yet
|
||||||
if more_domains:
|
if more_domains:
|
||||||
# body+= "<small style='margin-top: 10px; display: block'>Accepted authorization providers by the site:</small>"
|
# body+= "<small style='margin-top: 10px; display: block'>Accepted authorization providers by the site:</small>"
|
||||||
body += "<div style='background-color: #F7F7F7; margin-right: -30px'>"
|
body += "<div style='background-color: #F7F7F7; margin-right: -30px'>"
|
||||||
|
@ -552,13 +552,13 @@ class UiWebsocket(object):
|
||||||
# Send the notification
|
# Send the notification
|
||||||
self.cmd("notification", ["ask", body])
|
self.cmd("notification", ["ask", body])
|
||||||
|
|
||||||
|
# - Admin actions -
|
||||||
|
|
||||||
# Set certificate that used for authenticate user for site
|
# Set certificate that used for authenticate user for site
|
||||||
def actionCertSet(self, to, domain):
|
def actionCertSet(self, to, domain):
|
||||||
self.user.setCert(self.site.address, domain)
|
self.user.setCert(self.site.address, domain)
|
||||||
self.site.updateWebsocket(cert_changed=domain)
|
self.site.updateWebsocket(cert_changed=domain)
|
||||||
|
|
||||||
# - Admin actions -
|
|
||||||
|
|
||||||
# List all site info
|
# List all site info
|
||||||
def actionSiteList(self, to):
|
def actionSiteList(self, to):
|
||||||
ret = []
|
ret = []
|
||||||
|
@ -681,11 +681,11 @@ class UiWebsocket(object):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.strip() == "[global]":
|
if line.strip() == "[global]":
|
||||||
global_line_i = i
|
global_line_i = i
|
||||||
if line.startswith(key+" = "):
|
if line.startswith(key + " = "):
|
||||||
key_line_i = i
|
key_line_i = i
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
if value == None: # Delete line
|
if value is None: # Delete line
|
||||||
if key_line_i:
|
if key_line_i:
|
||||||
del lines[key_line_i]
|
del lines[key_line_i]
|
||||||
else: # Add / update
|
else: # Add / update
|
||||||
|
@ -696,7 +696,7 @@ class UiWebsocket(object):
|
||||||
lines.append("[global]")
|
lines.append("[global]")
|
||||||
lines.append(new_line)
|
lines.append(new_line)
|
||||||
else: # Has global section, append the line after it
|
else: # Has global section, append the line after it
|
||||||
lines.insert(global_line_i+1, new_line)
|
lines.insert(global_line_i + 1, new_line)
|
||||||
|
|
||||||
open(config.config_file, "w").write("\n".join(lines))
|
open(config.config_file, "w").write("\n".join(lines))
|
||||||
self.response(to, "ok")
|
self.response(to, "ok")
|
||||||
|
|
Loading…
Reference in a new issue