mirror of https://github.com/dirtbags/moth.git
Fix some junk
This commit is contained in:
parent
3d0e73d0e9
commit
6d2c65f9c0
|
@ -153,7 +153,7 @@ class MothRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
except KeyError:
|
||||
self.send_error(
|
||||
HTTPStatus.NOT_FOUND,
|
||||
"File Not Found",
|
||||
"File Not Found: %s" % self.req["filename"],
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -233,6 +233,8 @@ class MothRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||
HTTPStatus.NOT_IMPLEMENTED,
|
||||
"Unsupported method (%r)" % self.command,
|
||||
)
|
||||
|
||||
# I don't fully understand why you can't do this inside the class definition.
|
||||
MothRequestHandler.extensions_map[".mjs"] = "application/ecmascript"
|
||||
|
||||
|
||||
|
|
|
@ -233,6 +233,12 @@ class Puzzle:
|
|||
except IndexError:
|
||||
pass
|
||||
self.files[name] = PuzzleFile(stream, name, not hidden)
|
||||
elif key == 'files':
|
||||
for file in val:
|
||||
path = file["path"]
|
||||
stream = open(path, "rb")
|
||||
name = file.get("name") or path
|
||||
self.files[name] = PuzzleFile(stream, name, not file.get("hidden"))
|
||||
elif key == 'script':
|
||||
stream = open(val, 'rb')
|
||||
self.add_script_stream(stream, val)
|
||||
|
@ -400,10 +406,12 @@ class Puzzle:
|
|||
"""Return a dict packaging of the puzzle."""
|
||||
|
||||
files = [fn for fn,f in self.files.items() if f.visible]
|
||||
hidden = [fn for fn,f in self.files.items() if not f.visible]
|
||||
return {
|
||||
'authors': self.get_authors(),
|
||||
'hashes': self.hashes(),
|
||||
'files': files,
|
||||
'hidden': hidden,
|
||||
'scripts': self.scripts,
|
||||
'pattern': self.pattern,
|
||||
'body': self.html_body(),
|
||||
|
|
Loading…
Reference in New Issue