mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #10309 from nathan-muir/webapp-runtime-override-is-modern
Fix Meteor.isModern when inline scripts are disabled.
This commit is contained in:
@@ -386,12 +386,7 @@ WebAppInternals.staticFilesMiddleware = async function (
|
||||
res.end();
|
||||
};
|
||||
|
||||
if (pathname === "/meteor_runtime_config.js" &&
|
||||
! WebAppInternals.inlineScriptsAllowed()) {
|
||||
serveStaticJs("__meteor_runtime_config__ = " +
|
||||
JSON.stringify(__meteor_runtime_config__) + ";");
|
||||
return;
|
||||
} else if (_.has(additionalStaticJs, pathname) &&
|
||||
if (_.has(additionalStaticJs, pathname) &&
|
||||
! WebAppInternals.inlineScriptsAllowed()) {
|
||||
serveStaticJs(additionalStaticJs[pathname]);
|
||||
return;
|
||||
@@ -404,7 +399,14 @@ WebAppInternals.staticFilesMiddleware = async function (
|
||||
|
||||
// If pauseClient(arch) has been called, program.paused will be a
|
||||
// Promise that will be resolved when the program is unpaused.
|
||||
await WebApp.clientPrograms[arch].paused;
|
||||
const program = WebApp.clientPrograms[arch];
|
||||
await program.paused;
|
||||
|
||||
if (path === "/meteor_runtime_config.js" &&
|
||||
! WebAppInternals.inlineScriptsAllowed()) {
|
||||
serveStaticJs(`__meteor_runtime_config__ = ${program.meteorRuntimeConfig};`);
|
||||
return;
|
||||
}
|
||||
|
||||
const info = getStaticFileInfo(pathname, path, arch);
|
||||
if (! info) {
|
||||
@@ -789,13 +791,18 @@ function runWebAppServer() {
|
||||
|
||||
function generateBoilerplateForArch(arch) {
|
||||
const program = WebApp.clientPrograms[arch];
|
||||
const additionalOptions = defaultOptionsForArch[arch] || {};
|
||||
const { baseData } = boilerplateByArch[arch] =
|
||||
WebAppInternals.generateBoilerplateInstance(
|
||||
arch,
|
||||
program.manifest,
|
||||
defaultOptionsForArch[arch],
|
||||
additionalOptions,
|
||||
);
|
||||
|
||||
// We need the runtime config with overrides for meteor_runtime_config.js:
|
||||
program.meteorRuntimeConfig = JSON.stringify({
|
||||
...__meteor_runtime_config__,
|
||||
...(additionalOptions.runtimeConfigOverrides || null),
|
||||
});
|
||||
program.refreshableAssets = baseData.css.map(file => ({
|
||||
url: bundledJsCssUrlRewriteHook(file.url),
|
||||
}));
|
||||
@@ -835,7 +842,7 @@ function runWebAppServer() {
|
||||
// Do this before the next middleware destroys req.url if a path prefix
|
||||
// is set to close #10111.
|
||||
app.use(query());
|
||||
|
||||
|
||||
function getPathParts(path) {
|
||||
const parts = path.split("/");
|
||||
while (parts[0] === "") parts.shift();
|
||||
|
||||
Reference in New Issue
Block a user