AppId-dependant HCP

This commit is contained in:
Slava Kim
2014-10-01 14:41:13 -07:00
committed by Justin SB
parent fd24de9ceb
commit fb56aec96f
3 changed files with 12 additions and 3 deletions

View File

@@ -182,7 +182,8 @@ var retry = new Retry({
var failures = 0;
Autoupdate._retrySubscription = function () {
Meteor.subscribe("meteor_autoupdate_clientVersions", {
var appId = __meteor_runtime_config__.appId;
Meteor.subscribe("meteor_autoupdate_clientVersions", appId, {
onError: function (err) {
Meteor._debug("autoupdate subscription failed:", err);
failures++;
@@ -216,3 +217,4 @@ Autoupdate._retrySubscription = function () {
};
Meteor.startup(Autoupdate._retrySubscription);

View File

@@ -49,6 +49,7 @@ ClientVersions = new Mongo.Collection("meteor_autoupdate_clientVersions",
Autoupdate.autoupdateVersion = null;
Autoupdate.autoupdateVersionRefreshable = null;
Autoupdate.autoupdateVersionCordova = null;
Autoupdate.appId = __meteor_runtime_config__.appId = process.env.APP_ID;
var syncQueue = new Meteor._SynchronousQueue();
@@ -135,7 +136,12 @@ var updateVersions = function (shouldReloadClientProgram) {
Meteor.publish(
"meteor_autoupdate_clientVersions",
function () {
function (appId) {
// Don't notify clients using wrong appId such as mobile apps built with a
// different server but pointing at the same local url
if (Autoupdate.appId && appId && Autoupdate.appId !== appId)
return [];
return ClientVersions.find();
},
{is_auto: true}

View File

@@ -279,7 +279,8 @@ var generateCordovaBoilerplate = function (clientDir, options) {
options.host + ':' + options.port,
autoupdateVersionCordova: version,
cleanCache: options.clean,
httpProxyPort: options.httpProxyPort
httpProxyPort: options.httpProxyPort,
appId: project.appId
};
if (publicSettings)