forked from cory/tildefriends
Fixed https.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3734 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
20
core/core.js
20
core/core.js
@ -380,6 +380,17 @@ async function perfettoHandler(request, response, uri) {
|
||||
}
|
||||
}
|
||||
|
||||
async function wellKnownHandler(request, response, path) {
|
||||
var 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 sendData(response, data, type) {
|
||||
if (data) {
|
||||
if (startsWithBytes(data, [0xff, 0xd8, 0xff, 0xdb]) ||
|
||||
@ -555,14 +566,7 @@ loadSettings().then(function() {
|
||||
} else if (request.uri == "/robots.txt") {
|
||||
return blobHandler(request, response, null, request.uri);
|
||||
} else if ((match = /^\/.well-known\/(.*)/.exec(request.uri)) && request.uri.indexOf("..") == -1) {
|
||||
var data = File.readFile("data/global/.well-known/" + match[1]);
|
||||
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");
|
||||
}
|
||||
return wellKnownHandler(request, response, match[1]);
|
||||
} else {
|
||||
var data = "File not found.";
|
||||
response.writeHead(404, {"Content-Type": "text/plain; charset=utf-8", "Content-Length": data.length.toString()});
|
||||
|
Reference in New Issue
Block a user