@dan-uni/dan-any 0.6.9 → 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.js +70 -60
- package/dist/index.umd.min.js +70 -60
- package/dist/src/index.d.ts +9 -8
- package/dist/src/utils/dm-gen.d.ts +13 -8
- package/dist/src/utils/id-gen.d.ts +2 -1
- package/package.json +2 -2
- package/src/ass-gen/__tests__/898651903.xml.ass +1 -1
- package/src/ass-gen/ass/raw.ts +2 -2
- package/src/index.test.ts +22 -0
- package/src/index.ts +42 -16
- package/src/utils/dm-gen.ts +136 -84
- package/src/utils/id-gen.ts +10 -2
- package/tsconfig.json +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -125,7 +125,7 @@ class id_gen_UniID {
|
|
|
125
125
|
return this.fromNull(domain);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
function createDMID(content = '', senderID, ctime, extraStr, slice = 8) {
|
|
128
|
+
function createDMID(content = '', senderID = id_gen_UniID.fromNull().toString(), ctime = new Date().toISOString(), extraStr, slice = 8) {
|
|
129
129
|
return new jssha('SHA3-256', 'TEXT').update(`${content}|${senderID}|${UniDM.transCtime(ctime).toISOString()}|${extraStr}`).getHash('HEX').slice(0, slice);
|
|
130
130
|
}
|
|
131
131
|
function _ts_decorate(decorators, target, key, desc) {
|
|
@@ -167,7 +167,7 @@ const toBits = (number)=>{
|
|
|
167
167
|
bits.unshift(!!(1 & number));
|
|
168
168
|
number >>= 1;
|
|
169
169
|
}while (number);
|
|
170
|
-
return bits.
|
|
170
|
+
return bits.toReversed();
|
|
171
171
|
};
|
|
172
172
|
var dm_gen_DMAttr = /*#__PURE__*/ function(DMAttr) {
|
|
173
173
|
DMAttr["Protect"] = "Protect";
|
|
@@ -250,8 +250,10 @@ var dm_gen_Pools = /*#__PURE__*/ function(Pools) {
|
|
|
250
250
|
return Pools;
|
|
251
251
|
}({});
|
|
252
252
|
class UniDM {
|
|
253
|
-
init() {
|
|
253
|
+
init(options) {
|
|
254
|
+
this.options = options || this.options;
|
|
254
255
|
const def = new UniDM();
|
|
256
|
+
if (void 0 === this.options.dmid || true === this.options.dmid) this.options.dmid = createDMID;
|
|
255
257
|
if (!this.SOID) this.SOID = def.SOID;
|
|
256
258
|
if (!this.progress) this.progress = def.progress;
|
|
257
259
|
if (!this.mode) this.mode = def.mode;
|
|
@@ -263,7 +265,7 @@ class UniDM {
|
|
|
263
265
|
if (!this.weight) this.weight = def.weight;
|
|
264
266
|
if (!this.pool) this.pool = def.pool;
|
|
265
267
|
if (!this.attr) this.attr = def.attr;
|
|
266
|
-
if (!this.DMID) this.DMID = this.toDMID();
|
|
268
|
+
if (!this.DMID && false !== this.options.dmid) this.DMID = this.toDMID();
|
|
267
269
|
this.progress = Number.parseFloat(this.progress.toFixed(3));
|
|
268
270
|
if (this.extraStr) this.extraStr = dm_gen_JSON.stringify(cleanEmptyObjects(dm_gen_JSON.parse(this.extraStr)));
|
|
269
271
|
if ('{}' === this.extraStr) this.extraStr = void 0;
|
|
@@ -281,13 +283,13 @@ class UniDM {
|
|
|
281
283
|
async validate() {
|
|
282
284
|
return validateOrReject(this);
|
|
283
285
|
}
|
|
284
|
-
static create(pjson) {
|
|
286
|
+
static create(pjson, options) {
|
|
285
287
|
return pjson ? plainToInstance(UniDM, pjson.extra ? {
|
|
286
288
|
...pjson,
|
|
287
289
|
extraStr: pjson.extra ? dm_gen_JSON.stringify(pjson.extra) : pjson.extraStr
|
|
288
290
|
} : pjson, {
|
|
289
291
|
excludeExtraneousValues: true
|
|
290
|
-
}).init() : new UniDM();
|
|
292
|
+
}).init(options) : new UniDM();
|
|
291
293
|
}
|
|
292
294
|
get extra() {
|
|
293
295
|
const extra = dm_gen_JSON.parse(this.extraStr || '{}');
|
|
@@ -298,7 +300,10 @@ class UniDM {
|
|
|
298
300
|
return false;
|
|
299
301
|
}
|
|
300
302
|
toDMID() {
|
|
301
|
-
|
|
303
|
+
if (false === this.options.dmid) return;
|
|
304
|
+
if (true === this.options.dmid) return createDMID(this.content, this.senderID, this.ctime, this.extraStr);
|
|
305
|
+
if ('number' == typeof this.options.dmid) return createDMID(this.content, this.senderID, this.ctime, this.extraStr, this.options.dmid);
|
|
306
|
+
return this.options.dmid(this.content, this.senderID, this.ctime, this.extraStr);
|
|
302
307
|
}
|
|
303
308
|
isSameAs(dan, options) {
|
|
304
309
|
if (4 === this.mode || 4 === dan.mode) return false;
|
|
@@ -416,7 +421,7 @@ class UniDM {
|
|
|
416
421
|
}
|
|
417
422
|
return mode;
|
|
418
423
|
}
|
|
419
|
-
static fromBili(args, cid) {
|
|
424
|
+
static fromBili(args, cid, options) {
|
|
420
425
|
if (args.oid && !cid) cid = args.oid;
|
|
421
426
|
const SOID = `def_${platform_PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
422
427
|
cid
|
|
@@ -459,7 +464,7 @@ class UniDM {
|
|
|
459
464
|
}
|
|
460
465
|
return this.create({
|
|
461
466
|
...args,
|
|
462
|
-
SOID
|
|
467
|
+
SOID,
|
|
463
468
|
mode,
|
|
464
469
|
senderID: senderID.toString(),
|
|
465
470
|
ctime: this.transCtime(args.ctime, 's'),
|
|
@@ -468,7 +473,7 @@ class UniDM {
|
|
|
468
473
|
attr: DMAttrUtils.fromBin(args.attr, platform_PlatformVideoSource.Bilibili),
|
|
469
474
|
platform: platform_PlatformVideoSource.Bilibili,
|
|
470
475
|
extra
|
|
471
|
-
});
|
|
476
|
+
}, options);
|
|
472
477
|
}
|
|
473
478
|
toBiliXML(options) {
|
|
474
479
|
if (options?.skipBiliCommand && this.extra.bili?.command) return null;
|
|
@@ -523,16 +528,16 @@ class UniDM {
|
|
|
523
528
|
].join(',')
|
|
524
529
|
};
|
|
525
530
|
}
|
|
526
|
-
static fromBiliCommand(args, cid) {
|
|
531
|
+
static fromBiliCommand(args, cid, options) {
|
|
527
532
|
if (args.oid && !cid) cid = args.oid;
|
|
528
|
-
const SOID = id_gen_UniID.fromBili({
|
|
533
|
+
const SOID = `def_${platform_PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
529
534
|
cid
|
|
530
|
-
})
|
|
535
|
+
})}`, senderID = id_gen_UniID.fromBili({
|
|
531
536
|
mid: args.mid
|
|
532
537
|
});
|
|
533
538
|
return this.create({
|
|
534
539
|
...args,
|
|
535
|
-
SOID
|
|
540
|
+
SOID,
|
|
536
541
|
mode: 4,
|
|
537
542
|
senderID: senderID.toString(),
|
|
538
543
|
ctime: new Date(`${args.ctime} GMT+0800`),
|
|
@@ -547,9 +552,9 @@ class UniDM {
|
|
|
547
552
|
command: args
|
|
548
553
|
}
|
|
549
554
|
}
|
|
550
|
-
});
|
|
555
|
+
}, options);
|
|
551
556
|
}
|
|
552
|
-
static fromDplayer(args, playerID, domain) {
|
|
557
|
+
static fromDplayer(args, playerID, domain, options) {
|
|
553
558
|
const SOID = id_gen_UniID.fromUnknown(playerID, domain), senderID = id_gen_UniID.fromUnknown(args.midHash, domain);
|
|
554
559
|
return this.create({
|
|
555
560
|
...args,
|
|
@@ -557,7 +562,7 @@ class UniDM {
|
|
|
557
562
|
mode: this.transMode(args.mode, 'dplayer'),
|
|
558
563
|
senderID: senderID.toString(),
|
|
559
564
|
platform: domain
|
|
560
|
-
});
|
|
565
|
+
}, options);
|
|
561
566
|
}
|
|
562
567
|
toDplayer() {
|
|
563
568
|
let mode = 0;
|
|
@@ -571,7 +576,7 @@ class UniDM {
|
|
|
571
576
|
content: this.content
|
|
572
577
|
};
|
|
573
578
|
}
|
|
574
|
-
static fromArtplayer(args, playerID, domain) {
|
|
579
|
+
static fromArtplayer(args, playerID, domain, options) {
|
|
575
580
|
const SOID = id_gen_UniID.fromUnknown(playerID, domain), senderID = id_gen_UniID.fromUnknown('', domain);
|
|
576
581
|
let extra = args.border ? {
|
|
577
582
|
artplayer: {
|
|
@@ -597,7 +602,7 @@ class UniDM {
|
|
|
597
602
|
senderID: senderID.toString(),
|
|
598
603
|
platform: domain,
|
|
599
604
|
extra
|
|
600
|
-
});
|
|
605
|
+
}, options);
|
|
601
606
|
}
|
|
602
607
|
toArtplayer() {
|
|
603
608
|
let mode = 0;
|
|
@@ -611,7 +616,7 @@ class UniDM {
|
|
|
611
616
|
style: this.extra.artplayer?.style
|
|
612
617
|
};
|
|
613
618
|
}
|
|
614
|
-
static fromDDplay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay) {
|
|
619
|
+
static fromDDplay(args, episodeId, domain = platform_PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
615
620
|
const SOID = id_gen_UniID.fromUnknown(`def_${platform_PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
616
621
|
return this.create({
|
|
617
622
|
...args,
|
|
@@ -621,7 +626,7 @@ class UniDM {
|
|
|
621
626
|
content: args.m,
|
|
622
627
|
platform: domain,
|
|
623
628
|
DMID: args.cid.toString()
|
|
624
|
-
});
|
|
629
|
+
}, options);
|
|
625
630
|
}
|
|
626
631
|
toDDplay() {
|
|
627
632
|
let mode = 1;
|
|
@@ -648,6 +653,9 @@ class UniDM {
|
|
|
648
653
|
this.weight = 0;
|
|
649
654
|
this.pool = 0;
|
|
650
655
|
this.attr = [];
|
|
656
|
+
this.options = {
|
|
657
|
+
dmid: createDMID
|
|
658
|
+
};
|
|
651
659
|
}
|
|
652
660
|
}
|
|
653
661
|
_ts_decorate([
|
|
@@ -750,7 +758,9 @@ _ts_decorate([
|
|
|
750
758
|
_ts_decorate([
|
|
751
759
|
Expose(),
|
|
752
760
|
_ts_metadata("design:type", Function),
|
|
753
|
-
_ts_metadata("design:paramtypes", [
|
|
761
|
+
_ts_metadata("design:paramtypes", [
|
|
762
|
+
"undefined" == typeof Options ? Object : Options
|
|
763
|
+
]),
|
|
754
764
|
_ts_metadata("design:returntype", void 0)
|
|
755
765
|
], UniDM.prototype, "init", null);
|
|
756
766
|
_ts_decorate([
|
|
@@ -973,8 +983,8 @@ class UniPool {
|
|
|
973
983
|
platform: s.platform.sort((a, b)=>b.count - a.count)[0].val
|
|
974
984
|
};
|
|
975
985
|
}
|
|
976
|
-
static create() {
|
|
977
|
-
return new UniPool([]);
|
|
986
|
+
static create(options) {
|
|
987
|
+
return new UniPool([], options);
|
|
978
988
|
}
|
|
979
989
|
assign(dans) {
|
|
980
990
|
if (dans instanceof UniPool) return new UniPool([
|
|
@@ -1136,7 +1146,7 @@ class UniPool {
|
|
|
1136
1146
|
}
|
|
1137
1147
|
}
|
|
1138
1148
|
}
|
|
1139
|
-
static fromPb(bin) {
|
|
1149
|
+
static fromPb(bin, options) {
|
|
1140
1150
|
const data = fromBinary(DanmakuReplySchema, new Uint8Array(bin));
|
|
1141
1151
|
return new UniPool(data.danmakus.map((d)=>UniDM.create({
|
|
1142
1152
|
...d,
|
|
@@ -1144,7 +1154,7 @@ class UniPool {
|
|
|
1144
1154
|
ctime: timestampDate(d.ctime || timestampNow()),
|
|
1145
1155
|
pool: d.pool,
|
|
1146
1156
|
attr: d.attr
|
|
1147
|
-
})));
|
|
1157
|
+
}, options)), options);
|
|
1148
1158
|
}
|
|
1149
1159
|
toPb() {
|
|
1150
1160
|
return toBinary(DanmakuReplySchema, create(DanmakuReplySchema, {
|
|
@@ -1166,7 +1176,7 @@ class UniPool {
|
|
|
1166
1176
|
}))
|
|
1167
1177
|
}));
|
|
1168
1178
|
}
|
|
1169
|
-
static fromBiliXML(xml) {
|
|
1179
|
+
static fromBiliXML(xml, options) {
|
|
1170
1180
|
const parser = new XMLParser({
|
|
1171
1181
|
ignoreAttributes: false
|
|
1172
1182
|
}), oriData = parser.parse(xml), dans = oriData.i.d;
|
|
@@ -1183,8 +1193,8 @@ class UniPool {
|
|
|
1183
1193
|
midHash: p_arr[6],
|
|
1184
1194
|
id: BigInt(p_arr[7]),
|
|
1185
1195
|
weight: Number.parseInt(p_arr[8])
|
|
1186
|
-
}, BigInt(oriData.i.chatid));
|
|
1187
|
-
}).filter((d)=>null !== d));
|
|
1196
|
+
}, BigInt(oriData.i.chatid), options);
|
|
1197
|
+
}).filter((d)=>null !== d), options);
|
|
1188
1198
|
}
|
|
1189
1199
|
toBiliXML() {
|
|
1190
1200
|
const genCID = (id)=>{
|
|
@@ -1215,25 +1225,25 @@ class UniPool {
|
|
|
1215
1225
|
}
|
|
1216
1226
|
});
|
|
1217
1227
|
}
|
|
1218
|
-
static fromBiliGrpc(bin) {
|
|
1228
|
+
static fromBiliGrpc(bin, options) {
|
|
1219
1229
|
const data = fromBinary(DmSegMobileReplySchema, new Uint8Array(bin)), json = data.elems;
|
|
1220
1230
|
return new UniPool(json.map((d)=>UniDM.fromBili({
|
|
1221
1231
|
...d,
|
|
1222
1232
|
progress: d.progress / 1000
|
|
1223
|
-
})));
|
|
1233
|
+
}, d.oid, options)), options);
|
|
1224
1234
|
}
|
|
1225
|
-
static fromBiliCommandGrpc(bin) {
|
|
1235
|
+
static fromBiliCommandGrpc(bin, options) {
|
|
1226
1236
|
const data = fromBinary(DmWebViewReplySchema, new Uint8Array(bin)), json = data.commandDms;
|
|
1227
|
-
return new UniPool(json.map((d)=>UniDM.fromBiliCommand(d)));
|
|
1237
|
+
return new UniPool(json.map((d)=>UniDM.fromBiliCommand(d, d.oid, options)), options);
|
|
1228
1238
|
}
|
|
1229
|
-
static fromDplayer(json, playerID, domain = 'other') {
|
|
1239
|
+
static fromDplayer(json, playerID, domain = 'other', options) {
|
|
1230
1240
|
return new UniPool(json.data.map((d)=>UniDM.fromDplayer({
|
|
1231
1241
|
content: d[4],
|
|
1232
1242
|
progress: d[0],
|
|
1233
1243
|
mode: d[1],
|
|
1234
1244
|
color: d[2],
|
|
1235
1245
|
midHash: d[3]
|
|
1236
|
-
}, playerID, domain)));
|
|
1246
|
+
}, playerID, domain, options)), options);
|
|
1237
1247
|
}
|
|
1238
1248
|
toDplayer() {
|
|
1239
1249
|
return {
|
|
@@ -1250,14 +1260,14 @@ class UniPool {
|
|
|
1250
1260
|
})
|
|
1251
1261
|
};
|
|
1252
1262
|
}
|
|
1253
|
-
static fromArtplayer(json, playerID, domain = 'other') {
|
|
1263
|
+
static fromArtplayer(json, playerID, domain = 'other', options) {
|
|
1254
1264
|
return new UniPool(json.map((d)=>UniDM.fromArtplayer({
|
|
1255
1265
|
content: d.text,
|
|
1256
1266
|
progress: d.time || 0,
|
|
1257
1267
|
mode: d.mode || 0,
|
|
1258
1268
|
color: Number((d.color || 'FFFFFF').replace('#', '0x')),
|
|
1259
1269
|
style: d.style
|
|
1260
|
-
}, playerID, domain)));
|
|
1270
|
+
}, playerID, domain, options)), options);
|
|
1261
1271
|
}
|
|
1262
1272
|
toArtplayer() {
|
|
1263
1273
|
return this.dans.map((dan)=>{
|
|
@@ -1272,7 +1282,7 @@ class UniPool {
|
|
|
1272
1282
|
};
|
|
1273
1283
|
});
|
|
1274
1284
|
}
|
|
1275
|
-
static fromDDPlay(json, episodeId) {
|
|
1285
|
+
static fromDDPlay(json, episodeId, options) {
|
|
1276
1286
|
return new UniPool(json.comments.map((d)=>{
|
|
1277
1287
|
const p_arr = d.p.split(',');
|
|
1278
1288
|
return UniDM.fromDDplay({
|
|
@@ -1282,8 +1292,8 @@ class UniPool {
|
|
|
1282
1292
|
mode: Number.parseInt(p_arr[1]),
|
|
1283
1293
|
progress: Number.parseFloat(p_arr[0]),
|
|
1284
1294
|
uid: p_arr[3]
|
|
1285
|
-
}, episodeId);
|
|
1286
|
-
}));
|
|
1295
|
+
}, episodeId, void 0, options);
|
|
1296
|
+
}), options);
|
|
1287
1297
|
}
|
|
1288
1298
|
toDDplay() {
|
|
1289
1299
|
return {
|
|
@@ -1625,7 +1635,7 @@ function raw_raw(list, config, context, compressType = 'brotli', baseType = 'bas
|
|
|
1625
1635
|
config,
|
|
1626
1636
|
context
|
|
1627
1637
|
}, rawText = JSON.stringify(raw1);
|
|
1628
|
-
let compress
|
|
1638
|
+
let compress;
|
|
1629
1639
|
compress = 'brotli' === compressType ? brotliCompressSync(rawText) : gzipSync(rawText);
|
|
1630
1640
|
return `;RawCompressType: ${compressType}\n;RawBaseType: ${baseType}\n;Raw: ${'base64' === baseType ? compress.toString('base64') : fromUint16Array(external_base16384_encode(compress))}`;
|
|
1631
1641
|
}
|
|
@@ -1637,7 +1647,7 @@ function deRaw(ass) {
|
|
|
1637
1647
|
if (!compressTypes.includes(compressType)) compressType = 'gzip';
|
|
1638
1648
|
if (!baseTypes.includes(baseType)) baseType = 'base64';
|
|
1639
1649
|
const text = lineRaw.replace(';Raw: ', '').trim(), buffer = 'base64' === baseType ? Buffer.from(text, 'base64') : Buffer.from(decode(Buffer.from(text, 'utf-8').toString('utf-8')));
|
|
1640
|
-
let decompress
|
|
1650
|
+
let decompress;
|
|
1641
1651
|
decompress = 'brotli' === compressType ? brotliDecompressSync(buffer) : gunzipSync(buffer);
|
|
1642
1652
|
try {
|
|
1643
1653
|
return JSON.parse(decompress.toString('utf-8'));
|
|
@@ -1899,8 +1909,8 @@ class src_UniPool {
|
|
|
1899
1909
|
platform: s.platform.sort((a, b)=>b.count - a.count)[0].val
|
|
1900
1910
|
};
|
|
1901
1911
|
}
|
|
1902
|
-
static create() {
|
|
1903
|
-
return new src_UniPool([]);
|
|
1912
|
+
static create(options) {
|
|
1913
|
+
return new src_UniPool([], options);
|
|
1904
1914
|
}
|
|
1905
1915
|
assign(dans) {
|
|
1906
1916
|
if (dans instanceof src_UniPool) return new src_UniPool([
|
|
@@ -2062,7 +2072,7 @@ class src_UniPool {
|
|
|
2062
2072
|
}
|
|
2063
2073
|
}
|
|
2064
2074
|
}
|
|
2065
|
-
static fromPb(bin) {
|
|
2075
|
+
static fromPb(bin, options) {
|
|
2066
2076
|
const data = fromBinary(DanmakuReplySchema, new Uint8Array(bin));
|
|
2067
2077
|
return new src_UniPool(data.danmakus.map((d)=>UniDM.create({
|
|
2068
2078
|
...d,
|
|
@@ -2070,7 +2080,7 @@ class src_UniPool {
|
|
|
2070
2080
|
ctime: timestampDate(d.ctime || timestampNow()),
|
|
2071
2081
|
pool: d.pool,
|
|
2072
2082
|
attr: d.attr
|
|
2073
|
-
})));
|
|
2083
|
+
}, options)), options);
|
|
2074
2084
|
}
|
|
2075
2085
|
toPb() {
|
|
2076
2086
|
return toBinary(DanmakuReplySchema, create(DanmakuReplySchema, {
|
|
@@ -2092,7 +2102,7 @@ class src_UniPool {
|
|
|
2092
2102
|
}))
|
|
2093
2103
|
}));
|
|
2094
2104
|
}
|
|
2095
|
-
static fromBiliXML(xml) {
|
|
2105
|
+
static fromBiliXML(xml, options) {
|
|
2096
2106
|
const parser = new XMLParser({
|
|
2097
2107
|
ignoreAttributes: false
|
|
2098
2108
|
}), oriData = parser.parse(xml), dans = oriData.i.d;
|
|
@@ -2109,8 +2119,8 @@ class src_UniPool {
|
|
|
2109
2119
|
midHash: p_arr[6],
|
|
2110
2120
|
id: BigInt(p_arr[7]),
|
|
2111
2121
|
weight: Number.parseInt(p_arr[8])
|
|
2112
|
-
}, BigInt(oriData.i.chatid));
|
|
2113
|
-
}).filter((d)=>null !== d));
|
|
2122
|
+
}, BigInt(oriData.i.chatid), options);
|
|
2123
|
+
}).filter((d)=>null !== d), options);
|
|
2114
2124
|
}
|
|
2115
2125
|
toBiliXML() {
|
|
2116
2126
|
const genCID = (id)=>{
|
|
@@ -2141,25 +2151,25 @@ class src_UniPool {
|
|
|
2141
2151
|
}
|
|
2142
2152
|
});
|
|
2143
2153
|
}
|
|
2144
|
-
static fromBiliGrpc(bin) {
|
|
2154
|
+
static fromBiliGrpc(bin, options) {
|
|
2145
2155
|
const data = fromBinary(DmSegMobileReplySchema, new Uint8Array(bin)), json = data.elems;
|
|
2146
2156
|
return new src_UniPool(json.map((d)=>UniDM.fromBili({
|
|
2147
2157
|
...d,
|
|
2148
2158
|
progress: d.progress / 1000
|
|
2149
|
-
})));
|
|
2159
|
+
}, d.oid, options)), options);
|
|
2150
2160
|
}
|
|
2151
|
-
static fromBiliCommandGrpc(bin) {
|
|
2161
|
+
static fromBiliCommandGrpc(bin, options) {
|
|
2152
2162
|
const data = fromBinary(DmWebViewReplySchema, new Uint8Array(bin)), json = data.commandDms;
|
|
2153
|
-
return new src_UniPool(json.map((d)=>UniDM.fromBiliCommand(d)));
|
|
2163
|
+
return new src_UniPool(json.map((d)=>UniDM.fromBiliCommand(d, d.oid, options)), options);
|
|
2154
2164
|
}
|
|
2155
|
-
static fromDplayer(json, playerID, domain = 'other') {
|
|
2165
|
+
static fromDplayer(json, playerID, domain = 'other', options) {
|
|
2156
2166
|
return new src_UniPool(json.data.map((d)=>UniDM.fromDplayer({
|
|
2157
2167
|
content: d[4],
|
|
2158
2168
|
progress: d[0],
|
|
2159
2169
|
mode: d[1],
|
|
2160
2170
|
color: d[2],
|
|
2161
2171
|
midHash: d[3]
|
|
2162
|
-
}, playerID, domain)));
|
|
2172
|
+
}, playerID, domain, options)), options);
|
|
2163
2173
|
}
|
|
2164
2174
|
toDplayer() {
|
|
2165
2175
|
return {
|
|
@@ -2176,14 +2186,14 @@ class src_UniPool {
|
|
|
2176
2186
|
})
|
|
2177
2187
|
};
|
|
2178
2188
|
}
|
|
2179
|
-
static fromArtplayer(json, playerID, domain = 'other') {
|
|
2189
|
+
static fromArtplayer(json, playerID, domain = 'other', options) {
|
|
2180
2190
|
return new src_UniPool(json.map((d)=>UniDM.fromArtplayer({
|
|
2181
2191
|
content: d.text,
|
|
2182
2192
|
progress: d.time || 0,
|
|
2183
2193
|
mode: d.mode || 0,
|
|
2184
2194
|
color: Number((d.color || 'FFFFFF').replace('#', '0x')),
|
|
2185
2195
|
style: d.style
|
|
2186
|
-
}, playerID, domain)));
|
|
2196
|
+
}, playerID, domain, options)), options);
|
|
2187
2197
|
}
|
|
2188
2198
|
toArtplayer() {
|
|
2189
2199
|
return this.dans.map((dan)=>{
|
|
@@ -2198,7 +2208,7 @@ class src_UniPool {
|
|
|
2198
2208
|
};
|
|
2199
2209
|
});
|
|
2200
2210
|
}
|
|
2201
|
-
static fromDDPlay(json, episodeId) {
|
|
2211
|
+
static fromDDPlay(json, episodeId, options) {
|
|
2202
2212
|
return new src_UniPool(json.comments.map((d)=>{
|
|
2203
2213
|
const p_arr = d.p.split(',');
|
|
2204
2214
|
return UniDM.fromDDplay({
|
|
@@ -2208,8 +2218,8 @@ class src_UniPool {
|
|
|
2208
2218
|
mode: Number.parseInt(p_arr[1]),
|
|
2209
2219
|
progress: Number.parseFloat(p_arr[0]),
|
|
2210
2220
|
uid: p_arr[3]
|
|
2211
|
-
}, episodeId);
|
|
2212
|
-
}));
|
|
2221
|
+
}, episodeId, void 0, options);
|
|
2222
|
+
}), options);
|
|
2213
2223
|
}
|
|
2214
2224
|
toDDplay() {
|
|
2215
2225
|
return {
|