@aguacerowx/react-native 0.0.51 → 0.0.52
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/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +11 -3
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +315 -311
- package/ios/SatelliteLayerView.swift +11 -4
- package/ios/WeatherFrameProcessorModule.swift +222 -219
- package/lib/commonjs/WeatherLayerManager.js +61 -45
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroRnDebug.js +8 -1
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -1
- package/lib/commonjs/gridCdnAuth.js +64 -0
- package/lib/commonjs/gridCdnAuth.js.map +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +25 -25
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +24 -24
- package/lib/commonjs/satellite/satelliteAndroidController.js +15 -15
- package/lib/module/WeatherLayerManager.js +61 -45
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroRnDebug.js +8 -1
- package/lib/module/aguaceroRnDebug.js.map +1 -1
- package/lib/module/gridCdnAuth.js +56 -0
- package/lib/module/gridCdnAuth.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +25 -25
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +24 -24
- package/lib/module/satellite/satelliteAndroidController.js +15 -15
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -1
- package/lib/typescript/gridCdnAuth.d.ts +24 -0
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/WeatherLayerManager.js +2024 -2004
- package/src/aguaceroRnDebug.js +8 -1
- package/src/gridCdnAuth.js +56 -0
- package/src/index.js +19 -15
- package/src/nexrad/nexradAndroidController.js +1078 -1078
- package/src/nexrad/nexradDiag.js +150 -150
- package/src/satellite/satelliteAndroidController.js +245 -245
package/src/aguaceroRnDebug.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import { Platform } from 'react-native';
|
|
23
|
+
import { resolveGridRequestSiteOrigin } from './gridCdnAuth';
|
|
23
24
|
|
|
24
25
|
const LOG_PREFIX = '[AguaceroRN][debug]';
|
|
25
26
|
|
|
@@ -201,7 +202,7 @@ export function getAguaceroAuthDiagnosticSnapshot(core, extra = {}) {
|
|
|
201
202
|
? { present: true, value: String(origin), length: String(origin).length }
|
|
202
203
|
: {
|
|
203
204
|
present: false,
|
|
204
|
-
hint: 'Pass gridRequestSiteOrigin on WeatherLayerManager
|
|
205
|
+
hint: 'Pass gridRequestSiteOrigin on WeatherLayerManager (RN falls back to https://localhost if omitted)',
|
|
205
206
|
},
|
|
206
207
|
willSendAppIdentifier: Boolean(bundleId && core?.isReactNative),
|
|
207
208
|
willSendOriginHeaders: Boolean(origin && String(origin).trim()),
|
|
@@ -216,6 +217,12 @@ export function getAguaceroAuthDiagnosticSnapshot(core, extra = {}) {
|
|
|
216
217
|
*/
|
|
217
218
|
export function augmentProcessFrameOptionsForDebug(options, core) {
|
|
218
219
|
const out = { ...options };
|
|
220
|
+
if (!out.gridRequestSiteOrigin && core) {
|
|
221
|
+
const origin = resolveGridRequestSiteOrigin(undefined, core);
|
|
222
|
+
if (origin) {
|
|
223
|
+
out.gridRequestSiteOrigin = origin;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
219
226
|
if (!isAguaceroRnDebugEnabled()) {
|
|
220
227
|
return out;
|
|
221
228
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CloudFront grid CDN auth helpers for React Native.
|
|
3
|
+
*
|
|
4
|
+
* The CDN returns HTTP 403 when {@code Origin} is missing (even if {@code x-api-key} and
|
|
5
|
+
* {@code apiKey} query are valid). Browsers set Origin automatically; RN native HTTP does not.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Fallback when no prop/core/global origin is configured (any origin satisfies the CDN). */
|
|
9
|
+
export const RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN = 'https://localhost';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
14
|
+
export function readGlobalGridRequestSiteOrigin() {
|
|
15
|
+
try {
|
|
16
|
+
const g = globalThis.__AGUACERO_GRID_REQUEST_SITE_ORIGIN__;
|
|
17
|
+
if (typeof g === 'string' && g.trim()) {
|
|
18
|
+
return g.trim().replace(/\/+$/, '');
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
/* ignore */
|
|
22
|
+
}
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the site origin used for {@code Origin} / {@code Referer} on grid CDN requests.
|
|
28
|
+
*
|
|
29
|
+
* @param {string | undefined | null} propOrigin - {@link WeatherLayerManager} `gridRequestSiteOrigin` prop
|
|
30
|
+
* @param {{ gridRequestSiteOrigin?: string | null; isReactNative?: boolean } | null | undefined} core
|
|
31
|
+
* @returns {string | null} Normalized origin without trailing slash, or null on web when unset
|
|
32
|
+
*/
|
|
33
|
+
export function resolveGridRequestSiteOrigin(propOrigin, core) {
|
|
34
|
+
const normalize = (s) => {
|
|
35
|
+
let o = String(s).trim();
|
|
36
|
+
while (o.endsWith('/')) {
|
|
37
|
+
o = o.slice(0, -1);
|
|
38
|
+
}
|
|
39
|
+
return o;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (typeof propOrigin === 'string' && propOrigin.trim()) {
|
|
43
|
+
return normalize(propOrigin);
|
|
44
|
+
}
|
|
45
|
+
if (typeof core?.gridRequestSiteOrigin === 'string' && core.gridRequestSiteOrigin.trim()) {
|
|
46
|
+
return normalize(core.gridRequestSiteOrigin);
|
|
47
|
+
}
|
|
48
|
+
const fromGlobal = readGlobalGridRequestSiteOrigin();
|
|
49
|
+
if (fromGlobal) {
|
|
50
|
+
return fromGlobal;
|
|
51
|
+
}
|
|
52
|
+
if (core?.isReactNative) {
|
|
53
|
+
return RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
export { MapManager } from './MapManager';
|
|
2
|
-
export { WeatherLayerManager } from './WeatherLayerManager';
|
|
3
|
-
export {
|
|
4
|
-
configureAguaceroRnDebug,
|
|
5
|
-
setAguaceroRnDebugEnabled,
|
|
6
|
-
isAguaceroRnDebugEnabled,
|
|
7
|
-
getAguaceroAuthDiagnosticSnapshot,
|
|
8
|
-
aguaceroDebug,
|
|
9
|
-
aguaceroDebugWarn,
|
|
10
|
-
} from './aguaceroRnDebug';
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from './
|
|
1
|
+
export { MapManager } from './MapManager';
|
|
2
|
+
export { WeatherLayerManager } from './WeatherLayerManager';
|
|
3
|
+
export {
|
|
4
|
+
configureAguaceroRnDebug,
|
|
5
|
+
setAguaceroRnDebugEnabled,
|
|
6
|
+
isAguaceroRnDebugEnabled,
|
|
7
|
+
getAguaceroAuthDiagnosticSnapshot,
|
|
8
|
+
aguaceroDebug,
|
|
9
|
+
aguaceroDebugWarn,
|
|
10
|
+
} from './aguaceroRnDebug';
|
|
11
|
+
export {
|
|
12
|
+
resolveGridRequestSiteOrigin,
|
|
13
|
+
RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN,
|
|
14
|
+
} from './gridCdnAuth';
|
|
15
|
+
export { default as GridRenderLayer } from './GridRenderLayerNativeComponent';
|
|
16
|
+
export {
|
|
17
|
+
AGUACERO_NEXRAD_MAP_LAYER_ID,
|
|
18
|
+
AGUACERO_SATELLITE_MAP_LAYER_ID,
|
|
19
|
+
} from './nws/nwsAndroidConstants';
|