sorted filenames

This commit is contained in:
Ruben van de Ven 2021-11-23 12:30:49 +01:00
parent 98a82b7d6a
commit b90c85f56e
1 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
"""
Websocket from the workers
"""
CORS_ORIGINS = ['localhost']
# CORS_ORIGINS = ['localhost']
connections = set()
def initialize(self, config):
@ -45,11 +45,11 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
self.hasWritten = False
self.dimensions = [None, None]
def check_origin(self, origin):
parsed_origin = urlparse(origin)
# parsed_origin.netloc.lower() gives localhost:3333
valid = any([parsed_origin.hostname.endswith(origin) for origin in self.CORS_ORIGINS])
return valid
# def check_origin(self, origin):
# parsed_origin = urlparse(origin)
# # parsed_origin.netloc.lower() gives localhost:3333
# valid = any([parsed_origin.hostname.endswith(origin) for origin in self.CORS_ORIGINS])
# return valid
# the client connected
def open(self, p = None):
@ -127,7 +127,7 @@ class AnimationHandler(tornado.web.RequestHandler):
self.set_header("Content-Type", "application/json")
# filename = self.get_argument("file", None)
if filename == '':
names = [f"/files/{name[:-4]}" for name in os.listdir(self.config.storage) if name not in ['.gitignore']]
names = sorted([f"/files/{name[:-4]}" for name in os.listdir(self.config.storage) if name not in ['.gitignore']])
self.write(json.dumps(names))
else:
path = os.path.join(self.config.storage,os.path.basename(filename)+".csv")