Fix syntax highlighting, process spawning, extensions, terminals (#22)

* Fix syntax highlighting, process spawning, extensions, terminals

* Replace colons in toISOString

* Move pathSets included in task
This commit is contained in:
Kyle Carberry
2019-01-28 11:14:06 -06:00
parent 9b1a635d63
commit b4798d1a48
31 changed files with 300 additions and 46 deletions

View File

@@ -36,6 +36,9 @@ export const createApp = (registerMiddleware?: (app: express.Application) => voi
},
close: (): void => ws.close(),
send: (data): void => {
if (ws.readyState !== ws.OPEN) {
return;
}
try {
ws.send(data);
} catch (error) {
@@ -64,15 +67,15 @@ export const createApp = (registerMiddleware?: (app: express.Application) => voi
} : undefined);
});
app.use(express.static(path.join(__dirname, "../build/web")));
app.use(express.static(path.join(process.env.BUILD_DIR || path.join(__dirname, ".."), "build/web")));
app.get("/resource/:url(*)", async (req, res) => {
try {
const fullPath = `/${req.params.url}`;
const relative = path.relative(options!.dataDirectory, fullPath);
if (relative.startsWith("..")) {
return res.status(403).end();
}
// const relative = path.relative(options!.dataDirectory, fullPath);
// if (relative.startsWith("..")) {
// return res.status(403).end();
// }
const exists = await util.promisify(fs.exists)(fullPath);
if (!exists) {
res.status(404).end();