react-native-update 10.10.2 → 10.10.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.10.2",
3
+ "version": "10.10.3",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
package/src/client.ts CHANGED
@@ -17,8 +17,10 @@ import {
17
17
  const defaultServer = {
18
18
  main: 'https://update.react-native.cn/api',
19
19
  backups: ['https://update.reactnative.cn/api'],
20
- queryUrl:
20
+ queryUrls: [
21
+ 'https://gitee.com/sunnylqm/react-native-pushy/raw/master/endpoints.json',
21
22
  'https://cdn.jsdelivr.net/gh/reactnativecn/react-native-pushy@master/endpoints.json',
23
+ ],
22
24
  };
23
25
 
24
26
  const empty = {};
@@ -233,9 +235,11 @@ export class Pushy {
233
235
  if (!server) {
234
236
  return [];
235
237
  }
236
- if (server.queryUrl) {
238
+ if (server.queryUrls) {
237
239
  try {
238
- const resp = await fetch(server.queryUrl);
240
+ const resp = await Promise.race(
241
+ server.queryUrls.map(queryUrl => fetch(queryUrl)),
242
+ );
239
243
  const remoteEndpoints = await resp.json();
240
244
  log('fetch endpoints:', remoteEndpoints);
241
245
  if (Array.isArray(remoteEndpoints)) {
@@ -244,7 +248,7 @@ export class Pushy {
244
248
  );
245
249
  }
246
250
  } catch (e: any) {
247
- log('failed to fetch endpoints from: ', server.queryUrl);
251
+ log('failed to fetch endpoints from: ', server.queryUrls);
248
252
  }
249
253
  }
250
254
  return server.backups;
package/src/type.ts CHANGED
@@ -62,7 +62,7 @@ export type UpdateEventsLogger = ({
62
62
  export interface PushyServerConfig {
63
63
  main: string;
64
64
  backups?: string[];
65
- queryUrl?: string;
65
+ queryUrls?: string[];
66
66
  }
67
67
 
68
68
  export interface PushyOptions {