Move some deps to deps.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3903 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-06-18 17:07:36 +00:00
parent e1ca715c64
commit ed6550a4cd
22 changed files with 27 additions and 41 deletions

View File

@ -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);

View File

@ -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)) {

View File

@ -59,8 +59,8 @@
<iframe id="document" sandbox="allow-forms allow-scripts allow-top-navigation allow-modals" style="width: 100%; height: 100%; border: 0"></iframe>
</div>
</div>
<script src="/static/split.min.js"></script>
<script src="/static/smoothie.js"></script>
<script src="/split/split.min.js"></script>
<script src="/smoothie/smoothie.js"></script>
<script src="/static/client.js"></script>
</body>
</html>