@smpx/koa-request 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Request.js +19 -5
- package/package.json +1 -1
package/Request.js
CHANGED
|
@@ -654,11 +654,16 @@ class Request {
|
|
|
654
654
|
let [os, appVersion, installId] = infoStr.split(separator);
|
|
655
655
|
os = os.toLowerCase();
|
|
656
656
|
|
|
657
|
-
const appInfo = {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
657
|
+
const appInfo = {};
|
|
658
|
+
if (os) {
|
|
659
|
+
appInfo.os = os;
|
|
660
|
+
}
|
|
661
|
+
if (appVersion) {
|
|
662
|
+
appInfo.appVersion = appVersion;
|
|
663
|
+
}
|
|
664
|
+
if (installId) {
|
|
665
|
+
appInfo.installId = installId;
|
|
666
|
+
}
|
|
662
667
|
|
|
663
668
|
if (this.appPlatforms().has(os)) {
|
|
664
669
|
appInfo.appType = 'app';
|
|
@@ -760,6 +765,8 @@ class Request {
|
|
|
760
765
|
else if (!appInfo.deviceType) {
|
|
761
766
|
appInfo.deviceType = this._getDeviceType();
|
|
762
767
|
}
|
|
768
|
+
|
|
769
|
+
return appInfo;
|
|
763
770
|
}
|
|
764
771
|
|
|
765
772
|
/*
|
|
@@ -834,6 +841,13 @@ class Request {
|
|
|
834
841
|
return false;
|
|
835
842
|
}
|
|
836
843
|
|
|
844
|
+
platform() {
|
|
845
|
+
if (this.isApp()) return 'mobile_app';
|
|
846
|
+
if (this.isMobile()) return 'mobile_web';
|
|
847
|
+
if (this.isAPI()) return 'api';
|
|
848
|
+
return 'desktop';
|
|
849
|
+
}
|
|
850
|
+
|
|
837
851
|
/**
|
|
838
852
|
* @typedef {Object} UTMObject
|
|
839
853
|
* @property {string} source
|