apollo-media-utils 0.0.0-stage → 1.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.
@@ -0,0 +1,54 @@
1
+ declare const getPlatformSite: (platformVal: string, user: any) => ZMT.ISite | null;
2
+
3
+ declare const SetHideProgressEvent: (taskId: string, msg: string, detail?: any) => void;
4
+
5
+ declare const createBrowserEvent: () => ZMT.BrowserEventBus;
6
+ declare const createAPIEvent: () => ZMT.BrowserEventBus;
7
+
8
+ declare const getImgUrl: (tab: any, selector: string, index?: number) => Promise<any>;
9
+ declare const getInnerText: (tab: any, selector: string, index?: number) => Promise<any>;
10
+ declare const getAiText: (tab: any, selector: string, index?: number) => Promise<any>;
11
+ declare const keyEnter: (tab: any) => Promise<void>;
12
+ declare const waitForSelector: (tab: any, selector: string, timeout: number, selector_length?: number) => Promise<boolean>;
13
+ declare const waitForSelectorByText: (tab: any, selector: any, text: any, timeout: any, selector_length?: number, includes?: "true" | "false") => Promise<boolean>;
14
+ declare const whileForSelector: (tab: any, selector: string, isExist: boolean, timeout?: number) => Promise<boolean>;
15
+ declare const getElRect: (tab: any, selector: string) => Promise<any>;
16
+ declare const getElRectByText: (tab: any, selector: string, text: string, index?: number) => Promise<any>;
17
+ declare const sendText: (tab: any, value: any) => Promise<void>;
18
+ declare const fillText: (tab: any, selector: string, text?: string) => Promise<void>;
19
+ /** 点击元素 */
20
+ declare const jsDomClick: (tab: any, selector: string) => Promise<void>;
21
+ /** 点击元素 */
22
+ declare const jsDomClickByText: (tab: any, selector: string, text?: string, index?: number) => Promise<boolean>;
23
+ /** 点击元素 */
24
+ declare const domClick: (tab: any, selector: string) => Promise<void>;
25
+ declare const getLocalStorages: (tab: any, list?: Array<string>) => Promise<Record<string, any>>;
26
+ declare const getLocalStoragesNew: (tab: any, list?: Array<string>) => Promise<Record<string, any>>;
27
+ declare const getHref: (tab: any) => Promise<any>;
28
+ declare const toHref: (tab: any, url: any) => Promise<any>;
29
+ declare const getCookie: (tab: any) => Promise<any>;
30
+
31
+ declare const DomTools_domClick: typeof domClick;
32
+ declare const DomTools_fillText: typeof fillText;
33
+ declare const DomTools_getAiText: typeof getAiText;
34
+ declare const DomTools_getCookie: typeof getCookie;
35
+ declare const DomTools_getElRect: typeof getElRect;
36
+ declare const DomTools_getElRectByText: typeof getElRectByText;
37
+ declare const DomTools_getHref: typeof getHref;
38
+ declare const DomTools_getImgUrl: typeof getImgUrl;
39
+ declare const DomTools_getInnerText: typeof getInnerText;
40
+ declare const DomTools_getLocalStorages: typeof getLocalStorages;
41
+ declare const DomTools_getLocalStoragesNew: typeof getLocalStoragesNew;
42
+ declare const DomTools_jsDomClick: typeof jsDomClick;
43
+ declare const DomTools_jsDomClickByText: typeof jsDomClickByText;
44
+ declare const DomTools_keyEnter: typeof keyEnter;
45
+ declare const DomTools_sendText: typeof sendText;
46
+ declare const DomTools_toHref: typeof toHref;
47
+ declare const DomTools_waitForSelector: typeof waitForSelector;
48
+ declare const DomTools_waitForSelectorByText: typeof waitForSelectorByText;
49
+ declare const DomTools_whileForSelector: typeof whileForSelector;
50
+ declare namespace DomTools {
51
+ export { DomTools_domClick as domClick, DomTools_fillText as fillText, DomTools_getAiText as getAiText, DomTools_getCookie as getCookie, DomTools_getElRect as getElRect, DomTools_getElRectByText as getElRectByText, DomTools_getHref as getHref, DomTools_getImgUrl as getImgUrl, DomTools_getInnerText as getInnerText, DomTools_getLocalStorages as getLocalStorages, DomTools_getLocalStoragesNew as getLocalStoragesNew, DomTools_jsDomClick as jsDomClick, DomTools_jsDomClickByText as jsDomClickByText, DomTools_keyEnter as keyEnter, DomTools_sendText as sendText, DomTools_toHref as toHref, DomTools_waitForSelector as waitForSelector, DomTools_waitForSelectorByText as waitForSelectorByText, DomTools_whileForSelector as whileForSelector };
52
+ }
53
+
54
+ export { DomTools, SetHideProgressEvent, createAPIEvent, createBrowserEvent, getPlatformSite };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // 本文件由 scripts/compile-jsc.mjs 自动生成,请勿手改
2
+ // 运行时先加载 bytenode(注册 .jsc 模块加载器),再执行 V8 字节码
3
+ require('bytenode');
4
+ module.exports = require('./index.jsc');
package/dist/index.jsc ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,77 @@
1
- {
2
- "name": "apollo-media-utils",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "apollo-media-utils",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "types": "types/index.d.ts",
6
+ "files": [
7
+ "dist",
8
+ "types"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./types/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.js"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "tsup",
19
+ "obfuscate": "node scripts/obfuscate.mjs",
20
+ "jsc": "node scripts/compile-jsc.mjs",
21
+ "prepublishOnly": "npm run build && npm run obfuscate && npm run jsc",
22
+ "pack:dry": "npm pack --dry-run",
23
+ "pack": "npm pack",
24
+ "release": "npm run build && npm run obfuscate && npm run jsc && npm publish"
25
+ },
26
+ "description": "我的工具包",
27
+ "license": "MIT",
28
+ "dependencies": {
29
+ "aws4-axios": "^3.3.0",
30
+ "axios": "^1.6.2",
31
+ "axios-retry": "^4.0.0",
32
+ "bytenode": "^2.1.0",
33
+ "crypto-js": "^4.2.0",
34
+ "fast-xml-parser": "^4.3.2",
35
+ "fs-extra": "^10.1.0",
36
+ "html-to-docx": "^1.8.0",
37
+ "htmlparser2": "^8.0.1",
38
+ "https-proxy-agent": "5.0.1",
39
+ "iconv-lite": "^0.6.3",
40
+ "image-hash": "^5.3.2",
41
+ "jimp": "^0.22.10",
42
+ "jschardet": "^3.1.4",
43
+ "jsdom": "^20.0.3",
44
+ "json-stringify-safe": "^5.0.1",
45
+ "json5": "^2.2.3",
46
+ "jsqr": "^1.4.0",
47
+ "jsrsasign": "^11.1.0",
48
+ "less": "^4.2.0",
49
+ "lodash": "^4.17.21",
50
+ "log4js": "^6.9.1",
51
+ "moment": "^2.29.4",
52
+ "prosemirror-model": "^1.25.11",
53
+ "socks-proxy-agent": "8.0.5",
54
+ "typescript-collections": "^1.3.3",
55
+ "xml-writer": "^1.7.0",
56
+ "xmldom": "^0.6.0",
57
+ "xpath": "^0.0.34"
58
+ },
59
+ "devDependencies": {
60
+ "@electron-toolkit/preload": "^2.0.0",
61
+ "@electron-toolkit/utils": "^2.0.1",
62
+ "@types/node": "^20.10.2",
63
+ "@typescript-eslint/eslint-plugin": "^6.17.0",
64
+ "@typescript-eslint/parser": "^6.17.0",
65
+ "electron": "^22.3.27",
66
+ "eslint": "^8.55.0",
67
+ "eslint-config-airbnb-base": "^15.0.0",
68
+ "eslint-config-prettier": "^9.1.0",
69
+ "eslint-plugin-import": "^2.29.0",
70
+ "eslint-plugin-prettier": "^5.0.1",
71
+ "eslint-plugin-simple-import-sort": "^10.0.0",
72
+ "extract-zip": "^2.0.1",
73
+ "javascript-obfuscator": "^5.9.0",
74
+ "tsup": "^8.3.5",
75
+ "typescript": "^5.3.2"
76
+ }
77
+ }
@@ -0,0 +1,935 @@
1
+ declare namespace ZMT {
2
+ interface AppSetting {
3
+ /**
4
+ * 客户端名称
5
+ */
6
+ name: string;
7
+
8
+ version: string;
9
+
10
+ /**
11
+ * 窗口大小id
12
+ */
13
+ "common.windowSizeId": number;
14
+
15
+ /**
16
+ * 窗口大小id
17
+ */
18
+ "common.fontSize": number;
19
+
20
+ /**
21
+ * 是否以全屏启动
22
+ */
23
+ "common.startInFullscreen": boolean;
24
+
25
+ /**
26
+ * 语言id
27
+ */
28
+ "common.langId": I18n["locale"] | null;
29
+
30
+ /**
31
+ * api id
32
+ */
33
+ "common.apiSource": string;
34
+
35
+ /**
36
+ * 是否同意软件协议
37
+ */
38
+ "common.isAgreePact": boolean;
39
+
40
+ /**
41
+ * 尝试自动更新
42
+ */
43
+ "common.tryAutoUpdate": boolean;
44
+
45
+ /**
46
+ * 更新版本后是否显示变更日志
47
+ */
48
+ "common.showChangeLog": boolean;
49
+
50
+ /**
51
+ * 是否启用下载功能
52
+ */
53
+ "download.enable": boolean;
54
+
55
+ /**
56
+ * 下载路径
57
+ */
58
+ "download.savePath": string;
59
+
60
+ /**
61
+ * 是否启用代理
62
+ */
63
+ "network.proxy.enable": boolean;
64
+
65
+ /**
66
+ * 代理服务器地址
67
+ */
68
+ "network.proxy.host": string;
69
+
70
+ /**
71
+ * 代理服务器端口号
72
+ */
73
+ "network.proxy.port": string;
74
+
75
+ /**
76
+ * 代理服务器用户名
77
+ */
78
+ "network.proxy.username": string;
79
+
80
+ /**
81
+ * 代理服务器密码
82
+ */
83
+ "network.proxy.password": string;
84
+
85
+ /**
86
+ * 是否启用托盘
87
+ */
88
+ "tray.enable": boolean;
89
+
90
+ /**
91
+ * 是否关闭时是否最小化到托盘
92
+ */
93
+ "tray.isToTray": boolean;
94
+
95
+ /**
96
+ * 同步服务模式
97
+ */
98
+ "sync.mode": "server" | "client";
99
+
100
+ /**
101
+ * 是否启用同步服务
102
+ */
103
+ "sync.enable": boolean;
104
+
105
+ /**
106
+ * 图片存储目录
107
+ */
108
+ "common.picPath": string;
109
+ /**
110
+ * 私信消息提醒
111
+ */
112
+ "message.im": boolean;
113
+
114
+ /**
115
+ * 评论消息提醒
116
+ */
117
+ "message.comment": boolean;
118
+
119
+ /**
120
+ * 发布成功消息提醒
121
+ */
122
+ "message.publish.success": boolean;
123
+
124
+ /**
125
+ * 发布失败消息提醒
126
+ */
127
+ "message.publish.error": boolean;
128
+
129
+ /**
130
+ * 相同平台间作品发布时间间隔 s
131
+ */
132
+ "publish.samePlatformTimeInterval": number;
133
+
134
+ /**同一账号作品发布时间间隔 s */
135
+ "publish.sameAccountTimeInterval": number;
136
+
137
+ /** 是否使用浏览器进行发布 */
138
+ "publish.useBrowser": boolean;
139
+
140
+ /** 是否使用浏览器进行发布 */
141
+ "inputcode.username": string;
142
+
143
+ /** 是否使用浏览器进行发布 */
144
+ "inputcode.password": string;
145
+ }
146
+
147
+ namespace List {
148
+ interface AccountInfo {
149
+ id: string;
150
+ userId: number;
151
+ platform: string;
152
+ platName: string;
153
+ uid: string;
154
+ name: string;
155
+ nickname: string;
156
+ subName: string;
157
+ avatar: string | null;
158
+ lastLogin: number;
159
+ originData: string;
160
+ order: number;
161
+ online: number;
162
+ cookie: string;
163
+ localStorage: string;
164
+ cookieUpdateTime: number;
165
+ dailyStatUpdate: number;
166
+ totalStatUpdate: number;
167
+ postListUpdate: number;
168
+ remark: string;
169
+ groups: string;
170
+ createdAt: number;
171
+ updatedAt: number;
172
+ url: string | null | undefined;
173
+ curl: string | null | undefined;
174
+ badge: any;
175
+ localStorageNew?: string;
176
+ useragent?: string;
177
+ defaultConfig?: string;
178
+ authIndex?: number;
179
+ avatar64?: string;
180
+ avatarURL?: string;
181
+ netproxy?: string; // 网络代理
182
+ proxyType?: string;
183
+ proxyCity?: string;
184
+ isImport?: boolean;
185
+ fingerprint: number;
186
+ }
187
+
188
+ interface Group {
189
+ id: string;
190
+ name: string;
191
+ uids: string;
192
+ createdAt?: string;
193
+ updatedAt?: string;
194
+ userId: number;
195
+ }
196
+
197
+ interface PublishLogInfo {
198
+ id: number | bigint;
199
+ userId: number | bigint;
200
+ platform: string;
201
+ uid: string;
202
+ postId: string;
203
+ title: string;
204
+ cover: string;
205
+ desc: string;
206
+ content: string;
207
+ timing: number;
208
+ postTime: number;
209
+ status: string;
210
+ postStatus: string; // 0 已失败,1 已完成 其他状态
211
+ postMsg: string;
212
+ postType: string;
213
+ videoTime: number;
214
+ imgCount: number;
215
+ images: string;
216
+ localId: string;
217
+ formData: string | null;
218
+ publishType: number; // 1 视频 2 文章 3 图文
219
+ error: string;
220
+ videoPath: string;
221
+ isCustomCover: number;
222
+ createTime: number;
223
+ updateTime: number;
224
+ posts: PublishLogInfoPost[] | null;
225
+ postsStatus: any;
226
+ verifyStatus: any;
227
+ }
228
+
229
+ interface PublishLogInfoPost {
230
+ id: number | bigint;
231
+ platform: string;
232
+ uid: string;
233
+ account_id: string;
234
+ publishlog_id: number | bigint;
235
+ account_post_id: string;
236
+ firstsync_time: number;
237
+ sync_time: number;
238
+ publish_time: number;
239
+ issync_suc: number;
240
+ sync_msg: string;
241
+ ispublish_suc: number;
242
+ publish_msg: string;
243
+ publish_msg_detail: string;
244
+ verify_state: number;
245
+ verify_msg: string;
246
+ formData: string;
247
+ info: string;
248
+ publishLog?: PublishLogInfo;
249
+ staticData?: any;
250
+ videoId?: string;
251
+ }
252
+
253
+ /** 平台原始作品数据 */
254
+ interface ContentPost {
255
+ id?: number;
256
+ platform: string;
257
+ uid: string;
258
+ postId: string;
259
+ title?: string;
260
+ desc?: string;
261
+ cover?: string;
262
+ timing?: number;
263
+ postTime?: string;
264
+ status?: string;
265
+ isPublished?: boolean;
266
+ postType?: number;
267
+ videoTime?: number;
268
+ imgCount?: number;
269
+ images?: string;
270
+ originData?: string;
271
+ userId?: number;
272
+ upateTime?: string;
273
+ view?: number;
274
+ comment?: number;
275
+ favorite?: number;
276
+ forward?: number;
277
+ like?: number;
278
+ fullView?: number;
279
+ viewTime?: number;
280
+ danmu?: number;
281
+ coin?: number;
282
+ url?: string;
283
+ taskType?: number; // 任务类型,1 删除 ,2 隐藏
284
+ extraInfo?: any; // 每个平台的额外信息
285
+ }
286
+
287
+ interface Message {
288
+ id: string;
289
+ userId: number;
290
+ title: string;
291
+ content: string;
292
+ msgType: string;
293
+ msgSubType: string;
294
+ isRead: number;
295
+ dealStatus: number;
296
+ info: string;
297
+ msgtime: number;
298
+ createtime: number;
299
+ updatetime: number;
300
+ }
301
+
302
+ interface ProxyConfig {
303
+ id: string;
304
+ userId: number;
305
+ protocol: string;
306
+ address: string;
307
+ port: number;
308
+ remark: string;
309
+ authRequired: number;
310
+ username: string;
311
+ password: string;
312
+ status: number;
313
+ createtime: number;
314
+ updatetime: number;
315
+ expiretime?: number;
316
+ areaCode?: string;
317
+ realPublicIp?: string; // 代理后的公网IP
318
+ geolocation?: string;
319
+ }
320
+
321
+ interface AITask {
322
+ id: string;
323
+ userId: number;
324
+ title: string;
325
+ cover: string;
326
+ content: string;
327
+ task_type: number;
328
+ status: number;
329
+ createtime: number;
330
+ updatetime: number;
331
+ task_list?: Array<AITaskList>;
332
+ verifyStatus?: any;
333
+ }
334
+
335
+ interface AITaskList {
336
+ id: string;
337
+ userId: number;
338
+ duration: number;
339
+ ai_task_id?: string;
340
+ title: string;
341
+ cover: string;
342
+ content: string;
343
+ status: number;
344
+ msg?: string;
345
+ output?: string;
346
+ createtime: number;
347
+ updatetime: number;
348
+ AITask?: AITask;
349
+ }
350
+ }
351
+
352
+ interface VideoConfig {
353
+ videoId: string;
354
+ fileName: string;
355
+ videoPath: string;
356
+ videoBlobUrl: string;
357
+ screenshotDataUrl?: string;
358
+ cover?: string;
359
+ thumbScreenshotDataUrl?: string;
360
+ hasError?: boolean;
361
+ videoInfo?: {
362
+ type: string;
363
+ width: number;
364
+ height: number;
365
+ duration: number;
366
+ frameCount: number;
367
+ size: number;
368
+ format: string;
369
+ };
370
+ commonConfig: {
371
+ title?: string;
372
+ desc?: string;
373
+ pic?: Array;
374
+ cover?: string;
375
+ tags?: Array;
376
+ publishType?: string;
377
+ publishTime?: number;
378
+ };
379
+ accounts: Array<any>;
380
+ }
381
+
382
+ interface ArticleConfig {
383
+ articleId: string;
384
+ fileName: string;
385
+ filePath: string;
386
+ cover?: string;
387
+ hasError?: boolean;
388
+ articleInfo?: {
389
+ fileSize: number;
390
+ paragraphCount: number;
391
+ size: number;
392
+ format: string;
393
+ errorInfo?: string;
394
+ };
395
+ commonConfig: {
396
+ title?: string;
397
+ desc?: string;
398
+ pic?: Array;
399
+ cover?: string;
400
+ tags?: Array;
401
+ publishType?: string;
402
+ publishTime?: number;
403
+ };
404
+ accounts: Array<any>;
405
+ }
406
+
407
+ interface ImagesConfig {
408
+ imagesId: string;
409
+ dirName: string;
410
+ images: Array<string>;
411
+ cover?: string;
412
+ hasError?: boolean;
413
+ commonConfig: {
414
+ title?: string;
415
+ desc?: string;
416
+ pic?: Array;
417
+ cover?: string;
418
+ tags?: Array;
419
+ publishType?: string;
420
+ publishTime?: number;
421
+ };
422
+ accounts: Array<any>;
423
+ }
424
+
425
+ namespace Model {
426
+ interface ContentPageInfo {}
427
+
428
+ interface ContentListResult {
429
+ code?: number;
430
+ message?: string;
431
+ hasMore: boolean;
432
+ pageInfo?: any;
433
+ data?: Array<ZMT.List.ContentPost>;
434
+ }
435
+
436
+ interface ContentDeleteResult {
437
+ code?: number;
438
+ message?: string;
439
+ success: boolean;
440
+ }
441
+
442
+ interface ContentDeleteMessage {
443
+ data: ZMT.List.ContentPost;
444
+ status: string;
445
+ delResult: ContentDeleteResult;
446
+ hasMessage: boolean;
447
+ total: number;
448
+ }
449
+
450
+ interface Message {
451
+ //消息id,雪花id,有序增长
452
+ id?: string;
453
+ //消息文件类型 文本|附件|ping|语音
454
+ message_type: string;
455
+ server_message_id: string;
456
+ event_type: number; // 1 发送 2 接收
457
+ conversation_id: string;
458
+ //聊天回话id
459
+ conversation_short_id: string;
460
+ //聊天对象
461
+ from_id: string;
462
+ // 消息发送者
463
+ to_id?: string;
464
+ // 消息所属
465
+ open_id: string;
466
+
467
+ //消息内容
468
+ text: string;
469
+ avatar?: string;
470
+ nick_name?: string;
471
+ //消息时间
472
+ msg_create_time: number;
473
+ //消息类型:1私聊|群聊
474
+ conversation_type: number;
475
+ source?: string;
476
+ resource_type?: string;
477
+ resource_width?: number;
478
+ resource_height?: number;
479
+ resource_url?: string;
480
+ item_id?: string;
481
+ card_id?: string;
482
+ card_status?: number;
483
+ card_data?: string;
484
+ update_time?: string;
485
+ extend?: any;
486
+ imageLoaded?: boolean;
487
+ }
488
+
489
+ interface MessageDesc {
490
+ conversation_id: string;
491
+ nick_name: string;
492
+ avatar: string;
493
+ open_id: string;
494
+ to_id: string;
495
+ msg_time: number;
496
+ unread?: number;
497
+ message: string;
498
+ new_messages?: Message[];
499
+ from_messages?: Message[];
500
+ }
501
+
502
+ interface Content {
503
+ id: string;
504
+ item_id: string;
505
+ open_id: string;
506
+ video_id: string;
507
+ title: string;
508
+ cover: string;
509
+ publish_time?: number;
510
+ media_type: number;
511
+ comment_count: number;
512
+ sync_time?: number;
513
+ comments?: Comment[];
514
+ }
515
+
516
+ interface Comment {
517
+ id: string;
518
+ comment_id: string;
519
+ item_id: string;
520
+ open_id: string;
521
+ comment_user_id: string;
522
+ content: string;
523
+ content_create_time: number;
524
+ avatar: string;
525
+ nick_name: string;
526
+ digg_count?: number;
527
+ reply_comment_total: number;
528
+ reply_comment_id?: number;
529
+ parent_id?: number;
530
+ is_reply?: number;
531
+ content_id: string;
532
+ is_author?: number;
533
+ }
534
+
535
+ interface ImAndCommentNotice {
536
+ account?: ZMT.List.AccountInfo;
537
+ descList?: MessageDesc[];
538
+ contentList?: Content[];
539
+ }
540
+
541
+ interface ReplyStrategy {
542
+ id: string;
543
+ user_id: number;
544
+ name: string;
545
+ // 使用联合类型严格约束枚举值
546
+ reply_strategy_rule_type?: "AllKeywords" | "AnyKeywords" | "NoNeedKeywords" | "";
547
+ reply_strategy_keywords: string;
548
+ keywords?: string[];
549
+ account_id?: string;
550
+ content_count?: number;
551
+ // JSON 字段根据实际业务结构定义,这里假设为数组
552
+ replies: string;
553
+ replyList: string[];
554
+ delay_time: number;
555
+ reply_rate: number;
556
+ applied_range: number;
557
+ status: 0 | 1;
558
+ expired: 0 | 1;
559
+ create_time?: string; // 或 Date 类型,取决于后端返回格式
560
+ update_time?: string;
561
+ strategy_type: "message" | "comment";
562
+ check_all: 0 | 1;
563
+ }
564
+ }
565
+
566
+ interface MessageAccountBase {
567
+ id?: string;
568
+ account_id: string;
569
+ user_id?: number;
570
+ platform?: string;
571
+ uid?: string;
572
+ nickname?: string;
573
+ platform_uid?: string;
574
+ message?: boolean;
575
+ comment?: boolean;
576
+ interval?: number;
577
+ comment_content_new?: number;
578
+ comment_content_new_type?: number;
579
+ data_sync_start_time?: number;
580
+ data_sync_time?: number;
581
+ state?: string;
582
+ message_last_time?: number;
583
+ content_last_time?: number;
584
+ }
585
+
586
+ interface MessageAccount extends ZMT.List.AccountInfo {
587
+ local_none?: boolean;
588
+ isBind?: boolean;
589
+ bindId?: string;
590
+ bindItem?: MessageAccountBase;
591
+ }
592
+
593
+ interface IProxyServer {
594
+ host: string;
595
+
596
+ port: number;
597
+
598
+ time: number;
599
+
600
+ server: any;
601
+
602
+ start(): void;
603
+
604
+ status(): void;
605
+ }
606
+
607
+ interface IMessageTask {
608
+ id: string;
609
+
610
+ type: string;
611
+
612
+ item: MessageAccountBase;
613
+
614
+ account: ZMT.List.AccountInfo | undefined;
615
+
616
+ autoReply?: IMessageAutoReply;
617
+
618
+ interval: number;
619
+
620
+ lastExecutionTime: number;
621
+
622
+ successExcuteTimes: number; // 成功执行的次数
623
+
624
+ state: string;
625
+
626
+ pendingRemove: boolean;
627
+
628
+ userCache: Record<string, { nickname: string; avatar: string }>;
629
+
630
+ contentCache: Record<string, ZMT.Model.Content>;
631
+
632
+ message_last_time: number; // 0 未执行过
633
+
634
+ content_last_time: number; // 0 未执行过
635
+
636
+ getMessageLastTime(): number;
637
+
638
+ getContentLastTime(): number;
639
+
640
+ updateItem(item: MessageAccountBase): void;
641
+
642
+ updateAccount(account: ZMT.List.AccountInfo): void;
643
+
644
+ /** 距离上次执行过去了多久 */
645
+ idleDuration(): number;
646
+
647
+ isReadyMessage(): string;
648
+
649
+ /** 是否已到达可执行时间 */
650
+ isReady(): boolean;
651
+
652
+ updateBindAccount(data): any;
653
+
654
+ updateMessages(data: { messages: ZMT.Model.MessageDesc[]; maxTime: number }): Promise<{ code: number; data: Array<string> } | null>;
655
+
656
+ updateContents(contents: ZMT.Model.Content[]): any;
657
+
658
+ updateComments(comments: ZMT.Model.Comment[], updateTime: number, content?: ZMT.Model.Content): any;
659
+ }
660
+
661
+ interface IMessageAutoReply {
662
+ task?: IMessageTask;
663
+
664
+ inited: boolean;
665
+
666
+ lastReplyTimes: Map<string, number>;
667
+
668
+ imStrategy?: ZMT.Model.ReplyStrategy;
669
+
670
+ commentStrategy?: ZMT.Model.ReplyStrategy;
671
+
672
+ reset(): void;
673
+
674
+ reply(message: string, msgtime: number, to_id: string, type: "im" | "comment"): Promise<{ content: string; delay: number } | null>;
675
+
676
+ updateReplyStrategy(): void;
677
+ }
678
+
679
+ interface ProxyCache {
680
+ id: string;
681
+ type: string;
682
+ protocol: string;
683
+ host: string;
684
+ port: number;
685
+ username: string;
686
+ password: string;
687
+ expiredTime?: number;
688
+ areaCode?: string;
689
+ platforms?: Record<string, boolean>;
690
+ accountIds?: Record<string, boolean>;
691
+ }
692
+
693
+ interface BrowserBase {
694
+ identifier: string;
695
+ window?: Electron.BrowserWindow;
696
+ headerView?: Electron.BrowserView;
697
+ activeTab: BrowserTab | null;
698
+ tabs: Array<BrowserTab>;
699
+ tabManager?: BrowserTabManager;
700
+ initWindow(): void;
701
+ initHeaderView(): Promise<void>;
702
+ setBounds(): void;
703
+ getTab(tabId: any): Tab;
704
+ openPulishTab(context: ZMT.List.AccountInfo, tabId: any, url: any): Promise<BrowserTab | null>;
705
+ open(context: ZMT.List.AccountInfo, tabId: any, url: any, platformName?: string, type?: string): Promise<any>;
706
+ toTop(): void;
707
+ offTop(): void;
708
+ setTabViewToTop(tab: any): void;
709
+ setTop(view: any): void;
710
+ init(): Promise<void>;
711
+ tabFaviconUpdated(_tabId: any, contextIdentifier: any, url: any, that: any): void;
712
+ tabLoaded(_tabId: any, that: any): void;
713
+ tabClosed(_tabId: any, that: any): void;
714
+ tabActivated(_tabId: any, that: any): void;
715
+ updateHeader(val?: string): void;
716
+ active(id2: any): void;
717
+ removeTab(tabId: any): void;
718
+ closeAllTab(contextId: any): void;
719
+ closeRightTab(tabId: any): void;
720
+ closeOtherTab(tabId: any): void;
721
+ closeGroup(): void;
722
+ close(): void;
723
+ detory(): void;
724
+ syncFavorites(contextFavorites: any): void;
725
+ }
726
+
727
+ interface BrowserTab {
728
+ id: any;
729
+ context: ZMT.List.AccountInfo;
730
+ group?: BrowserBase;
731
+ isLoad: boolean;
732
+ isClosed: boolean;
733
+ view?: Electron.BrowserView;
734
+ window?: Electron.BrowserWindow;
735
+ icon: string;
736
+ getWebContents(): Electron.WebContents | undefined;
737
+ createView(preloadPath?: string, base?: boolean, isCheck?: boolean): Promise<void>;
738
+ initEvents?(): Promise<void>;
739
+ bindGroup?(group: any): void;
740
+ launch(url: any, base?: boolean, isCheck?: boolean): void;
741
+ setVisible(visible: any): void;
742
+ close(): void;
743
+ setBounds?(group: BrowserBase): void;
744
+ executeJavaScript(script: string): Promise<any>;
745
+ executeJavaScriptByTime(script: string, waitTime?: number): Promise<any>;
746
+ get canGoBack(): boolean | undefined;
747
+ get canGoForward(): boolean | undefined;
748
+ goBack(): void;
749
+ goForward(): void;
750
+ refresh(): void;
751
+ }
752
+
753
+ interface BrowserTabManager {
754
+ tabs: Array<BrowserTab>;
755
+ addTab(tab: any): void;
756
+ removeTab(tab: any): void;
757
+ openWebSpaceTab(tabId: any, context: any, url: any, type?: string): Promise<BrowserTab>;
758
+ openAccountSpaceTab(tabId: any, context: any, url: any, type?: string): Promise<BrowserTab>;
759
+ openPublishTab(tabId: any, context: any, url: any): Promise<BrowserTab>;
760
+ getTabsByContext(contextId: any): BrowserTab[];
761
+ closeTab(tabId: any): void;
762
+ anyWebSpaceTabOpened(identifier: any): boolean;
763
+ anyAccountSpaceTabOpened(identifier: any): boolean;
764
+ }
765
+
766
+ interface ISite {
767
+ cookie: string;
768
+ user: any;
769
+ errs: string[];
770
+ logs: Array<
771
+ | {
772
+ msg: string;
773
+ detail: any;
774
+ }
775
+ | string
776
+ >;
777
+
778
+ addlogs(msg: string, detail?: any): void;
779
+ getHttpInstance(check?: boolean): Promise<any>;
780
+ getUserInfo(cookie: string, useragent?: string, extra?: any): any;
781
+ upload(data: any): any;
782
+ updateData(): any;
783
+ hasAccountData(): boolean;
784
+ updatePost(): any;
785
+ poiSearch(data: any): any;
786
+ getTaskStatus(post: ZMT.List.PublishLogInfoPost, cookie: any): any;
787
+ downloadImage(url: string): Promise<{
788
+ code: number; // 0失败,1 成功,2 图片是其他格式,Jimp无法读取
789
+ img: any;
790
+ md5: string;
791
+ msg: string;
792
+ }>;
793
+ getPostList(pageInfo: any): Promise<ZMT.Model.ContentListResult>;
794
+ /**
795
+ * 删除作品
796
+ * @param info
797
+ * @returns
798
+ */
799
+ deleteContent(info: ZMT.List.ContentPost): Promise<ZMT.Model.ContentDeleteResult>;
800
+ /**
801
+ * 隐藏作品
802
+ * @param info
803
+ * @returns
804
+ */
805
+ hideContent(info: ZMT.List.ContentPost): Promise<ZMT.Model.ContentDeleteResult>;
806
+
807
+ getParsedCookie(cookie: string, domain: string): any[];
808
+ getMessageHandler(task: IMessageTask): Promise<IMessageHander | null>;
809
+ }
810
+
811
+ interface IMessageHander {
812
+ start(): Promise<any>;
813
+ end(): Promise<any>;
814
+ getMessages(): Promise<{
815
+ messages?: Array<ZMT.Model.MessageDesc>;
816
+ maxTime?: number;
817
+ } | null>;
818
+ autoReplyMessages(messagesDesc?: Array<ZMT.Model.MessageDesc>): Promise<any>;
819
+ getComments(): Promise<{
820
+ total: number;
821
+ contents: ZMT.Model.Content[];
822
+ }>;
823
+ autoReplyComments(contents: ZMT.Model.Content[]): Promise<any>;
824
+ getDescText(text?: string): string;
825
+ }
826
+
827
+ interface IPInfoResponse {
828
+ testId: string;
829
+ result: boolean;
830
+ ip?: string;
831
+ isp?: string;
832
+ address?: string;
833
+ loc?: string;
834
+ city?: string;
835
+ city_code?: string;
836
+ code?: number;
837
+ msg?: string;
838
+ security_risks?: string;
839
+ }
840
+
841
+ interface IBrowserEventBus {
842
+ emit(eventName: any, ...args: any[]): void;
843
+ on(eventName: any, listener: any): () => void;
844
+ off(eventName: any, listener: any): void;
845
+ }
846
+
847
+ interface GlobalService {
848
+ appSetting: ZMT.AppSetting;
849
+
850
+ /**
851
+ * 当前登录的用户ID
852
+ */
853
+ userId: number;
854
+
855
+ /**
856
+ * 当前登录的用户token
857
+ */
858
+ token: string;
859
+
860
+ worker: any;
861
+
862
+ icon: string;
863
+
864
+ /**
865
+ * 主窗口
866
+ */
867
+ mainWindow?: any;
868
+
869
+ event_browser: BrowserEventBus;
870
+
871
+ evt_media_api?: BrowserEventBus;
872
+
873
+ /**
874
+ * 微信扫码取消
875
+ */
876
+ wxcodeCanceled: any;
877
+
878
+ netProxyCache: Record<string, ProxyCache | null>;
879
+
880
+ rpaBrowserServiceMap: Record<string, any>;
881
+
882
+ getBrowserBase: (id: string) => BrowserBase;
883
+
884
+ getBrowserTab: (id: string, context, type: "tab" | "script" | "sign") => BrowserTab;
885
+
886
+ proxyServer: IProxyServer;
887
+
888
+ getProxyById: (account: ZMT.List.AccountInfo, check: boolean = false, dedup: boolean = false) => Promise<ZMT.List.ProxyConfig>;
889
+ }
890
+
891
+ interface BrowserEventBus {
892
+ emit(eventName: any, ...args: any[]): void;
893
+ on(eventName: any, listener: any): () => void;
894
+ off(eventName: any, listener: any): void;
895
+ }
896
+
897
+ interface TaskCache {
898
+ site: Record<string, ISite | null>; // taskId 与任务的关联
899
+ }
900
+
901
+ declare namespace App {
902
+ const getPlatformSite: (platformVal: string, user: any) => ZMT.ISite | null;
903
+ const SetHideProgressEvent: (taskId: string, msg: string, detail?: any) => void;
904
+ const createBrowserEvent: () => ZMT.BrowserEventBus;
905
+ const createAPIEvent: () => ZMT.BrowserEventBus;
906
+ declare namespace DomTools {
907
+ declare const getImgUrl: (tab: any, selector: string, index?: number) => Promise<any>;
908
+ declare const getInnerText: (tab: any, selector: string, index?: number) => Promise<any>;
909
+ declare const getAiText: (tab: any, selector: string, index?: number) => Promise<any>;
910
+ declare const keyEnter: (tab: any) => Promise<void>;
911
+ declare const waitForSelector: (tab: any, selector: string, timeout: number, selector_length?: number) => Promise<boolean>;
912
+ declare const waitForSelectorByText: (tab: any, selector: any, text: any, timeout: any, selector_length?: number, includes?: "true" | "false") => Promise<boolean>;
913
+ declare const whileForSelector: (tab: any, selector: string, isExist: boolean, timeout?: number) => Promise<boolean>;
914
+ declare const getElRect: (tab: any, selector: string) => Promise<any>;
915
+ declare const getElRectByText: (tab: any, selector: string, text: string, index?: number) => Promise<any>;
916
+ declare const sendText: (tab: any, value: any) => Promise<void>;
917
+ declare const fillText: (tab: any, selector: string, text?: string) => Promise<void>;
918
+ /** 点击元素 */
919
+ declare const jsDomClick: (tab: any, selector: string) => Promise<void>;
920
+ /** 点击元素 */
921
+ declare const jsDomClickByText: (tab: any, selector: string, text?: string, index?: number) => Promise<boolean>;
922
+ /** 点击元素 */
923
+ declare const domClick: (tab: any, selector: string) => Promise<void>;
924
+ declare const getLocalStorages: (tab: any, list?: Array<string>) => Promise<Record<string, any>>;
925
+ declare const getLocalStoragesNew: (tab: any, list?: Array<string>) => Promise<Record<string, any>>;
926
+ declare const getHref: (tab: any) => Promise<any>;
927
+ declare const toHref: (tab: any, url: any) => Promise<any>;
928
+ declare const getCookie: (tab: any) => Promise<any>;
929
+ }
930
+ }
931
+ }
932
+
933
+ declare module "apollo-media-utils" {
934
+ export = ZMT.App;
935
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.