koishi-plugin-chat-patch 5.6.0 → 6.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/lib/media.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare class MediaManager {
17
17
  cacheUrl(url: string, channelId?: string): Promise<string | null>;
18
18
  cacheMessageMedia(source: unknown, channelId?: string): Promise<string[]>;
19
19
  private resolveAndDownload;
20
- private detectExtension;
20
+ private detectExtensionFromFile;
21
21
  private migrateCachedMedia;
22
22
  private cleanup;
23
23
  private exists;
package/lib/recorder.d.ts CHANGED
@@ -1,17 +1,14 @@
1
- import { Config } from './config';
2
1
  import { ContactCacheService } from './cache';
3
2
  import { ChatDatabase } from './database';
4
3
  import { MediaManager } from './media';
5
4
  import { PluginLogger } from './logger';
6
5
  export declare class Recorder {
7
- private config;
8
6
  private database;
9
7
  private media;
10
8
  private contactCache;
11
9
  private logger;
12
- constructor(config: Config, database: ChatDatabase, media: MediaManager, contactCache: ContactCacheService, logger: PluginLogger);
10
+ constructor(database: ChatDatabase, media: MediaManager, contactCache: ContactCacheService, logger: PluginLogger);
13
11
  handleEvent(body: Record<string, unknown>): Promise<boolean>;
14
- private isBlocked;
15
12
  private handleMessageCreated;
16
13
  private handleMessageDeleted;
17
14
  private cacheMessageContacts;
@@ -1,20 +1,17 @@
1
1
  import { Context } from 'koishi';
2
- import { Config } from './config';
3
2
  import { ChatDatabase } from './database';
4
3
  import { MediaManager } from './media';
5
4
  import { PluginLogger } from './logger';
6
5
  export declare class SelfMessageRecorder {
7
6
  private ctx;
8
- private config;
9
7
  private database;
10
8
  private media;
11
9
  private logger;
12
10
  private wrapped;
13
11
  private sequence;
14
- constructor(ctx: Context, config: Config, database: ChatDatabase, media: MediaManager, logger: PluginLogger);
12
+ constructor(ctx: Context, database: ChatDatabase, media: MediaManager, logger: PluginLogger);
15
13
  start(): void;
16
14
  dispose(): void;
17
- private isBlocked;
18
15
  private wrapBot;
19
16
  private unwrapBot;
20
17
  private prepareOptions;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-chat-patch",
3
3
  "description": "[<ruby>chat-patch<rp>(</rp><rt>点我预览效果</rt><rp>)</rp></ruby>](https://i0.hdslb.com/bfs/openplatform/71074dfc9e5256fc3333d8bd8478bec1af874046.png) 视奸小插件((bushi( (低性能警告)。手机端适配。灵感来自 chat 插件。",
4
- "version": "5.6.0",
4
+ "version": "6.0.0",
5
5
  "scripts": {
6
6
  "build:web": "npm --prefix client/web run build",
7
7
  "prepack": "npm run build:web",
@@ -36,7 +36,8 @@
36
36
  "koishi": {
37
37
  "service": {
38
38
  "required": [
39
- "console"
39
+ "console",
40
+ "node"
40
41
  ]
41
42
  }
42
43
  },
@@ -44,7 +45,8 @@
44
45
  "@koishijs/plugin-console": "^5.11.0",
45
46
  "@koishijs/plugin-server": "^3.2.9",
46
47
  "@koishijs/plugin-server-satori": "^2.9.1",
47
- "koishi": "^4.16.0"
48
+ "koishi": "^4.16.0",
49
+ "koishi-plugin-w-node": "^2.1.0"
48
50
  },
49
51
  "devDependencies": {
50
52
  "@element-plus/icons-vue": "^2.3.2",
@@ -54,15 +56,28 @@
54
56
  "@types/mime-types": "^3.0.1",
55
57
  "autoprefixer": "^10.4.23",
56
58
  "cosmokit": "^1.0.0",
59
+ "debug": "^4.4.3",
60
+ "depd": "^1.1.2",
57
61
  "element-plus": "^2.13.0",
58
- "koishi": "^4.16.0",
59
- "postcss": "^8.5.6",
60
- "tailwindcss": "^3.4.17"
61
- },
62
- "dependencies": {
63
62
  "file-type": "^16.5.4",
63
+ "has-flag": "^4.0.0",
64
+ "http-errors": "^1.8.1",
65
+ "ieee754": "^1.2.1",
66
+ "inherits": "2.0.4",
64
67
  "koa-send": "^5.0.1",
65
- "level": "^10.0.0",
66
- "mime-types": "^3.0.2"
68
+ "koishi": "^4.16.0",
69
+ "mime-types": "^3.0.2",
70
+ "ms": "^2.1.3",
71
+ "path-is-absolute": "1.0.1",
72
+ "peek-readable": "^4.1.0",
73
+ "postcss": "^8.5.6",
74
+ "resolve-path": "^1.4.0",
75
+ "setprototypeof": "1.2.0",
76
+ "statuses": "^1.5.0",
77
+ "strtok3": "^6.3.0",
78
+ "supports-color": "^8.1.1",
79
+ "tailwindcss": "^3.4.17",
80
+ "toidentifier": "1.0.1",
81
+ "token-types": "^4.2.1"
67
82
  }
68
83
  }
package/src/bootstrap.ts CHANGED
@@ -26,7 +26,8 @@ export function registerBootstrap(
26
26
  token: ctx.satori?.server?.config?.token ?? '',
27
27
  basePath: config.basePath,
28
28
  logins: getLogins(),
29
- blockedPlatforms: config.blockedPlatforms ?? [],
29
+ // 旧配置里默认屏蔽 qq/qqguild,容易造成漏消息;这里不再下发屏蔽规则
30
+ blockedPlatforms: [],
30
31
  }
31
32
  }, { authority: 4 })
32
33
 
@@ -46,7 +47,7 @@ export function registerBootstrap(
46
47
  maxMessagesPerChannel: config.maxMessagesPerChannel,
47
48
  historyPageSize: config.historyPageSize,
48
49
  maxMediaFiles: config.maxMediaFiles,
49
- blockedPlatforms: config.blockedPlatforms ?? [],
50
+ blockedPlatforms: [],
50
51
  loggerinfo: config.loggerinfo,
51
52
  }
52
53
  }, { authority: 4 })
package/src/config.ts CHANGED
@@ -25,11 +25,7 @@ export const Config: Schema<Config> = Schema.intersect([
25
25
  blockedPlatforms: Schema.array(Schema.object({
26
26
  platformName: Schema.string(),
27
27
  exactMatch: Schema.boolean().default(true),
28
- })).role('table').description('屏蔽消息接收的平台').default([
29
- { platformName: 'qq', exactMatch: true },
30
- { platformName: 'qqguild', exactMatch: true },
31
- { platformName: 'sandbox', exactMatch: false },
32
- ]),
28
+ })).role('table').description('屏蔽消息接收的平台').default([]),
33
29
  loggerinfo: Schema.boolean().default(false).description('调试日志开关').hidden().experimental(),
34
30
  }).description('高级设置'),
35
31
  ])