.well-known => C.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4837 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-02-10 16:10:58 +00:00
parent 5a978bb30d
commit 51a327c52d
2 changed files with 20 additions and 24 deletions

View File

@ -556,17 +556,6 @@ function startsWithBytes(data, bytes) {
}
}
async function wellKnownHandler(request, response, path) {
let data = await File.readFile("data/global/.well-known/" + path);
if (data) {
response.writeHead(200, {"Content-Type": "text/plain", "Content-Length": data.length});
response.end(data);
} else {
response.writeHead(404, {"Content-Type": "text/plain", "Content-Length": "File not found".length});
response.end("File not found");
}
}
function guessTypeFromName(path) {
let extension = path.split('.').pop();
return k_mime_types[extension];
@ -940,8 +929,6 @@ loadSettings().then(function() {
return blobHandler(request, response, match[1], match[2]);
} else if (match = /^(.*)(\/(?:save|delete)?)$/.exec(request.uri)) {
return blobHandler(request, response, match[1], match[2]);
} else if ((match = /^\/.well-known\/(.*)/.exec(request.uri)) && request.uri.indexOf("..") == -1) {
return wellKnownHandler(request, response, match[1]);
} else {
let data = "File not found.";
response.writeHead(404, {"Content-Type": "text/plain; charset=utf-8", "Content-Length": data.length.toString()});