Rev420, Ignore file delete errors, Schedule download user files later if first content.json failed at first try, Reload content.json content after cloning, Allow modals on owned sites to display coffeescript compile errors, Disable opener checking because its easy to dodge
This commit is contained in:
parent
6ae0c1a626
commit
93312ae129
5 changed files with 26 additions and 6 deletions
|
@ -8,7 +8,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.3.2"
|
||||
self.rev = 414
|
||||
self.rev = 420
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.createParser()
|
||||
|
|
|
@ -17,7 +17,7 @@ class ContentManager(object):
|
|||
self.site = site
|
||||
self.log = self.site.log
|
||||
self.contents = {} # Known content.json (without files and includes)
|
||||
self.loadContent(add_bad_files=False)
|
||||
self.loadContent(add_bad_files=False, delete_removed_files=False)
|
||||
self.site.settings["size"] = self.getTotalSize()
|
||||
|
||||
# Load content.json to self.content
|
||||
|
@ -66,8 +66,11 @@ class ContentManager(object):
|
|||
if deleted:
|
||||
# Deleting files that no longer in content.json
|
||||
for file_inner_path in deleted:
|
||||
self.log.debug("Deleting file: %s" % file_inner_path)
|
||||
self.site.storage.delete(file_inner_path)
|
||||
try:
|
||||
self.site.storage.delete(file_inner_path)
|
||||
self.log.debug("Deleted file: %s" % file_inner_path)
|
||||
except Exception, err:
|
||||
self.log.debug("Error deleting file %s: %s" % (file_inner_path, err))
|
||||
|
||||
# Load includes
|
||||
if load_includes and "includes" in new_content:
|
||||
|
|
|
@ -111,6 +111,9 @@ class Site:
|
|||
found = self.needFile(inner_path, update=self.bad_files.get(inner_path))
|
||||
content_inner_dir = self.content_manager.toDir(inner_path)
|
||||
if not found:
|
||||
self.log.debug("Download %s failed, check_modifications: %s" % (inner_path, check_modifications))
|
||||
if check_modifications: # Download failed, but check modifications if its succed later
|
||||
self.onFileDone.once(lambda file_name: self.checkModifications(0), "check_modifications")
|
||||
return False # Could not download content.json
|
||||
|
||||
self.log.debug("Got %s" % inner_path)
|
||||
|
@ -415,9 +418,15 @@ class Site:
|
|||
)
|
||||
if privatekey:
|
||||
new_site.content_manager.sign(file_inner_path.replace("-default", ""), privatekey)
|
||||
new_site.content_manager.loadContent(
|
||||
file_inner_path, add_bad_files=False, delete_removed_files=False, load_includes=False
|
||||
)
|
||||
|
||||
if privatekey:
|
||||
new_site.content_manager.sign("content.json", privatekey)
|
||||
new_site.content_manager.loadContent(
|
||||
"content.json", add_bad_files=False, delete_removed_files=False, load_includes=False
|
||||
)
|
||||
|
||||
# Rebuild DB
|
||||
if new_site.storage.isFile("dbschema.json"):
|
||||
|
|
|
@ -250,6 +250,11 @@ class UiRequest(object):
|
|||
if content.get("viewport"):
|
||||
meta_tags += '<meta name="viewport" id="viewport" content="%s">' % cgi.escape(content["viewport"], True)
|
||||
|
||||
if site.settings.get("own"):
|
||||
sandbox_permissions = "allow-modals" # For coffeescript compile errors
|
||||
else:
|
||||
sandbox_permissions = ""
|
||||
|
||||
return self.render(
|
||||
"src/Ui/template/wrapper.html",
|
||||
server_url=server_url,
|
||||
|
@ -264,6 +269,7 @@ class UiRequest(object):
|
|||
wrapper_key=site.settings["wrapper_key"],
|
||||
permissions=json.dumps(site.settings["permissions"]),
|
||||
show_loadingscreen=json.dumps(not site.storage.isFile(file_inner_path)),
|
||||
sandbox_permissions=sandbox_permissions,
|
||||
rev=config.rev,
|
||||
homepage=homepage
|
||||
)
|
||||
|
@ -461,7 +467,7 @@ class UiRequest(object):
|
|||
self.sendHeader(500)
|
||||
return self.formatError("Server error", cgi.escape(message))
|
||||
|
||||
def formatError(self, title, message):
|
||||
def formatError(self, title, message, details = True):
|
||||
import sys
|
||||
import gevent
|
||||
|
||||
|
|
|
@ -18,9 +18,11 @@ if (window.self !== window.top) window.stop();
|
|||
if (window.self !== window.top && document.execCommand) document.execCommand("Stop", false)
|
||||
|
||||
// Dont allow site to load in a popup
|
||||
/*
|
||||
if (window.opener) document.write("Opener not allowed")
|
||||
if (window.opener && document.execCommand) document.execCommand("Stop", false)
|
||||
if (window.opener && window.stop) window.stop()
|
||||
*/
|
||||
</script>
|
||||
|
||||
<div class="progressbar">
|
||||
|
@ -52,7 +54,7 @@ if (window.opener && window.stop) window.stop()
|
|||
|
||||
|
||||
<!-- Site Iframe -->
|
||||
<iframe src='about:blank' id='inner-iframe' sandbox="allow-forms allow-scripts allow-top-navigation allow-popups"></iframe>
|
||||
<iframe src='about:blank' id='inner-iframe' sandbox="allow-forms allow-scripts allow-top-navigation allow-popups {sandbox_permissions}"></iframe>
|
||||
|
||||
<!-- Site info -->
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue