@dan-uni/dan-any 1.1.1 → 1.2.2
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/browser/157.min.js +20 -4
- package/dist/browser/17.min.js +13289 -0
- package/dist/browser/898.min.js +10 -0
- package/dist/browser/index.min.js +1 -13248
- package/dist/browser/plugins/bili-dedupe.min.js +1 -1
- package/dist/browser/plugins/index.min.js +1 -0
- package/dist/browser/plugins/stats.min.js +1 -0
- package/dist/browser/src/index.d.ts +4 -4
- package/dist/browser/src/plugins/bili-dedupe/index.d.ts +3 -5
- package/dist/browser/src/plugins/index.d.ts +2 -2
- package/dist/browser/src/plugins/stats/getLatestDan.d.ts +6 -0
- package/dist/browser/src/plugins/stats/index.d.ts +1 -0
- package/dist/browser/src/plugins/stats/index.test.d.ts +1 -0
- package/dist/node/157.js +20 -4
- package/dist/node/17.js +1864 -0
- package/dist/node/898.js +10 -0
- package/dist/node/index.js +1 -1823
- package/dist/node/plugins/bili-dedupe.js +1 -1
- package/dist/node/plugins/index.js +1 -0
- package/dist/node/plugins/stats.js +1 -0
- package/dist/node/src/index.d.ts +4 -4
- package/dist/node/src/plugins/bili-dedupe/index.d.ts +3 -5
- package/dist/node/src/plugins/index.d.ts +2 -2
- package/dist/node/src/plugins/stats/getLatestDan.d.ts +6 -0
- package/dist/node/src/plugins/stats/index.d.ts +1 -0
- package/dist/node/src/plugins/stats/index.test.d.ts +1 -0
- package/dist/umd/index.umd.min.js +65 -62
- package/dist/umd/plugins/bili-dedupe.umd.min.js +24997 -48
- package/dist/umd/plugins/bili-dedupe.umd.min.js.LICENSE.txt +34 -0
- package/dist/umd/plugins/index.umd.min.js +24971 -21
- package/dist/umd/plugins/index.umd.min.js.LICENSE.txt +34 -0
- package/dist/umd/plugins/stats.umd.min.js +39 -0
- package/dist/umd/src/index.d.ts +4 -4
- package/dist/umd/src/plugins/bili-dedupe/index.d.ts +3 -5
- package/dist/umd/src/plugins/index.d.ts +2 -2
- package/dist/umd/src/plugins/stats/getLatestDan.d.ts +6 -0
- package/dist/umd/src/plugins/stats/index.d.ts +1 -0
- package/dist/umd/src/plugins/stats/index.test.d.ts +1 -0
- package/package.json +1 -1
- package/rslib.config.ts +1 -0
- package/src/index.ts +8 -4
- package/src/plugins/bili-dedupe/index.test.ts +5 -2
- package/src/plugins/bili-dedupe/index.ts +13 -3
- package/src/plugins/index.ts +2 -3
- package/src/plugins/stats/getLatestDan.ts +13 -0
- package/src/plugins/stats/index.test.ts +39 -0
- package/src/plugins/stats/index.ts +1 -0
- package/dist/browser/42.min.js +0 -45
- package/dist/node/42.js +0 -45
- /package/dist/browser/{index.min.js.LICENSE.txt → 17.min.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { bili_dedupe_0 as bili_dedupe, to_bili_deduped } from "../157.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getLatestDan } from "../898.js";
|
package/dist/node/src/index.d.ts
CHANGED
|
@@ -120,8 +120,8 @@ export type DM_format = 'danuni.json' | 'danuni.pb.bin' | 'bili.xml' | 'bili.pb.
|
|
|
120
120
|
type shareItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'senderID' | 'platform' | 'SOID' | 'pool' | 'mode' | 'color'>>;
|
|
121
121
|
type statItems = Partial<Pick<UniDMTools.UniDMObj, 'SOID' | 'mode' | 'fontsize' | 'color' | 'senderID' | 'content' | 'weight' | 'pool' | 'platform'>>;
|
|
122
122
|
type Stats<T extends keyof statItems> = Map<statItems[T], number>;
|
|
123
|
-
type UniPoolPipe = (that: UniPool) => Promise<
|
|
124
|
-
type UniPoolPipeSync = (that: UniPool) =>
|
|
123
|
+
type UniPoolPipe = (that: UniPool) => Promise<any>;
|
|
124
|
+
type UniPoolPipeSync = (that: UniPool) => any;
|
|
125
125
|
export interface Options {
|
|
126
126
|
dedupe?: boolean;
|
|
127
127
|
/**
|
|
@@ -145,8 +145,8 @@ export declare class UniPool {
|
|
|
145
145
|
*/
|
|
146
146
|
fromConverted: boolean;
|
|
147
147
|
});
|
|
148
|
-
pipe(fn:
|
|
149
|
-
pipeSync(fn:
|
|
148
|
+
pipe<T extends (...args: any) => any = UniPoolPipe>(fn: T): Promise<ReturnType<T>>;
|
|
149
|
+
pipeSync<T extends (...args: any) => any = UniPoolPipeSync>(fn: T): ReturnType<T>;
|
|
150
150
|
/**
|
|
151
151
|
* @deprecated 使用 `getShared` 代替
|
|
152
152
|
*/
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export default function bili_dedupe(that: UniPool): UniPool;
|
|
1
|
+
import { UniPool } from '../..';
|
|
2
|
+
export declare function to_bili_deduped(that: UniPool): UniPool;
|
|
3
|
+
export declare function bili_dedupe(that: UniPool): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
export * as bili_dedupe from './bili-dedupe';
|
|
2
|
+
export * as stats from './stats';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as getLatestDan } from './getLatestDan';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13570,6 +13570,51 @@
|
|
|
13570
13570
|
return number + '';
|
|
13571
13571
|
};
|
|
13572
13572
|
},
|
|
13573
|
+
"./src/utils/platform.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13574
|
+
"use strict";
|
|
13575
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13576
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
13577
|
+
PlatformDanmakuOnlySource: ()=>PlatformDanmakuOnlySource,
|
|
13578
|
+
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
13579
|
+
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
13580
|
+
PlatformInfoSource: ()=>PlatformInfoSource,
|
|
13581
|
+
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
13582
|
+
PlatformSources: ()=>PlatformSources,
|
|
13583
|
+
PlatformVideoSource: ()=>PlatformVideoSource,
|
|
13584
|
+
PlatformVideoSources: ()=>PlatformVideoSources
|
|
13585
|
+
});
|
|
13586
|
+
var PlatformInfoSource = /*#__PURE__*/ function(PlatformInfoSource) {
|
|
13587
|
+
PlatformInfoSource["Bangumi"] = "bgm";
|
|
13588
|
+
PlatformInfoSource["TMDB"] = "tmdb";
|
|
13589
|
+
return PlatformInfoSource;
|
|
13590
|
+
}({});
|
|
13591
|
+
const PlatformInfoSources = Object.values(PlatformInfoSource);
|
|
13592
|
+
var PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
13593
|
+
PlatformVideoSource["Acfun"] = "acfun";
|
|
13594
|
+
PlatformVideoSource["Baha"] = "baha";
|
|
13595
|
+
PlatformVideoSource["Bilibili"] = "bili";
|
|
13596
|
+
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
13597
|
+
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
13598
|
+
PlatformVideoSource["Tencent"] = "tencent";
|
|
13599
|
+
PlatformVideoSource["Youku"] = "youku";
|
|
13600
|
+
return PlatformVideoSource;
|
|
13601
|
+
}({});
|
|
13602
|
+
const PlatformVideoSources = Object.values(PlatformVideoSource);
|
|
13603
|
+
var PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
13604
|
+
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
13605
|
+
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
13606
|
+
return PlatformDanmakuOnlySource;
|
|
13607
|
+
}({});
|
|
13608
|
+
const PlatformDanmakuOnlySources = Object.values(PlatformDanmakuOnlySource);
|
|
13609
|
+
const PlatformDanmakuSources = [
|
|
13610
|
+
...PlatformVideoSources,
|
|
13611
|
+
...PlatformDanmakuOnlySources
|
|
13612
|
+
];
|
|
13613
|
+
const PlatformSources = [
|
|
13614
|
+
...PlatformInfoSources,
|
|
13615
|
+
...PlatformDanmakuSources
|
|
13616
|
+
];
|
|
13617
|
+
},
|
|
13573
13618
|
"?c028" () {},
|
|
13574
13619
|
"?8beb" () {},
|
|
13575
13620
|
"../../node_modules/.pnpm/available-typed-arrays@1.0.7/node_modules/available-typed-arrays/index.js" (module1, __unused_rspack_exports, __webpack_require__) {
|
|
@@ -14217,24 +14262,12 @@ and limitations under the License.
|
|
|
14217
14262
|
"use strict";
|
|
14218
14263
|
__webpack_require__.r(__webpack_exports__);
|
|
14219
14264
|
__webpack_require__.d(__webpack_exports__, {
|
|
14220
|
-
platform: ()=>
|
|
14265
|
+
platform: ()=>platform,
|
|
14221
14266
|
UniDM: ()=>UniDM,
|
|
14222
14267
|
UniDMTools: ()=>dm_gen_namespaceObject,
|
|
14223
14268
|
UniPool: ()=>UniPool,
|
|
14224
14269
|
UniIDTools: ()=>id_gen_namespaceObject
|
|
14225
14270
|
});
|
|
14226
|
-
var platform_namespaceObject = {};
|
|
14227
|
-
__webpack_require__.r(platform_namespaceObject);
|
|
14228
|
-
__webpack_require__.d(platform_namespaceObject, {
|
|
14229
|
-
PlatformDanmakuOnlySource: ()=>platform_PlatformDanmakuOnlySource,
|
|
14230
|
-
PlatformDanmakuOnlySources: ()=>PlatformDanmakuOnlySources,
|
|
14231
|
-
PlatformDanmakuSources: ()=>PlatformDanmakuSources,
|
|
14232
|
-
PlatformInfoSource: ()=>platform_PlatformInfoSource,
|
|
14233
|
-
PlatformInfoSources: ()=>PlatformInfoSources,
|
|
14234
|
-
PlatformSources: ()=>PlatformSources,
|
|
14235
|
-
PlatformVideoSource: ()=>platform_PlatformVideoSource,
|
|
14236
|
-
PlatformVideoSources: ()=>PlatformVideoSources
|
|
14237
|
-
});
|
|
14238
14271
|
var id_gen_namespaceObject = {};
|
|
14239
14272
|
__webpack_require__.r(id_gen_namespaceObject);
|
|
14240
14273
|
__webpack_require__.d(id_gen_namespaceObject, {
|
|
@@ -21010,7 +21043,7 @@ and limitations under the License.
|
|
|
21010
21043
|
function timestamp_timestampMs(timestamp) {
|
|
21011
21044
|
return 1000 * Number(timestamp.seconds) + Math.round(timestamp.nanos / 1000000);
|
|
21012
21045
|
}
|
|
21013
|
-
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.
|
|
21046
|
+
var package_namespaceObject = JSON.parse('{"UU":"@dan-uni/dan-any","rE":"1.2.2","TB":"https://github.com/ani-uni/danuni/tree/master/packages/dan-any#readme"}');
|
|
21014
21047
|
const color_pad = (s)=>s.length < 2 ? `0${s}` : s;
|
|
21015
21048
|
const decimalToHex = (n)=>color_pad(n.toString(16));
|
|
21016
21049
|
const isDarkColor = ({ r, g, b })=>0.299 * r + 0.587 * g + 0.114 * b < 0x30;
|
|
@@ -23247,37 +23280,7 @@ and limitations under the License.
|
|
|
23247
23280
|
return this.P.getHMAC(t, n);
|
|
23248
23281
|
}
|
|
23249
23282
|
}
|
|
23250
|
-
var
|
|
23251
|
-
PlatformInfoSource["Bangumi"] = "bgm";
|
|
23252
|
-
PlatformInfoSource["TMDB"] = "tmdb";
|
|
23253
|
-
return PlatformInfoSource;
|
|
23254
|
-
}({});
|
|
23255
|
-
const PlatformInfoSources = Object.values(platform_PlatformInfoSource);
|
|
23256
|
-
var platform_PlatformVideoSource = /*#__PURE__*/ function(PlatformVideoSource) {
|
|
23257
|
-
PlatformVideoSource["Acfun"] = "acfun";
|
|
23258
|
-
PlatformVideoSource["Baha"] = "baha";
|
|
23259
|
-
PlatformVideoSource["Bilibili"] = "bili";
|
|
23260
|
-
PlatformVideoSource["BilibiliGlobal"] = "bglobal";
|
|
23261
|
-
PlatformVideoSource["Iqiyi"] = "iqiyi";
|
|
23262
|
-
PlatformVideoSource["Tencent"] = "tencent";
|
|
23263
|
-
PlatformVideoSource["Youku"] = "youku";
|
|
23264
|
-
return PlatformVideoSource;
|
|
23265
|
-
}({});
|
|
23266
|
-
const PlatformVideoSources = Object.values(platform_PlatformVideoSource);
|
|
23267
|
-
var platform_PlatformDanmakuOnlySource = /*#__PURE__*/ function(PlatformDanmakuOnlySource) {
|
|
23268
|
-
PlatformDanmakuOnlySource["DanDanPlay"] = "ddplay";
|
|
23269
|
-
PlatformDanmakuOnlySource["TuCao"] = "tucao";
|
|
23270
|
-
return PlatformDanmakuOnlySource;
|
|
23271
|
-
}({});
|
|
23272
|
-
const PlatformDanmakuOnlySources = Object.values(platform_PlatformDanmakuOnlySource);
|
|
23273
|
-
const PlatformDanmakuSources = [
|
|
23274
|
-
...PlatformVideoSources,
|
|
23275
|
-
...PlatformDanmakuOnlySources
|
|
23276
|
-
];
|
|
23277
|
-
const PlatformSources = [
|
|
23278
|
-
...PlatformInfoSources,
|
|
23279
|
-
...PlatformDanmakuSources
|
|
23280
|
-
];
|
|
23283
|
+
var platform = __webpack_require__("./src/utils/platform.ts");
|
|
23281
23284
|
class id_gen_UniID {
|
|
23282
23285
|
constructor(id, domain){
|
|
23283
23286
|
this.id = id;
|
|
@@ -23294,10 +23297,10 @@ and limitations under the License.
|
|
|
23294
23297
|
return new id_gen_UniID('runtime' === domain ? 'runtime' : 'anonymous', domain || 'danuni');
|
|
23295
23298
|
}
|
|
23296
23299
|
static fromBili({ cid, mid, midHash }) {
|
|
23297
|
-
if (cid) return new id_gen_UniID(cid.toString(),
|
|
23298
|
-
if (mid) return new id_gen_UniID(mid.toString(),
|
|
23299
|
-
if (midHash) return new id_gen_UniID(midHash,
|
|
23300
|
-
return this.fromNull(
|
|
23300
|
+
if (cid) return new id_gen_UniID(cid.toString(), platform.PlatformVideoSource.Bilibili);
|
|
23301
|
+
if (mid) return new id_gen_UniID(mid.toString(), platform.PlatformVideoSource.Bilibili);
|
|
23302
|
+
if (midHash) return new id_gen_UniID(midHash, platform.PlatformVideoSource.Bilibili);
|
|
23303
|
+
return this.fromNull(platform.PlatformVideoSource.Bilibili);
|
|
23301
23304
|
}
|
|
23302
23305
|
static fromUnknown(id, domain) {
|
|
23303
23306
|
if (id) return new id_gen_UniID(id, domain);
|
|
@@ -23479,7 +23482,7 @@ and limitations under the License.
|
|
|
23479
23482
|
return extra;
|
|
23480
23483
|
}
|
|
23481
23484
|
get isFrom3rdPlatform() {
|
|
23482
|
-
if (this.platform && PlatformDanmakuSources.includes(this.platform)) return true;
|
|
23485
|
+
if (this.platform && platform.PlatformDanmakuSources.includes(this.platform)) return true;
|
|
23483
23486
|
return false;
|
|
23484
23487
|
}
|
|
23485
23488
|
toDMID() {
|
|
@@ -23633,7 +23636,7 @@ and limitations under the License.
|
|
|
23633
23636
|
}
|
|
23634
23637
|
static fromBili(args, cid, options, recSOID) {
|
|
23635
23638
|
if (args.oid && !cid) cid = args.oid;
|
|
23636
|
-
const SOID = recSOID || `def_${
|
|
23639
|
+
const SOID = recSOID || `def_${platform.PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
23637
23640
|
cid
|
|
23638
23641
|
})}`;
|
|
23639
23642
|
const senderID = IsEmail_isEmail(args.midHash, {
|
|
@@ -23686,8 +23689,8 @@ and limitations under the License.
|
|
|
23686
23689
|
ctime: this.transCtime(args.ctime, 's'),
|
|
23687
23690
|
weight: args.weight || (3 === pool ? 1 : 0),
|
|
23688
23691
|
pool,
|
|
23689
|
-
attr: DMAttrUtils.fromBin(args.attr,
|
|
23690
|
-
platform:
|
|
23692
|
+
attr: DMAttrUtils.fromBin(args.attr, platform.PlatformVideoSource.Bilibili),
|
|
23693
|
+
platform: platform.PlatformVideoSource.Bilibili,
|
|
23691
23694
|
extra
|
|
23692
23695
|
}, options);
|
|
23693
23696
|
}
|
|
@@ -23738,7 +23741,7 @@ and limitations under the License.
|
|
|
23738
23741
|
this.color,
|
|
23739
23742
|
this.ctime.getTime() / 1000,
|
|
23740
23743
|
this.extra.bili?.pool || this.pool,
|
|
23741
|
-
options?.avoidSenderIDWithAt ? this.senderID.replaceAll(`@${
|
|
23744
|
+
options?.avoidSenderIDWithAt ? this.senderID.replaceAll(`@${platform.PlatformVideoSource.Bilibili}`, '') : this.senderID,
|
|
23742
23745
|
this.extra.bili?.dmid || this.DMID || this.toDMID(),
|
|
23743
23746
|
this.weight
|
|
23744
23747
|
].join(',')
|
|
@@ -23746,7 +23749,7 @@ and limitations under the License.
|
|
|
23746
23749
|
}
|
|
23747
23750
|
static fromBiliCommand(args, cid, options) {
|
|
23748
23751
|
if (args.oid && !cid) cid = args.oid;
|
|
23749
|
-
const SOID = `def_${
|
|
23752
|
+
const SOID = `def_${platform.PlatformVideoSource.Bilibili}+${id_gen_UniID.fromBili({
|
|
23750
23753
|
cid
|
|
23751
23754
|
})}`;
|
|
23752
23755
|
const senderID = id_gen_UniID.fromBili({
|
|
@@ -23763,7 +23766,7 @@ and limitations under the License.
|
|
|
23763
23766
|
attr: [
|
|
23764
23767
|
"Protect"
|
|
23765
23768
|
],
|
|
23766
|
-
platform:
|
|
23769
|
+
platform: platform.PlatformVideoSource.Bilibili,
|
|
23767
23770
|
extra: {
|
|
23768
23771
|
bili: {
|
|
23769
23772
|
command: args
|
|
@@ -23835,8 +23838,8 @@ and limitations under the License.
|
|
|
23835
23838
|
style: this.extra.artplayer?.style
|
|
23836
23839
|
};
|
|
23837
23840
|
}
|
|
23838
|
-
static fromDDplay(args, episodeId, domain =
|
|
23839
|
-
const SOID = id_gen_UniID.fromUnknown(`def_${
|
|
23841
|
+
static fromDDplay(args, episodeId, domain = platform.PlatformDanmakuOnlySource.DanDanPlay, options) {
|
|
23842
|
+
const SOID = id_gen_UniID.fromUnknown(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+${episodeId}`, domain);
|
|
23840
23843
|
return this.create({
|
|
23841
23844
|
...args,
|
|
23842
23845
|
SOID: SOID.toString(),
|
|
@@ -24861,14 +24864,14 @@ and limitations under the License.
|
|
|
24861
24864
|
toBiliXML(options) {
|
|
24862
24865
|
const genCID = (id)=>{
|
|
24863
24866
|
const UniID = id_gen_UniID.fromString(id);
|
|
24864
|
-
if (UniID.domain ===
|
|
24865
|
-
const cid = UniID.id.replaceAll(`def_${
|
|
24867
|
+
if (UniID.domain === platform.PlatformVideoSource.Bilibili) {
|
|
24868
|
+
const cid = UniID.id.replaceAll(`def_${platform.PlatformVideoSource.Bilibili}+`, '');
|
|
24866
24869
|
if (cid) return cid;
|
|
24867
24870
|
}
|
|
24868
24871
|
return !options?.cid || id;
|
|
24869
24872
|
};
|
|
24870
24873
|
if (options?.avoidSenderIDWithAt) {
|
|
24871
|
-
const ok = this.dans.every((d)=>d.senderID.endsWith(`@${
|
|
24874
|
+
const ok = this.dans.every((d)=>d.senderID.endsWith(`@${platform.PlatformVideoSource.Bilibili}`));
|
|
24872
24875
|
if (!ok) throw new Error('存在其他来源的senderID,请关闭该功能再试!');
|
|
24873
24876
|
}
|
|
24874
24877
|
const builder = new Builder({
|
|
@@ -25003,7 +25006,7 @@ and limitations under the License.
|
|
|
25003
25006
|
});
|
|
25004
25007
|
}
|
|
25005
25008
|
toDDplay() {
|
|
25006
|
-
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${
|
|
25009
|
+
const episodeId = this.dans[0].SOID.split('@')[0].replaceAll(`def_${platform.PlatformDanmakuOnlySource.DanDanPlay}+`, '');
|
|
25007
25010
|
return {
|
|
25008
25011
|
danuni: {
|
|
25009
25012
|
...DanUniConvertTipTemplate,
|