Browse Source

Merge branch 'master' into fleets

Mike L 3 years ago
parent
commit
3ef5681785
5 changed files with 16 additions and 15 deletions
  1. 2 0
      README.md
  2. 4 4
      config.example.json
  3. 5 5
      dist/main.js
  4. 0 1
      package.json
  5. 5 5
      src/main.ts

+ 2 - 0
README.md

@@ -12,6 +12,7 @@
 - 支持直接查看指定的推文链接,或(在没有其他用户订阅该用户时)从最新推文回溯到该条推文,由新到旧显示
 - 图片使用 [sharp](https://github.com/lovell/sharp) 压缩为 JPEG
 - 视频使用 [gifski](https://github.com/ImageOptim/gifski) 压缩为 GIF(请务必下载并放到 `PATH` 下,推荐[这里](https://github.com/CL-Jeremy/gifski/releases/tag/1.0.1-unofficial)的最新修改版,注意从包管理器安装依赖)
+- 由于推特改版后引发了 Chromium 的 bug,截图部分从 Puppeteer 改为 Playwright 并使用特殊的 WebSocket 格式 URL(这种方式可以使用本地或远程 WebSocket 代理服务器上的 Playwright 服务端)
 - 机器人的 QQ 号码必须手动填写
 - Puppeteer 不再自动启动,请手动开启并监听本地 9222 端口(这种方式可以使用 Chrome 或是远程 WebSocket 代理服务器)
 - 自动处理<u>来自群友的好友请求</u>和<u>来自好友的加群邀请</u>
@@ -31,6 +32,7 @@
 | twitter_access_token_key | Twitter App access_token_key | (必填) |
 | twitter_access_token_secret | Twitter App access_token_secret | (必填) |
 | mode | 工作模式,0 为图文模式,1 为纯文本模式,2 为文<br />本附图模式 | 0 |
+| playwright_ws_spec_endpoint | Playwright 配置拉取 URL,内容格式为:<br />`{<浏览器>:<开发工具 WebSocket 端点 URL>}` | [http://127.0.0.1:8080<br />/playwright-ws.json](http://127.0.0.1:8080/playwright-ws.json)<br />(示例值,模式 0 时必填) |
 | resume_on_start | 是否在启动时从退出时的进度继续(拉取本应用非活<br />动时期错过的推文) | false |
 | work_interval | 对单个订阅两次拉取更新的最少间隔时间(秒) | 60 |
 | webshot_delay | 抓取网页截图时等待网页加载的延迟时长(毫秒) | 10000 |

+ 4 - 4
config.example.json

@@ -1,8 +1,8 @@
 {
-  "cq_access_token": "",
-  "cq_http_host": "127.0.0.1",
-  "cq_http_port": 5700,
-  "cq_bot_qq": 10000,
+  "mirai_access_token": "",
+  "mirai_http_host": "127.0.0.1",
+  "mirai_http_port": 8080,
+  "mirai_bot_qq": 10000,
   "twitter_consumer_key": "",
   "twitter_consumer_secret": "",
   "twitter_access_token_key": "",

+ 5 - 5
dist/main.js

@@ -50,7 +50,7 @@ const requiredFields = [
     'twitter_consumer_key', 'twitter_consumer_secret', 'twitter_access_token_key', 'twitter_access_token_secret',
 ];
 const warningFields = [
-    'cq_http_host', 'cq_http_port', 'cq_access_token',
+    'mirai_http_host', 'mirai_http_port', 'mirai_access_token',
 ];
 const optionalFields = [
     'lockfile', 'work_interval', 'webshot_delay', 'loglevel', 'mode', 'resume_on_start',
@@ -107,10 +107,10 @@ if (!config.resume_on_start) {
     });
 }
 const qq = new mirai_1.default({
-    access_token: config.cq_access_token,
-    host: config.cq_http_host,
-    port: config.cq_http_port,
-    bot_id: config.cq_bot_qq,
+    access_token: config.mirai_access_token,
+    host: config.mirai_http_host,
+    port: config.mirai_http_port,
+    bot_id: config.mirai_bot_qq,
     list: (c, a, cb) => command_1.list(c, a, cb, lock),
     sub: (c, a, cb) => command_1.sub(c, a, cb, lock, config.lockfile),
     unsub: (c, a, cb) => command_1.unsub(c, a, cb, lock, config.lockfile),

+ 0 - 1
package.json

@@ -38,7 +38,6 @@
     "mirai-ts": "github:CL-Jeremy/mirai-ts#upload-file-built",
     "playwright": "^1.9.1",
     "pngjs": "^5.0.0",
-    "puppeteer": "^2.1.0",
     "read-all-stream": "^3.1.0",
     "request": "^2.72.0",
     "sha1": "^1.1.1",

+ 5 - 5
src/main.ts

@@ -60,7 +60,7 @@ const requiredFields = [
 ];
 
 const warningFields = [
-  'cq_http_host', 'cq_http_port', 'cq_access_token',
+  'mirai_http_host', 'mirai_http_port', 'mirai_access_token',
 ];
 
 const optionalFields = [
@@ -120,10 +120,10 @@ if (!config.resume_on_start) {
 }
 
 const qq = new QQBot({
-  access_token: config.cq_access_token,
-  host: config.cq_http_host,
-  port: config.cq_http_port,
-  bot_id: config.cq_bot_qq,
+  access_token: config.mirai_access_token,
+  host: config.mirai_http_host,
+  port: config.mirai_http_port,
+  bot_id: config.mirai_bot_qq,
   list: (c, a, cb) => list(c, a, cb, lock),
   sub: (c, a, cb) => sub(c, a, cb, lock, config.lockfile),
   unsub: (c, a, cb) => unsub(c, a, cb, lock, config.lockfile),