@dan-uni/dan-any-plugin-detaolu 0.0.2 → 0.7.3

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.
@@ -12,6 +12,21 @@
12
12
  * @license MIT
13
13
  */
14
14
 
15
+ /*! *****************************************************************************
16
+ Copyright (C) Microsoft. All rights reserved.
17
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
18
+ this file except in compliance with the License. You may obtain a copy of the
19
+ License at http://www.apache.org/licenses/LICENSE-2.0
20
+
21
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
23
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
24
+ MERCHANTABLITY OR NON-INFRINGEMENT.
25
+
26
+ See the Apache Version 2.0 License for specific language governing permissions
27
+ and limitations under the License.
28
+ ***************************************************************************** */
29
+
15
30
  /*! For license information please see index.umd.min.js.LICENSE.txt */
16
31
 
17
32
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -1,6 +1,6 @@
1
1
  import type { Config } from '.';
2
2
  import type { int, Stats } from './types';
3
- export declare function init(wasm_module: ArrayBuffer): Promise<void>;
3
+ export declare function init(wasm_module: ArrayBuffer | NonSharedBuffer): Promise<void>;
4
4
  export declare function begin_chunk(config: Config): void;
5
5
  export declare function begin_index_lock(): void;
6
6
  export declare function detect_similarity(str: string, mode: number, index_l: int, S: Stats): null | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-uni/dan-any-plugin-detaolu",
3
- "version": "0.0.2",
3
+ "version": "0.7.3",
4
4
  "description": "A filter, dedupe and anti-spam plugin of dan-any, a danmaku transformer lib, based on pakku.js.",
5
5
  "keywords": [
6
6
  "bangumi",
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "author": "rinne",
19
19
  "main": "dist/index.js",
20
- "module": "dist/index.js",
21
- "types": "dist/src/index.d.ts",
20
+ "module": "src/index.ts",
21
+ "types": "dist/index.d.ts",
22
22
  "browser": "dist/index.umd.min.js",
23
23
  "scripts": {
24
24
  "test": "vitest",
package/src/index.ts CHANGED
@@ -42,13 +42,15 @@ async function detaolu(that: UniPool, config?: DeTaoLuConfig) {
42
42
  content: p.chosen_str,
43
43
  weight: 10,
44
44
  pool: pool.shared.pool ?? pool.most.pool,
45
- attr: ['Protect'],
45
+ attr: [UniDMTools.DMAttr.Protect],
46
46
  platform: pool.shared.platform ?? pool.most.platform,
47
47
  extra: {
48
48
  danuni: {
49
49
  merge: {
50
50
  count: p.danuni_count,
51
- duration: Math.max(...progess) - Math.min(...progess),
51
+ duration: Number.parseFloat(
52
+ (Math.max(...progess) - Math.min(...progess)).toFixed(3),
53
+ ),
52
54
  senders: pool.dans
53
55
  .filter((d) => d.content === p.chosen_str)
54
56
  .map((d) => d.senderID),
@@ -9,7 +9,7 @@ let ptr_buf: number
9
9
 
10
10
  const MAX_STRING_LEN = 16005
11
11
 
12
- export async function init(wasm_module: ArrayBuffer) {
12
+ export async function init(wasm_module: ArrayBuffer | NonSharedBuffer) {
13
13
  module = await generated_promise({ wasm: wasm_module })
14
14
  ptr_buf = module._malloc(MAX_STRING_LEN * 2 + 7)
15
15
  if (ptr_buf % 2)