@any-listen/extension-kit 0.1.5 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@any-listen/extension-kit",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "keywords": [
5
5
  "any-listen",
6
6
  "any-listen-extension"
@@ -8,7 +8,7 @@ type ResourceAction =
8
8
  | 'musicUrl'
9
9
  | 'songlistSearch'
10
10
  | 'songlist'
11
- | 'leaderboard'
11
+ | 'topSongs'
12
12
  | 'albumSearch'
13
13
  | 'album'
14
14
  | 'singerSearch'
@@ -12,6 +12,8 @@ declare namespace AnyListen {
12
12
  type AddMusicLocationType = 'top' | 'bottom'
13
13
 
14
14
  namespace Player {
15
+ type SourceType = 'local' | 'songlist' | 'topSongs' | 'search' | 'album'
16
+
15
17
  interface MusicInfo {
16
18
  id: string | null
17
19
  pic: string | null | undefined
@@ -41,9 +43,9 @@ declare namespace AnyListen {
41
43
  */
42
44
  listId: string
43
45
  /**
44
- * 是否在线列表
46
+ * 列表类型
45
47
  */
46
- isOnline: boolean
48
+ source: SourceType
47
49
  /**
48
50
  * 是否属于 “稍后播放”
49
51
  */
@@ -58,7 +60,7 @@ declare namespace AnyListen {
58
60
  duration: number
59
61
  index: number
60
62
  listId: string | null
61
- isOnline: boolean
63
+ source: SourceType
62
64
  historyIndex: number
63
65
  }
64
66
 
@@ -190,12 +192,15 @@ declare namespace AnyListen {
190
192
  enabledRemove?: boolean
191
193
  usePolling?: boolean
192
194
  }
195
+ type SourceType = 'songlist' | 'topSongs' | 'search' | 'album'
193
196
  interface UserListInfoByOnlineMeta extends UserListInfoBaseMeta {
194
197
  extensionId: string
195
198
  source: string
196
199
  syncId: string
197
200
  syncTime: number
198
201
  picUrl: string | null
202
+ sourceType: SourceType
203
+ [key: string]: unknown
199
204
  }
200
205
  interface UserListInfoByRemoteMeta extends UserListInfoBaseMeta {
201
206
  extensionId: string
@@ -491,7 +496,7 @@ declare namespace AnyListen {
491
496
  interface PlayerActionSet {
492
497
  listId: string | null
493
498
  list: Player.PlayMusicInfo[]
494
- isOnline: boolean
499
+ source: List.SourceType
495
500
  isSync?: boolean
496
501
  }
497
502
  interface PlayerActionAdd {
@@ -563,7 +568,7 @@ declare namespace AnyListen {
563
568
  info: SavedPlayInfo
564
569
  list: Player.PlayMusicInfo[]
565
570
  listId: string | null
566
- isOnline: boolean
571
+ source: List.SourceType
567
572
  historyList: PlayHistoryListItem[]
568
573
  isCollect: boolean
569
574
  }
@@ -587,6 +592,7 @@ declare namespace AnyListen {
587
592
  desc?: string
588
593
  author?: string
589
594
  play_count?: string
595
+ date?: string
590
596
  }
591
597
 
592
598
  interface CommonItem {
@@ -599,7 +605,31 @@ declare namespace AnyListen {
599
605
  list: CommonItem[]
600
606
  }
601
607
 
602
- type BoardItem = CommonItem
608
+ interface TopSongsItem extends CommonItem {
609
+ pic?: string
610
+ }
611
+ interface TopSongsDetailInfo {
612
+ name: string
613
+ pic?: string
614
+ desc?: string
615
+ date?: string
616
+ }
617
+
618
+ interface MusicCommentItem {
619
+ id: string
620
+ userId?: string
621
+ userName: string
622
+ text: string
623
+ time?: number
624
+ images?: string[]
625
+ location?: string
626
+ avatar?: string
627
+ likedCount?: number
628
+ skipPage?: boolean
629
+ replyTotal?: number
630
+ reply?: MusicCommentItem[]
631
+ replySkipPage?: boolean
632
+ }
603
633
  }
604
634
  }
605
635
 
@@ -615,7 +645,13 @@ interface CommonParams {
615
645
  }
616
646
  interface CommonListParams extends CommonParams {
617
647
  page: number
618
- limit: number
648
+ limit?: number
649
+ }
650
+ interface CommonSearchParams extends CommonListParams {
651
+ keyword: string
652
+ }
653
+ interface TipSearchParams extends CommonParams {
654
+ keyword: string
619
655
  }
620
656
  interface MusicSearchParams extends CommonListParams {
621
657
  name: string
@@ -642,9 +678,6 @@ interface PicSearchParams extends CommonParams {
642
678
  artist?: string
643
679
  interval?: number
644
680
  }
645
- interface SonglistSearchParams extends CommonListParams {
646
- keyword: string
647
- }
648
681
  interface ListDetailParams extends CommonListParams {
649
682
  id: string
650
683
  }
@@ -659,33 +692,21 @@ interface SonglistListParams extends CommonListParams {
659
692
  interface SonglistDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
660
693
  info: AnyListen.Resource.SongListDetailInfo
661
694
  }
662
- interface LeaderboardDateParams extends CommonParams {
695
+ interface TopSongsDateParams extends CommonParams {
663
696
  id: string
664
697
  }
665
- interface LeaderboardDetailParams extends CommonListParams {
698
+ interface TopSongsDetailParams extends CommonListParams {
666
699
  id: string
667
700
  date: string
668
701
  }
702
+ interface TopSongsDetailResult extends ListCommonResult<AnyListen.Music.MusicInfoOnline> {
703
+ info: AnyListen.Resource.TopSongsDetailInfo
704
+ }
669
705
  interface MusicCommentParams extends CommonListParams {
670
706
  musicInfo: AnyListen.Music.MusicInfoOnline
671
707
  id?: string
672
708
  type: 'hot' | 'new' | 'reply'
673
709
  }
674
- export interface MusicComment {
675
- id: string
676
- userId?: string
677
- userName: string
678
- text: string
679
- time?: number
680
- images?: string[]
681
- location?: string
682
- avatar?: string
683
- likedCount?: number
684
- skipPage?: boolean
685
- replyTotal?: number
686
- reply?: MusicComment[]
687
- replySkipPage?: boolean
688
- }
689
710
  export interface ListCommonResult<T> {
690
711
  list: T[]
691
712
  total: number
@@ -753,7 +774,9 @@ declare global {
753
774
  type CommonItem = AnyListen.Resource.CommonItem
754
775
  type TagItem = AnyListen.Resource.TagItem
755
776
  type TagGroupItem = AnyListen.Resource.TagGroupItem
756
- type BoardItem = AnyListen.Resource.BoardItem
777
+ type TopSongsItem = AnyListen.Resource.TopSongsItem
778
+ type TopSongsDetailInfo = AnyListen.Resource.TopSongsDetailInfo
779
+ type MusicCommentItem = AnyListen.Resource.MusicCommentItem
757
780
 
758
781
  type ParamsData = Record<string, string | number | null | undefined | boolean>
759
782
  interface RequestOptions {
@@ -764,7 +787,7 @@ declare global {
764
787
  maxRedirect?: number
765
788
  // signal?: AbortController['signal']
766
789
  signal?: unknown
767
- json?: Record<string, unknown>
790
+ json?: Record<string, unknown> | unknown[]
768
791
  form?: Record<string, string | number | null | undefined | boolean>
769
792
  binary?: Uint8Array
770
793
  text?: string
@@ -989,9 +1012,9 @@ declare global {
989
1012
  */
990
1013
  listId: string
991
1014
  /**
992
- * 是否在线列表
1015
+ * 列表类型
993
1016
  */
994
- isOnline: boolean
1017
+ source: AnyListen.List.SourceType
995
1018
  /**
996
1019
  * 是否属于 “稍后播放”
997
1020
  */
@@ -1047,7 +1070,7 @@ declare global {
1047
1070
  type MusicSearchResult = ListCommonResult<AnyListen.Music.MusicInfoOnline>
1048
1071
 
1049
1072
  interface ResourceAction {
1050
- tipSearch: (params: CommonParams) => Promise<string[]>
1073
+ tipSearch: (params: TipSearchParams) => Promise<string[]>
1051
1074
  hotSearch: (params: CommonParams) => Promise<string[]>
1052
1075
  musicSearch: (params: MusicSearchParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
1053
1076
  musicPic: (params: MusicCommonParams) => Promise<string>
@@ -1056,15 +1079,15 @@ declare global {
1056
1079
  musicPicSearch: (params: PicSearchParams) => Promise<string[]>
1057
1080
  lyricSearch: (params: LyricSearchParams) => Promise<LyricSearchResult[]>
1058
1081
  lyricDetail: (params: LyricDetailParams) => Promise<AnyListen.Music.LyricInfo>
1059
- songlistSearch: (params: SonglistSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1082
+ songlistSearch: (params: CommonSearchParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1060
1083
  songlistSorts: (params: CommonParams) => Promise<AnyListen.Resource.TagItem[]>
1061
1084
  songlistTags: (params: CommonParams) => Promise<SonglistTagResult>
1062
1085
  songlist: (params: SonglistListParams) => Promise<ListCommonResult<AnyListen.Resource.SongListItem>>
1063
1086
  songlistDetail: (params: ListDetailParams) => Promise<SonglistDetailResult>
1064
- leaderboard: (params: CommonParams) => Promise<AnyListen.Resource.TagGroupItem[]>
1065
- leaderboardDate: (params: LeaderboardDateParams) => Promise<AnyListen.Resource.TagItem[]>
1066
- leaderboardDetail: (params: LeaderboardDetailParams) => Promise<ListCommonResult<AnyListen.Music.MusicInfoOnline>>
1067
- musicComment: (params: MusicCommentParams) => Promise<ListCommonResult<MusicComment>>
1087
+ topSongs: (params: CommonParams) => Promise<AnyListen.Resource.TopSongsItem[]>
1088
+ topSongsDate: (params: TopSongsDateParams) => Promise<AnyListen.Resource.TagItem[]>
1089
+ topSongsDetail: (params: TopSongsDetailParams) => Promise<TopSongsDetailResult>
1090
+ musicComment: (params: MusicCommentParams) => Promise<ListCommonResult<AnyListen.Resource.MusicCommentItem>>
1068
1091
  }
1069
1092
 
1070
1093
  interface BackupDataAction {
@@ -1099,7 +1122,20 @@ declare global {
1099
1122
  key: Uint8Array | string,
1100
1123
  iv: Uint8Array | string
1101
1124
  ) => Promise<string>
1125
+ aesDecrypt: <T extends 'base64' | 'binary' | 'utf-8' = 'binary'>(
1126
+ mode: AES_MODE,
1127
+ data: Uint8Array | string,
1128
+ key: Uint8Array | string,
1129
+ iv: Uint8Array | string,
1130
+ encoding?: T
1131
+ ) => Promise<T extends 'binary' ? Uint8Array : string>
1102
1132
  rsaEncrypt: (mode: RSA_PADDING, data: Uint8Array, key: Uint8Array) => Promise<string>
1133
+ rsaDecrypt: <T extends 'base64' | 'binary' | 'utf-8' = 'binary'>(
1134
+ mode: RSA_PADDING,
1135
+ data: Uint8Array,
1136
+ key: Uint8Array,
1137
+ encoding?: T
1138
+ ) => Promise<T extends 'binary' ? Uint8Array : string>
1103
1139
  randomBytes: (size: number) => Promise<Uint8Array>
1104
1140
  md5: (text: string | Uint8Array) => Promise<string>
1105
1141
  sha1: (text: string | Uint8Array) => Promise<string>