diff --git a/resources/web/code-web.js b/resources/web/code-web.js index 2690d2fc9a7..f9c004501bf 100644 --- a/resources/web/code-web.js +++ b/resources/web/code-web.js @@ -261,6 +261,9 @@ const requestHandler = (req, res) => { } else if (pathname === '/fetch-callback') { // callback fetch support return handleFetchCallback(req, res, parsedUrl); + } else if (pathname === '/builtin') { + // builtin extnesions JSON + return handleBuiltInExtensions(req, res, parsedUrl); } return serveError(req, res, 404, 'Not found.'); @@ -303,6 +306,17 @@ function addCORSReplyHeader(req) { return (ALLOWED_CORS_ORIGINS.indexOf(req.headers['origin']) >= 0); } +/** + * @param {import('http').IncomingMessage} req + * @param {import('http').ServerResponse} res + * @param {import('url').UrlWithParsedQuery} parsedUrl + */ +async function handleBuiltInExtensions(req, res, parsedUrl) { + const { extensions } = await builtInExtensionsPromise; + res.writeHead(200, { 'Content-Type': 'application/json' }); + return res.end(JSON.stringify(extensions)); +} + /** * @param {import('http').IncomingMessage} req * @param {import('http').ServerResponse} res