Rev571, Optional file sizes to sidebar, Download all optional files option in sidebar, Optional file number in peer stats, Delete removed or changed optional files, Auto download optional files if autodownloadoptional checked, SiteReload command, Peer use global file server if no site defined, Allow browser cache video files, Allow more keepalive connections, Gevent 1.1 ranged request bugfix, Dont sent optional files details on websocket, Remove files from workermanager tasks if no longer in bad_files, Notify local client about changes on external siteSign
This commit is contained in:
parent
2cf34c132f
commit
3587777ea8
17 changed files with 212 additions and 41 deletions
|
@ -138,6 +138,7 @@ class UiRequest(object):
|
|||
headers = []
|
||||
headers.append(("Version", "HTTP/1.1"))
|
||||
headers.append(("Connection", "Keep-Alive"))
|
||||
headers.append(("Keep-Alive", "max=25, timeout=30"))
|
||||
headers.append(("Access-Control-Allow-Origin", "*")) # Allow json access
|
||||
if self.env["REQUEST_METHOD"] == "OPTIONS":
|
||||
# Allow json access
|
||||
|
@ -145,11 +146,11 @@ class UiRequest(object):
|
|||
headers.append(("Access-Control-Allow-Credentials", "true"))
|
||||
|
||||
cacheable_type = (
|
||||
content_type == "text/css" or content_type.startswith("image") or
|
||||
content_type == "text/css" or content_type.startswith("image") or content_type.startswith("video") or
|
||||
self.env["REQUEST_METHOD"] == "OPTIONS" or content_type == "application/javascript"
|
||||
)
|
||||
|
||||
if status == 200 and cacheable_type: # Cache Css, Js, Image files for 10min
|
||||
if status in (200, 206) and cacheable_type: # Cache Css, Js, Image files for 10min
|
||||
headers.append(("Cache-Control", "public, max-age=600")) # Cache 10 min
|
||||
else:
|
||||
headers.append(("Cache-Control", "no-cache, no-store, private, must-revalidate, max-age=0")) # No caching at all
|
||||
|
@ -380,7 +381,7 @@ class UiRequest(object):
|
|||
range_end = int(re.match(".*?-([0-9]+)", range).group(1))+1
|
||||
else:
|
||||
range_end = file_size
|
||||
extra_headers["Content-Length"] = range_end - range_start
|
||||
extra_headers["Content-Length"] = str(range_end - range_start)
|
||||
extra_headers["Content-Range"] = "bytes %s-%s/%s" % (range_start, range_end-1, file_size)
|
||||
if range:
|
||||
status = 206
|
||||
|
|
|
@ -152,6 +152,7 @@ class UiWebsocket(object):
|
|||
if content: # Remove unnecessary data transfer
|
||||
content = content.copy()
|
||||
content["files"] = len(content.get("files", {}))
|
||||
content["files_optional"] = len(content.get("files_optional", {}))
|
||||
content["includes"] = len(content.get("includes", {}))
|
||||
if "sign" in content:
|
||||
del(content["sign"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue