Changeset - ec6ec713c276
[Not reviewed]
default
0 1 0
Drew Perttula - 6 years ago 2019-06-01 10:54:45
drewp@bigasterisk.com
output escaping bug in homepage made spectrograms fail
Ignore-this: b27ede936127b02f4ed30e132d2bf0d
1 file changed with 9 insertions and 11 deletions:
0 comments (0 inline, 0 general)
bin/homepageConfig
Show inline comments
 
@@ -13,38 +13,36 @@ webServer = graph.value(netHome, L9['web
 
if not webServer:
 
    raise ValueError('no %r :webServer' % netHome)
 
print("listen %s;" % splitport(urlparse(webServer).netloc)[1])
 

	
 

	
 
def location(path, server):
 
    print("""
 
    location /%(path)s/ {
 
    print(f"""
 
    location /{path}/ {{
 

	
 
      # for websocket
 
      proxy_http_version 1.1;
 
      proxy_set_header Upgrade $http_upgrade;
 
      proxy_set_header Connection "upgrade";
 
      proxy_set_header Host $host;
 

	
 
      proxy_pass %(server)s;
 
      proxy_pass {server};
 
      proxy_buffering off;
 
      rewrite /[^/]+/(.*) /$1 break;
 
    }""" % vars())
 
    }}""")
 

	
 

	
 
for role, server in sorted(graph.predicate_objects(netHome)):
 
    if not server.startswith('http') or role == L9['webServer']:
 
        continue
 
    path = graph.value(role, L9['urlPath'])
 
    if not path:
 
        continue
 
    server = server.rstrip('/')
 
    location(path, server)
 

	
 
showPath = showconfig.showUri().split('/', 3)[-1]
 
print("""
 
    location /%(path)s {
 
      root %(root)s;
 
    }""" % {
 
    'path': showPath,
 
    'root': showconfig.root()[:-len(showPath)]
 
})
 
root = showconfig.root()[:-len(showPath)].decode('ascii')
 
print(f"""
 
    location /{showPath} {{
 
      root {root};
 
    }}""")
0 comments (0 inline, 0 general)