Include hash of minimum modern versions in autoupdate versions.

This commit is contained in:
Ben Newman
2018-07-10 17:36:30 -04:00
parent 6335d68c0a
commit 99b79dc00f
3 changed files with 20 additions and 3 deletions

View File

@@ -95,6 +95,12 @@ function getCaller(calleeName) {
Object.assign(exports, {
isModern,
setMinimumBrowserVersions,
calculateHashOfMinimumVersions() {
const { createHash } = require("crypto");
return createHash("sha1").update(
JSON.stringify(minimumVersions)
).digest("hex");
}
});
// For making defensive copies of [major, minor, ...] version arrays, so

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "modern-browsers",
version: "0.1.1",
version: "0.1.2",
summary: "API for defining the boundary between modern and legacy " +
"JavaScript clients",
documentation: "README.md"

View File

@@ -14,7 +14,10 @@ import query from "qs-middleware";
import parseRequest from "parseurl";
import basicAuth from "basic-auth-connect";
import { lookup as lookupUserAgent } from "useragent";
import { isModern } from "meteor/modern-browsers";
import {
isModern,
calculateHashOfMinimumVersions,
} from "meteor/modern-browsers";
import send from "send";
import {
removeExistingSocketFile,
@@ -641,7 +644,15 @@ function runWebAppServer() {
const { AUTOUPDATE_VERSION } = process.env;
const { PUBLIC_SETTINGS } = __meteor_runtime_config__;
const configOverrides = { PUBLIC_SETTINGS };
const configOverrides = {
PUBLIC_SETTINGS,
// Since the minimum modern versions defined in the modern-versions
// package affect which bundle a given client receives, any changes
// in those versions should trigger a corresponding change in the
// versions calculated below.
minimumModernVersionsHash: calculateHashOfMinimumVersions(),
};
const program = {
format: "web-program-pre1",
manifest: manifest,