wx2tg-puppet 2.2.5 → 3.0.0
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/dist/action/common.js +10 -6
- package/dist/api/ToolsApi.d.ts +2 -0
- package/dist/api/ToolsApi.js +4 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/action/common.js
CHANGED
|
@@ -136,13 +136,17 @@ const say = (content, toWxid, ats) => __awaiter(void 0, void 0, void 0, function
|
|
|
136
136
|
return new Message_1.ResponseMsg(imgRes.data.Data);
|
|
137
137
|
case 'other':
|
|
138
138
|
// 直接从 FileBox 获取文件内容
|
|
139
|
-
const fileBuffer =
|
|
140
|
-
const fileBlob = new Blob([fileBuffer], { type: 'application/octet-stream' });
|
|
139
|
+
// const fileBuffer = await content.toBuffer();
|
|
140
|
+
// const fileBlob = new Blob([fileBuffer], { type: 'application/octet-stream' });
|
|
141
141
|
// 创建 FormData
|
|
142
|
-
const formData = new FormData();
|
|
143
|
-
formData.append('wxid',
|
|
144
|
-
formData.append('file', fileBlob, fileName);
|
|
145
|
-
const
|
|
142
|
+
// const formData = new FormData();
|
|
143
|
+
// formData.append('wxid', config?.wxid || '');
|
|
144
|
+
// formData.append('file', fileBlob, fileName);
|
|
145
|
+
const fileBase64 = yield content.toBase64();
|
|
146
|
+
const res = yield ToolsApi_1.toolsApi.UploadAppAttachApi({
|
|
147
|
+
"Wxid": config === null || config === void 0 ? void 0 : config.wxid,
|
|
148
|
+
"fileData": fileBase64
|
|
149
|
+
});
|
|
146
150
|
if (res.data.Code !== 0) {
|
|
147
151
|
throw new Error(`上传文件失败: ${res.data.Message}`);
|
|
148
152
|
}
|
package/dist/api/ToolsApi.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ declare class ToolsApi {
|
|
|
33
33
|
UpdateStepNumberApi(body: any): Promise<AxiosResponse<ApiResponse>>;
|
|
34
34
|
/** 文件上传 */
|
|
35
35
|
UploadFile(body: any): Promise<AxiosResponse<ApiResponse>>;
|
|
36
|
+
/** 文件上传 */
|
|
37
|
+
UploadAppAttachApi(body: any): Promise<AxiosResponse<ApiResponse>>;
|
|
36
38
|
/** 二进制文件上传 */
|
|
37
39
|
UploadFileBinary(formData: FormData): Promise<AxiosResponse<ApiResponse>>;
|
|
38
40
|
/** 设置/删除代理IP */
|
package/dist/api/ToolsApi.js
CHANGED
|
@@ -67,6 +67,10 @@ class ToolsApi {
|
|
|
67
67
|
UploadFile(body) {
|
|
68
68
|
return axiosInstance_1.axiosInstance.post('/Tools/UploadFile', body);
|
|
69
69
|
}
|
|
70
|
+
/** 文件上传 */
|
|
71
|
+
UploadAppAttachApi(body) {
|
|
72
|
+
return axiosInstance_1.axiosInstance.post('/Tools/UploadAppAttachApi', body);
|
|
73
|
+
}
|
|
70
74
|
/** 二进制文件上传 */
|
|
71
75
|
UploadFileBinary(formData) {
|
|
72
76
|
return axiosInstance_1.axiosInstance.post('/Tools/UploadFileBinary', formData, {
|
package/dist/index.js
CHANGED
|
@@ -192,7 +192,7 @@ class WxBot extends events_1.EventEmitter {
|
|
|
192
192
|
}
|
|
193
193
|
const data = response.data;
|
|
194
194
|
this.uuid = data.Data.Uuid;
|
|
195
|
-
const match = data.Data.QrUrl.match(/[?&]
|
|
195
|
+
const match = data.Data.QrUrl.match(/[?&]url=([^&]+)/);
|
|
196
196
|
if (match && match[1]) {
|
|
197
197
|
const qrLink = decodeURIComponent(match[1]);
|
|
198
198
|
this.emit('scan', {
|