Send plugin version with requests (#178)
* Update sample apps to install CodePush from the working directory * Send the plugin version as a request header This is just a quick PR to send the plugin version as a header in requests to the CodePush server. The acquisition SDK version currently being sent with requests is unreliable, because it is only updated rarely, and because it is shared with the React Native plugin. Sending the actual `cordova-plugin-code-push` version allows the server to have fine-grained recognition of the exact plugin and version, and is necessary for breaking features such as the new CDN used to distribute updates.
This commit is contained in:
Родитель
009e349ca6
Коммит
da962757ae
|
@ -33,6 +33,8 @@ var HttpRequester = (function () {
|
|||
if (this.contentType) {
|
||||
xhr.setRequestHeader("Content-Type", this.contentType);
|
||||
}
|
||||
xhr.setRequestHeader("X-CodePush-Plugin-Name", "cordova-plugin-code-push");
|
||||
xhr.setRequestHeader("X-CodePush-Plugin-Version", cordova.require("cordova/plugin_list").metadata["cordova-plugin-code-push"]);
|
||||
xhr.setRequestHeader("X-CodePush-SDK-Version", cordova.require("cordova/plugin_list").metadata["code-push"]);
|
||||
xhr.send(requestBody);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
*/platforms
|
||||
*/plugins
|
|
@ -9,7 +9,7 @@
|
|||
<content src="index.html" />
|
||||
|
||||
<plugin name="cordova-plugin-whitelist" version="1" />
|
||||
<plugin name="cordova-plugin-code-push" version="1.5.0-beta" />
|
||||
<plugin name="cordova-plugin-code-push" spec="../.." />
|
||||
|
||||
<!-- This sample application can communicate with any external domain.
|
||||
If you want to restrict this, don't forget to enable communication with the Code-Push server URL as well. -->
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<content src="index.html" />
|
||||
|
||||
<plugin name="cordova-plugin-whitelist" version="1" />
|
||||
<plugin name="cordova-plugin-code-push" version="1.5.0-beta" />
|
||||
<plugin name="cordova-plugin-code-push" spec="../.." />
|
||||
|
||||
<!-- This sample application can communicate with any external domain.
|
||||
If you want to restrict this, don't forget to enable communication with the Code-Push server URL as well. -->
|
||||
|
|
|
@ -40,6 +40,8 @@ class HttpRequester implements Http.Requester {
|
|||
xhr.setRequestHeader("Content-Type", this.contentType);
|
||||
}
|
||||
|
||||
xhr.setRequestHeader("X-CodePush-Plugin-Name", "cordova-plugin-code-push");
|
||||
xhr.setRequestHeader("X-CodePush-Plugin-Version", cordova.require("cordova/plugin_list").metadata["cordova-plugin-code-push"]);
|
||||
xhr.setRequestHeader("X-CodePush-SDK-Version", cordova.require("cordova/plugin_list").metadata["code-push"]);
|
||||
xhr.send(requestBody);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче