@dan-uni/dan-any-plugin-detaolu 0.6.8 → 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.
package/dist/index.umd.min.js
CHANGED
|
@@ -33010,7 +33010,7 @@ and limitations under the License.
|
|
|
33010
33010
|
return this.fromNull(domain);
|
|
33011
33011
|
}
|
|
33012
33012
|
}
|
|
33013
|
-
function createDMID(content = '', senderID, ctime, extraStr, slice = 8) {
|
|
33013
|
+
function createDMID(content = '', senderID = id_gen_UniID.fromNull().toString(), ctime = new Date().toISOString(), extraStr, slice = 8) {
|
|
33014
33014
|
return new ht('SHA3-256', 'TEXT').update(`${content}|${senderID}|${UniDM.transCtime(ctime).toISOString()}|${extraStr}`).getHash('HEX').slice(0, slice);
|
|
33015
33015
|
}
|
|
33016
33016
|
function _ts_decorate(decorators, target, key, desc) {
|
|
@@ -33052,7 +33052,7 @@ and limitations under the License.
|
|
|
33052
33052
|
bits.unshift(!!(1 & number));
|
|
33053
33053
|
number >>= 1;
|
|
33054
33054
|
}while (number);
|
|
33055
|
-
return bits.
|
|
33055
|
+
return bits.toReversed();
|
|
33056
33056
|
};
|
|
33057
33057
|
var dm_gen_DMAttr = /*#__PURE__*/ function(DMAttr) {
|
|
33058
33058
|
DMAttr["Protect"] = "Protect";
|
|
@@ -33135,8 +33135,10 @@ and limitations under the License.
|
|
|
33135
33135
|
return Pools;
|
|
33136
33136
|
}({});
|
|
33137
33137
|
class UniDM {
|
|
33138
|
-
init() {
|
|
33138
|
+
init(options) {
|
|
33139
|
+
this.options = options || this.options;
|
|
33139
33140
|
const def = new UniDM();
|
|
33141
|
+
if (void 0 === this.options.dmid || true === this.options.dmid) this.options.dmid = createDMID;
|
|
33140
33142
|
if (!this.SOID) this.SOID = def.SOID;
|
|
33141
33143
|
if (!this.progress) this.progress = def.progress;
|
|
33142
33144
|
if (!this.mode) this.mode = def.mode;
|
|
@@ -33148,7 +33150,7 @@ and limitations under the License.
|
|
|
33148
33150
|
if (!this.weight) this.weight = def.weight;
|
|
33149
33151
|
if (!this.pool) this.pool = def.pool;
|
|
33150
33152
|
if (!this.attr) this.attr = def.attr;
|
|
33151
|
-
if (!this.DMID) this.DMID = this.toDMID();
|
|
33153
|
+
if (!this.DMID && false !== this.options.dmid) this.DMID = this.toDMID();
|
|
33152
33154
|
this.progress = Number.parseFloat(this.progress.toFixed(3));
|
|
33153
33155
|
if (this.extraStr) this.extraStr = dm_gen_JSON.stringify(cleanEmptyObjects(dm_gen_JSON.parse(this.extraStr)));
|
|
33154
33156
|
if ('{}' === this.extraStr) this.extraStr = void 0;
|
|
@@ -33166,13 +33168,13 @@ and limitations under the License.
|
|
|
33166
33168
|
async validate() {
|
|
33167
33169
|
return validateOrReject(this);
|
|
33168
33170
|
}
|
|
33169
|
-
static create(pjson) {
|
|
33171
|
+
static create(pjson, options) {
|
|
33170
33172
|
return pjson ? plainToInstance(UniDM, pjson.extra ? {
|
|
33171
33173
|
...pjson,
|
|
33172
33174
|
extraStr: pjson.extra ? dm_gen_JSON.stringify(pjson.extra) : pjson.extraStr
|
|
33173
33175
|
} : pjson, {
|
|
33174
33176
|
excludeExtraneousValues: true
|
|
33175
|
-
}).init() : new UniDM();
|
|
33177
|
+
}).init(options) : new UniDM();
|
|
33176
33178
|
}
|
|
33177
33179
|
get extra() {
|
|
33178
33180
|
const extra = dm_gen_JSON.parse(this.extraStr || '{}');
|
|
@@ -33183,7 +33185,10 @@ and limitations under the License.
|
|
|
33183
33185
|
return false;
|
|
33184
33186
|
}
|
|
33185
33187
|
toDMID() {
|
|
33186
|
-
|
|
33188
|
+
if (false === this.options.dmid) return;
|
|
33189
|
+
if (true === this.options.dmid) return createDMID(this.content, this.senderID, this.ctime, this.extraStr);
|
|
33190
|
+
if ('number' == typeof this.options.dmid) return createDMID(this.content, this.senderID, this.ctime, this.extraStr, this.options.dmid);
|
|
33191
|
+
return this.options.dmid(this.content, this.senderID, this.ctime, this.extraStr);
|
|
33187
33192
|
}
|
|
33188
33193
|
isSameAs(dan, options) {
|
|
33189
33194
|
if (4 === this.mode || 4 === dan.mode) return false;
|
|
@@ -33301,7 +33306,7 @@ and limitations under the License.
|
|
|
33301
33306
|
}
|
|
33302
33307
|
return mode;
|
|
33303
33308
|
}
|
|
33304
|
-
static fromBili(args, cid) {
|
|
33309
|
+
static fromBili(args, cid, options) {
|
|
33305
33310
|
if (args.oid && !cid) cid = args.oid;
|
|
33306
33311
|
const SOID = `def_${platform_PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
33307
33312
|
cid
|
|
@@ -33344,7 +33349,7 @@ and limitations under the License.
|
|
|
33344
33349
|
}
|
|
33345
33350
|
return this.create({
|
|
33346
33351
|
...args,
|
|
33347
|
-
SOID
|
|
33352
|
+
SOID,
|
|
33348
33353
|
mode,
|
|
33349
33354
|
senderID: senderID.toString(),
|
|
33350
33355
|
ctime: this.transCtime(args.ctime, 's'),
|
|
@@ -33353,7 +33358,7 @@ and limitations under the License.
|
|
|
33353
33358
|
attr: DMAttrUtils.fromBin(args.attr, platform_PlatformVideoSource.Bilibili),
|
|
33354
33359
|
platform: platform_PlatformVideoSource.Bilibili,
|
|
33355
33360
|
extra
|
|
33356
|
-
});
|
|
33361
|
+
}, options);
|
|
33357
33362
|
}
|
|
33358
33363
|
toBiliXML(options) {
|
|
33359
33364
|
if (options?.skipBiliCommand && this.extra.bili?.command) return null;
|
|
@@ -33408,16 +33413,16 @@ and limitations under the License.
|
|
|
33408
33413
|
].join(',')
|
|
33409
33414
|
};
|
|
33410
33415
|
}
|
|
33411
|
-
static fromBiliCommand(args, cid) {
|
|
33416
|
+
static fromBiliCommand(args, cid, options) {
|
|
33412
33417
|
if (args.oid && !cid) cid = args.oid;
|
|
33413
|
-
const SOID = id_gen_UniID.fromBili({
|
|
33418
|
+
const SOID = `def_${platform_PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
33414
33419
|
cid
|
|
33415
|
-
})
|
|
33420
|
+
})}`, senderID = id_gen_UniID.fromBili({
|
|
33416
33421
|
mid: args.mid
|
|
33417
33422
|
});
|
|
33418
33423
|
return this.create({
|
|
33419
33424
|
...args,
|
|
33420
|
-
SOID
|
|
33425
|
+
SOID,
|
|
33421
33426
|
mode: 4,
|
|
33422
33427
|
senderID: senderID.toString(),
|
|
33423
33428
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
@@ -33432,9 +33437,9 @@ and limitations under the License.
|
|
|
33432
33437
|
command: args
|
|
33433
33438
|
}
|
|
33434
33439
|
}
|
|
33435
|
-
});
|
|
33440
|
+
}, options);
|
|
33436
33441
|
}
|
|
33437
|
-
static fromDplayer(args, playerID, domain) {
|
|
33442
|
+
static fromDplayer(args, playerID, domain, options) {
|
|
33438
33443
|
const SOID = id_gen_UniID.fromUnknown(playerID, domain), senderID = id_gen_UniID.fromUnknown(args.midHash, domain);
|
|
33439
33444
|
return this.create({
|
|
33440
33445
|
...args,
|
|
@@ -33442,7 +33447,7 @@ and limitations under the License.
|
|
|
33442
33447
|
mode: this.transMode(args.mode, 'dplayer'),
|
|
33443
33448
|
senderID: senderID.toString(),
|
|
33444
33449
|
platform: domain
|
|
33445
|
-
});
|
|
33450
|
+
}, options);
|
|
33446
33451
|
}
|
|
33447
33452
|
toDplayer() {
|
|
33448
33453
|
let mode = 0;
|
|
@@ -33456,7 +33461,7 @@ and limitations under the License.
|
|
|
33456
33461
|
content: this.content
|
|
33457
33462
|
};
|
|
33458
33463
|
}
|
|
33459
|
-
static fromArtplayer(args, playerID, domain) {
|
|
33464
|
+
static fromArtplayer(args, playerID, domain, options) {
|
|
33460
33465
|
const SOID = id_gen_UniID.fromUnknown(playerID, domain), senderID = id_gen_UniID.fromUnknown('', domain);
|
|
33461
33466
|
let extra = args.border ? {
|
|
33462
33467
|
artplayer: {
|
|
@@ -33482,7 +33487,7 @@ and limitations under the License.
|
|
|
33482
33487
|
senderID: senderID.toString(),
|
|
33483
33488
|
platform: domain,
|
|
33484
33489
|
extra
|
|
33485
|
-
});
|
|
33490
|
+
}, options);
|
|
33486
33491
|
}
|
|
33487
33492
|
toArtplayer() {
|
|
33488
33493
|
let mode = 0;
|
|
@@ -33496,8 +33501,8 @@ and limitations under the License.
|
|
|
33496
33501
|
style: this.extra.artplayer?.style
|
|
33497
33502
|
};
|
|
33498
33503
|
}
|
|
33499
|
-
static fromDDplay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay) {
|
|
33500
|
-
const SOID = id_gen_UniID.fromUnknown(`
|
|
33504
|
+
static fromDDplay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
33505
|
+
const SOID = id_gen_UniID.fromUnknown(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
33501
33506
|
return this.create({
|
|
33502
33507
|
...args,
|
|
33503
33508
|
SOID: SOID.toString(),
|
|
@@ -33506,7 +33511,7 @@ and limitations under the License.
|
|
|
33506
33511
|
content: args.m,
|
|
33507
33512
|
platform: domain,
|
|
33508
33513
|
DMID: args.cid.toString()
|
|
33509
|
-
});
|
|
33514
|
+
}, options);
|
|
33510
33515
|
}
|
|
33511
33516
|
toDDplay() {
|
|
33512
33517
|
let mode = 1;
|
|
@@ -33533,6 +33538,9 @@ and limitations under the License.
|
|
|
33533
33538
|
this.weight = 0;
|
|
33534
33539
|
this.pool = 0;
|
|
33535
33540
|
this.attr = [];
|
|
33541
|
+
this.options = {
|
|
33542
|
+
dmid: createDMID
|
|
33543
|
+
};
|
|
33536
33544
|
}
|
|
33537
33545
|
}
|
|
33538
33546
|
_ts_decorate([
|
|
@@ -33635,7 +33643,9 @@ and limitations under the License.
|
|
|
33635
33643
|
_ts_decorate([
|
|
33636
33644
|
Expose(),
|
|
33637
33645
|
_ts_metadata("design:type", Function),
|
|
33638
|
-
_ts_metadata("design:paramtypes", [
|
|
33646
|
+
_ts_metadata("design:paramtypes", [
|
|
33647
|
+
"undefined" == typeof Options ? Object : Options
|
|
33648
|
+
]),
|
|
33639
33649
|
_ts_metadata("design:returntype", void 0)
|
|
33640
33650
|
], UniDM.prototype, "init", null);
|
|
33641
33651
|
_ts_decorate([
|
|
@@ -33859,8 +33869,8 @@ and limitations under the License.
|
|
|
33859
33869
|
platform: s.platform.sort((a, b)=>b.count - a.count)[0].val
|
|
33860
33870
|
};
|
|
33861
33871
|
}
|
|
33862
|
-
static create() {
|
|
33863
|
-
return new UniPool([]);
|
|
33872
|
+
static create(options) {
|
|
33873
|
+
return new UniPool([], options);
|
|
33864
33874
|
}
|
|
33865
33875
|
assign(dans) {
|
|
33866
33876
|
if (dans instanceof UniPool) return new UniPool([
|
|
@@ -34022,7 +34032,7 @@ and limitations under the License.
|
|
|
34022
34032
|
}
|
|
34023
34033
|
}
|
|
34024
34034
|
}
|
|
34025
|
-
static fromPb(bin) {
|
|
34035
|
+
static fromPb(bin, options) {
|
|
34026
34036
|
const data = fromBinary(DanmakuReplySchema, new Uint8Array(bin));
|
|
34027
34037
|
return new UniPool(data.danmakus.map((d)=>UniDM.create({
|
|
34028
34038
|
...d,
|
|
@@ -34030,7 +34040,7 @@ and limitations under the License.
|
|
|
34030
34040
|
ctime: timestampDate(d.ctime || timestampNow()),
|
|
34031
34041
|
pool: d.pool,
|
|
34032
34042
|
attr: d.attr
|
|
34033
|
-
})));
|
|
34043
|
+
}, options)), options);
|
|
34034
34044
|
}
|
|
34035
34045
|
toPb() {
|
|
34036
34046
|
return toBinary(DanmakuReplySchema, create(DanmakuReplySchema, {
|
|
@@ -34052,7 +34062,7 @@ and limitations under the License.
|
|
|
34052
34062
|
}))
|
|
34053
34063
|
}));
|
|
34054
34064
|
}
|
|
34055
|
-
static fromBiliXML(xml) {
|
|
34065
|
+
static fromBiliXML(xml, options) {
|
|
34056
34066
|
const parser = new XMLParser({
|
|
34057
34067
|
ignoreAttributes: false
|
|
34058
34068
|
}), oriData = parser.parse(xml), dans = oriData.i.d;
|
|
@@ -34069,8 +34079,8 @@ and limitations under the License.
|
|
|
34069
34079
|
midHash: p_arr[6],
|
|
34070
34080
|
id: BigInt(p_arr[7]),
|
|
34071
34081
|
weight: Number.parseInt(p_arr[8])
|
|
34072
|
-
}, BigInt(oriData.i.chatid));
|
|
34073
|
-
}).filter((d)=>null !== d));
|
|
34082
|
+
}, BigInt(oriData.i.chatid), options);
|
|
34083
|
+
}).filter((d)=>null !== d), options);
|
|
34074
34084
|
}
|
|
34075
34085
|
toBiliXML() {
|
|
34076
34086
|
const genCID = (id)=>{
|
|
@@ -34101,25 +34111,25 @@ and limitations under the License.
|
|
|
34101
34111
|
}
|
|
34102
34112
|
});
|
|
34103
34113
|
}
|
|
34104
|
-
static fromBiliGrpc(bin) {
|
|
34114
|
+
static fromBiliGrpc(bin, options) {
|
|
34105
34115
|
const data = fromBinary(DmSegMobileReplySchema, new Uint8Array(bin)), json = data.elems;
|
|
34106
34116
|
return new UniPool(json.map((d)=>UniDM.fromBili({
|
|
34107
34117
|
...d,
|
|
34108
34118
|
progress: d.progress / 1000
|
|
34109
|
-
})));
|
|
34119
|
+
}, d.oid, options)), options);
|
|
34110
34120
|
}
|
|
34111
|
-
static fromBiliCommandGrpc(bin) {
|
|
34121
|
+
static fromBiliCommandGrpc(bin, options) {
|
|
34112
34122
|
const data = fromBinary(DmWebViewReplySchema, new Uint8Array(bin)), json = data.commandDms;
|
|
34113
|
-
return new UniPool(json.map((d)=>UniDM.fromBiliCommand(d)));
|
|
34123
|
+
return new UniPool(json.map((d)=>UniDM.fromBiliCommand(d, d.oid, options)), options);
|
|
34114
34124
|
}
|
|
34115
|
-
static fromDplayer(json, playerID, domain = 'other') {
|
|
34125
|
+
static fromDplayer(json, playerID, domain = 'other', options) {
|
|
34116
34126
|
return new UniPool(json.data.map((d)=>UniDM.fromDplayer({
|
|
34117
34127
|
content: d[4],
|
|
34118
34128
|
progress: d[0],
|
|
34119
34129
|
mode: d[1],
|
|
34120
34130
|
color: d[2],
|
|
34121
34131
|
midHash: d[3]
|
|
34122
|
-
}, playerID, domain)));
|
|
34132
|
+
}, playerID, domain, options)), options);
|
|
34123
34133
|
}
|
|
34124
34134
|
toDplayer() {
|
|
34125
34135
|
return {
|
|
@@ -34136,14 +34146,14 @@ and limitations under the License.
|
|
|
34136
34146
|
})
|
|
34137
34147
|
};
|
|
34138
34148
|
}
|
|
34139
|
-
static fromArtplayer(json, playerID, domain = 'other') {
|
|
34149
|
+
static fromArtplayer(json, playerID, domain = 'other', options) {
|
|
34140
34150
|
return new UniPool(json.map((d)=>UniDM.fromArtplayer({
|
|
34141
34151
|
content: d.text,
|
|
34142
34152
|
progress: d.time || 0,
|
|
34143
34153
|
mode: d.mode || 0,
|
|
34144
34154
|
color: Number((d.color || 'FFFFFF').replace('#', '0x')),
|
|
34145
34155
|
style: d.style
|
|
34146
|
-
}, playerID, domain)));
|
|
34156
|
+
}, playerID, domain, options)), options);
|
|
34147
34157
|
}
|
|
34148
34158
|
toArtplayer() {
|
|
34149
34159
|
return this.dans.map((dan)=>{
|
|
@@ -34158,7 +34168,7 @@ and limitations under the License.
|
|
|
34158
34168
|
};
|
|
34159
34169
|
});
|
|
34160
34170
|
}
|
|
34161
|
-
static fromDDPlay(json, episodeId) {
|
|
34171
|
+
static fromDDPlay(json, episodeId, options) {
|
|
34162
34172
|
return new UniPool(json.comments.map((d)=>{
|
|
34163
34173
|
const p_arr = d.p.split(',');
|
|
34164
34174
|
return UniDM.fromDDplay({
|
|
@@ -34168,8 +34178,8 @@ and limitations under the License.
|
|
|
34168
34178
|
mode: Number.parseInt(p_arr[1]),
|
|
34169
34179
|
progress: Number.parseFloat(p_arr[0]),
|
|
34170
34180
|
uid: p_arr[3]
|
|
34171
|
-
}, episodeId);
|
|
34172
|
-
}));
|
|
34181
|
+
}, episodeId, void 0, options);
|
|
34182
|
+
}), options);
|
|
34173
34183
|
}
|
|
34174
34184
|
toDDplay() {
|
|
34175
34185
|
return {
|
|
@@ -34515,7 +34525,7 @@ and limitations under the License.
|
|
|
34515
34525
|
config,
|
|
34516
34526
|
context
|
|
34517
34527
|
}, rawText = JSON.stringify(raw1);
|
|
34518
|
-
let compress
|
|
34528
|
+
let compress;
|
|
34519
34529
|
compress = 'brotli' === compressType ? (0, lib.brotliCompressSync)(rawText) : (0, lib.gzipSync)(rawText);
|
|
34520
34530
|
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(base16384_lib.encode(compress))}`;
|
|
34521
34531
|
}
|
|
@@ -34527,7 +34537,7 @@ and limitations under the License.
|
|
|
34527
34537
|
if (!compressTypes.includes(compressType)) compressType = 'gzip';
|
|
34528
34538
|
if (!baseTypes.includes(baseType)) baseType = 'base64';
|
|
34529
34539
|
const text = lineRaw.replace(';Raw: ', '').trim(), buffer = 'base64' === baseType ? raw_Buffer.from(text, 'base64') : raw_Buffer.from(base16384_lib.decode(raw_Buffer.from(text, 'utf-8').toString('utf-8')));
|
|
34530
|
-
let decompress
|
|
34540
|
+
let decompress;
|
|
34531
34541
|
decompress = 'brotli' === compressType ? (0, lib.brotliDecompressSync)(buffer) : (0, lib.gunzipSync)(buffer);
|
|
34532
34542
|
try {
|
|
34533
34543
|
return JSON.parse(decompress.toString('utf-8'));
|
|
@@ -34790,8 +34800,8 @@ and limitations under the License.
|
|
|
34790
34800
|
platform: s.platform.sort((a, b)=>b.count - a.count)[0].val
|
|
34791
34801
|
};
|
|
34792
34802
|
}
|
|
34793
|
-
static create() {
|
|
34794
|
-
return new src_UniPool([]);
|
|
34803
|
+
static create(options) {
|
|
34804
|
+
return new src_UniPool([], options);
|
|
34795
34805
|
}
|
|
34796
34806
|
assign(dans) {
|
|
34797
34807
|
if (dans instanceof src_UniPool) return new src_UniPool([
|
|
@@ -34953,7 +34963,7 @@ and limitations under the License.
|
|
|
34953
34963
|
}
|
|
34954
34964
|
}
|
|
34955
34965
|
}
|
|
34956
|
-
static fromPb(bin) {
|
|
34966
|
+
static fromPb(bin, options) {
|
|
34957
34967
|
const data = fromBinary(DanmakuReplySchema, new Uint8Array(bin));
|
|
34958
34968
|
return new src_UniPool(data.danmakus.map((d)=>UniDM.create({
|
|
34959
34969
|
...d,
|
|
@@ -34961,7 +34971,7 @@ and limitations under the License.
|
|
|
34961
34971
|
ctime: timestampDate(d.ctime || timestampNow()),
|
|
34962
34972
|
pool: d.pool,
|
|
34963
34973
|
attr: d.attr
|
|
34964
|
-
})));
|
|
34974
|
+
}, options)), options);
|
|
34965
34975
|
}
|
|
34966
34976
|
toPb() {
|
|
34967
34977
|
return toBinary(DanmakuReplySchema, create(DanmakuReplySchema, {
|
|
@@ -34983,7 +34993,7 @@ and limitations under the License.
|
|
|
34983
34993
|
}))
|
|
34984
34994
|
}));
|
|
34985
34995
|
}
|
|
34986
|
-
static fromBiliXML(xml) {
|
|
34996
|
+
static fromBiliXML(xml, options) {
|
|
34987
34997
|
const parser = new XMLParser({
|
|
34988
34998
|
ignoreAttributes: false
|
|
34989
34999
|
}), oriData = parser.parse(xml), dans = oriData.i.d;
|
|
@@ -35000,8 +35010,8 @@ and limitations under the License.
|
|
|
35000
35010
|
midHash: p_arr[6],
|
|
35001
35011
|
id: BigInt(p_arr[7]),
|
|
35002
35012
|
weight: Number.parseInt(p_arr[8])
|
|
35003
|
-
}, BigInt(oriData.i.chatid));
|
|
35004
|
-
}).filter((d)=>null !== d));
|
|
35013
|
+
}, BigInt(oriData.i.chatid), options);
|
|
35014
|
+
}).filter((d)=>null !== d), options);
|
|
35005
35015
|
}
|
|
35006
35016
|
toBiliXML() {
|
|
35007
35017
|
const genCID = (id)=>{
|
|
@@ -35032,25 +35042,25 @@ and limitations under the License.
|
|
|
35032
35042
|
}
|
|
35033
35043
|
});
|
|
35034
35044
|
}
|
|
35035
|
-
static fromBiliGrpc(bin) {
|
|
35045
|
+
static fromBiliGrpc(bin, options) {
|
|
35036
35046
|
const data = fromBinary(DmSegMobileReplySchema, new Uint8Array(bin)), json = data.elems;
|
|
35037
35047
|
return new src_UniPool(json.map((d)=>UniDM.fromBili({
|
|
35038
35048
|
...d,
|
|
35039
35049
|
progress: d.progress / 1000
|
|
35040
|
-
})));
|
|
35050
|
+
}, d.oid, options)), options);
|
|
35041
35051
|
}
|
|
35042
|
-
static fromBiliCommandGrpc(bin) {
|
|
35052
|
+
static fromBiliCommandGrpc(bin, options) {
|
|
35043
35053
|
const data = fromBinary(DmWebViewReplySchema, new Uint8Array(bin)), json = data.commandDms;
|
|
35044
|
-
return new src_UniPool(json.map((d)=>UniDM.fromBiliCommand(d)));
|
|
35054
|
+
return new src_UniPool(json.map((d)=>UniDM.fromBiliCommand(d, d.oid, options)), options);
|
|
35045
35055
|
}
|
|
35046
|
-
static fromDplayer(json, playerID, domain = 'other') {
|
|
35056
|
+
static fromDplayer(json, playerID, domain = 'other', options) {
|
|
35047
35057
|
return new src_UniPool(json.data.map((d)=>UniDM.fromDplayer({
|
|
35048
35058
|
content: d[4],
|
|
35049
35059
|
progress: d[0],
|
|
35050
35060
|
mode: d[1],
|
|
35051
35061
|
color: d[2],
|
|
35052
35062
|
midHash: d[3]
|
|
35053
|
-
}, playerID, domain)));
|
|
35063
|
+
}, playerID, domain, options)), options);
|
|
35054
35064
|
}
|
|
35055
35065
|
toDplayer() {
|
|
35056
35066
|
return {
|
|
@@ -35067,14 +35077,14 @@ and limitations under the License.
|
|
|
35067
35077
|
})
|
|
35068
35078
|
};
|
|
35069
35079
|
}
|
|
35070
|
-
static fromArtplayer(json, playerID, domain = 'other') {
|
|
35080
|
+
static fromArtplayer(json, playerID, domain = 'other', options) {
|
|
35071
35081
|
return new src_UniPool(json.map((d)=>UniDM.fromArtplayer({
|
|
35072
35082
|
content: d.text,
|
|
35073
35083
|
progress: d.time || 0,
|
|
35074
35084
|
mode: d.mode || 0,
|
|
35075
35085
|
color: Number((d.color || 'FFFFFF').replace('#', '0x')),
|
|
35076
35086
|
style: d.style
|
|
35077
|
-
}, playerID, domain)));
|
|
35087
|
+
}, playerID, domain, options)), options);
|
|
35078
35088
|
}
|
|
35079
35089
|
toArtplayer() {
|
|
35080
35090
|
return this.dans.map((dan)=>{
|
|
@@ -35089,7 +35099,7 @@ and limitations under the License.
|
|
|
35089
35099
|
};
|
|
35090
35100
|
});
|
|
35091
35101
|
}
|
|
35092
|
-
static fromDDPlay(json, episodeId) {
|
|
35102
|
+
static fromDDPlay(json, episodeId, options) {
|
|
35093
35103
|
return new src_UniPool(json.comments.map((d)=>{
|
|
35094
35104
|
const p_arr = d.p.split(',');
|
|
35095
35105
|
return UniDM.fromDDplay({
|
|
@@ -35099,8 +35109,8 @@ and limitations under the License.
|
|
|
35099
35109
|
mode: Number.parseInt(p_arr[1]),
|
|
35100
35110
|
progress: Number.parseFloat(p_arr[0]),
|
|
35101
35111
|
uid: p_arr[3]
|
|
35102
|
-
}, episodeId);
|
|
35103
|
-
}));
|
|
35112
|
+
}, episodeId, void 0, options);
|
|
35113
|
+
}), options);
|
|
35104
35114
|
}
|
|
35105
35115
|
toDDplay() {
|
|
35106
35116
|
return {
|
|
@@ -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
|
@@ -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)
|