@wutiange/log-listener-plugin 1.3.2 → 2.0.1-alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +130 -24
- package/dist/src/HTTPInterceptor.d.ts +1 -0
- package/dist/src/HTTPInterceptor.js +12 -9
- package/dist/src/HTTPInterceptor.js.map +1 -1
- package/dist/src/Server.d.ts +13 -6
- package/dist/src/Server.js +119 -41
- package/dist/src/Server.js.map +1 -1
- package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js +0 -1
- package/dist/src/__mocks__/react-native/Libraries/Blob/FileReader.js.map +1 -1
- package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js +0 -1
- package/dist/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js.map +1 -1
- package/dist/src/__tests__/Server.test.js +76 -115
- package/dist/src/__tests__/Server.test.js.map +1 -1
- package/dist/src/common.d.ts +19 -10
- package/dist/src/common.js +63 -4
- package/dist/src/common.js.map +1 -1
- package/dist/src/logPlugin.d.ts +12 -9
- package/dist/src/logPlugin.js +87 -82
- package/dist/src/logPlugin.js.map +1 -1
- package/dist/src/logger.d.ts +6 -0
- package/dist/src/logger.js +16 -0
- package/dist/src/logger.js.map +1 -0
- package/dist/src/utils.js +12 -7
- package/dist/src/utils.js.map +1 -1
- package/index.ts +3 -0
- package/package.json +18 -12
- package/src/HTTPInterceptor.ts +339 -0
- package/src/Server.ts +164 -0
- package/src/__mocks__/react-native/Libraries/Blob/FileReader.js +45 -0
- package/src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js +39 -0
- package/src/__tests__/HTTPInterceptor.test.ts +322 -0
- package/src/__tests__/Server.test.ts +150 -0
- package/src/__tests__/utils.test.ts +113 -0
- package/src/common.ts +70 -0
- package/src/logPlugin.ts +224 -0
- package/src/logger.ts +15 -0
- package/src/utils.ts +112 -0
- package/tsconfig.json +27 -0
package/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# log-listener-plugin
|
2
|
-
|
3
2
|
[![Dependencies](https://img.shields.io/badge/dependencies-none-green)](https://www.npmjs.com/package/@wutiange/log-listener-plugin?activeTab=dependencies)
|
4
3
|
[![npm](https://img.shields.io/npm/v/@wutiange/log-listener-plugin)](https://www.npmjs.com/package/@wutiange/log-listener-plugin)
|
5
4
|
[![npm downloads](https://img.shields.io/npm/dm/@wutiange/log-listener-plugin)](https://www.npmjs.com/package/@wutiange/log-listener-plugin)
|
@@ -9,49 +8,156 @@
|
|
9
8
|
|
10
9
|
要想正常使用 [log-record](https://github.com/wutiange/log-record) 客户端来收集日志,方便排查问题,那么就需要把这个插件安装到项目中。
|
11
10
|
|
12
|
-
## 安装
|
11
|
+
## 1. 安装
|
13
12
|
|
14
13
|
使用 npm 安装
|
14
|
+
|
15
15
|
```bash
|
16
16
|
npm install @wutiange/log-listener-plugin
|
17
17
|
```
|
18
18
|
|
19
19
|
使用 yarn 安装
|
20
|
+
|
20
21
|
```bash
|
21
22
|
yarn add @wutiange/log-listener-plugin
|
22
23
|
```
|
23
24
|
|
24
|
-
## 使用
|
25
|
-
|
25
|
+
## 2. 使用
|
26
|
+
|
27
|
+
在你需要开始记录日志的地方,调用下面的代码即可。
|
28
|
+
|
29
|
+
### 2.1 基于自我发现的使用
|
30
|
+
|
31
|
+
先安装 react-native-zeroconf ,这个的目的是发现局域网内可用的日志系统。
|
32
|
+
|
33
|
+
```bash
|
34
|
+
yarn add react-native-zeroconf
|
35
|
+
# 或
|
36
|
+
npm install react-native-zeroconf
|
37
|
+
```
|
38
|
+
|
39
|
+
具体安装步骤请移步:[react-native-zeroconf](https://www.npmjs.com/package/react-native-zeroconf) ,请不要忽略这行,因为要想使用这个还需要做一些必要的步骤,我也把这些复制到下面,以免被人忽略。
|
40
|
+
|
41
|
+
For Android please ensure your manifest is requesting all necessary permissions.
|
42
|
+
|
43
|
+
```xml
|
44
|
+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
45
|
+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
46
|
+
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
47
|
+
```
|
48
|
+
|
49
|
+
IOS 14 requires you to specify the services you want to scan for and a description for what you're using them.
|
50
|
+
|
51
|
+
In your `info.plist` add the following strings:
|
52
|
+
|
53
|
+
```plist
|
54
|
+
<key>NSBonjourServices</key>
|
55
|
+
<array>
|
56
|
+
<string>_http._tcp</string>
|
57
|
+
</array>
|
58
|
+
<key>NSLocalNetworkUsageDescription</key>
|
59
|
+
<string>Access nearby Log Records to view logs</string>
|
60
|
+
```
|
61
|
+
|
62
|
+
接下来只需要在项目中找个合适的位置,一般是在 App.js 中调用。
|
63
|
+
|
26
64
|
```ts
|
27
65
|
import logger from '@wutiange/log-listener-plugin';
|
28
|
-
// 填写日志服务器的地址
|
29
|
-
logger.setBaseUrl('http://127.0.0.1');
|
30
|
-
// 设置基础数据,一般数据从 react-native-device-info 中获取,这里你按自己的情况来上报即可,当然你也可以不设置
|
31
|
-
logger.setBaseData({
|
32
|
-
version: displayVersion,
|
33
|
-
brand: DeviceInfo.getBrand(),
|
34
|
-
model: DeviceInfo.getModel(),
|
35
|
-
appVersion: DeviceInfo.getVersion(),
|
36
|
-
carrier: DeviceInfo.getCarrierSync(),
|
37
|
-
manufacturer: DeviceInfo.getManufacturerSync(),
|
38
|
-
systemName: DeviceInfo.getSystemName(),
|
39
|
-
deviceUniqueId: DeviceInfo.getUniqueId(),
|
40
|
-
});
|
41
|
-
|
42
66
|
// 启动日志记录
|
43
|
-
logger.
|
67
|
+
logger.config({isAuto: true});
|
68
|
+
```
|
44
69
|
|
45
|
-
|
46
|
-
|
70
|
+
### 2.2 基于手动设置的方式使用
|
71
|
+
|
72
|
+
```ts
|
73
|
+
import logger from '@wutiange/log-listener-plugin';
|
74
|
+
// 填写日志服务器的地址,如果你使用自我发现功能,那么这一步可以省略
|
75
|
+
logger.config({isAuto: true, testUrl: 'http://127.0.0.1'});
|
47
76
|
```
|
48
|
-
|
77
|
+
|
78
|
+
### 2.3 设置基本数据
|
79
|
+
|
80
|
+
设置基础数据,一般数据从 react-native-device-info 中获取,如果你没有特殊的可以不要调用,内部会根据你安装的 react-native-device-info 自动获取基础数据。这些基础数据的目的是为了过滤数据,不是必须的。
|
81
|
+
|
82
|
+
```ts
|
83
|
+
logger.config({
|
84
|
+
baseData: {
|
85
|
+
Brand: DeviceInfo.getBrand(),
|
86
|
+
Model: DeviceInfo.getModel(),
|
87
|
+
AppVersion: DeviceInfo.getVersion(),
|
88
|
+
Carrier: DeviceInfo.getCarrierSync(),
|
89
|
+
Manufacturer: DeviceInfo.getManufacturerSync(),
|
90
|
+
SystemName: DeviceInfo.getSystemName(),
|
91
|
+
}
|
92
|
+
});
|
93
|
+
```
|
94
|
+
|
95
|
+
### 2.4 单独记录和停止所有记录
|
96
|
+
|
97
|
+
尽量不要使用以下 API ,这些 API 也没必要,这些数据都只会保存到你打开的日志系统中,所以都是能收集啥就都收集啥,目的是方便排查问题。
|
98
|
+
|
49
99
|
```ts
|
50
100
|
// 只抓取日志
|
51
101
|
logger.startRecordLog();
|
52
102
|
// 只抓取网络日志
|
53
103
|
logger.startRecordNetwork();
|
104
|
+
|
105
|
+
// 停止日志记录,会同时停止日志和网络
|
106
|
+
logger.unAuto();
|
107
|
+
```
|
108
|
+
|
109
|
+
### 2.5 其他使用说明
|
110
|
+
|
111
|
+
如果你希望杀死手机后下次进来仍然能记住之前保存的 IP 地址,那么你可以考虑安装:
|
112
|
+
|
113
|
+
```bash
|
114
|
+
yarn add @react-native-async-storage/async-storage
|
54
115
|
```
|
55
116
|
|
56
|
-
|
57
|
-
|
117
|
+
如果你本地有安装其他的 storage ,那么你可以手动设置:
|
118
|
+
|
119
|
+
```ts
|
120
|
+
logger.config({
|
121
|
+
storage: // 你的 storage ;或者你自己写的,只要遵循 getItem 和 setItem 接口规范即可
|
122
|
+
})
|
123
|
+
```
|
124
|
+
|
125
|
+
现在把若干配置相关的都放到了 config 中,以此来简化配置,配置的每一项都是可选的:
|
126
|
+
|
127
|
+
```ts
|
128
|
+
type Options = {
|
129
|
+
/**
|
130
|
+
* storage 用于存储已设置的日志系统的 url
|
131
|
+
* @default @react-native-async-storage/async-storage
|
132
|
+
*/
|
133
|
+
storage?: Storage
|
134
|
+
/**
|
135
|
+
* 设置上传日志的超时时间,单位为毫秒
|
136
|
+
* @default 3000
|
137
|
+
*/
|
138
|
+
timeout?: number
|
139
|
+
/**
|
140
|
+
* 日志系统的url
|
141
|
+
*/
|
142
|
+
testUrl?: string
|
143
|
+
/**
|
144
|
+
* 是否自动开启日志记录
|
145
|
+
* @default false
|
146
|
+
*/
|
147
|
+
isAuto?: boolean
|
148
|
+
/**
|
149
|
+
* 设置日志系统的基础数据,这些数据会自动添加到每条日志中
|
150
|
+
*/
|
151
|
+
baseData?: Record<string, any>
|
152
|
+
}
|
153
|
+
```
|
154
|
+
|
155
|
+
这是 config 每一项的说明。
|
156
|
+
|
157
|
+
## 3. 其他重要说明
|
158
|
+
|
159
|
+
1. 如果你使用的自我发现模式,那么要保证你的手机和 log-record 客户端在同一个局域网下。
|
160
|
+
1. 在配置 baseUrl 的时候,必须填写的是 [log-record](https://github.com/wutiange/log-record) 的地址,也就是你在什么电脑打开的 log-record 客户端,那么这里添加的就是对应电脑的 ip 地址。集成这个插件的 app 端要保证跟 log-record 客户端在同一个局域网下。
|
161
|
+
1. 如果你不知道日志系统的 IP ,可以在日志系统的 `设置 > 链接说明(需要版本大于1.0.9)` 中找到,如下图所示:
|
162
|
+
|
163
|
+
![](https://p0-xtjj-private.juejin.cn/tos-cn-i-73owjymdk6/2d63a50d17db4bc8ae3af0f54ad607c5~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAg5ZC05pWs5oKm:q75.awebp?policy=eyJ2bSI6MywidWlkIjoiNDM2MzYxOTgyMTYwNjEifQ%3D%3D&rk3s=e9ecf3d6&x-orig-authkey=f32326d3454f2ac7e96d3d06cdbb035152127018&x-orig-expires=1731033526&x-orig-sign=dafJc6ntYEXBbDauv9%2F8ksAhYm4%3D)
|
@@ -41,6 +41,7 @@ declare class HTTPInterceptor {
|
|
41
41
|
private headerReceivedHandle;
|
42
42
|
private responseHandle;
|
43
43
|
private sendHandle;
|
44
|
+
setIgnoredUrls: (ignoredUrls: string[]) => void;
|
44
45
|
enable: (options?: StartNetworkLoggingOptions) => void;
|
45
46
|
disable: () => void;
|
46
47
|
reset: () => void;
|
@@ -66,7 +66,7 @@ class HTTPInterceptor {
|
|
66
66
|
this.userListeners = this.userListeners.filter(([name, tempListener]) => name !== eventName || tempListener !== listener);
|
67
67
|
};
|
68
68
|
this.listenerHandle = (eventName, data) => {
|
69
|
-
this.userListeners.forEach((
|
69
|
+
this.userListeners.forEach((_a) => __awaiter(this, [_a], void 0, function* ([name, listener]) {
|
70
70
|
try {
|
71
71
|
if (name === eventName) {
|
72
72
|
yield listener(data);
|
@@ -158,6 +158,16 @@ class HTTPInterceptor {
|
|
158
158
|
currentRequest.startTime = Date.now();
|
159
159
|
this.listenerHandle('send', currentRequest);
|
160
160
|
};
|
161
|
+
this.setIgnoredUrls = (ignoredUrls) => {
|
162
|
+
if (ignoredUrls === null || ignoredUrls === void 0 ? void 0 : ignoredUrls.length) {
|
163
|
+
if (!Array.isArray(ignoredUrls) ||
|
164
|
+
typeof ignoredUrls[0] !== 'string') {
|
165
|
+
console.warn('ignoredUrls must be an array of strings. The logger has not been started.');
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
this.ignoredUrls = new Set(ignoredUrls);
|
169
|
+
}
|
170
|
+
};
|
161
171
|
this.enable = (options) => {
|
162
172
|
try {
|
163
173
|
if (this.enabled ||
|
@@ -178,14 +188,7 @@ class HTTPInterceptor {
|
|
178
188
|
if (options === null || options === void 0 ? void 0 : options.ignoredPatterns) {
|
179
189
|
this.ignoredPatterns = options.ignoredPatterns;
|
180
190
|
}
|
181
|
-
|
182
|
-
if (!Array.isArray(options.ignoredUrls) ||
|
183
|
-
typeof options.ignoredUrls[0] !== 'string') {
|
184
|
-
console.warn('ignoredUrls must be an array of strings. The logger has not been started.');
|
185
|
-
return;
|
186
|
-
}
|
187
|
-
this.ignoredUrls = new Set(options.ignoredUrls);
|
188
|
-
}
|
191
|
+
this.setIgnoredUrls(options === null || options === void 0 ? void 0 : options.ignoredUrls);
|
189
192
|
XHRInterceptor_1.default.setOpenCallback(this.openHandle);
|
190
193
|
XHRInterceptor_1.default.setRequestHeaderCallback(this.requestHeaderHandle);
|
191
194
|
XHRInterceptor_1.default.setHeaderReceivedCallback(this.headerReceivedHandle);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"HTTPInterceptor.js","sourceRoot":"","sources":["../../src/HTTPInterceptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mGAA2E;AAC3E,wFAAoE;AAEpE,mCAAyE;AAqDzE,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,EAAE;;IAClC,MAAM,IAAI,GAAG,CAAA,MAAA,MAAA,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,0CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,KAAI,SAAS,CAAC;IAE3E,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAO,QAAc,EAAE,EAAE;IACjD,MAAM,UAAU,GAAG,IAAI,oBAAc,EAAE,CAAC;IACxC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAEhC,OAAO,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,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
@@ -1,13 +1,20 @@
|
|
1
1
|
declare class Server {
|
2
|
-
private
|
2
|
+
private baseUrlObj;
|
3
3
|
private timeout;
|
4
|
-
|
4
|
+
private baseData;
|
5
|
+
private urlsListener;
|
6
|
+
private innerBaseData;
|
7
|
+
constructor(url?: string | Record<string, string>, timeout?: number);
|
8
|
+
addUrlsListener: (onNewUrlCallback: (urls: string[], urlsObj: Record<string, string>) => void) => void;
|
9
|
+
private requestJoin;
|
10
|
+
private handleZeroConf;
|
5
11
|
updateTimeout(timeout?: number): void;
|
6
|
-
|
7
|
-
getUrl(): string;
|
12
|
+
getUrls(): string[];
|
8
13
|
private send;
|
9
14
|
updateUrl(url: string): void;
|
10
|
-
|
11
|
-
|
15
|
+
setBaseUrlObj(urlObj: Record<string, string>): void;
|
16
|
+
updateBaseData(data: Record<string, any>): void;
|
17
|
+
log: (data: Record<string, any>) => Promise<void>;
|
18
|
+
network: (data: Record<string, any>) => Promise<void>;
|
12
19
|
}
|
13
20
|
export default Server;
|
package/dist/src/Server.js
CHANGED
@@ -8,41 +8,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
9
|
});
|
10
10
|
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
15
|
const utils_1 = require("./utils");
|
16
|
+
const common_1 = require("./common");
|
17
|
+
const logger_1 = __importDefault(require("./logger"));
|
18
|
+
const md5_1 = __importDefault(require("crypto-js/md5"));
|
13
19
|
const DEFAULT_PORT = 27751;
|
14
20
|
class Server {
|
15
|
-
constructor(url, timeout =
|
16
|
-
this.
|
17
|
-
this.
|
18
|
-
this.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
21
|
+
constructor(url, timeout = 30000) {
|
22
|
+
this.baseUrlObj = {};
|
23
|
+
this.baseData = {};
|
24
|
+
this.innerBaseData = {};
|
25
|
+
this.addUrlsListener = (onNewUrlCallback) => {
|
26
|
+
this.urlsListener = onNewUrlCallback;
|
27
|
+
};
|
28
|
+
this.requestJoin = (url, token) => __awaiter(this, void 0, void 0, function* () {
|
29
|
+
const response = yield fetch(url, {
|
30
|
+
method: "POST",
|
31
|
+
headers: {
|
32
|
+
"Content-Type": "application/json;charset=utf-8",
|
33
|
+
},
|
34
|
+
body: JSON.stringify({
|
35
|
+
token,
|
36
|
+
model: this.innerBaseData.Model,
|
37
|
+
id: (0, md5_1.default)(JSON.stringify(this.innerBaseData)).toString(),
|
38
|
+
}),
|
39
|
+
});
|
40
|
+
if (response.status !== 200) {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
const json = yield response.json();
|
44
|
+
if (json.code !== 0) {
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
return true;
|
48
|
+
});
|
49
|
+
this.send = (path, data) => __awaiter(this, void 0, void 0, function* () {
|
50
|
+
const request = (url, _data) => __awaiter(this, void 0, void 0, function* () {
|
51
|
+
yield Promise.race([
|
52
|
+
fetch(`${url}/${path}`, {
|
53
|
+
method: "POST",
|
42
54
|
headers: {
|
43
|
-
|
55
|
+
"Content-Type": "application/json;charset=utf-8",
|
44
56
|
},
|
45
|
-
body: JSON.stringify(
|
57
|
+
body: JSON.stringify(Object.assign(Object.assign(Object.assign({}, this.innerBaseData), this.baseData), _data), (_, val) => {
|
46
58
|
if (val instanceof Error) {
|
47
59
|
return val.toString();
|
48
60
|
}
|
@@ -51,29 +63,95 @@ class Server {
|
|
51
63
|
}),
|
52
64
|
(0, utils_1.sleep)(this.timeout, true),
|
53
65
|
]);
|
54
|
-
|
55
|
-
|
66
|
+
});
|
67
|
+
try {
|
68
|
+
if (Object.keys(this.baseUrlObj).length === 0) {
|
69
|
+
return;
|
56
70
|
}
|
57
|
-
return
|
71
|
+
yield Promise.all(this.getUrls().map((e) => __awaiter(this, void 0, void 0, function* () { return request(e, data); })));
|
58
72
|
}
|
59
73
|
catch (error) {
|
60
|
-
|
74
|
+
logger_1.default.warn(common_1.LOG_KEY, "上报日志失败", error);
|
61
75
|
}
|
62
76
|
});
|
77
|
+
this.log = (data) => __awaiter(this, void 0, void 0, function* () {
|
78
|
+
return this.send("log", data);
|
79
|
+
});
|
80
|
+
this.network = (data) => __awaiter(this, void 0, void 0, function* () {
|
81
|
+
return this.send("network", data);
|
82
|
+
});
|
83
|
+
if (typeof url === "string") {
|
84
|
+
this.updateUrl(url);
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
this.setBaseUrlObj(url !== null && url !== void 0 ? url : {});
|
88
|
+
}
|
89
|
+
this.timeout = timeout;
|
90
|
+
this.innerBaseData = (0, common_1.getBaseData)();
|
91
|
+
this.handleZeroConf();
|
63
92
|
}
|
64
|
-
|
65
|
-
this.baseUrl = url;
|
66
|
-
}
|
67
|
-
log(data) {
|
93
|
+
handleZeroConf() {
|
68
94
|
return __awaiter(this, void 0, void 0, function* () {
|
69
|
-
|
95
|
+
var _a;
|
96
|
+
try {
|
97
|
+
const Zeroconf = (_a = require("react-native-zeroconf")) === null || _a === void 0 ? void 0 : _a.default;
|
98
|
+
if (!Zeroconf) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
const zeroconf = new Zeroconf();
|
102
|
+
zeroconf.on("resolved", (service) => __awaiter(this, void 0, void 0, function* () {
|
103
|
+
var _a;
|
104
|
+
try {
|
105
|
+
const { path, token } = (_a = service.txt) !== null && _a !== void 0 ? _a : {};
|
106
|
+
if (!(path && token) || this.baseUrlObj[token]) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
const url = `http://${service.host}:${service.port}`;
|
110
|
+
if (!(yield this.requestJoin(`${url}${path}`, token))) {
|
111
|
+
return;
|
112
|
+
}
|
113
|
+
this.baseUrlObj[token] = url;
|
114
|
+
if (this.urlsListener) {
|
115
|
+
this.urlsListener(this.getUrls(), this.baseUrlObj);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
catch (error) {
|
119
|
+
logger_1.default.warn(common_1.LOG_KEY, "加入日志系统失败---", error);
|
120
|
+
}
|
121
|
+
}));
|
122
|
+
zeroconf.scan("http", "tcp");
|
123
|
+
}
|
124
|
+
catch (error) {
|
125
|
+
logger_1.default.warn(common_1.LOG_KEY, "zeroconf扫描或处理相关逻辑失败或者您根本就没有安装 react-native-zeroconf ,如果您没有安装,那么您将无法使用发现功能", error);
|
126
|
+
}
|
70
127
|
});
|
71
128
|
}
|
72
|
-
|
73
|
-
|
74
|
-
|
129
|
+
updateTimeout(timeout = 3000) {
|
130
|
+
this.timeout = timeout;
|
131
|
+
}
|
132
|
+
getUrls() {
|
133
|
+
return Object.values(this.baseUrlObj).map((e) => {
|
134
|
+
if ((0, utils_1.hasPort)(e)) {
|
135
|
+
return e;
|
136
|
+
}
|
137
|
+
return `${e}:${DEFAULT_PORT}`;
|
75
138
|
});
|
76
139
|
}
|
140
|
+
updateUrl(url) {
|
141
|
+
const tempUrl = url.includes("http") ? url : `http://${url}`;
|
142
|
+
if (!url) {
|
143
|
+
delete this.baseUrlObj["Default"];
|
144
|
+
}
|
145
|
+
else {
|
146
|
+
this.baseUrlObj["Default"] = tempUrl;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
setBaseUrlObj(urlObj) {
|
150
|
+
this.baseUrlObj = urlObj;
|
151
|
+
}
|
152
|
+
updateBaseData(data) {
|
153
|
+
this.baseData = data;
|
154
|
+
}
|
77
155
|
}
|
78
156
|
exports.default = Server;
|
79
157
|
//# sourceMappingURL=Server.js.map
|
package/dist/src/Server.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../src/Server.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Server.js","sourceRoot":"","sources":["../../src/Server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mCAAyC;AAEzC,qCAA2D;AAC3D,sDAA8B;AAC9B,wDAAgC;AAGhC,MAAM,YAAY,GAAG,KAAK,CAAC;AAC3B,MAAM,MAAM;IAUV,YAAY,GAAqC,EAAE,UAAkB,KAAK;QATlE,eAAU,GAA2B,EAAE,CAAC;QAExC,aAAQ,GAAwB,EAAE,CAAC;QAKnC,kBAAa,GAA2B,EAAE,CAAC;QAanD,oBAAe,GAAG,CAChB,gBAA2E,EAC3E,EAAE;YACF,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC;QACvC,CAAC,CAAC;QAEM,gBAAW,GAAG,CAAO,GAAW,EAAE,KAAa,EAAE,EAAE;YACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;gBAChC,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,gCAAgC;iBACjD;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,KAAK;oBACL,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;oBAC/B,EAAE,EAAE,IAAA,aAAG,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE;iBACvD,CAAC;aACH,CAAC,CAAC;YACH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC;YACf,CAAC;YACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAEnC,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACpB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAA,CAAA;QA+CO,SAAI,GAAG,CACb,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IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC;QACvC,CAAC;IACH,CAAC;IAED,aAAa,CAAC,MAA8B;QAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IAC3B,CAAC;IAED,cAAc,CAAC,IAAyB;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CASF;AAED,kBAAe,MAAM,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FileReader.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Blob/FileReader.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"FileReader.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Blob/FileReader.js"],"names":[],"mappings":";AAAA,MAAM,UAAU;IACd;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC;IACrC,CAAC;IAMD,gBAAgB,CAAC,KAAK,EAAE,QAAQ;QAC9B,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,QAAQ,CAAC;IAChC,CAAC;IAED,mBAAmB,CAAC,KAAK,EAAE,QAAQ;QACjC,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,KAAK,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,UAAU,CAAC,IAAI;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,iBAAiB,CAAC,IAAI;QACpB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,IAAI,EAAE,UAAU;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC;QACrC,UAAU,CAAC,GAAG,EAAE;YACd,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;YAClC,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,CAAC;iBAAM,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;gBAExC,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;YACnC,CAAC;YACD,IAAI,IAAI,CAAC,MAAM;gBAAE,IAAI,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;QAC/C,CAAC,EAAE,CAAC,CAAC,CAAC;IACR,CAAC;;AAlCM,gBAAK,GAAG,CAAC,CAAC;AACV,kBAAO,GAAG,CAAC,CAAC;AACZ,eAAI,GAAG,CAAC,CAAC;AAmClB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"XHRInterceptor.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"XHRInterceptor.js","sourceRoot":"","sources":["../../../../../../src/__mocks__/react-native/Libraries/Network/XHRInterceptor.js"],"names":[],"mappings":";AAEA,MAAM,cAAc;;AACX,oCAAqB,GAAG,KAAK,CAAA;AAC7B,2BAAY,GAAG,IAAI,CAAA;AACnB,oCAAqB,GAAG,IAAI,CAAA;AAC5B,qCAAsB,GAAG,IAAI,CAAA;AAC7B,2BAAY,GAAG,IAAI,CAAA;AACnB,+BAAgB,GAAG,IAAI,CAAA;AAEvB,8BAAe,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE;I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