diff --git a/core/client.js b/core/client.js
index cf14d468..7364cab5 100644
--- a/core/client.js
+++ b/core/client.js
@@ -91,22 +91,22 @@ function edit() {
gSplit = Split(['#editPane', '#viewPane'], {minSize: 0});
ensureLoaded([
- {tagName: "script", attributes: {src: "/static/codemirror/codemirror.min.js"}},
- {tagName: "link", attributes: {rel: "stylesheet", href: "/static/codemirror/base16-dark.min.css"}},
- {tagName: "link", attributes: {rel: "stylesheet", href: "/static/codemirror/matchesonscrollbar.min.css"}},
- {tagName: "link", attributes: {rel: "stylesheet", href: "/static/codemirror/dialog.min.css"}},
- {tagName: "link", attributes: {rel: "stylesheet", href: "/static/codemirror/codemirror.min.css"}},
- {tagName: "script", attributes: {src: "/static/codemirror/trailingspace.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/dialog.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/search.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/searchcursor.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/jump-to-line.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/matchesonscrollbar.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/annotatescrollbar.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/javascript.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/css.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/xml.min.js"}},
- {tagName: "script", attributes: {src: "/static/codemirror/htmlmixed.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/codemirror.min.js"}},
+ {tagName: "link", attributes: {rel: "stylesheet", href: "/codemirror/base16-dark.min.css"}},
+ {tagName: "link", attributes: {rel: "stylesheet", href: "/codemirror/matchesonscrollbar.min.css"}},
+ {tagName: "link", attributes: {rel: "stylesheet", href: "/codemirror/dialog.min.css"}},
+ {tagName: "link", attributes: {rel: "stylesheet", href: "/codemirror/codemirror.min.css"}},
+ {tagName: "script", attributes: {src: "/codemirror/trailingspace.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/dialog.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/search.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/searchcursor.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/jump-to-line.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/matchesonscrollbar.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/annotatescrollbar.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/javascript.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/css.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/xml.min.js"}},
+ {tagName: "script", attributes: {src: "/codemirror/htmlmixed.min.js"}},
], function() {
load().catch(function(error) {
alert(error);
diff --git a/core/core.js b/core/core.js
index e1d36aac..805ad495 100644
--- a/core/core.js
+++ b/core/core.js
@@ -266,26 +266,6 @@ var kStaticFiles = [
{uri: '/favicon.png', type: 'image/png'},
{uri: '/client.js', type: 'text/javascript; charset=UTF-8'},
{uri: '/robots.txt', type: 'text/plain; charset=UTF-8'},
-
- {uri: '/split.min.js'},
- {uri: '/split.min.js.map'},
- {uri: '/smoothie.js'},
- {uri: '/codemirror/codemirror.min.js'},
- {uri: '/codemirror/base16-dark.min.css'},
- {uri: '/codemirror/matchesonscrollbar.min.css'},
- {uri: '/codemirror/dialog.min.css'},
- {uri: '/codemirror/codemirror.min.css'},
- {uri: '/codemirror/trailingspace.min.js'},
- {uri: '/codemirror/dialog.min.js'},
- {uri: '/codemirror/search.min.js'},
- {uri: '/codemirror/searchcursor.min.js'},
- {uri: '/codemirror/jump-to-line.min.js'},
- {uri: '/codemirror/matchesonscrollbar.min.js'},
- {uri: '/codemirror/annotatescrollbar.min.js'},
- {uri: '/codemirror/javascript.min.js'},
- {uri: '/codemirror/css.min.js'},
- {uri: '/codemirror/xml.min.js'},
- {uri: '/codemirror/htmlmixed.min.js'},
];
function startsWithBytes(data, bytes) {
@@ -324,7 +304,7 @@ const k_mime_types = {
'map': 'application/json',
};
-async function perfettoHandler(request, response, uri) {
+async function staticDirectoryHandler(request, response, directory, uri) {
var filename = uri || 'index.html';
if (filename.indexOf('..') != -1) {
response.writeHead(404, {"Content-Type": "text/plain; charset=utf-8", "Content-Length": "File not found".length});
@@ -333,7 +313,7 @@ async function perfettoHandler(request, response, uri) {
}
try {
- var data = await File.readFile("deps/perfetto/" + filename);
+ var data = await File.readFile(directory + filename);
response.writeHead(200, {"Content-Type": k_mime_types[filename.split('.').pop()] || 'text/plain', "Content-Length": data.byteLength});
response.end(data);
} catch {
@@ -593,8 +573,14 @@ loadSettings().then(function() {
return blobHandler(request, response, match[1], match[2]);
} else if (match = /^\/static(\/.*)/.exec(request.uri)) {
return staticFileHandler(request, response, null, match[1]);
+ } else if (match = /^\/codemirror\/([\.\w-/]*)$/.exec(request.uri)) {
+ return staticDirectoryHandler(request, response, 'deps/codemirror/', match[1]);
} else if (match = /^\/perfetto\/([\.\w-/]*)$/.exec(request.uri)) {
- return perfettoHandler(request, response, match[1]);
+ return staticDirectoryHandler(request, response, 'deps/perfetto/', match[1]);
+ } else if (match = /^\/split\/([\.\w-/]*)$/.exec(request.uri)) {
+ return staticDirectoryHandler(request, response, 'deps/split/', match[1]);
+ } else if (match = /^\/smoothie\/([\.\w-/]*)$/.exec(request.uri)) {
+ return staticDirectoryHandler(request, response, 'deps/smoothie/', match[1]);
} else if (match = /^(.*)(\/save?)$/.exec(request.uri)) {
return blobHandler(request, response, match[1], match[2]);
} else if (match = /^\/trace$/.exec(request.uri)) {
diff --git a/core/index.html b/core/index.html
index 35463403..f338d4de 100644
--- a/core/index.html
+++ b/core/index.html
@@ -59,8 +59,8 @@
-
-
+
+