Expose creds to request handlers.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4343 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
c1ec150696
commit
c4a2d790a3
@ -604,7 +604,7 @@ async function getBlobOrContent(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let g_handler_index = 0;
|
let g_handler_index = 0;
|
||||||
async function useAppHandler(response, handler_blob_id, path, query) {
|
async function useAppHandler(response, handler_blob_id, path, query, headers) {
|
||||||
let do_resolve;
|
let do_resolve;
|
||||||
let promise = new Promise(async function(resolve, reject) {
|
let promise = new Promise(async function(resolve, reject) {
|
||||||
do_resolve = resolve;
|
do_resolve = resolve;
|
||||||
@ -621,6 +621,7 @@ async function useAppHandler(response, handler_blob_id, path, query) {
|
|||||||
},
|
},
|
||||||
respond: do_resolve,
|
respond: do_resolve,
|
||||||
},
|
},
|
||||||
|
credentials: auth.query(headers),
|
||||||
});
|
});
|
||||||
await process.ready;
|
await process.ready;
|
||||||
|
|
||||||
@ -793,7 +794,7 @@ async function blobHandler(request, response, blobId, uri) {
|
|||||||
if (!id && app_object.files['handler.js']) {
|
if (!id && app_object.files['handler.js']) {
|
||||||
let answer;
|
let answer;
|
||||||
try {
|
try {
|
||||||
answer = await useAppHandler(response, app_id, uri.substring(1), request.query ? form.decodeForm(request.query) : undefined);
|
answer = await useAppHandler(response, app_id, uri.substring(1), request.query ? form.decodeForm(request.query) : undefined, request.headers);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
data = utf8Encode(`Internal Server Error\n\n${error?.message}\n${error?.stack}`);
|
data = utf8Encode(`Internal Server Error\n\n${error?.message}\n${error?.stack}`);
|
||||||
response.writeHead(500, {'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': data.length});
|
response.writeHead(500, {'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': data.length});
|
||||||
|
Loading…
Reference in New Issue
Block a user