@cardsjd/device 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/lib/device.js +15 -2
  2. package/package.json +1 -2
package/lib/device.js CHANGED
@@ -71,6 +71,20 @@ export default class Device {
71
71
  * @returns {PlatformType}
72
72
  */
73
73
  getPlatform() {
74
+
75
+ //Get override information
76
+ const searchParams = new URLSearchParams(window.location.search);
77
+
78
+ //discord has a platform in its url and messes up detection //detect first
79
+ if (window.location.host.includes('discord') || (window.location.href.includes("localhost") && window.location.href.includes("frame_id"))) {
80
+ return 'discord';
81
+ }
82
+
83
+ //override
84
+ if (searchParams.has('platform')) {
85
+ return searchParams.get('platform');
86
+ }
87
+
74
88
  //facebook instant
75
89
  if (typeof globalThis.FBInstant !== 'undefined') {
76
90
  return 'FBInstant';
@@ -109,8 +123,7 @@ export default class Device {
109
123
  return Capacitor.getPlatform();
110
124
  }
111
125
 
112
- //stream
113
- const searchParams = new URLSearchParams(window.location.search);
126
+ //steam
114
127
  if (searchParams.get('steamId')) {
115
128
  return 'steam';
116
129
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cardsjd/device",
3
3
  "private": false,
4
- "version": "0.1.5",
4
+ "version": "0.1.7",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "files": [
@@ -15,7 +15,6 @@
15
15
  "@capacitor/core": "^6.0.0"
16
16
  },
17
17
  "peerDependencies": {
18
- "@cardsjd/device": "^0.1.4",
19
18
  "@sagi.io/globalthis": "^0.0.2"
20
19
  }
21
20
  }