Compare commits

..

377 Commits

Author SHA1 Message Date
bggRGjQaUbCoE
2ddfea5cf3 fix: webview params
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 15:37:19 +08:00
bggRGjQaUbCoE
79aee2fdd9 opt: view note
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 15:13:11 +08:00
bggRGjQaUbCoE
5dc8b8e54f feat: fav article page
Closes #402

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 14:41:13 +08:00
bggRGjQaUbCoE
72fa9c51f0 feat: fav pgc page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 13:45:14 +08:00
bggRGjQaUbCoE
6ea8ffea7a opt: note
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 11:24:39 +08:00
bggRGjQaUbCoE
eea5257da2 fix: only play audio
related #558

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 10:05:43 +08:00
bggRGjQaUbCoE
385cffefb8 fix(dep): downgrade media-kit
Closes #543
Closes #546
Closes #551
Closes #558

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 10:00:30 +08:00
bggRGjQaUbCoE
347420c531 feat: del note
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-29 09:53:02 +08:00
bggRGjQaUbCoE
cc774015f9 feat: fav note page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 22:35:38 +08:00
bggRGjQaUbCoE
da3f64feab refa: fav page [wip]
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 18:38:31 +08:00
My-Responsitories
76d031e8d1 feat: parallel upload & download image (#556)
* feat: parallel upload file

* feat: parallel download file
2025-03-28 10:30:15 +00:00
bggRGjQaUbCoE
25995b0ed6 fix: #555
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 17:46:45 +08:00
bggRGjQaUbCoE
3cdd40a710 feat: create note
related #554

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 17:32:27 +08:00
bggRGjQaUbCoE
f36f8d69fc refa: subtitle
Closes #553

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 16:13:21 +08:00
bggRGjQaUbCoE
5655e6ccdf opt: article report
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 11:06:00 +08:00
bggRGjQaUbCoE
49fff821b1 feat: live/article report
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 10:57:54 +08:00
bggRGjQaUbCoE
3b34cecdcd mod: set pos
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-28 10:09:11 +08:00
My-Responsitories
3693d6c350 change status api (#552) 2025-03-28 01:57:50 +00:00
bggRGjQaUbCoE
54cb1a6fc0 fix: #547
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 21:54:45 +08:00
bggRGjQaUbCoE
ab7b1524b6 opt: show dm
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 21:18:17 +08:00
bggRGjQaUbCoE
2b4a27076c fix: #344
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 20:59:35 +08:00
bggRGjQaUbCoE
63a7fa95f5 fix: pip aspectRatio
related #543

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 20:44:18 +08:00
bggRGjQaUbCoE
a15b932a69 opt: query dm
Closes #544

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 20:03:41 +08:00
bggRGjQaUbCoE
3a6b6614a4 opt: video tool bar
Closes #528

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 15:43:11 +08:00
bggRGjQaUbCoE
6ff83e34f3 opt: sort fav
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 14:47:40 +08:00
bggRGjQaUbCoE
e4cadc5a40 chore: update dep
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 13:50:33 +08:00
bggRGjQaUbCoE
907d37dd4c mod: whisper: show article_card
ref orz12/main

Closes #540

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 11:10:40 +08:00
bggRGjQaUbCoE
00d30313af opt: video widget
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-27 10:59:16 +08:00
bggRGjQaUbCoE
950dd82e3c fix: sort fav
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 23:40:03 +08:00
bggRGjQaUbCoE
c53c3a387c fix: #539
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 23:32:57 +08:00
bggRGjQaUbCoE
5d0b2dc8e3 feat: custom app font weight
Closes #533

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 21:42:57 +08:00
bggRGjQaUbCoE
f5e9375917 mod: update qa when switching
Closes #437

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 20:40:38 +08:00
bggRGjQaUbCoE
cdfab7a7db chore: update dep
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 19:02:24 +08:00
bggRGjQaUbCoE
f3e6a59e4f chore: upgrade deps
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 17:21:41 +08:00
bggRGjQaUbCoE
239c9ca2a7 mod: top or refresh debounce
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 16:39:52 +08:00
bggRGjQaUbCoE
becb566ca8 feat: sort fav
Closes #530

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 16:21:28 +08:00
bggRGjQaUbCoE
aa378d924b opt: post segments
Closes #531

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 12:10:55 +08:00
bggRGjQaUbCoE
812f351ddd opt: intro: queryUserStat
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-26 12:10:55 +08:00
My-Responsitories
b9adf26ee0 opt: model & feat: filter play (#529)
* opt: model

* opt: model

* feat: filter play
2025-03-25 14:45:30 +00:00
bggRGjQaUbCoE
018cd058ca opt: set playback speed
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 21:19:11 +08:00
bggRGjQaUbCoE
cd3385be63 opt: only play audio
Closes #519

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 18:25:12 +08:00
bggRGjQaUbCoE
d4e4813c78 feat: static dm duration
Closes #479

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 17:47:11 +08:00
My-Responsitories
8030912087 Revert "fix: mixinKeyEncTab" (#527)
This reverts commit 0f78669faf.
2025-03-25 17:03:15 +08:00
bggRGjQaUbCoE
4879701008 opt: up panel
Closes #513

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 16:49:27 +08:00
bggRGjQaUbCoE
6ab8e5925e mod: remove maxConnectionsPerHost
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 15:36:52 +08:00
bggRGjQaUbCoE
52dda9964c opt: queryFollowUp
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 15:15:19 +08:00
bggRGjQaUbCoE
1825329236 fix: SetSwitchItem
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 14:52:11 +08:00
bggRGjQaUbCoE
60a650f798 fix: #526
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 14:38:12 +08:00
bggRGjQaUbCoE
0f78669faf fix: mixinKeyEncTab
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 14:13:09 +08:00
bggRGjQaUbCoE
015309b3dc opt: main: anim to top
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 14:06:19 +08:00
My-Responsitories
a74edd22c1 feat: refresh on top (#524)
* feat: refresh on top

* check ctr client

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>

---------

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-25 13:46:38 +08:00
My-Responsitories
7a6085e923 refa: video model (#523) 2025-03-25 02:12:44 +00:00
bggRGjQaUbCoE
bf464994df opt: video progressbar
Closes #507
Closes #514

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 21:29:32 +08:00
bggRGjQaUbCoE
a611a88f69 opt: post segment
Closes #483

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 21:10:10 +08:00
bggRGjQaUbCoE
025b5c8e6d mod: search history
Closes #488

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 21:10:10 +08:00
bggRGjQaUbCoE
d37685f7cf opt: member page: show uname
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 21:10:10 +08:00
My-Responsitories
10a22b5186 opt: stat widget (#520) 2025-03-24 13:09:11 +00:00
bggRGjQaUbCoE
d9a74c43dc fix: del history
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 20:06:59 +08:00
bggRGjQaUbCoE
90c8aeb05d mod: history: full type
Closes #473

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 19:10:02 +08:00
bggRGjQaUbCoE
34f63612a4 fix: #517
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 14:29:54 +08:00
bggRGjQaUbCoE
edfa9a8dd1 mod: live: only play audio
Closes #465

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 14:07:42 +08:00
bggRGjQaUbCoE
95fa19f121 opt: dm widget
Closes #160
Closes #515

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 13:44:54 +08:00
bggRGjQaUbCoE
79d0d314f5 fix: #516
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 13:12:36 +08:00
bggRGjQaUbCoE
ddbf168c87 chore: update dm dep
Closes #511

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 11:37:02 +08:00
bggRGjQaUbCoE
0eee8bbac2 mod: def hwdec
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 10:50:51 +08:00
bggRGjQaUbCoE
92f02b5943 fix: search
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 10:20:43 +08:00
bggRGjQaUbCoE
f110c2a55f fix: fav search
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 10:16:01 +08:00
bggRGjQaUbCoE
8ddf42fff1 opt: switch btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-24 00:19:25 +08:00
My-Responsitories
d2c34d64c3 fix #510 2025-03-23 23:17:18 +08:00
bggRGjQaUbCoE
2341027972 mod: show switch btn when playall
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 22:19:13 +08:00
bggRGjQaUbCoE
006c9301d9 fix: follow staff
related #481

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 21:53:26 +08:00
bggRGjQaUbCoE
1f8955d0b3 opt: prev/next play
Closes #506

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 21:47:12 +08:00
bggRGjQaUbCoE
5a758ebb3a opt: play all
Closes #503

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 20:49:29 +08:00
bggRGjQaUbCoE
97bef56006 mod: live qa
Closes #464

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 20:35:16 +08:00
bggRGjQaUbCoE
96ba36ed67 fix: def subtitle stroke
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 20:34:59 +08:00
My-Responsitories
edf84fcc8f opt: blacklist (#501) 2025-03-23 11:13:07 +00:00
bggRGjQaUbCoE
a8428e52d2 opt: save subtitle
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 17:03:56 +08:00
bggRGjQaUbCoE
fd8559228e feat: save subtitle
Closes #495

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 16:27:38 +08:00
My-Responsitories
d6587cf3b6 feat: logout (#497)
* feat: logout

* update api type
2025-03-23 13:46:26 +08:00
My-Responsitories
7c3e3cb1f8 some fixes (#498)
* nologin reject headtbeat

* fix: change anonymity

* use account as key
2025-03-23 13:46:04 +08:00
bggRGjQaUbCoE
9d0ac30fad feat: follow staff
Closes #481

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 13:40:44 +08:00
bggRGjQaUbCoE
68d11d7638 feat: custom subtitle fontweight
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-23 12:19:25 +08:00
My-Responsitories
3881b3dc74 feat: retry before sending (#489)
* feat: retry before sending

* reduce idleTimeout
2025-03-23 12:09:11 +08:00
My-Responsitories
99b14d0f0e opt: danmaku filter (#486) 2025-03-23 12:07:57 +08:00
My-Responsitories
066f3d4132 some fix (#480)
* fix dislikeVideo

* fix profile update

* show login toast
2025-03-23 12:06:34 +08:00
My-Responsitories
b15fdfa2ff feat: account manager (#468)
* feat: account manager

* remove dep

* some fixes

* migrate accounts

* reimplement clearCookie
2025-03-19 13:19:32 +08:00
bggRGjQaUbCoE
94fa0652ac fix: #470
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-17 18:34:49 +08:00
bggRGjQaUbCoE
5c54e131ba opt: loadingwidget
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-17 14:00:11 +08:00
bggRGjQaUbCoE
1fc85fd618 mod: medialist: del btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-17 13:59:47 +08:00
bggRGjQaUbCoE
e1c561b613 fix: #467
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-17 00:45:35 +08:00
bggRGjQaUbCoE
950620bf9e opt: dyn panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 21:26:37 +08:00
bggRGjQaUbCoE
ae7a1e2373 mod: dyn: show medialist type
Closes #462

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 20:50:04 +08:00
bggRGjQaUbCoE
bddeb72d9b fix: medialist: del btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 18:44:32 +08:00
bggRGjQaUbCoE
b99cf4f629 opt: playall
Closes #450

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 18:19:22 +08:00
bggRGjQaUbCoE
b07cf62bdd mod: medialist: show del btn
Closes #451

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 16:36:43 +08:00
bggRGjQaUbCoE
57d2d3f5d9 fix: video page theme
mod: popscope

related #459

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 15:33:55 +08:00
My-Responsitories
7854c5e6b9 split report dialog (#460) 2025-03-16 13:34:04 +08:00
bggRGjQaUbCoE
0b8e95477c mod: handle show viewpoints btn
Closes #457

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-16 11:22:20 +08:00
dom
c2e9a7deb3 Update 功能请求.yml 2025-03-16 10:38:47 +08:00
bggRGjQaUbCoE
361a6a4c1d fix: get args
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-15 19:55:47 +08:00
bggRGjQaUbCoE
8eca9a6644 opt: live: msg bg
Closes #448

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-15 16:19:09 +08:00
bggRGjQaUbCoE
0770f325ab feat: subtitle stroke
Closes #446

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-15 15:46:07 +08:00
bggRGjQaUbCoE
98d52760b3 mod: pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-15 15:27:16 +08:00
bggRGjQaUbCoE
0ebe976b8a mod: custom enableSlideVolumeBrightness
Closes #439

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-14 19:47:22 +08:00
bggRGjQaUbCoE
21fe0ef288 mod: search from tag
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-14 12:19:30 +08:00
bggRGjQaUbCoE
28ef1890d1 fix: #438
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-13 22:08:06 +08:00
bggRGjQaUbCoE
d6f238c720 fix: get sortField
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-13 22:07:32 +08:00
bggRGjQaUbCoE
44bf9dd9e1 opt: dyn panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-13 13:49:39 +08:00
bggRGjQaUbCoE
e357da5162 opt: dyn panel
Closes #436

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-13 12:27:36 +08:00
bggRGjQaUbCoE
c296aa036a fix: img preview quality
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-13 11:54:22 +08:00
bggRGjQaUbCoE
12c46f938d mod: split dm/sub settings, add reset btn
Closes #223
Closes #361

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-12 18:27:08 +08:00
bggRGjQaUbCoE
b4412f5b37 opt: some widgets
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-12 16:45:21 +08:00
bggRGjQaUbCoE
5f2ac0d59b fix: ctr tag
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-12 09:37:10 +08:00
bggRGjQaUbCoE
2a73725455 opt: live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 22:25:13 +08:00
bggRGjQaUbCoE
a8725e64ee opt: live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 21:51:16 +08:00
bggRGjQaUbCoE
727ae8cd2b opt: live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 21:35:47 +08:00
bggRGjQaUbCoE
714f288170 opt: live room
Closes #427

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 21:10:37 +08:00
bggRGjQaUbCoE
3da64d2641 fix: share video
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 14:29:05 +08:00
My-Responsitories
2556290a6e fix #424 2025-03-11 14:11:13 +08:00
bggRGjQaUbCoE
66b547a904 fix: #424
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 13:59:58 +08:00
bggRGjQaUbCoE
c1ab273478 opt: video: long press
Closes #423

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 13:54:31 +08:00
bggRGjQaUbCoE
4aa3d5f273 opt: video sheet
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 13:44:24 +08:00
bggRGjQaUbCoE
a6a1de169b fix: video theme, view later
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 11:54:44 +08:00
bggRGjQaUbCoE
af6188be77 opt: live room bg
Closes #422

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-11 11:54:17 +08:00
bggRGjQaUbCoE
bd39de2109 opt: video dialog
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 23:56:51 +08:00
bggRGjQaUbCoE
33375aeb7d feat: dark video page
Closes #420

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 23:33:33 +08:00
bggRGjQaUbCoE
fafe6c1e91 opt: video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 21:40:59 +08:00
bggRGjQaUbCoE
68b072bf44 mod: remove unused import
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 20:19:43 +08:00
My-Responsitories
99cdec62a1 view later (#419) 2025-03-10 18:46:07 +08:00
bggRGjQaUbCoE
59797a2f5f mod: jump from invalid fav item
Closes #416

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 16:52:54 +08:00
bggRGjQaUbCoE
5cc661e314 opt: video width
Closes #417

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 15:54:38 +08:00
bggRGjQaUbCoE
2ce79d21b5 opt: view invalid user space
Closes #414

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 15:14:36 +08:00
bggRGjQaUbCoE
b75fda3596 mod: common ctr
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-10 11:12:52 +08:00
bggRGjQaUbCoE
2efa6f4ace mod: jump from cvid
Closes #405

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 21:42:47 +08:00
bggRGjQaUbCoE
95e50e436b mod: option show dyn actionbar
Closes #412

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 21:22:19 +08:00
bggRGjQaUbCoE
35a53bc8ac mod: option shrink video
Closes #410

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 21:00:24 +08:00
bggRGjQaUbCoE
58c16ef52e chore: add episode info api
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 20:49:53 +08:00
bggRGjQaUbCoE
847ac80d5f opt: viewpoints page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 10:09:54 +08:00
bggRGjQaUbCoE
0408b27ca5 mod: check reply manually
Closes #407

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-09 09:50:06 +08:00
My-Responsitories
2949adbbfd fix: msg_feed insert type error (#411)
* fix: msg_feed insert type error

* jump to dyn secondary reply
2025-03-09 09:49:16 +08:00
dom
2f616ba237 Update and rename 功能请求.md to 功能请求.yml 2025-03-08 20:01:16 +08:00
dom
b50ead327c Update and rename bug-反馈.md to bug-反馈.yml 2025-03-08 19:56:06 +08:00
bggRGjQaUbCoE
2fe0f43cb6 fix: #404
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-08 08:33:03 +08:00
bggRGjQaUbCoE
b85413be9b opt: video bg
Closes #397

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-07 15:04:16 +08:00
bggRGjQaUbCoE
c88776c4a0 mod: try-catch nextplay
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-07 11:51:20 +08:00
My-Responsitories
b7cb977f2b remove duplicated code (#396)
* remove duplicated code

* partical revert

---------

Co-authored-by: dom <githubaccount56556@proton.me>
2025-03-07 11:49:46 +08:00
bggRGjQaUbCoE
3048e36d2f mod: requery dm
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 16:27:51 +08:00
bggRGjQaUbCoE
64f37fa743 opt: triple
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 13:52:37 +08:00
bggRGjQaUbCoE
737b7d0507 fix: numformat
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 13:32:44 +08:00
bggRGjQaUbCoE
973dad4176 fix: video header
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 12:26:34 +08:00
bggRGjQaUbCoE
46110adb8f fix: #391
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 12:06:00 +08:00
bggRGjQaUbCoE
b5c7ed1c34 opt: video: check title width
Closes #206

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 11:58:39 +08:00
bggRGjQaUbCoE
86678ec15a opt: triple
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 11:03:58 +08:00
bggRGjQaUbCoE
893fb63a72 mod: video appbar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 10:48:37 +08:00
bggRGjQaUbCoE
3b717cfc58 fix: video minScale
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-06 10:11:10 +08:00
bggRGjQaUbCoE
ed40a91a52 opt: fullscreen triple
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 23:49:03 +08:00
bggRGjQaUbCoE
8b1bec6ed2 mod: blacklist item
Closes #390

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 23:02:32 +08:00
bggRGjQaUbCoE
a6a3476cb2 mod: video minScale
Closes #388

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 22:48:01 +08:00
bggRGjQaUbCoE
fac3c19d3f mod: show fullscreen action item
Closes #367

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 21:50:26 +08:00
bggRGjQaUbCoE
dc1451c3af opt: at me item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 17:57:51 +08:00
bggRGjQaUbCoE
08b0a93064 mod: msg top: show time
Closes #387

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 17:39:09 +08:00
bggRGjQaUbCoE
72dd0b9e81 opt: report panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 17:04:16 +08:00
bggRGjQaUbCoE
8236b93717 mod: msg top item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 17:01:22 +08:00
My-Responsitories
c4c5eee2eb fix banUid (#386) 2025-03-05 17:01:08 +08:00
My-Responsitories
5cc9c59c76 report panel (#385) 2025-03-05 15:42:04 +08:00
bggRGjQaUbCoE
bf4ecc85dd mod: article req
Closes #305

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 14:25:54 +08:00
bggRGjQaUbCoE
da5c2148ad opt: horizontal image view
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 13:42:35 +08:00
bggRGjQaUbCoE
bfcea11320 opt: dyndetail/html ctr listener
related #305

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 13:22:06 +08:00
bggRGjQaUbCoE
ed19e13630 fix: video appbar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 11:23:51 +08:00
bggRGjQaUbCoE
6497fb6cd0 mod: common slide page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 10:45:02 +08:00
bggRGjQaUbCoE
9c21f03df8 opt: tabbar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-05 00:04:38 +08:00
bggRGjQaUbCoE
7667e73d9d fix: #383
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 23:38:38 +08:00
bggRGjQaUbCoE
ff2ed0421c mod: pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 22:32:09 +08:00
bggRGjQaUbCoE
56c5ad360a mod: more slide dismiss pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 20:35:15 +08:00
bggRGjQaUbCoE
ef644d2837 fix: #381
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 20:34:45 +08:00
bggRGjQaUbCoE
4642eda98d refa: msg top page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 14:37:58 +08:00
bggRGjQaUbCoE
8ef163dd38 mod: refresh
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 12:06:50 +08:00
bggRGjQaUbCoE
5986add7dd feat: show video note list
Closes #376

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 11:42:41 +08:00
bggRGjQaUbCoE
c990cf1660 mod: progressbar
Closes #379

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-04 09:37:10 +08:00
bggRGjQaUbCoE
76c16c035e mod: show dm merged count
related #359

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-03 21:38:02 +08:00
My-Responsitories
d5a244ce7f update msg api (#375) 2025-03-03 17:23:19 +08:00
bggRGjQaUbCoE
432c5133e6 mod: show clear search history dialog
related #359

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-03 11:40:39 +08:00
bggRGjQaUbCoE
a9f9b324a9 opt: slide gesture
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 13:59:45 +08:00
bggRGjQaUbCoE
4735297285 opt: seek indicator
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 12:13:48 +08:00
bggRGjQaUbCoE
3abff4b9da opt: string ext
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 12:04:13 +08:00
bggRGjQaUbCoE
c32b98fa7f fix: thumbnail image url
Closes #360

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 11:53:51 +08:00
bggRGjQaUbCoE
a605c0fcfb mod: reenable multi seek
Closes #365

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 10:23:45 +08:00
bggRGjQaUbCoE
1e83b4557f mod: extra jump to reply
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 00:47:02 +08:00
bggRGjQaUbCoE
c3d729fc77 mod: scheme: jump to reply
Closes #362

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-02 00:39:39 +08:00
bggRGjQaUbCoE
00ea891784 fix: clear audio noti
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 17:53:24 +08:00
bggRGjQaUbCoE
c98dbccbd7 fix: #359
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 16:40:40 +08:00
bggRGjQaUbCoE
4a68122c31 opt: live bottom control
Closes #349

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 13:52:26 +08:00
bggRGjQaUbCoE
9c4a52de87 opt: video toolbar icon
Closes #329

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 13:32:54 +08:00
bggRGjQaUbCoE
6c11140f43 fix: #352
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 09:36:41 +08:00
bggRGjQaUbCoE
11398ca64b opt: handle response
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-03-01 09:36:41 +08:00
bggRGjQaUbCoE
312ce6e639 opt: pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 21:54:53 +08:00
bggRGjQaUbCoE
139b48c457 opt: dm widget
Closes #350

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 21:47:42 +08:00
bggRGjQaUbCoE
f1f478e193 fix: live: show statusbar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 21:47:42 +08:00
bggRGjQaUbCoE
1abaf3db3f fix: #343
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 21:47:42 +08:00
bggRGjQaUbCoE
f6bfbc3ed6 mod: video sheet panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 20:20:39 +08:00
bggRGjQaUbCoE
d2890d72e5 fix: #341 #343 #339
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 17:48:04 +08:00
bggRGjQaUbCoE
5c029c8f64 Revert "opt: video page"
This reverts commit 82030b8d06.
2025-02-28 17:30:50 +08:00
bggRGjQaUbCoE
c37a631df2 fix: #345
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 15:57:31 +08:00
bggRGjQaUbCoE
82030b8d06 opt: video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 15:36:39 +08:00
bggRGjQaUbCoE
e362f75dac opt: slide gesture
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 13:10:14 +08:00
bggRGjQaUbCoE
3fecf7c0a4 fix: #339
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 11:26:03 +08:00
bggRGjQaUbCoE
801043468d fix: getPlayerKey
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 10:16:02 +08:00
bggRGjQaUbCoE
1b4f588671 fix: #339 #341
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 10:05:27 +08:00
bggRGjQaUbCoE
7ad48570f0 mod: fullscreen debounce
Closes #340

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-28 00:37:57 +08:00
bggRGjQaUbCoE
5b8c68303f fix: #337
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 23:52:54 +08:00
bggRGjQaUbCoE
87d3d0ca14 fix: video page v
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 21:28:14 +08:00
bggRGjQaUbCoE
b330440371 fix: video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 21:00:49 +08:00
bggRGjQaUbCoE
2a173ef804 fix: #334
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 20:06:46 +08:00
bggRGjQaUbCoE
bceabae06f fix: video play
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 19:05:57 +08:00
bggRGjQaUbCoE
69667c135d feat: slide to dismiss subreply page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 18:05:34 +08:00
bggRGjQaUbCoE
587870ad71 fix: player key
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 16:52:33 +08:00
bggRGjQaUbCoE
609fab345a fix: video page v
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 16:26:54 +08:00
bggRGjQaUbCoE
29c47cee78 fix: #333
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 15:51:03 +08:00
bggRGjQaUbCoE
6a9795f561 opt: video page v
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 11:38:44 +08:00
bggRGjQaUbCoE
72e7f0aa9f Revert "fix: #333"
This reverts commit acfa384c0c.
2025-02-27 11:38:43 +08:00
bggRGjQaUbCoE
acfa384c0c fix: #333
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 09:51:21 +08:00
bggRGjQaUbCoE
c2d27ddd04 opt: video page v
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-27 09:28:43 +08:00
My-Responsitories
0a6950e34a enable http2 (#331) 2025-02-26 22:02:19 +08:00
My-Responsitories
1c3d77b95d opt: wbiSign (#332) 2025-02-26 22:01:38 +08:00
bggRGjQaUbCoE
fb11208bbe fix: video toolbar
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 20:23:26 +08:00
bggRGjQaUbCoE
94f05127b6 fix: #330
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 19:53:06 +08:00
bggRGjQaUbCoE
25a3046c3c fix: video page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 18:53:31 +08:00
bggRGjQaUbCoE
f479fc37ba mod: follow tabbarview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 18:36:25 +08:00
bggRGjQaUbCoE
3ee19a8f08 mod: show followed user verif
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 18:27:50 +08:00
bggRGjQaUbCoE
b8d2ad68dd fix: video page v
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 17:43:35 +08:00
dom
8434c488da refa: vertical video page (#328)
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 17:21:24 +08:00
bggRGjQaUbCoE
41f251ad50 fix: dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-26 11:39:56 +08:00
bggRGjQaUbCoE
8e99ff1173 mod: search: show user verf
Closes #322

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 18:27:15 +08:00
bggRGjQaUbCoE
a921b983f5 opt: cancel seek
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 18:03:26 +08:00
bggRGjQaUbCoE
81eeda0a68 mod: video: cancellable slide seek
Closes #319

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 16:53:35 +08:00
bggRGjQaUbCoE
1a54f61355 mod: player: enable long press feedback
Closes #318

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 16:53:01 +08:00
bggRGjQaUbCoE
382cd5b73d mod: error toast
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 15:20:52 +08:00
bggRGjQaUbCoE
e236485bc7 mod: listener
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-25 15:20:52 +08:00
bggRGjQaUbCoE
0e69e23606 mod: video tabbarview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 22:25:37 +08:00
bggRGjQaUbCoE
0ef85f2551 fix: search ctr
related #306

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 21:04:28 +08:00
My-Responsitories
8d3990124e revert genTraceId (#314) 2025-02-24 17:13:15 +08:00
bggRGjQaUbCoE
7f912a1781 mod: refresh
related #306

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 17:10:43 +08:00
bggRGjQaUbCoE
d9ae1dd97a fix: handle grpc response
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 16:31:04 +08:00
bggRGjQaUbCoE
307db51aec mod: filter goods reposted dyn
Closes #309

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 15:00:54 +08:00
My-Responsitories
347a704b54 replace grpc to dio (#313)
* replace grpc to dio

* load danmaku from grpc
2025-02-24 14:55:28 +08:00
My-Responsitories
9e242fb902 remove duplicate code (#312)
* remove duplicate code

* Update login.dart
2025-02-24 14:55:08 +08:00
bggRGjQaUbCoE
192cd60a4f fix: get video progress
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-24 10:31:14 +08:00
bggRGjQaUbCoE
a98d8511d6 Update README.md
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 21:03:05 +08:00
bggRGjQaUbCoE
811b79610c fix: live room
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 18:10:51 +08:00
bggRGjQaUbCoE
14129e8f21 mod: horizontal live room
Closes #62

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 17:15:25 +08:00
bggRGjQaUbCoE
16de044d3d mod: triple
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 15:10:31 +08:00
bggRGjQaUbCoE
e573a8a9c0 mod: fs
related #306

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 14:58:12 +08:00
bggRGjQaUbCoE
108648cabf mod: seek from url
related #208

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 11:28:13 +08:00
bggRGjQaUbCoE
8e4ce07d19 opt: parse scheme
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 11:05:50 +08:00
bggRGjQaUbCoE
09cebd70ae mod: seek from dm
Closes #208

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-23 10:43:35 +08:00
bggRGjQaUbCoE
6a615c408b opt: nav icon color
ref orz12/main
2025-02-22 20:37:51 +08:00
bggRGjQaUbCoE
9ebc054c8c opt: spring
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-22 20:17:38 +08:00
My-Responsitories
b2c520bd91 feat: custom spring (#304) 2025-02-22 17:56:36 +08:00
bggRGjQaUbCoE
6506afa732 mod: add expand dyn live panel option
Closes #302

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-22 16:35:25 +08:00
bggRGjQaUbCoE
d1c74b9389 Revert "mod: set user-agent"
This reverts commit 4c56fcd6a8.
2025-02-22 16:10:11 +08:00
bggRGjQaUbCoE
61ca7bc1cb opt: horizontal preview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-22 12:08:36 +08:00
bggRGjQaUbCoE
f94cb2a4b5 opt: pages
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 21:27:19 +08:00
bggRGjQaUbCoE
4c56fcd6a8 mod: set user-agent
Closes #299

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 20:56:15 +08:00
bggRGjQaUbCoE
d5bb2ec165 opt: del fav folder
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 18:20:08 +08:00
bggRGjQaUbCoE
27bc68f264 opt: follow page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 18:18:16 +08:00
bggRGjQaUbCoE
516eed76b7 mod: video sheet
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 18:04:31 +08:00
bggRGjQaUbCoE
4190c17cdc fix: #295
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 17:43:50 +08:00
bggRGjQaUbCoE
3d0fedfb61 mod: convert forEach
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 11:39:32 +08:00
bggRGjQaUbCoE
9d57deffb4 fix: filter dm midhash
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-21 11:17:54 +08:00
My-Responsitories
cc1951c721 fix regex & use set in uid (#296)
* fix regex count & use set in uid

* fix regex
2025-02-21 10:42:28 +08:00
bggRGjQaUbCoE
1cd8d4913d fix: #294
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-20 23:15:06 +08:00
bggRGjQaUbCoE
19890e29e9 mod: restore video duration
Closes #293

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-20 21:09:53 +08:00
bggRGjQaUbCoE
f759dba7da opt: filter danmaku
related #283

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-20 18:09:51 +08:00
bggRGjQaUbCoE
fb6f92a70b opt: #284
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-19 16:18:21 +08:00
bggRGjQaUbCoE
f22cad42d7 opt: filter data
Closes #283

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-19 15:42:24 +08:00
My-Responsitories
cfb6c674ea skip mcdn on parsing (#281) 2025-02-19 14:55:02 +08:00
bggRGjQaUbCoE
415c68a570 fix: typo
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-19 12:16:20 +08:00
bggRGjQaUbCoE
15b949bb9c mod: webview jump
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-19 11:42:05 +08:00
bggRGjQaUbCoE
316a9809e4 mod: delay checking dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 22:42:39 +08:00
bggRGjQaUbCoE
3f5aa03056 mod: insert dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 22:03:59 +08:00
bggRGjQaUbCoE
6bc33795a3 feat: create dyn antifraud
Closes #278

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 21:51:09 +08:00
bggRGjQaUbCoE
3191ae27a5 mod: repost panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 18:54:46 +08:00
bggRGjQaUbCoE
b25de52b9e feat: repost video
Closes #279

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 18:28:59 +08:00
bggRGjQaUbCoE
a08b4648d5 mod: try-catch biliSendCommAntifraud
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 17:07:00 +08:00
bggRGjQaUbCoE
e7a7c945de fix: biliSendCommAntifraud
related #275

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-18 15:48:39 +08:00
bggRGjQaUbCoE
571f358280 mod: user search widget
Closes #280

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-17 23:11:16 +08:00
bggRGjQaUbCoE
7ddc3adfaa feat: bili comm antifraud
Closes #275

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-17 21:31:55 +08:00
bggRGjQaUbCoE
957c326148 feat: anti goods reply
Closes #276

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-17 18:49:20 +08:00
bggRGjQaUbCoE
0b246d03a6 feat: anti goods dyn
Closes #277

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-17 18:49:03 +08:00
bggRGjQaUbCoE
5dd3ff32b6 fix: view forwarded dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 22:00:55 +08:00
bggRGjQaUbCoE
a48d262637 mod: show member coin/like archives(web)
Closes #265

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 20:55:41 +08:00
bggRGjQaUbCoE
b5d17b5161 mod: pay coins page
related #245

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 20:34:06 +08:00
bggRGjQaUbCoE
980733ba22 fix: member contribute page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 19:49:39 +08:00
bggRGjQaUbCoE
7043fdc35d mod: debug logout
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 15:09:53 +08:00
bggRGjQaUbCoE
81713a6bc4 mod: article: add action panel
related #235

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 15:00:49 +08:00
bggRGjQaUbCoE
959bcfaa30 mod: keep pgc index page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 13:37:34 +08:00
bggRGjQaUbCoE
fa465f792d opt: video width
Closes #267

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 13:37:34 +08:00
bggRGjQaUbCoE
74bf78b9cd feat: pgc index page
Closes #216

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 13:15:00 +08:00
bggRGjQaUbCoE
8c408e59f6 opt: post segment panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 09:25:33 +08:00
bggRGjQaUbCoE
25d27e42ed fix: #263
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-16 09:22:09 +08:00
bggRGjQaUbCoE
0f2b0cc5f2 Revert "fix: #263"
This reverts commit 84ed34f3a7.
2025-02-16 01:01:01 +08:00
bggRGjQaUbCoE
00ea34f45d opt: video bs
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 23:42:02 +08:00
bggRGjQaUbCoE
ec936c1821 opt: video bs
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 23:00:47 +08:00
bggRGjQaUbCoE
2ff84857e7 refa: video bottom sheet
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 22:19:43 +08:00
bggRGjQaUbCoE
84ed34f3a7 fix: #263
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 21:07:56 +08:00
bggRGjQaUbCoE
f0508e1bc2 mod: disable version check when debug
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 20:40:39 +08:00
bggRGjQaUbCoE
8ea7bf36d7 fix: dyn detail: repost btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 20:22:47 +08:00
bggRGjQaUbCoE
8819461eed mod: dyn detail: add action panel
Closes #235

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 18:04:43 +08:00
bggRGjQaUbCoE
7c30668c87 fix: #261
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 16:41:49 +08:00
bggRGjQaUbCoE
a3424950ca fix: push dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 14:33:58 +08:00
bggRGjQaUbCoE
ebc42eb05e fix: logout
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 14:25:10 +08:00
bggRGjQaUbCoE
fc6ff44471 fix: ai conclusion
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 14:23:15 +08:00
bggRGjQaUbCoE
be03377449 fix: emote
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 13:52:12 +08:00
bggRGjQaUbCoE
e52934093a opt: member tab
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 13:30:50 +08:00
bggRGjQaUbCoE
ebfd98488e mod: show staff verf
Closes #259

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 13:26:08 +08:00
bggRGjQaUbCoE
6a68af77dc mod: member tab
Closes #260

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 13:14:25 +08:00
bggRGjQaUbCoE
e5c0fb7cb2 fix: in-app webview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 12:57:04 +08:00
bggRGjQaUbCoE
d9611cce80 opt: in-app webview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 12:26:44 +08:00
bggRGjQaUbCoE
4b48aba2ae opt: data parse
related #258

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 12:03:43 +08:00
bggRGjQaUbCoE
47fbb6cd0e opt: whisper: msg preview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-15 00:06:35 +08:00
bggRGjQaUbCoE
dae71d427c feat: whisper: revoke msg
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 23:28:48 +08:00
bggRGjQaUbCoE
46bc2ceb78 mod: scheme match
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 21:52:57 +08:00
bggRGjQaUbCoE
6f98200179 mod: whisper pic type
Closes #253

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 21:35:15 +08:00
bggRGjQaUbCoE
a57b4c56a5 fix: #257
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 21:07:56 +08:00
bggRGjQaUbCoE
6c3062ba2d feat: pure black theme
Closes #254

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 16:10:22 +08:00
bggRGjQaUbCoE
064c8a9dfe mod: page observer
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-14 11:15:50 +08:00
bggRGjQaUbCoE
7dd47736fb opt: better url pattern
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-13 22:27:16 +08:00
bggRGjQaUbCoE
84cc65489f mod: scheme match
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-13 17:51:52 +08:00
bggRGjQaUbCoE
2b9cb54d91 opt: view from playlist
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-13 17:15:48 +08:00
dom
54c7fef217 opt: jump url (#246)
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-13 16:53:40 +08:00
bggRGjQaUbCoE
ba74cb8c01 opt: video bottom control
Closes #244

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-13 15:04:44 +08:00
bggRGjQaUbCoE
675932aa69 mod: try-catch some requests
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 22:17:01 +08:00
bggRGjQaUbCoE
d996e0a7dd fix: #240
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 21:52:27 +08:00
bggRGjQaUbCoE
b6279f702a fix: #239
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 20:48:14 +08:00
bggRGjQaUbCoE
695a89b91a opt: view pgc section
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 16:14:59 +08:00
bggRGjQaUbCoE
09753b6bbd fix: #226
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 14:20:16 +08:00
bggRGjQaUbCoE
6502b97388 mod: pgc coin
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 13:24:46 +08:00
bggRGjQaUbCoE
95d84647b7 opt: coin page checkbox
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 12:59:30 +08:00
bggRGjQaUbCoE
8f5065332e fix: intro up verify
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 12:59:23 +08:00
bggRGjQaUbCoE
71c8cbb8da fix: #232
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 12:39:31 +08:00
bggRGjQaUbCoE
3217731486 mod: coin with like
Closes #231

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 12:20:06 +08:00
bggRGjQaUbCoE
a4e63fe0e8 mod: video intro: show detailed owner info
Closes #229

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-12 12:27:29 +08:00
bggRGjQaUbCoE
cdb8f6845c mod: history card menu
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 21:50:59 +08:00
bggRGjQaUbCoE
0a7d286c47 mod: reply2reply header
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 21:14:35 +08:00
bggRGjQaUbCoE
e17fd0071d mod: forwarded live dyn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 21:14:35 +08:00
bggRGjQaUbCoE
a9ba30b9b9 mod: show dyn gif emote
mod: emote tabbar

opt: video progress indicator

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 18:30:01 +08:00
bggRGjQaUbCoE
4267a3b8e0 mod: member archive: show progress
Closes #225

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 17:21:06 +08:00
bggRGjQaUbCoE
50022ae635 fix: whisper: null check
related #217

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 15:20:52 +08:00
bggRGjQaUbCoE
0991621152 mod: dyn action
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 14:53:17 +08:00
bggRGjQaUbCoE
192f8924c8 fix: #217
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 14:07:43 +08:00
bggRGjQaUbCoE
51a12d7266 mod: minor tweaks
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-11 12:05:21 +08:00
bggRGjQaUbCoE
1417fcda6e fix: seek anim
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 21:33:57 +08:00
bggRGjQaUbCoE
6114e6f033 opt: restore scale btn
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 19:58:44 +08:00
bggRGjQaUbCoE
bc2dbc59ce mod: video scale set
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 18:51:41 +08:00
bggRGjQaUbCoE
7c5075413e mod: add restore video scale button
related #222

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 18:31:22 +08:00
bggRGjQaUbCoE
52175b0b69 mod: show reply gif emote
Closes #212

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 16:22:48 +08:00
bggRGjQaUbCoE
f0a3515279 opt: search aid/bvid
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 13:46:41 +08:00
bggRGjQaUbCoE
3c2ccf7d40 mod: check av/bv search
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 13:31:50 +08:00
bggRGjQaUbCoE
abd01e1a27 fix: reply cv jump
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 13:14:40 +08:00
bggRGjQaUbCoE
0f63976a00 mod: reply jump
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 12:04:13 +08:00
bggRGjQaUbCoE
6817eb6e56 fix: reply jump url
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 11:13:55 +08:00
bggRGjQaUbCoE
a951d42623 mod: web down
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-10 11:13:54 +08:00
bggRGjQaUbCoE
8f5c2bf3ba mod: dyn article: show block type
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 22:47:31 +08:00
bggRGjQaUbCoE
7744217d17 mod: grpc reply: jump to vote
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 20:59:58 +08:00
bggRGjQaUbCoE
a84c153bdd fix: later request
log #214

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 18:35:01 +08:00
bggRGjQaUbCoE
31a0a90ba4 mod: reply2relpy header
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 15:43:57 +08:00
bggRGjQaUbCoE
383ce777e3 mod: webview: handle download request
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 10:44:46 +08:00
bggRGjQaUbCoE
e7ac88ffb1 opt: reply2reply header
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 09:36:26 +08:00
bggRGjQaUbCoE
9657c77999 mod: push article
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 09:36:26 +08:00
bggRGjQaUbCoE
afd508f28b opt: persistent header
Closes #211

ref pilipala

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-09 00:25:25 +08:00
bggRGjQaUbCoE
634612c1a2 fix: article
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-08 23:50:17 +08:00
bggRGjQaUbCoE
76545397d4 mod: video push
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-08 23:22:25 +08:00
bggRGjQaUbCoE
d2f586a7f1 fix: push bangumi
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-08 23:08:58 +08:00
bggRGjQaUbCoE
7cfebcb6ed opt: webview to video
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-08 22:56:43 +08:00
bggRGjQaUbCoE
9a3766e7b7 opt: webview to video
Closes #209

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-08 21:41:19 +08:00
bggRGjQaUbCoE
588a06bece opt: article content
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-07 17:40:45 +08:00
bggRGjQaUbCoE
e45a126862 fix: handleWebview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-02-07 16:39:33 +08:00
340 changed files with 25867 additions and 17645 deletions

View File

@@ -1,23 +0,0 @@
---
name: Bug 反馈
about: 描述你所遇到的bug
title: "[Bug] "
labels: bug
assignees: ''
---
### 问题描述
请提供一个清晰而简明的问题描述。
### 复现步骤
请提供复现该问题所需的具体步骤。
### 预期行为
请描述你期望的正确行为或结果。
### 错误日志
请提供设置->关于->错误日志中的内容粘贴在下方代码框中。如果没有请提供您的app版本号、系统版本、设备型号等相关信息。
### 相关信息
请补充截图、录屏、BV号等其他有助于解决问题的信息。

51
.github/ISSUE_TEMPLATE/bug-反馈.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: Bug 反馈
description: 描述你所遇到的bug
labels: [ "bug" ]
title: "[Bug] "
body:
- type: checkboxes
id: checklist
attributes:
label: 检查清单
options:
- label: 之前没有人提交过类似或相同的 bug report。
required: true
- label: 正在使用最新版本。
required: true
- type: textarea
id: bug
attributes:
label: 问题描述
description: 请提供一个清晰而简明的问题描述。
validations:
required: true
- type: textarea
id: steps
attributes:
label: 复现步骤
description: 请提供复现该问题所需的具体步骤。
validations:
required: true
- type: textarea
id: expected
attributes:
label: 预期行为
description: 请描述你期望的正确行为或结果。
validations:
required: true
- type: textarea
id: log
attributes:
label: 错误日志
description: 请提供设置->关于->错误日志中的内容粘贴在下方代码框中。如果没有请提供您的app版本号、系统版本、设备型号等相关信息。
- type: textarea
id: info
attributes:
label: 相关信息
description: 请补充截图、录屏、BV号等其他有助于解决问题的信息。

View File

@@ -1,20 +0,0 @@
---
name: 功能请求
about: 对于功能的一些建议
title: "[FR] "
labels: enhancement
assignees: ''
---
### 功能描述
请提供对所请求功能的清晰描述。
### 目标
请描述你希望通过这个功能实现的目标。
### 解决方案
如果你有任何关于如何实现这个功能的想法或建议,请在这里提供。
### 其他
请提供已实现该功能或类似功能的应用

43
.github/ISSUE_TEMPLATE/功能请求.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: 功能请求
description: 对于功能的一些建议
labels: [ "enhancement" ]
title: "[FR] "
body:
- type: checkboxes
id: checklist
attributes:
label: 检查清单
options:
- label: 之前没有人提交过类似或相同的功能请求。
required: true
- label: 正在使用最新版本。
required: true
- type: textarea
id: desc
attributes:
label: 功能描述
description: 请提供对所请求功能的清晰描述。
validations:
required: true
- type: textarea
id: propose
attributes:
label: 目标
description: 请描述你希望通过这个功能实现的目标。
validations:
required: true
- type: textarea
id: solution
attributes:
label: 解决方案
description: 如果你有任何关于如何实现这个功能的想法或建议,请在这里提供。
- type: textarea
id: addition
attributes:
label: 其他
description: 请提供已实现该功能或类似功能的应用

View File

@@ -47,8 +47,9 @@
## feat
- [x] 屏蔽带货动态/评论
- [x] 互动视频
- [x] 发评反诈
- [x] 发评/动态反诈
- [x] 高能进度条
- [x] 滑动跳转预览视频缩略图
- [x] Live Photo
@@ -84,7 +85,7 @@
- [x] 筛选搜索
- [x] 转发动态
- [x] 合集图片
- [x] 删除/置顶私信
- [x] 删除/置顶/撤回私信
- [x] 举报用户/评论/视频/动态
- [x] 删除/发布文本/图片动态
- [x] 其他

View File

@@ -4,6 +4,7 @@ import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import com.ryanheise.audioservice.AudioServiceActivity
import android.content.ComponentName
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
@@ -21,6 +22,39 @@ class MainActivity : AudioServiceActivity() {
methodChannel.setMethodCallHandler { call, result ->
if (call.method == "back") {
back()
} else if (call.method == "biliSendCommAntifraud") {
try {
val action = call.argument<Int>("action") ?: 0
val oid = call.argument<Number>("oid") ?: 0L
val type = call.argument<Int>("type") ?: 0
val rpid = call.argument<Number>("rpid") ?: 0L
val root = call.argument<Number>("root") ?: 0L
val parent = call.argument<Number>("parent") ?: 0L
val ctime = call.argument<Number>("ctime") ?: 0L
val commentText = call.argument<String>("comment_text") ?: ""
val pictures = call.argument<String?>("pictures")
val sourceId = call.argument<String>("source_id") ?: ""
val uid = call.argument<Number>("uid") ?: 0L
val cookies = call.argument<List<String>>("cookies") ?: emptyList<String>()
val intent = Intent().apply {
component = ComponentName("icu.freedomIntrovert.biliSendCommAntifraud", "icu.freedomIntrovert.biliSendCommAntifraud.ByXposedLaunchedActivity")
putExtra("action", action)
putExtra("oid", oid.toLong())
putExtra("type", type)
putExtra("rpid", rpid.toLong())
putExtra("root", root.toLong())
putExtra("parent", parent.toLong())
putExtra("ctime", ctime.toLong())
putExtra("comment_text", commentText)
if(pictures != null)
putExtra("pictures", pictures)
putExtra("source_id", sourceId)
putExtra("uid", uid.toLong())
putStringArrayListExtra("cookies", ArrayList(cookies))
}
startActivity(intent)
} catch (e: Exception) {}
} else {
result.notImplemented()
}

View File

@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="108dp"
android:width="108dp"
android:height="24dp"
android:width="24dp"
android:viewportWidth="108.0"
android:viewportHeight="108.0">
<path
android:fillColor="#FF5CB67B"
android:pathData="M56,54L39.78,54l2.22,-10.94h14c3.02,0 5.47,2.45 5.47,5.47 0,3.02 -2.45,5.47 -5.47,5.47zM56,35.77h-9.62l-7.13,36.45h7.51L48.92,61.29h7.08c7.05,0 12.76,-5.71 12.76,-12.76 0,-7.05 -5.71,-12.76 -12.76,-12.76z"
android:pathData="M57.54,54L28.82,54l3.93,-19.36h24.78c5.35,0 9.68,4.33 9.68,9.68 0,5.35 -4.33,9.68 -9.68,9.68zM57.54,21.73L40.5,21.73L27.88,86.27h13.3l3.83,-19.36h12.54c12.48,0 22.59,-10.11 22.59,-22.59 0,-12.48 -10.11,-22.59 -22.59,-22.59z"
android:strokeWidth="0.252073"
android:fillType="evenOdd" />
</vector>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/*" />

View File

@@ -18,19 +18,33 @@ subprojects {
afterEvaluate { project ->
if (project.extensions.findByName("android") != null) {
Integer pluginCompileSdk = project.android.compileSdk
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
project.logger.error(
"Warning: Overriding compileSdk version in Flutter plugin: "
+ project.name
+ " from "
+ pluginCompileSdk
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
+ project.name
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
)
project.android {
compileSdk 31
if (pluginCompileSdk != null) {
if (pluginCompileSdk < 31) {
project.logger.error(
"Warning: Overriding compileSdk version in Flutter plugin: "
+ project.name
+ " from "
+ pluginCompileSdk
+ " to 31 (to work around https://issuetracker.google.com/issues/199180389)."
+ "\nIf there is not a new version of " + project.name + ", consider filing an issue against "
+ project.name
+ " to increase their compileSdk to the latest (otherwise try updating to the latest version)."
)
project.android {
compileSdk 31
}
}
if (pluginCompileSdk > 34) {
project.logger.error(
"Warning: Overriding compileSdk version in Flutter plugin: "
+ project.name
+ " from "
+ pluginCompileSdk
+ " to 34"
)
project.android {
compileSdk 34
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -23,246 +23,251 @@ class Constants {
static const String userAgent =
'Mozilla/5.0 BiliDroid/1.46.2 (bbcallen@gmail.com) os/android model/vivo mobi_app/android_hd build/2001100 channel/yingyongbao innerVer/2001100 osVer/14 network/2';
static const String statistics =
'%7B%22appId%22%3A5%2C%22platform%22%3A3%2C%22version%22%3A%221.46.2%22%2C%22abtest%22%3A%22%22%7D';
//Uri.encodeComponent('{"appId": 5,"platform": 3,"version": "1.46.2","abtest": ""}');
'{"appId":5,"platform":3,"version":"1.46.2","abtest":""}';
// 请求时会自动encodeComponent
// 超分辨率滤镜
static const List<String> mpvAnime4KShaders = [
'Anime4K_Clamp_Highlights.glsl',
'Anime4K_Restore_CNN_VL.glsl',
'Anime4K_Upscale_CNN_x2_VL.glsl',
'Anime4K_AutoDownscalePre_x2.glsl',
'Anime4K_AutoDownscalePre_x4.glsl',
'Anime4K_Upscale_CNN_x2_M.glsl'
];
static const urlPattern =
r'https?://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]';
static get goodsUrlPrefix => "https://gaoneng.bilibili.com/tetris";
// 超分辨率滤镜
static List<String> get mpvAnime4KShaders => [
'Anime4K_Clamp_Highlights.glsl',
'Anime4K_Restore_CNN_VL.glsl',
'Anime4K_Upscale_CNN_x2_VL.glsl',
'Anime4K_AutoDownscalePre_x2.glsl',
'Anime4K_AutoDownscalePre_x4.glsl',
'Anime4K_Upscale_CNN_x2_M.glsl'
];
// 超分辨率滤镜 (轻量)
static const List<String> mpvAnime4KShadersLite = [
'Anime4K_Clamp_Highlights.glsl',
'Anime4K_Restore_CNN_M.glsl',
'Anime4K_Restore_CNN_S.glsl',
'Anime4K_Upscale_CNN_x2_M.glsl',
'Anime4K_AutoDownscalePre_x2.glsl',
'Anime4K_AutoDownscalePre_x4.glsl',
'Anime4K_Upscale_CNN_x2_S.glsl'
];
static List<String> get mpvAnime4KShadersLite => [
'Anime4K_Clamp_Highlights.glsl',
'Anime4K_Restore_CNN_M.glsl',
'Anime4K_Restore_CNN_S.glsl',
'Anime4K_Upscale_CNN_x2_M.glsl',
'Anime4K_AutoDownscalePre_x2.glsl',
'Anime4K_AutoDownscalePre_x4.glsl',
'Anime4K_Upscale_CNN_x2_S.glsl'
];
//内容来自 https://passport.bilibili.com/web/generic/country/list
static const List<Map<String, dynamic>> internationalDialingPrefix = [
{"id": 1, "cname": "中国大陆", "country_id": "86"},
{"id": 5, "cname": "中国香港特别行政区", "country_id": "852"},
{"id": 2, "cname": "中国澳门特别行政区", "country_id": "853"},
{"id": 3, "cname": "中国台湾", "country_id": "886"},
{"id": 4, "cname": "美国", "country_id": "1"},
{"id": 6, "cname": "比利时", "country_id": "32"},
{"id": 7, "cname": "澳大利亚", "country_id": "61"},
{"id": 8, "cname": "法国", "country_id": "33"},
{"id": 9, "cname": "加拿大", "country_id": "1"},
{"id": 10, "cname": "日本", "country_id": "81"},
{"id": 11, "cname": "新加坡", "country_id": "65"},
{"id": 12, "cname": "韩国", "country_id": "82"},
{"id": 13, "cname": "马来西亚", "country_id": "60"},
{"id": 14, "cname": "英国", "country_id": "44"},
{"id": 15, "cname": "意大利", "country_id": "39"},
{"id": 16, "cname": "德国", "country_id": "49"},
{"id": 18, "cname": "俄罗斯", "country_id": "7"},
{"id": 19, "cname": "新西兰", "country_id": "64"}, //common:1-19
{"id": 153, "cname": "瓦利斯群岛和富图纳群岛", "country_id": "1681"},
{"id": 152, "cname": "葡萄牙", "country_id": "351"},
{"id": 151, "cname": "帕劳", "country_id": "680"},
{"id": 150, "cname": "诺福克岛", "country_id": "672"},
{"id": 149, "cname": "挪威", "country_id": "47"},
{"id": 148, "cname": "纽埃岛", "country_id": "683"},
{"id": 147, "cname": "尼日利亚", "country_id": "234"},
{"id": 146, "cname": "尼日尔", "country_id": "227"},
{"id": 145, "cname": "尼加拉瓜", "country_id": "505"},
{"id": 144, "cname": "尼泊尔", "country_id": "977"},
{"id": 143, "cname": "瑙鲁", "country_id": "674"},
{"id": 154, "cname": "格鲁吉亚", "country_id": "995"},
{"id": 155, "cname": "瑞典", "country_id": "46"},
{"id": 165, "cname": "沙特阿拉伯", "country_id": "966"},
{"id": 164, "cname": "桑给巴尔岛", "country_id": "259"},
{"id": 163, "cname": "塞舌尔共和国", "country_id": "248"},
{"id": 162, "cname": "塞浦路斯", "country_id": "357"},
{"id": 161, "cname": "塞内加尔", "country_id": "221"},
{"id": 160, "cname": "塞拉利昂", "country_id": "232"},
{"id": 159, "cname": "萨摩亚,东部", "country_id": "684"},
{"id": 158, "cname": "萨摩亚,西部", "country_id": "685"},
{"id": 157, "cname": "萨尔瓦多", "country_id": "503"},
{"id": 156, "cname": "瑞士", "country_id": "41"},
{"id": 166, "cname": "圣多美和普林西比", "country_id": "239"},
{"id": 142, "cname": "塞尔维亚", "country_id": "381"},
{"id": 141, "cname": "南非", "country_id": "27"},
{"id": 128, "cname": "毛里塔尼亚", "country_id": "222"},
{"id": 127, "cname": "毛里求斯", "country_id": "230"},
{"id": 126, "cname": "马歇尔岛", "country_id": "692"},
{"id": 125, "cname": "马提尼克岛", "country_id": "596"},
{"id": 124, "cname": "马其顿", "country_id": "389"},
{"id": 123, "cname": "马里亚纳岛", "country_id": "1670"},
{"id": 122, "cname": "马里", "country_id": "223"},
{"id": 121, "cname": "马拉维", "country_id": "265"},
{"id": 120, "cname": "马耳他", "country_id": "356"},
{"id": 119, "cname": "马尔代夫", "country_id": "960"},
{"id": 129, "cname": "蒙古", "country_id": "976"},
{"id": 130, "cname": "蒙特塞拉特岛", "country_id": "1664"},
{"id": 140, "cname": "纳米比亚", "country_id": "264"},
{"id": 139, "cname": "墨西哥", "country_id": "52"},
{"id": 138, "cname": "莫桑比克", "country_id": "258"},
{"id": 137, "cname": "摩纳哥", "country_id": "377"},
{"id": 136, "cname": "摩洛哥", "country_id": "212"},
{"id": 135, "cname": "摩尔多瓦", "country_id": "373"},
{"id": 134, "cname": "缅甸", "country_id": "95"},
{"id": 133, "cname": "密克罗尼西亚", "country_id": "691"},
{"id": 132, "cname": "秘鲁", "country_id": "51"},
{"id": 131, "cname": "孟加拉国", "country_id": "880"},
{"id": 118, "cname": "马达加斯加", "country_id": "261"},
{"id": 167, "cname": "圣卢西亚", "country_id": "1784"},
{"id": 216, "cname": "智利", "country_id": "56"},
{"id": 203, "cname": "牙买加", "country_id": "1876"},
{"id": 202, "cname": "叙利亚", "country_id": "963"},
{"id": 201, "cname": "匈牙利", "country_id": "36"},
{"id": 200, "cname": "科特迪瓦", "country_id": "225"},
{"id": 199, "cname": "希腊", "country_id": "30"},
{"id": 198, "cname": "西班牙", "country_id": "34"},
{"id": 197, "cname": "乌兹别克斯坦", "country_id": "998"},
{"id": 196, "cname": "乌拉圭", "country_id": "598"},
{"id": 195, "cname": "乌克兰", "country_id": "380"},
{"id": 194, "cname": "乌干达", "country_id": "256"},
{"id": 204, "cname": "亚美尼亚", "country_id": "374"},
{"id": 205, "cname": "也门", "country_id": "967"},
{"id": 215, "cname": "直布罗陀", "country_id": "350"},
{"id": 214, "cname": "乍得", "country_id": "235"},
{"id": 213, "cname": "赞比亚", "country_id": "260"},
{"id": 212, "cname": "越南", "country_id": "84"},
{"id": 211, "cname": "约旦", "country_id": "962"},
{"id": 210, "cname": "印尼", "country_id": "62"},
{"id": 209, "cname": "印度", "country_id": "91"},
{"id": 208, "cname": "以色列", "country_id": "972"},
{"id": 207, "cname": "伊朗", "country_id": "98"},
{"id": 206, "cname": "伊拉克", "country_id": "964"},
{"id": 193, "cname": "文莱", "country_id": "673"},
{"id": 192, "cname": "委内瑞拉", "country_id": "58"},
{"id": 191, "cname": "维珍群岛(英属)", "country_id": "1284"},
{"id": 178, "cname": "泰国", "country_id": "66"},
{"id": 177, "cname": "索马里", "country_id": "252"},
{"id": 176, "cname": "所罗门群岛", "country_id": "677"},
{"id": 175, "cname": "苏里南", "country_id": "597"},
{"id": 174, "cname": "苏丹", "country_id": "249"},
{"id": 173, "cname": "斯威士兰", "country_id": "268"},
{"id": 172, "cname": "斯洛文尼亚", "country_id": "386"},
{"id": 171, "cname": "斯洛伐克", "country_id": "421"},
{"id": 170, "cname": "斯里兰卡", "country_id": "94"},
{"id": 169, "cname": "圣皮埃尔和密克隆群岛", "country_id": "508"},
{"id": 179, "cname": "坦桑尼亚", "country_id": "255"},
{"id": 180, "cname": "汤加", "country_id": "676"},
{"id": 190, "cname": "维珍群岛(美属)", "country_id": "1340"},
{"id": 189, "cname": "瓦努阿图", "country_id": "678"},
{"id": 188, "cname": "托克劳岛", "country_id": "690"},
{"id": 187, "cname": "土库曼斯坦", "country_id": "993"},
{"id": 186, "cname": "土耳其", "country_id": "90"},
{"id": 185, "cname": "图瓦卢", "country_id": "688"},
{"id": 184, "cname": "突尼斯", "country_id": "216"},
{"id": 183, "cname": "阿森松岛", "country_id": "247"},
{"id": 182, "cname": "特立尼达和多巴哥", "country_id": "1868"},
{"id": 181, "cname": "特克斯和凯科斯", "country_id": "1649"},
{"id": 168, "cname": "圣马力诺", "country_id": "378"},
{"id": 67, "cname": "法属圭亚那", "country_id": "594"},
{"id": 54, "cname": "不丹", "country_id": "975"},
{"id": 53, "cname": "博茨瓦纳", "country_id": "267"},
{"id": 52, "cname": "伯利兹", "country_id": "501"},
{"id": 51, "cname": "玻利维亚", "country_id": "591"},
{"id": 50, "cname": "波兰", "country_id": "48"},
{"id": 49, "cname": "波黑", "country_id": "387"},
{"id": 48, "cname": "波多黎各", "country_id": "1787"},
{"id": 47, "cname": "冰岛", "country_id": "354"},
{"id": 46, "cname": "贝宁", "country_id": "229"},
{"id": 45, "cname": "保加利亚", "country_id": "359"},
{"id": 55, "cname": "布基纳法索", "country_id": "226"},
{"id": 56, "cname": "布隆迪", "country_id": "257"},
{"id": 66, "cname": "法属波利尼西亚", "country_id": "689"},
{"id": 65, "cname": "法罗岛", "country_id": "298"},
{"id": 64, "cname": "厄立特里亚", "country_id": "291"},
{"id": 63, "cname": "厄瓜多尔", "country_id": "593"},
{"id": 62, "cname": "多米尼加代表", "country_id": "1809"},
{"id": 61, "cname": "多米尼加", "country_id": "1767"},
{"id": 60, "cname": "多哥", "country_id": "228"},
{"id": 59, "cname": "迪戈加西亚岛", "country_id": "246"},
{"id": 58, "cname": "丹麦", "country_id": "45"},
{"id": 57, "cname": "赤道几内亚", "country_id": "240"},
{"id": 44, "cname": "百慕大群岛", "country_id": "1441"},
{"id": 43, "cname": "白俄罗斯", "country_id": "375"},
{"id": 42, "cname": "巴西", "country_id": "55"},
{"id": 29, "cname": "爱尔兰", "country_id": "353"},
{"id": 28, "cname": "埃塞俄比亚", "country_id": "251"},
{"id": 27, "cname": "埃及", "country_id": "20"},
{"id": 26, "cname": "阿塞拜疆", "country_id": "994"},
{"id": 25, "cname": "阿曼", "country_id": "968"},
{"id": 24, "cname": "阿联酋", "country_id": "971"},
{"id": 23, "cname": "阿根廷", "country_id": "54"},
{"id": 22, "cname": "阿富汗", "country_id": "93"},
{"id": 21, "cname": "阿尔及利亚", "country_id": "213"},
{"id": 20, "cname": "阿尔巴尼亚", "country_id": "355"},
{"id": 30, "cname": "爱沙尼亚", "country_id": "372"},
{"id": 31, "cname": "安道尔", "country_id": "376"},
{"id": 41, "cname": "巴拿马", "country_id": "507"},
{"id": 40, "cname": "巴林", "country_id": "973"},
{"id": 39, "cname": "巴拉圭", "country_id": "595"},
{"id": 38, "cname": "巴基斯坦", "country_id": "92"},
{"id": 37, "cname": "巴哈马群岛", "country_id": "1242"},
{"id": 36, "cname": "巴布亚新几内亚", "country_id": "675"},
{"id": 35, "cname": "巴巴多斯", "country_id": "1246"},
{"id": 34, "cname": "奥地利", "country_id": "43"},
{"id": 33, "cname": "安提瓜岛和巴布达", "country_id": "1268"},
{"id": 32, "cname": "安哥拉", "country_id": "244"},
{"id": 68, "cname": "非洲中部", "country_id": "236"},
{"id": 117, "cname": "罗马尼亚", "country_id": "40"},
{"id": 104, "cname": "科威特", "country_id": "965"},
{"id": 103, "cname": "科摩罗", "country_id": "269"},
{"id": 102, "cname": "开曼群岛", "country_id": "1345"},
{"id": 101, "cname": "卡塔尔", "country_id": "974"},
{"id": 100, "cname": "喀麦隆", "country_id": "237"},
{"id": 99, "cname": "聚会岛", "country_id": "262"},
{"id": 98, "cname": "津巴布韦", "country_id": "263"},
{"id": 97, "cname": "捷克", "country_id": "420"},
{"id": 96, "cname": "柬埔寨", "country_id": "855"},
{"id": 95, "cname": "加蓬", "country_id": "241"},
{"id": 105, "cname": "克罗地亚", "country_id": "385"},
{"id": 106, "cname": "肯尼亚", "country_id": "254"},
{"id": 116, "cname": "卢旺达", "country_id": "250"},
{"id": 115, "cname": "卢森堡", "country_id": "352"},
{"id": 114, "cname": "利比亚", "country_id": "218"},
{"id": 113, "cname": "利比里亚", "country_id": "231"},
{"id": 112, "cname": "立陶宛", "country_id": "370"},
{"id": 111, "cname": "黎巴嫩", "country_id": "961"},
{"id": 110, "cname": "老挝", "country_id": "856"},
{"id": 109, "cname": "莱索托", "country_id": "266"},
{"id": 108, "cname": "拉脱维亚", "country_id": "371"},
{"id": 107, "cname": "库克岛", "country_id": "682"},
{"id": 94, "cname": "加纳", "country_id": "233"},
{"id": 93, "cname": "几内亚比绍", "country_id": "245"},
{"id": 92, "cname": "几内亚", "country_id": "224"},
{"id": 79, "cname": "格林纳达", "country_id": "1473"},
{"id": 78, "cname": "哥斯达黎加", "country_id": "506"},
{"id": 77, "cname": "哥伦比亚", "country_id": "57"},
{"id": 76, "cname": "刚果(金)", "country_id": "243"},
{"id": 75, "cname": "刚果", "country_id": "242"},
{"id": 74, "cname": "冈比亚", "country_id": "220"},
{"id": 73, "cname": "福克兰岛", "country_id": "500"},
{"id": 72, "cname": "佛得角", "country_id": "238"},
{"id": 71, "cname": "芬兰", "country_id": "358"},
{"id": 70, "cname": "斐济", "country_id": "679"},
{"id": 80, "cname": "格陵兰岛", "country_id": "299"},
{"id": 81, "cname": "古巴", "country_id": "53"},
{"id": 91, "cname": "吉尔吉斯斯坦", "country_id": "996"},
{"id": 90, "cname": "吉布提", "country_id": "253"},
{"id": 89, "cname": "基里巴斯", "country_id": "686"},
{"id": 88, "cname": "维克岛", "country_id": "1808"},
{"id": 87, "cname": "洪都拉斯", "country_id": "504"},
{"id": 86, "cname": "荷兰", "country_id": "31"},
{"id": 85, "cname": "朝鲜", "country_id": "850"},
{"id": 84, "cname": "海地", "country_id": "509"},
{"id": 83, "cname": "关岛", "country_id": "1671"},
{"id": 82, "cname": "瓜德罗普岛", "country_id": "590"},
{"id": 69, "cname": "菲律宾", "country_id": "63"}
];
static List<Map<String, dynamic>> get internationalDialingPrefix => [
{"id": 1, "cname": "中国大陆", "country_id": "86"},
{"id": 5, "cname": "中国香港特别行政区", "country_id": "852"},
{"id": 2, "cname": "中国澳门特别行政区", "country_id": "853"},
{"id": 3, "cname": "中国台湾", "country_id": "886"},
{"id": 4, "cname": "美国", "country_id": "1"},
{"id": 6, "cname": "比利时", "country_id": "32"},
{"id": 7, "cname": "澳大利亚", "country_id": "61"},
{"id": 8, "cname": "法国", "country_id": "33"},
{"id": 9, "cname": "加拿大", "country_id": "1"},
{"id": 10, "cname": "日本", "country_id": "81"},
{"id": 11, "cname": "新加坡", "country_id": "65"},
{"id": 12, "cname": "韩国", "country_id": "82"},
{"id": 13, "cname": "马来西亚", "country_id": "60"},
{"id": 14, "cname": "英国", "country_id": "44"},
{"id": 15, "cname": "意大利", "country_id": "39"},
{"id": 16, "cname": "德国", "country_id": "49"},
{"id": 18, "cname": "俄罗斯", "country_id": "7"},
{"id": 19, "cname": "新西兰", "country_id": "64"}, //common:1-19
{"id": 153, "cname": "瓦利斯群岛和富图纳群岛", "country_id": "1681"},
{"id": 152, "cname": "葡萄牙", "country_id": "351"},
{"id": 151, "cname": "帕劳", "country_id": "680"},
{"id": 150, "cname": "诺福克岛", "country_id": "672"},
{"id": 149, "cname": "挪威", "country_id": "47"},
{"id": 148, "cname": "纽埃岛", "country_id": "683"},
{"id": 147, "cname": "尼日利亚", "country_id": "234"},
{"id": 146, "cname": "尼日尔", "country_id": "227"},
{"id": 145, "cname": "尼加拉瓜", "country_id": "505"},
{"id": 144, "cname": "尼泊尔", "country_id": "977"},
{"id": 143, "cname": "瑙鲁", "country_id": "674"},
{"id": 154, "cname": "格鲁吉亚", "country_id": "995"},
{"id": 155, "cname": "瑞典", "country_id": "46"},
{"id": 165, "cname": "沙特阿拉伯", "country_id": "966"},
{"id": 164, "cname": "桑给巴尔岛", "country_id": "259"},
{"id": 163, "cname": "塞舌尔共和国", "country_id": "248"},
{"id": 162, "cname": "塞浦路斯", "country_id": "357"},
{"id": 161, "cname": "塞内加尔", "country_id": "221"},
{"id": 160, "cname": "塞拉利昂", "country_id": "232"},
{"id": 159, "cname": "萨摩亚,东部", "country_id": "684"},
{"id": 158, "cname": "萨摩亚,西部", "country_id": "685"},
{"id": 157, "cname": "萨尔瓦多", "country_id": "503"},
{"id": 156, "cname": "瑞士", "country_id": "41"},
{"id": 166, "cname": "圣多美和普林西比", "country_id": "239"},
{"id": 142, "cname": "塞尔维亚", "country_id": "381"},
{"id": 141, "cname": "南非", "country_id": "27"},
{"id": 128, "cname": "毛里塔尼亚", "country_id": "222"},
{"id": 127, "cname": "毛里求斯", "country_id": "230"},
{"id": 126, "cname": "马歇尔岛", "country_id": "692"},
{"id": 125, "cname": "马提尼克岛", "country_id": "596"},
{"id": 124, "cname": "马其顿", "country_id": "389"},
{"id": 123, "cname": "马里亚纳岛", "country_id": "1670"},
{"id": 122, "cname": "马里", "country_id": "223"},
{"id": 121, "cname": "马拉维", "country_id": "265"},
{"id": 120, "cname": "马耳他", "country_id": "356"},
{"id": 119, "cname": "马尔代夫", "country_id": "960"},
{"id": 129, "cname": "蒙古", "country_id": "976"},
{"id": 130, "cname": "蒙特塞拉特岛", "country_id": "1664"},
{"id": 140, "cname": "纳米比亚", "country_id": "264"},
{"id": 139, "cname": "墨西哥", "country_id": "52"},
{"id": 138, "cname": "莫桑比克", "country_id": "258"},
{"id": 137, "cname": "摩纳哥", "country_id": "377"},
{"id": 136, "cname": "摩洛哥", "country_id": "212"},
{"id": 135, "cname": "摩尔多瓦", "country_id": "373"},
{"id": 134, "cname": "缅甸", "country_id": "95"},
{"id": 133, "cname": "密克罗尼西亚", "country_id": "691"},
{"id": 132, "cname": "秘鲁", "country_id": "51"},
{"id": 131, "cname": "孟加拉国", "country_id": "880"},
{"id": 118, "cname": "马达加斯加", "country_id": "261"},
{"id": 167, "cname": "圣卢西亚", "country_id": "1784"},
{"id": 216, "cname": "智利", "country_id": "56"},
{"id": 203, "cname": "牙买加", "country_id": "1876"},
{"id": 202, "cname": "叙利亚", "country_id": "963"},
{"id": 201, "cname": "匈牙利", "country_id": "36"},
{"id": 200, "cname": "科特迪瓦", "country_id": "225"},
{"id": 199, "cname": "希腊", "country_id": "30"},
{"id": 198, "cname": "西班牙", "country_id": "34"},
{"id": 197, "cname": "乌兹别克斯坦", "country_id": "998"},
{"id": 196, "cname": "乌拉圭", "country_id": "598"},
{"id": 195, "cname": "乌克兰", "country_id": "380"},
{"id": 194, "cname": "乌干达", "country_id": "256"},
{"id": 204, "cname": "亚美尼亚", "country_id": "374"},
{"id": 205, "cname": "也门", "country_id": "967"},
{"id": 215, "cname": "直布罗陀", "country_id": "350"},
{"id": 214, "cname": "乍得", "country_id": "235"},
{"id": 213, "cname": "赞比亚", "country_id": "260"},
{"id": 212, "cname": "越南", "country_id": "84"},
{"id": 211, "cname": "约旦", "country_id": "962"},
{"id": 210, "cname": "印尼", "country_id": "62"},
{"id": 209, "cname": "印度", "country_id": "91"},
{"id": 208, "cname": "以色列", "country_id": "972"},
{"id": 207, "cname": "伊朗", "country_id": "98"},
{"id": 206, "cname": "伊拉克", "country_id": "964"},
{"id": 193, "cname": "文莱", "country_id": "673"},
{"id": 192, "cname": "委内瑞拉", "country_id": "58"},
{"id": 191, "cname": "维珍群岛(英属)", "country_id": "1284"},
{"id": 178, "cname": "泰国", "country_id": "66"},
{"id": 177, "cname": "索马里", "country_id": "252"},
{"id": 176, "cname": "所罗门群岛", "country_id": "677"},
{"id": 175, "cname": "苏里南", "country_id": "597"},
{"id": 174, "cname": "苏丹", "country_id": "249"},
{"id": 173, "cname": "斯威士兰", "country_id": "268"},
{"id": 172, "cname": "斯洛文尼亚", "country_id": "386"},
{"id": 171, "cname": "斯洛伐克", "country_id": "421"},
{"id": 170, "cname": "斯里兰卡", "country_id": "94"},
{"id": 169, "cname": "圣皮埃尔和密克隆群岛", "country_id": "508"},
{"id": 179, "cname": "坦桑尼亚", "country_id": "255"},
{"id": 180, "cname": "汤加", "country_id": "676"},
{"id": 190, "cname": "维珍群岛(美属)", "country_id": "1340"},
{"id": 189, "cname": "瓦努阿图", "country_id": "678"},
{"id": 188, "cname": "托克劳岛", "country_id": "690"},
{"id": 187, "cname": "土库曼斯坦", "country_id": "993"},
{"id": 186, "cname": "土耳其", "country_id": "90"},
{"id": 185, "cname": "图瓦卢", "country_id": "688"},
{"id": 184, "cname": "突尼斯", "country_id": "216"},
{"id": 183, "cname": "阿森松岛", "country_id": "247"},
{"id": 182, "cname": "特立尼达和多巴哥", "country_id": "1868"},
{"id": 181, "cname": "特克斯和凯科斯", "country_id": "1649"},
{"id": 168, "cname": "圣马力诺", "country_id": "378"},
{"id": 67, "cname": "法属圭亚那", "country_id": "594"},
{"id": 54, "cname": "不丹", "country_id": "975"},
{"id": 53, "cname": "博茨瓦纳", "country_id": "267"},
{"id": 52, "cname": "伯利兹", "country_id": "501"},
{"id": 51, "cname": "玻利维亚", "country_id": "591"},
{"id": 50, "cname": "波兰", "country_id": "48"},
{"id": 49, "cname": "波黑", "country_id": "387"},
{"id": 48, "cname": "波多黎各", "country_id": "1787"},
{"id": 47, "cname": "冰岛", "country_id": "354"},
{"id": 46, "cname": "贝宁", "country_id": "229"},
{"id": 45, "cname": "保加利亚", "country_id": "359"},
{"id": 55, "cname": "布基纳法索", "country_id": "226"},
{"id": 56, "cname": "布隆迪", "country_id": "257"},
{"id": 66, "cname": "法属波利尼西亚", "country_id": "689"},
{"id": 65, "cname": "法罗岛", "country_id": "298"},
{"id": 64, "cname": "厄立特里亚", "country_id": "291"},
{"id": 63, "cname": "厄瓜多尔", "country_id": "593"},
{"id": 62, "cname": "多米尼加代表", "country_id": "1809"},
{"id": 61, "cname": "多米尼加", "country_id": "1767"},
{"id": 60, "cname": "多哥", "country_id": "228"},
{"id": 59, "cname": "迪戈加西亚岛", "country_id": "246"},
{"id": 58, "cname": "丹麦", "country_id": "45"},
{"id": 57, "cname": "赤道几内亚", "country_id": "240"},
{"id": 44, "cname": "百慕大群岛", "country_id": "1441"},
{"id": 43, "cname": "白俄罗斯", "country_id": "375"},
{"id": 42, "cname": "巴西", "country_id": "55"},
{"id": 29, "cname": "爱尔兰", "country_id": "353"},
{"id": 28, "cname": "埃塞俄比亚", "country_id": "251"},
{"id": 27, "cname": "埃及", "country_id": "20"},
{"id": 26, "cname": "阿塞拜疆", "country_id": "994"},
{"id": 25, "cname": "阿曼", "country_id": "968"},
{"id": 24, "cname": "阿联酋", "country_id": "971"},
{"id": 23, "cname": "阿根廷", "country_id": "54"},
{"id": 22, "cname": "阿富汗", "country_id": "93"},
{"id": 21, "cname": "阿尔及利亚", "country_id": "213"},
{"id": 20, "cname": "阿尔巴尼亚", "country_id": "355"},
{"id": 30, "cname": "爱沙尼亚", "country_id": "372"},
{"id": 31, "cname": "安道尔", "country_id": "376"},
{"id": 41, "cname": "巴拿马", "country_id": "507"},
{"id": 40, "cname": "巴林", "country_id": "973"},
{"id": 39, "cname": "巴拉圭", "country_id": "595"},
{"id": 38, "cname": "巴基斯坦", "country_id": "92"},
{"id": 37, "cname": "巴哈马群岛", "country_id": "1242"},
{"id": 36, "cname": "巴布亚新几内亚", "country_id": "675"},
{"id": 35, "cname": "巴巴多斯", "country_id": "1246"},
{"id": 34, "cname": "奥地利", "country_id": "43"},
{"id": 33, "cname": "安提瓜岛和巴布达", "country_id": "1268"},
{"id": 32, "cname": "安哥拉", "country_id": "244"},
{"id": 68, "cname": "非洲中部", "country_id": "236"},
{"id": 117, "cname": "罗马尼亚", "country_id": "40"},
{"id": 104, "cname": "科威特", "country_id": "965"},
{"id": 103, "cname": "科摩罗", "country_id": "269"},
{"id": 102, "cname": "开曼群岛", "country_id": "1345"},
{"id": 101, "cname": "卡塔尔", "country_id": "974"},
{"id": 100, "cname": "喀麦隆", "country_id": "237"},
{"id": 99, "cname": "聚会岛", "country_id": "262"},
{"id": 98, "cname": "津巴布韦", "country_id": "263"},
{"id": 97, "cname": "捷克", "country_id": "420"},
{"id": 96, "cname": "柬埔寨", "country_id": "855"},
{"id": 95, "cname": "加蓬", "country_id": "241"},
{"id": 105, "cname": "克罗地亚", "country_id": "385"},
{"id": 106, "cname": "肯尼亚", "country_id": "254"},
{"id": 116, "cname": "卢旺达", "country_id": "250"},
{"id": 115, "cname": "卢森堡", "country_id": "352"},
{"id": 114, "cname": "利比亚", "country_id": "218"},
{"id": 113, "cname": "利比里亚", "country_id": "231"},
{"id": 112, "cname": "立陶宛", "country_id": "370"},
{"id": 111, "cname": "黎巴嫩", "country_id": "961"},
{"id": 110, "cname": "老挝", "country_id": "856"},
{"id": 109, "cname": "莱索托", "country_id": "266"},
{"id": 108, "cname": "拉脱维亚", "country_id": "371"},
{"id": 107, "cname": "库克岛", "country_id": "682"},
{"id": 94, "cname": "加纳", "country_id": "233"},
{"id": 93, "cname": "几内亚比绍", "country_id": "245"},
{"id": 92, "cname": "几内亚", "country_id": "224"},
{"id": 79, "cname": "格林纳达", "country_id": "1473"},
{"id": 78, "cname": "哥斯达黎加", "country_id": "506"},
{"id": 77, "cname": "哥伦比亚", "country_id": "57"},
{"id": 76, "cname": "刚果(金)", "country_id": "243"},
{"id": 75, "cname": "刚果", "country_id": "242"},
{"id": 74, "cname": "冈比亚", "country_id": "220"},
{"id": 73, "cname": "福克兰岛", "country_id": "500"},
{"id": 72, "cname": "佛得角", "country_id": "238"},
{"id": 71, "cname": "芬兰", "country_id": "358"},
{"id": 70, "cname": "斐济", "country_id": "679"},
{"id": 80, "cname": "格陵兰岛", "country_id": "299"},
{"id": 81, "cname": "古巴", "country_id": "53"},
{"id": 91, "cname": "吉尔吉斯斯坦", "country_id": "996"},
{"id": 90, "cname": "吉布提", "country_id": "253"},
{"id": 89, "cname": "基里巴斯", "country_id": "686"},
{"id": 88, "cname": "维克岛", "country_id": "1808"},
{"id": 87, "cname": "洪都拉斯", "country_id": "504"},
{"id": 86, "cname": "荷兰", "country_id": "31"},
{"id": 85, "cname": "朝鲜", "country_id": "850"},
{"id": 84, "cname": "海地", "country_id": "509"},
{"id": 83, "cname": "关岛", "country_id": "1671"},
{"id": 82, "cname": "瓜德罗普岛", "country_id": "590"},
{"id": 69, "cname": "菲律宾", "country_id": "63"}
];
}

View File

@@ -1,5 +1,6 @@
import 'package:PiliPlus/common/widgets/no_splash_factory.dart';
import 'package:PiliPlus/common/widgets/overlay_pop.dart';
import 'package:PiliPlus/models/model_video.dart';
import 'package:flutter/material.dart';
class AnimatedDialog extends StatefulWidget {
@@ -9,7 +10,7 @@ class AnimatedDialog extends StatefulWidget {
required this.closeFn,
});
final dynamic videoItem;
final BaseVideoItemModel videoItem;
final Function closeFn;
@override
@@ -31,13 +32,17 @@ class AnimatedDialogState extends State<AnimatedDialog>
opacityAnimation = Tween<double>(begin: 0.0, end: 0.6)
.animate(CurvedAnimation(parent: controller, curve: Curves.linear));
scaleAnimation = CurvedAnimation(parent: controller, curve: Curves.linear);
controller.addListener(() => setState(() {}));
controller.addListener(listener);
controller.forward();
}
void listener() {
setState(() {});
}
@override
void dispose() {
controller.removeListener(() {});
controller.removeListener(listener);
controller.dispose();
super.dispose();
}

View File

@@ -11,7 +11,9 @@ Widget articleContent({
required BuildContext context,
required List<ArticleContentModel> list,
Function(List<String>, int)? callback,
required double maxWidth,
}) {
debugPrint('articleContent');
List<String>? imgList = list
.where((item) => item.pic != null)
.toList()
@@ -57,31 +59,28 @@ Widget articleContent({
),
);
} else if (item.pic != null) {
return LayoutBuilder(
builder: (context, constraints) => Hero(
tag: item.pic!.pics!.first.url!,
child: GestureDetector(
onTap: () {
if (callback != null) {
callback(
imgList,
imgList.indexOf(item.pic!.pics!.first.url!),
);
} else {
context.imageView(
initialPage: imgList.indexOf(item.pic!.pics!.first.url!),
imgList:
imgList.map((url) => SourceModel(url: url)).toList(),
);
}
},
child: NetworkImgLayer(
width: constraints.maxWidth,
height: constraints.maxWidth *
item.pic!.pics!.first.height! /
item.pic!.pics!.first.width!,
src: item.pic!.pics!.first.url,
),
return Hero(
tag: item.pic!.pics!.first.url!,
child: GestureDetector(
onTap: () {
if (callback != null) {
callback(
imgList,
imgList.indexOf(item.pic!.pics!.first.url!),
);
} else {
context.imageView(
initialPage: imgList.indexOf(item.pic!.pics!.first.url!),
imgList: imgList.map((url) => SourceModel(url: url)).toList(),
);
}
},
child: NetworkImgLayer(
width: maxWidth,
height: maxWidth *
item.pic!.pics!.first.height! /
item.pic!.pics!.first.width!,
src: item.pic!.pics!.first.url,
),
),
);

View File

@@ -484,6 +484,9 @@ class _RenderProgressBar extends RenderBox {
}
void _onDragStart(DragStartDetails details) {
if (onDragStart == null) {
return;
}
_userIsDraggingThumb = true;
_updateThumbPosition(details.localPosition);
onDragStart?.call(ThumbDragDetails(
@@ -494,6 +497,9 @@ class _RenderProgressBar extends RenderBox {
}
void _onDragUpdate(DragUpdateDetails details) {
if (onDragUpdate == null) {
return;
}
_updateThumbPosition(details.localPosition);
onDragUpdate?.call(ThumbDragDetails(
timeStamp: _currentThumbDuration(),
@@ -503,6 +509,9 @@ class _RenderProgressBar extends RenderBox {
}
void _onDragEnd(DragEndDetails details) {
if (onSeek == null) {
return;
}
onDragEnd?.call();
onSeek?.call(_currentThumbDuration());
_finishDrag();

View File

@@ -19,8 +19,16 @@ class CustomSliverPersistentHeaderDelegate
//创建child子组件
//shrinkOffsetchild偏移值minExtent~maxExtent
//overlapsContentSliverPersistentHeader覆盖其他子组件返回true否则返回false
return ColoredBox(
color: bgColor,
return DecoratedBox(
decoration: BoxDecoration(
color: bgColor,
boxShadow: [
BoxShadow(
color: bgColor,
offset: const Offset(0, -2),
),
],
),
child: child,
);
}

View File

@@ -31,3 +31,37 @@ class CustomToast extends StatelessWidget {
);
}
}
class LoadingWidget extends StatelessWidget {
const LoadingWidget({super.key, required this.msg});
///loading msg
final String msg;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
borderRadius: BorderRadius.circular(15),
),
child: Column(mainAxisSize: MainAxisSize.min, children: [
//loading animation
CircularProgressIndicator(
strokeWidth: 3,
valueColor: AlwaysStoppedAnimation(
Theme.of(context).colorScheme.onSurfaceVariant),
),
//msg
Container(
margin: const EdgeInsets.only(top: 20),
child: Text(msg,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant)),
),
]),
);
}
}

View File

@@ -22,7 +22,10 @@ void showConfirmDialog({
),
),
TextButton(
onPressed: onConfirm,
onPressed: () {
Get.back();
onConfirm();
},
child: Text('确认'),
),
],
@@ -30,3 +33,70 @@ void showConfirmDialog({
},
);
}
void showPgcFollowDialog({
required BuildContext context,
required String type,
required int followStatus,
required ValueChanged<int> onUpdateStatus,
}) {
Widget statusItem({
required bool enabled,
required String text,
required VoidCallback onTap,
}) {
return ListTile(
dense: true,
enabled: enabled,
title: Padding(
padding: const EdgeInsets.only(left: 10),
child: Text(
'标记为 $text',
style: const TextStyle(fontSize: 14),
),
),
trailing: !enabled ? const Icon(size: 22, Icons.check) : null,
onTap: onTap,
);
}
showDialog(
context: context,
builder: (context) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
...[
{'followStatus': 3, 'title': '看过'},
{'followStatus': 2, 'title': '在看'},
{'followStatus': 1, 'title': '想看'},
].map(
(Map item) => statusItem(
enabled: followStatus != item['followStatus'],
text: item['title'],
onTap: () {
Get.back();
onUpdateStatus(item['followStatus']);
},
),
),
ListTile(
dense: true,
title: Padding(
padding: EdgeInsets.only(left: 10),
child: Text(
'取消$type',
style: TextStyle(fontSize: 14),
),
),
onTap: () {
Get.back();
onUpdateStatus(-1);
},
)
],
),
));
}

View File

@@ -13,6 +13,7 @@ Widget htmlRender({
required double constrainedWidth,
Function(List<String>, int)? callback,
}) {
debugPrint('htmlRender');
return SelectionArea(
child: Html(
data: htmlContent,
@@ -27,17 +28,11 @@ Widget htmlRender({
String imgUrl = key.contains('src')
? attributes['src'] as String
: attributes['data-src'] as String;
if (imgUrl.startsWith('//')) {
imgUrl = 'https:$imgUrl';
}
if (imgUrl.startsWith('http://')) {
imgUrl = imgUrl.replaceAll('http://', 'https://');
}
imgUrl = imgUrl.contains('@') ? imgUrl.split('@').first : imgUrl;
final bool isEmote = imgUrl.contains('/emote/');
final bool isMall = imgUrl.contains('/mall/');
if (isMall) {
return const SizedBox();
return const SizedBox.shrink();
}
// bool inTable =
// extensionContext.element!.previousElementSibling == null ||
@@ -48,6 +43,18 @@ Widget htmlRender({
// width: isEmote ? 22 : null,
// height: isEmote ? 22 : null,
// );
String? height = RegExp(r'max-height:(\d+)px')
.firstMatch('${attributes['style']}')
?.group(1);
if (height != null) {
return NetworkImgLayer(
width: constrainedWidth,
height: double.parse(height),
src: imgUrl,
type: 'emote',
boxFit: BoxFit.contain,
);
}
return Hero(
tag: imgUrl,
child: GestureDetector(

View File

@@ -15,7 +15,7 @@ void imageSaveDialog({
final double imgWidth = min(Get.width, Get.height) - 8 * 2;
SmartDialog.show(
animationType: SmartAnimationType.centerScale_otherSlide,
builder: (context) => Container(
builder: (_) => Container(
width: imgWidth,
margin: const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
decoration: BoxDecoration(
@@ -84,7 +84,11 @@ void imageSaveDialog({
SmartDialog.dismiss();
}
},
icon: const Icon(Icons.download, size: 20),
icon: Icon(
Icons.download,
size: 20,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
)
],
),

View File

@@ -6,15 +6,16 @@ import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:media_kit/media_kit.dart';
import 'package:media_kit_video/media_kit_video.dart';
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:status_bar_control/status_bar_control.dart';
import 'interactive_viewer_boundary.dart';
import 'interactive_viewer.dart' as custom;
@@ -67,7 +68,7 @@ class InteractiveviewerGallery<T> extends StatefulWidget {
this.onClose,
});
final VoidCallback? onClose;
final ValueChanged? onClose;
final bool? setStatusBar;
@@ -111,15 +112,12 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
late final RxInt currentIndex = widget.initIndex.obs;
late List<bool> _thumbList;
late final int _quality = GStorage.previewQ;
@override
void initState() {
super.initState();
_thumbList = List.generate(widget.sources.length, (_) => true);
_pageController = PageController(initialPage: widget.initIndex);
_transformationController = custom.TransformationController();
@@ -127,10 +125,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
_animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
)..addListener(() {
_transformationController!.value =
_animation?.value ?? Matrix4.identity();
});
)..addListener(listener);
if (widget.setStatusBar != false) {
setStatusBar();
@@ -141,24 +136,36 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
}
}
void listener() {
_transformationController!.value = _animation?.value ?? Matrix4.identity();
}
SystemUiMode? mode;
setStatusBar() async {
if (Platform.isIOS || Platform.isAndroid) {
await StatusBarControl.setHidden(
true,
animation: StatusBarAnimation.FADE,
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.immersiveSticky,
);
}
if (Platform.isAndroid &&
(await DeviceInfoPlugin().androidInfo).version.sdkInt < 29) {
mode = SystemUiMode.manual;
}
}
@override
void dispose() async {
void dispose() {
widget.onClose?.call(true);
_player?.dispose();
_pageController?.dispose();
_animationController.removeListener(() {});
_animationController.removeListener(listener);
_animationController.dispose();
if (widget.setStatusBar != false) {
if (Platform.isIOS || Platform.isAndroid) {
StatusBarControl.setHidden(false, animation: StatusBarAnimation.FADE);
SystemChrome.setEnabledSystemUIMode(
mode ?? SystemUiMode.edgeToEdge,
overlays: SystemUiOverlay.values,
);
}
}
for (int index = 0; index < widget.sources.length; index++) {
@@ -253,13 +260,15 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
}
}
String _getActualUrl(int index) => _thumbList[index] && _quality != 100
? '${widget.sources[index].url}@${_quality}q.webp'.http2https
: widget.sources[index].url.http2https;
String _getActualUrl(int index) {
return _quality != 100
? Utils.thumbnailImgUrl(widget.sources[index].url, _quality)
: widget.sources[index].url.http2https;
}
void onClose() {
if (widget.onClose != null) {
widget.onClose!();
widget.onClose!(false);
} else {
Get.back();
widget.onDismissed?.call(_pageController!.page!.floor());
@@ -435,16 +444,30 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
// 图片分享
void onShareImg(String imgUrl) async {
SmartDialog.showLoading();
var response = await Request()
.get(imgUrl, options: Options(responseType: ResponseType.bytes));
final temp = await getTemporaryDirectory();
SmartDialog.dismiss();
String imgName =
"plpl_pic_${DateTime.now().toString().split('-').join()}.jpg";
var path = '${temp.path}/$imgName';
File(path).writeAsBytesSync(response.data);
Share.shareXFiles([XFile(path)], subject: imgUrl);
try {
SmartDialog.showLoading();
var response = await Request()
.get(imgUrl, options: Options(responseType: ResponseType.bytes));
final temp = await getTemporaryDirectory();
SmartDialog.dismiss();
String imgName =
"plpl_pic_${DateTime.now().toString().split('-').join()}.jpg";
var path = '${temp.path}/$imgName';
File(path).writeAsBytesSync(response.data);
Rect? sharePositionOrigin;
if (Platform.isIOS && (await Utils.isIpad())) {
sharePositionOrigin = Rect.fromLTWH(0, 0, Get.width, Get.height / 2);
}
Share.shareXFiles(
[XFile(path)],
subject: imgUrl,
sharePositionOrigin: sharePositionOrigin,
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
}
Widget _itemBuilder(index) {

View File

@@ -7,6 +7,7 @@ import 'package:PiliPlus/common/widgets/network_img_layer.dart';
import 'package:PiliPlus/http/video.dart';
import 'package:PiliPlus/models/bangumi/info.dart' as bangumi;
import 'package:PiliPlus/models/video_detail_res.dart' as video;
import 'package:PiliPlus/pages/common/common_slide_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
@@ -14,8 +15,9 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import '../../utils/storage.dart';
import '../../utils/utils.dart';
import 'package:PiliPlus/common/widgets/spring_physics.dart';
class ListSheetContent extends StatefulWidget {
class ListSheetContent extends CommonSlidePage {
const ListSheetContent({
super.key,
this.index, // tab index
@@ -30,6 +32,7 @@ class ListSheetContent extends StatefulWidget {
this.showTitle,
this.isSupportReverse,
this.isReversed,
super.enableSlide,
});
final dynamic index;
@@ -49,7 +52,7 @@ class ListSheetContent extends StatefulWidget {
State<ListSheetContent> createState() => _ListSheetContentState();
}
class _ListSheetContentState extends State<ListSheetContent>
class _ListSheetContentState extends CommonSlidePageState<ListSheetContent>
with TickerProviderStateMixin {
late List<ItemScrollController> itemScrollController = [];
late int currentIndex = _currentIndex;
@@ -104,6 +107,12 @@ class _ListSheetContentState extends State<ListSheetContent>
.indexWhere((e) => e.cid == widget.currentCid)
: episodes.indexWhere((e) => e.cid == widget.currentCid));
void listener() {
_indexStream?.add(_ctr?.index);
}
late bool _isInit = true;
@override
void initState() {
super.initState();
@@ -113,9 +122,7 @@ class _ListSheetContentState extends State<ListSheetContent>
vsync: this,
length: widget.season.sections.length,
initialIndex: _index,
)..addListener(() {
_indexStream?.add(_ctr?.index);
});
)..addListener(listener);
}
itemScrollController = _isList
? List.generate(
@@ -124,7 +131,7 @@ class _ListSheetContentState extends State<ListSheetContent>
reverse = _isList
? List.generate(widget.season.sections.length, (_) => false)
: [false];
if (widget.bvid != null && widget.season != null) {
if (Accounts.main.isLogin && widget.bvid != null && widget.season != null) {
_favStream ??= StreamController<int>();
() async {
dynamic result = await VideoHttp.videoRelation(bvid: widget.bvid);
@@ -135,9 +142,22 @@ class _ListSheetContentState extends State<ListSheetContent>
}();
}
WidgetsBinding.instance.addPostFrameCallback((_) {
try {
itemScrollController[_index].jumpTo(index: currentIndex);
} catch (_) {}
if (GStorage.collapsibleVideoPage) {
if (mounted) {
setState(() {
_isInit = false;
});
WidgetsBinding.instance.addPostFrameCallback((_) {
try {
itemScrollController[_index].jumpTo(index: currentIndex);
} catch (_) {}
});
}
} else {
try {
itemScrollController[_index].jumpTo(index: currentIndex);
} catch (_) {}
}
});
}
@@ -147,7 +167,7 @@ class _ListSheetContentState extends State<ListSheetContent>
_favStream = null;
_indexStream?.close();
_indexStream = null;
_ctr?.removeListener(() {});
_ctr?.removeListener(listener);
_ctr?.dispose();
super.dispose();
}
@@ -275,144 +295,160 @@ class _ListSheetContentState extends State<ListSheetContent>
@override
Widget build(BuildContext context) {
return Container(
height: Utils.getSheetHeight(context),
color: Theme.of(context).colorScheme.surface,
child: Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
if (GStorage.collapsibleVideoPage && _isInit) {
return CustomScrollView(
physics: const NeverScrollableScrollPhysics(),
);
}
return enableSlide
? Padding(
padding: EdgeInsets.only(top: padding),
child: buildPage,
)
: buildPage;
}
@override
Widget get buildPage => Material(
color: widget.showTitle == false
? Colors.transparent
: Theme.of(context).colorScheme.surface,
child: Column(
children: [
Container(
height: 45,
padding: EdgeInsets.symmetric(
horizontal: widget.showTitle != false ? 14 : 6),
child: Row(
children: [
if (widget.showTitle != false)
Text(
'合集(${_isList ? widget.season.epCount : episodes?.length ?? ''})',
style: Theme.of(context).textTheme.titleMedium,
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
StreamBuilder(
stream: _favStream?.stream,
builder: (context, snapshot) => snapshot.hasData
? mediumButton(
tooltip: _seasonFav == 1 ? '取消订阅' : '订阅',
icon: _seasonFav == 1
? Icons.notifications_off_outlined
: Icons.notifications_active_outlined,
onPressed: () async {
dynamic result = await VideoHttp.seasonFav(
isFav: _seasonFav == 1,
seasonId: widget.season.id,
);
if (result['status']) {
SmartDialog.showToast(
'${_seasonFav == 1 ? '取消' : ''}订阅成功');
_seasonFav = _seasonFav == 1 ? 0 : 1;
_favStream?.add(_seasonFav);
} else {
SmartDialog.showToast(result['msg']);
}
},
)
: const SizedBox.shrink(),
),
mediumButton(
tooltip: '跳至顶部',
icon: Icons.vertical_align_top,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] = !reverse[_ctr?.index ?? 0];
});
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? 0
: _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
tooltip: '跳至底部',
icon: Icons.vertical_align_bottom,
onPressed: () {
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: !reverse[_ctr?.index ?? 0]
? _isList
? widget.season.sections[_ctr?.index].episodes
.length -
1
: episodes.length - 1
: 0,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
],
mediumButton(
tooltip: '跳至当前',
icon: Icons.my_location,
onPressed: () async {
if (_ctr != null && _ctr?.index != (_index)) {
_ctr?.animateTo(_index);
await Future.delayed(const Duration(milliseconds: 225));
}
try {
itemScrollController[_ctr?.index ?? 0].scrollTo(
index: currentIndex,
duration: const Duration(milliseconds: 200),
);
} catch (_) {}
},
),
if (widget.isSupportReverse == true)
if (!_isList)
_reverseButton
else
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) {
return snapshot.data == _index
? _reverseButton
: const SizedBox.shrink();
},
),
const Spacer(),
StreamBuilder(
stream: _indexStream?.stream,
initialData: _index,
builder: (context, snapshot) => mediumButton(
tooltip: reverse[snapshot.data] ? '顺序' : '倒序',
icon: !reverse[snapshot.data]
? MdiIcons.sortNumericAscending
: MdiIcons.sortNumericDescending,
onPressed: () {
setState(() {
reverse[_ctr?.index ?? 0] =
!reverse[_ctr?.index ?? 0];
});
},
),
),
if (widget.onClose != null)
mediumButton(
tooltip: '关闭',
icon: Icons.close,
onPressed: widget.onClose,
),
],
),
),
),
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
Material(
child: TabBar(
Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
if (_isList)
TabBar(
controller: _ctr,
padding: const EdgeInsets.only(right: 60),
isScrollable: true,
@@ -422,23 +458,32 @@ class _ListSheetContentState extends State<ListSheetContent>
dividerHeight: 1,
dividerColor: Theme.of(context).dividerColor.withOpacity(0.1),
),
Expanded(
child: _isList
? Material(
color: Colors.transparent,
child: tabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
),
)
: enableSlide
? slideList()
: buildList,
),
Expanded(
child: _isList
? TabBarView(
controller: _ctr,
children: List.generate(
widget.season.sections.length,
(index) => _buildBody(
index, widget.season.sections[index].episodes),
),
)
: _buildBody(null, episodes),
),
],
),
);
}
],
),
);
@override
Widget get buildList => Material(
color: Colors.transparent,
child: _buildBody(null, episodes),
);
Widget get _reverseButton => mediumButton(
tooltip: widget.isReversed == true ? '正序播放' : '倒序播放',
@@ -464,30 +509,29 @@ class _ListSheetContentState extends State<ListSheetContent>
},
);
Widget _buildBody(i, episodes) => Material(
child: ScrollablePositionedList.separated(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
reverse: reverse[i ?? 0],
itemCount: episodes.length,
itemBuilder: (BuildContext context, int index) {
return buildEpisodeListItem(
episodes[index],
index,
episodes.length,
i != null
? i == (_index)
? currentIndex == index
: false
: currentIndex == index,
);
},
itemScrollController: itemScrollController[i ?? 0],
separatorBuilder: (context, index) => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
Widget _buildBody(i, episodes) => ScrollablePositionedList.separated(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).padding.bottom + 80,
),
reverse: reverse[i ?? 0],
itemCount: episodes.length,
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return buildEpisodeListItem(
episodes[index],
index,
episodes.length,
i != null
? i == (_index)
? currentIndex == index
: false
: currentIndex == index,
);
},
itemScrollController: itemScrollController[i ?? 0],
separatorBuilder: (context, index) => Divider(
height: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
);
}

View File

@@ -11,6 +11,7 @@ Widget errorWidget({errMsg, callback}) => HttpError(
);
Widget scrollErrorWidget({errMsg, callback}) => CustomScrollView(
controller: ScrollController(),
slivers: [
HttpError(
errMsg: errMsg,

View File

@@ -1,7 +1,7 @@
import 'package:PiliPlus/utils/utils.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/global_data.dart';
import '../constants.dart';
class NetworkImgLayer extends StatelessWidget {
@@ -22,6 +22,7 @@ class NetworkImgLayer extends StatelessWidget {
this.isLongPic,
this.callback,
this.getPlaceHolder,
this.boxFit,
});
final String? src;
@@ -38,6 +39,7 @@ class NetworkImgLayer extends StatelessWidget {
final Function? isLongPic;
final Function? callback;
final Function? getPlaceHolder;
final BoxFit? boxFit;
@override
Widget build(BuildContext context) {
@@ -56,8 +58,6 @@ class NetworkImgLayer extends StatelessWidget {
}
Widget _buildImage(context) {
late final int defaultImgQuality = GlobalData().imgQuality;
bool thumbnail = true;
int? memCacheWidth, memCacheHeight;
if (callback?.call() == true || width <= height) {
memCacheWidth = width.cacheSize(context);
@@ -65,29 +65,20 @@ class NetworkImgLayer extends StatelessWidget {
memCacheHeight = height.cacheSize(context);
}
return CachedNetworkImage(
imageUrl:
'${src?.startsWith('//') == true ? 'https:$src' : src?.http2https}${type != 'emote' && type != 'cover' && thumbnail ? '@${quality ?? defaultImgQuality}q.webp' : ''}',
imageUrl: Utils.thumbnailImgUrl(src, quality),
width: width,
height: ignoreHeight == null || ignoreHeight == false ? height : null,
memCacheWidth: memCacheWidth,
memCacheHeight: memCacheHeight,
fit: BoxFit.cover,
fit: boxFit ?? BoxFit.cover,
alignment:
isLongPic?.call() == true ? Alignment.topCenter : Alignment.center,
fadeOutDuration: fadeOutDuration ?? const Duration(milliseconds: 120),
fadeInDuration: fadeInDuration ?? const Duration(milliseconds: 120),
filterQuality: FilterQuality.low,
// errorWidget: (BuildContext context, String url, Object error) =>
// placeholder(context),
placeholder: (BuildContext context, String url) =>
getPlaceHolder?.call() ?? placeholder(context),
imageBuilder: imageBuilder,
// errorListener: (value) {
// thumbnail = false;
// if (context.mounted) {
// (context as Element).markNeedsBuild();
// }
// },
);
}

View File

@@ -1,25 +1,93 @@
import 'package:flutter/material.dart';
Widget radioWidget<T>({
required T value,
T? groupValue,
required ValueChanged onChanged,
required String title,
double? paddingStart,
}) {
return InkWell(
onTap: () => onChanged(value),
child: Row(
children: [
if (paddingStart != null) SizedBox(width: paddingStart),
Radio(
value: value,
groupValue: groupValue,
onChanged: onChanged,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
Text(title),
],
),
);
class RadioWidget<T> extends StatelessWidget {
final T value;
final T? groupValue;
final ValueChanged<T?> onChanged;
final String title;
final EdgeInsetsGeometry? padding;
const RadioWidget({
super.key,
required this.value,
this.groupValue,
required this.onChanged,
required this.title,
this.padding,
});
Widget _child() => Row(
children: [
Radio<T>(
value: value,
groupValue: groupValue,
onChanged: onChanged,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
Text(title),
],
);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => onChanged(value),
child: padding != null
? Padding(
padding: padding!,
child: _child(),
)
: _child(),
);
}
}
class WrapRadioOptionsGroup<T> extends StatelessWidget {
final String groupTitle;
final Map<T, String> options;
final T? selectedValue;
final ValueChanged<T?> onChanged;
final EdgeInsetsGeometry? itemPadding;
const WrapRadioOptionsGroup({
super.key,
required this.groupTitle,
required this.options,
required this.selectedValue,
required this.onChanged,
this.itemPadding,
});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (groupTitle.isNotEmpty)
Padding(
padding: const EdgeInsets.only(left: 22),
child: Text(
groupTitle,
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Wrap(
children: options.entries.map((entry) {
return IntrinsicWidth(
child: RadioWidget<T>(
value: entry.key,
groupValue: selectedValue,
onChanged: onChanged,
title: entry.value,
padding: itemPadding ?? const EdgeInsets.only(right: 10),
),
);
}).toList(),
),
),
],
);
}
}

View File

@@ -0,0 +1,225 @@
import 'package:PiliPlus/common/widgets/radio_widget.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
void autoWrapReportDialog(
BuildContext context,
Map<String, Map<int, String>> options,
Future<Map> Function(int, String?, bool) onSuccess,
) {
int? reasonType;
String? reasonDesc;
bool banUid = false;
late final key = GlobalKey<FormState>();
showDialog(
context: context,
builder: (context) => StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: const Text('举报'),
titlePadding: const EdgeInsets.only(left: 22, top: 16, right: 22),
contentPadding: const EdgeInsets.symmetric(vertical: 5),
actionsPadding:
const EdgeInsets.only(left: 16, right: 16, bottom: 10),
content: Form(
key: key,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Flexible(
child: SingleChildScrollView(
child: AnimatedSize(
duration: const Duration(milliseconds: 200),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.only(
left: 22,
right: 22,
bottom: 5,
),
child: Text('请选择举报的理由:'),
),
...options.entries.map(
(entry) => WrapRadioOptionsGroup<int>(
groupTitle: entry.key,
options: entry.value,
selectedValue: reasonType,
onChanged: (value) =>
setState(() => reasonType = value),
),
),
if (reasonType == 0)
ReasonField(
onChanged: (value) => reasonDesc = value),
],
),
),
),
),
BanUserCheckbox(onChanged: (value) => banUid = value),
],
),
),
actions: [
TextButton(
onPressed: Get.back,
child: Text(
'取消',
style: TextStyle(color: Theme.of(context).colorScheme.outline),
),
),
TextButton(
onPressed: () async {
if (reasonType == null ||
(reasonType == 0 && key.currentState?.validate() != true)) {
return;
}
SmartDialog.showLoading();
try {
final data = await onSuccess(reasonType!, reasonDesc, banUid);
SmartDialog.dismiss();
if (data['code'] == 0) {
Get.back();
SmartDialog.showToast('举报成功');
} else {
SmartDialog.showToast(data['message']);
}
} catch (e) {
SmartDialog.dismiss();
SmartDialog.showToast('提交失败:$e');
}
},
child: const Text('确定'),
),
],
);
},
),
);
}
class ReasonField extends StatefulWidget {
final ValueChanged<String> onChanged;
String? _validator(String? value) => value.isNullOrEmpty ? '理由不能为空' : null;
const ReasonField({super.key, required this.onChanged});
@override
State<ReasonField> createState() => _ReasonFieldState();
}
class _ReasonFieldState extends State<ReasonField> {
final _controller = TextEditingController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 22, top: 5, right: 22),
child: TextFormField(
controller: _controller,
autofocus: true,
minLines: 4,
maxLines: 4,
decoration: const InputDecoration(
labelText: '为帮助审核人员更快处理,请补充问题类型和出现位置等详细信息',
border: OutlineInputBorder(),
contentPadding: EdgeInsets.all(10),
),
onChanged: (value) {
widget.onChanged(value);
},
validator: widget._validator,
),
);
}
}
class BanUserCheckbox extends StatefulWidget {
final ValueChanged<bool> onChanged;
const BanUserCheckbox({super.key, required this.onChanged});
@override
State<BanUserCheckbox> createState() => _BanUserCheckboxState();
}
class _BanUserCheckboxState extends State<BanUserCheckbox> {
bool _banUid = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
setState(() => _banUid = !_banUid);
widget.onChanged(_banUid);
},
child: Padding(
padding: const EdgeInsets.only(left: 18, top: 10),
child: Row(
children: [
Icon(
size: 22,
_banUid
? Icons.check_box_outlined
: Icons.check_box_outline_blank,
color: _banUid
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurfaceVariant,
),
Text(
' 拉黑该用户',
style: TextStyle(
color: _banUid ? Theme.of(context).colorScheme.primary : null,
),
),
],
),
),
);
}
}
class ReportOptions {
// from https://s1.hdslb.com/bfs/seed/jinkela/comment-h5/static/js/605.chunks.js
static Map<String, Map<int, String>> get commentReport => {
'违反法律法规': {9: '违法违规', 2: '色情', 10: '低俗', 12: '赌博诈骗', 23: '违法信息外链'},
'谣言类不实信息': {19: '涉政谣言', 22: '虚假不实信息', 20: '涉社会事件谣言'},
'侵犯个人权益': {7: '人身攻击', 15: '侵犯隐私'},
'有害社区环境': {
1: '垃圾广告',
4: '引战',
5: '剧透',
3: '刷屏',
8: '视频不相关',
18: '违规抽奖',
17: '青少年不良信息',
},
'其他': {0: '其他'},
};
static Map<String, Map<int, String>> get dynamicReport => {
'': {
4: '垃圾广告',
8: '引战',
1: '色情',
5: '人身攻击',
3: '违法信息',
9: '涉政谣言',
10: '涉社会事件谣言',
12: '虚假不实信息',
13: '违法信息外链',
0: '其他',
},
};
}

View File

@@ -39,7 +39,13 @@ class _SelfSizedHorizontalListState extends State<SelfSizedHorizontalList> {
WidgetsBinding.instance.addPostFrameCallback((v) => setState(() {}));
}
if (widget.itemCount == 0) return const SizedBox();
if (isInit) return Container(key: infoKey, child: widget.childBuilder(0));
if (isInit) {
return Container(
key: infoKey,
padding: widget.padding,
child: widget.childBuilder(0),
);
}
return SizedBox(
height: height,

View File

@@ -0,0 +1,54 @@
import 'package:PiliPlus/utils/storage.dart';
import 'package:flutter/material.dart';
Widget videoTabBarView({
required List<Widget> children,
TabController? controller,
}) =>
TabBarView(
physics: const CustomTabBarViewClampingScrollPhysics(),
controller: controller,
children: children,
);
Widget tabBarView({
required List<Widget> children,
TabController? controller,
}) =>
TabBarView(
physics: const CustomTabBarViewScrollPhysics(),
controller: controller,
children: children,
);
class CustomTabBarViewScrollPhysics extends ScrollPhysics {
const CustomTabBarViewScrollPhysics({super.parent});
@override
CustomTabBarViewScrollPhysics applyTo(ScrollPhysics? ancestor) {
return CustomTabBarViewScrollPhysics(parent: buildParent(ancestor));
}
@override
SpringDescription get spring => SpringDescription(
mass: GStorage.springDescription[0],
stiffness: GStorage.springDescription[1],
damping: GStorage.springDescription[2],
);
}
class CustomTabBarViewClampingScrollPhysics extends ClampingScrollPhysics {
const CustomTabBarViewClampingScrollPhysics({super.parent});
@override
CustomTabBarViewClampingScrollPhysics applyTo(ScrollPhysics? ancestor) {
return CustomTabBarViewClampingScrollPhysics(parent: buildParent(ancestor));
}
@override
SpringDescription get spring => SpringDescription(
mass: GStorage.springDescription[0],
stiffness: GStorage.springDescription[1],
damping: GStorage.springDescription[2],
);
}

View File

@@ -1,35 +0,0 @@
import 'package:flutter/material.dart';
import 'package:PiliPlus/utils/utils.dart';
Widget statDanMu({
required BuildContext context,
String? theme,
dynamic danmu,
String? size,
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
};
Color color = colorObject[theme]!;
return Row(
children: [
Icon(
Icons.subtitles_outlined,
size: 14,
color: color,
),
const SizedBox(width: 2),
Text(
Utils.numFormat(danmu!),
style: TextStyle(
fontSize: size == 'medium' ? 12 : 11,
color: color,
),
overflow: TextOverflow.clip,
semanticsLabel: '${Utils.numFormat(danmu!)}条弹幕',
)
],
);
}

View File

@@ -0,0 +1,92 @@
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart';
abstract class _StatItemBase extends StatelessWidget {
final BuildContext context;
final Object value;
final String? theme;
final String? size;
final Color? textColor;
final double iconSize;
const _StatItemBase({
required this.context,
required this.value,
this.theme,
this.size,
this.textColor,
this.iconSize = 13,
});
IconData get iconData;
String get semanticsLabel;
Color get color {
return textColor ??
switch (theme) {
'gray' => Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black' => Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
_ => Colors.white,
};
}
@override
Widget build(BuildContext context) {
return Row(
children: [
Icon(
iconData,
size: iconSize,
color: color,
),
const SizedBox(width: 2),
Text(
Utils.numFormat(value),
style: TextStyle(fontSize: size == 'medium' ? 12 : 11, color: color),
overflow: TextOverflow.clip,
semanticsLabel: semanticsLabel,
)
],
);
}
}
class StatView extends _StatItemBase {
final String? goto;
const StatView({
required super.context,
required super.value,
this.goto,
super.theme,
super.size,
super.textColor,
}) : super(iconSize: 13);
@override
IconData get iconData => switch (goto) {
'picture' => Icons.remove_red_eye_outlined,
'like' => Icons.thumb_up_outlined,
_ => Icons.play_circle_outlined,
};
@override
String get semanticsLabel =>
'${Utils.numFormat(value)}${goto == "picture" ? "浏览" : "播放"}';
}
class StatDanMu extends _StatItemBase {
const StatDanMu({
required super.context,
required super.value,
super.theme,
super.size,
super.textColor,
}) : super(iconSize: 14);
@override
IconData get iconData => Icons.subtitles_outlined;
@override
String get semanticsLabel => '${Utils.numFormat(value)}条弹幕';
}

View File

@@ -1,39 +0,0 @@
import 'package:flutter/material.dart';
import 'package:PiliPlus/utils/utils.dart';
Widget statView({
required BuildContext context,
String? theme,
dynamic view,
String? size,
String? goto,
}) {
Map<String, Color> colorObject = {
'white': Colors.white,
'gray': Theme.of(context).colorScheme.outline.withOpacity(0.8),
'black': Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
};
Color color = colorObject[theme]!;
return Row(
children: [
Icon(
goto == 'picture'
? Icons.remove_red_eye_outlined
: Icons.play_circle_outlined,
size: 13,
color: color,
),
const SizedBox(width: 2),
Text(
Utils.numFormat(view!),
style: TextStyle(
fontSize: size == 'medium' ? 12 : 11,
color: color,
),
overflow: TextOverflow.clip,
semanticsLabel:
'${Utils.numFormat(view!)}${goto == "picture" ? "浏览" : "播放"}',
),
],
);
}

View File

@@ -1,15 +1,15 @@
import 'package:PiliPlus/common/widgets/image_save.dart';
import 'package:PiliPlus/models/model_hot_video_item.dart';
import 'package:PiliPlus/models/model_video.dart';
import 'package:PiliPlus/models/search/result.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../http/search.dart';
import '../../utils/utils.dart';
import '../constants.dart';
import 'badge.dart';
import 'network_img_layer.dart';
import 'stat/danmu.dart';
import 'stat/view.dart';
import 'stat/stat.dart';
import 'video_popup_menu.dart';
// 视频卡片 - 水平布局
@@ -24,8 +24,9 @@ class VideoCardH extends StatelessWidget {
this.showPubdate = false,
this.onTap,
this.onLongPress,
this.onViewLater,
});
final dynamic videoItem;
final BaseVideoItemModel videoItem;
final String source;
final bool showOwner;
final bool showView;
@@ -33,145 +34,161 @@ class VideoCardH extends StatelessWidget {
final bool showPubdate;
final VoidCallback? onTap;
final VoidCallback? onLongPress;
final ValueChanged<int>? onViewLater;
@override
Widget build(BuildContext context) {
final int aid = videoItem.aid;
final String bvid = videoItem.bvid;
final int aid = videoItem.aid!;
final String bvid = videoItem.bvid!;
String type = 'video';
try {
type = videoItem.type;
} catch (_) {}
return Stack(children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title is String
? videoItem.title
: videoItem.title is List
? (videoItem.title as List)
.map((item) => item['text'])
.join()
: '',
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap?.call();
return;
}
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if (videoItem is HotVideoItemModel &&
videoItem.redirectUrl?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.redirectUrl!)) {
return;
}
}
try {
final int cid =
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
Get.toNamed(
'/video?bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder:
(BuildContext context, BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic as String,
width: maxWidth,
height: maxHeight,
),
if (videoItem is HotVideoItemModel &&
videoItem.pgcLabel?.isNotEmpty == true)
PBadge(
text: videoItem.pgcLabel,
top: 6.0,
right: 6.0,
),
if (videoItem.duration != 0)
PBadge(
text: Utils.timeFormat(videoItem.duration!),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
),
// try {
// type = videoItem.type;
// } catch (_) {}
if (videoItem is SearchVideoItemModel) {
var typeOrNull = (videoItem as SearchVideoItemModel).type;
if (typeOrNull?.isNotEmpty == true) {
type = typeOrNull!;
}
}
return Material(
color: Colors.transparent,
child: Stack(
children: [
Semantics(
label: Utils.videoItemSemantics(videoItem),
excludeSemantics: true,
// customSemanticsActions: <CustomSemanticsAction, void Function()>{
// for (var item in actions)
// CustomSemanticsAction(
// label: item.title.isEmpty ? 'label' : item.title): item.onTap!,
// },
child: InkWell(
onLongPress: () {
if (onLongPress != null) {
onLongPress!();
} else {
imageSaveDialog(
context: context,
title: videoItem.title,
cover: videoItem.pic,
);
}
},
onTap: () async {
if (onTap != null) {
onTap!();
return;
}
if (type == 'ketang') {
SmartDialog.showToast('课堂视频暂不支持播放');
return;
}
if ((videoItem is HotVideoItemModel) &&
(videoItem as HotVideoItemModel).redirectUrl?.isNotEmpty ==
true) {
if (Utils.viewPgcFromUri(
(videoItem as HotVideoItemModel).redirectUrl!)) {
return;
}
}
try {
final int cid = videoItem.cid ??
await SearchHttp.ab2c(aid: aid, bvid: bvid);
if (source == 'later') {
onViewLater!(cid);
} else {
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
'videoItem': videoItem,
'heroTag': Utils.makeHeroTag(aid)
},
);
}
} catch (err) {
SmartDialog.showToast(err.toString());
}
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
vertical: 5,
),
const SizedBox(width: 10),
videoContent(context),
],
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AspectRatio(
aspectRatio: StyleString.aspectRatio,
child: LayoutBuilder(
builder: (BuildContext context,
BoxConstraints boxConstraints) {
final double maxWidth = boxConstraints.maxWidth;
final double maxHeight = boxConstraints.maxHeight;
return Stack(
children: [
NetworkImgLayer(
src: videoItem.pic,
width: maxWidth,
height: maxHeight,
),
if (videoItem is HotVideoItemModel &&
(videoItem as HotVideoItemModel)
.pgcLabel
?.isNotEmpty ==
true)
PBadge(
text:
(videoItem as HotVideoItemModel).pgcLabel,
top: 6.0,
right: 6.0,
),
if (videoItem.duration > 0)
PBadge(
text: Utils.timeFormat(videoItem.duration),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (type != 'video')
PBadge(
text: type,
left: 6.0,
bottom: 6.0,
type: 'primary',
),
// if (videoItem.rcmdReason != null &&
// videoItem.rcmdReason.content != '')
// pBadge(videoItem.rcmdReason.content, context,
// 6.0, 6.0, null, null),
],
);
},
),
),
const SizedBox(width: 10),
videoContent(context),
],
),
),
),
),
),
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
),
),
],
),
if (source == 'normal')
Positioned(
bottom: 0,
right: 12,
child: VideoPopupMenu(
size: 29,
iconSize: 17,
videoItem: videoItem,
),
),
]);
);
}
Widget videoContent(context) {
Widget videoContent(BuildContext context) {
String pubdate = showPubdate
? Utils.dateFormat(videoItem.pubdate!, formatType: 'day')
: '';
@@ -180,7 +197,33 @@ class VideoCardH extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (videoItem.title is String)
if ((videoItem is SearchVideoItemModel) &&
(videoItem as SearchVideoItemModel).titleList?.isNotEmpty == true)
Expanded(
child: Text.rich(
overflow: TextOverflow.ellipsis,
maxLines: 2,
TextSpan(
children: [
for (var i
in (videoItem as SearchVideoItemModel).titleList!)
TextSpan(
text: i['text'],
style: TextStyle(
fontSize:
Theme.of(context).textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: i['type'] == 'em'
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface,
),
),
],
),
),
)
else
Expanded(
child: Text(
videoItem.title,
@@ -193,31 +236,6 @@ class VideoCardH extends StatelessWidget {
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
)
else
Expanded(
child: Text.rich(
overflow: TextOverflow.ellipsis,
maxLines: 2,
TextSpan(
children: [
for (final i in videoItem.title) ...[
TextSpan(
text: i['text'] as String,
style: TextStyle(
fontSize:
Theme.of(context).textTheme.bodyMedium!.fontSize,
height: 1.42,
letterSpacing: 0.3,
color: i['type'] == 'em'
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.onSurface,
),
),
]
],
),
),
),
// const Spacer(),
// if (videoItem.rcmdReason != null &&
@@ -255,18 +273,18 @@ class VideoCardH extends StatelessWidget {
Row(
children: [
if (showView) ...[
statView(
StatView(
context: context,
theme: 'gray',
view: videoItem.stat.view as int,
value: videoItem.stat.viewStr,
),
const SizedBox(width: 8),
],
if (showDanmaku)
statDanMu(
StatDanMu(
context: context,
theme: 'gray',
danmu: videoItem.stat.danmu as int,
value: videoItem.stat.danmuStr,
),
const Spacer(),
if (source == 'normal') const SizedBox(width: 24),

View File

@@ -58,7 +58,7 @@ class VideoCardHGrpc extends StatelessWidget {
return;
}
try {
PiliScheme.routePush(Uri.parse(videoItem.smallCoverV5.base.uri));
PiliScheme.routePushFromUrl(videoItem.smallCoverV5.base.uri);
} catch (err) {
SmartDialog.showToast(err.toString());
}

View File

@@ -1,11 +1,10 @@
import 'package:PiliPlus/common/widgets/image_save.dart';
import 'package:PiliPlus/common/widgets/stat/danmu.dart';
import 'package:PiliPlus/common/widgets/stat/view.dart';
import 'package:PiliPlus/common/widgets/stat/stat.dart';
import 'package:PiliPlus/common/widgets/video_popup_menu.dart';
import 'package:PiliPlus/common/widgets/video_progress_indicator.dart';
import 'package:PiliPlus/models/space_archive/item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../utils/utils.dart';
import '../constants.dart';
import 'badge.dart';
@@ -43,12 +42,12 @@ class VideoCardHMemberVideo extends StatelessWidget {
return;
}
}
if (videoItem.bvid == null || videoItem.firstCid == null) {
if (videoItem.bvid == null || videoItem.cid == null) {
return;
}
try {
Get.toNamed(
'/video?bvid=${videoItem.bvid}&cid=${videoItem.firstCid}',
Utils.toViewPage(
'bvid=${videoItem.bvid}&cid=${videoItem.cid}',
arguments: {
'heroTag': Utils.makeHeroTag(videoItem.bvid),
},
@@ -91,13 +90,29 @@ class VideoCardHMemberVideo extends StatelessWidget {
right: 6.0,
top: 6.0,
),
if (videoItem.duration != null)
if (videoItem.duration > 0)
PBadge(
text: Utils.timeFormat(videoItem.duration),
right: 6.0,
bottom: 6.0,
type: 'gray',
),
if (videoItem.history != null)
Builder(builder: (context) {
try {
return Positioned(
left: 0,
right: 0,
bottom: 0,
child: videoProgressIndicator(
videoItem.history!['progress'] /
videoItem.history!['duration'],
),
);
} catch (_) {
return const SizedBox.shrink();
}
}),
],
);
},
@@ -132,7 +147,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
Expanded(
child: Text(
// videoItem.season?['title'] ?? videoItem.title ?? '',
videoItem.title ?? '',
videoItem.title,
textAlign: TextAlign.start,
style: TextStyle(
fontWeight: videoItem.bvid != null && videoItem.bvid == bvid
@@ -164,19 +179,19 @@ class VideoCardHMemberVideo extends StatelessWidget {
const SizedBox(height: 3),
Row(
children: [
statView(
StatView(
context: context,
theme: 'gray',
// view: videoItem.season?['view_content'] ??
// videoItem.viewContent,
view: videoItem.viewContent,
value: videoItem.stat.viewStr,
),
const SizedBox(width: 8),
statDanMu(
StatDanMu(
context: context,
theme: 'gray',
// danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku,
danmu: videoItem.danmaku,
value: videoItem.stat.danmuStr,
),
],
),

View File

@@ -5,8 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../models/home/rcmd/result.dart';
import '../../models/model_rec_video_item.dart';
import 'stat/danmu.dart';
import 'stat/view.dart';
import 'stat/stat.dart';
import '../../http/dynamics.dart';
import '../../utils/id_utils.dart';
import '../../utils/utils.dart';
@@ -17,7 +16,7 @@ import 'video_popup_menu.dart';
// 视频卡片 - 垂直布局
class VideoCardV extends StatelessWidget {
final dynamic videoItem;
final BaseRecVideoItemModel videoItem;
final VoidCallback? onRemove;
const VideoCardV({
@@ -32,56 +31,19 @@ class VideoCardV extends StatelessWidget {
}
void onPushDetail(heroTag) async {
String goto = videoItem.goto;
String goto = videoItem.goto!;
switch (goto) {
case 'bangumi':
// if (videoItem.bangumiBadge == '电影') {
// SmartDialog.showToast('暂不支持电影观看');
// return;
// }
Utils.viewBangumi(epId: videoItem.param);
// SmartDialog.showLoading(msg: '资源获取中');
// var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId);
// SmartDialog.dismiss();
// if (result['status']) {
// var bangumiDetail = result['data'];
// EpisodeItem episode = result['data'].episodes.first;
// int? epId = result['data'].userStatus?.progress?.lastEpId;
// if (epId == null) {
// epId = episode.epId;
// } else {
// for (var item in result['data'].episodes) {
// if (item.epId == epId) {
// episode = item;
// break;
// }
// }
// }
// String bvid = episode.bvid!;
// int cid = episode.cid!;
// String pic = episode.cover!;
// String seasonId = bangumiDetail.seasonId;
// dynamic heroTag = Utils.makeHeroTag(cid);
// Get.toNamed(
// '/video?bvid=$bvid&cid=$cid&seasonId=$seasonId&epId=$epId',
// arguments: {
// 'pic': pic,
// 'heroTag': heroTag,
// 'videoType': SearchType.media_bangumi,
// },
// );
// } else {
// SmartDialog.showToast(result['msg']);
// }
Utils.viewBangumi(epId: videoItem.param!);
break;
case 'av':
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid);
int cid = videoItem.cid;
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid!);
int cid = videoItem.cid!;
if (cid == -1) {
cid = await SearchHttp.ab2c(aid: videoItem.aid, bvid: bvid);
}
Get.toNamed(
'/video?bvid=$bvid&cid=$cid',
Utils.toViewPage(
'bvid=$bvid&cid=$cid',
arguments: {
// 'videoItem': videoItem,
'pic': videoItem.pic,
@@ -93,13 +55,13 @@ class VideoCardV extends StatelessWidget {
case 'picture':
try {
String dynamicType = 'picture';
String uri = videoItem.uri;
String uri = videoItem.uri!;
String id = '';
if (videoItem.uri.startsWith('bilibili://article/')) {
if (uri.startsWith('bilibili://article/')) {
// https://www.bilibili.com/read/cv27063554
dynamicType = 'read';
RegExp regex = RegExp(r'\d+');
Match match = regex.firstMatch(videoItem.uri)!;
Match match = regex.firstMatch(uri)!;
String matchedNumber = match.group(0)!;
videoItem.param = int.parse(matchedNumber);
id = 'cv${videoItem.param}';
@@ -133,8 +95,8 @@ class VideoCardV extends StatelessWidget {
}
break;
default:
SmartDialog.showToast(videoItem.goto);
Utils.handleWebview(videoItem.uri);
SmartDialog.showToast(goto);
Utils.handleWebview(videoItem.uri!);
}
}
@@ -152,7 +114,7 @@ class VideoCardV extends StatelessWidget {
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero,
child: InkWell(
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.id)),
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)),
onLongPress: () => imageSaveDialog(
context: context,
title: videoItem.title,
@@ -217,7 +179,7 @@ class VideoCardV extends StatelessWidget {
Row(
children: [
Expanded(
child: Text(videoItem.title + "\n",
child: Text("${videoItem.title}\n",
// semanticsLabel: "${videoItem.title}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
@@ -261,7 +223,7 @@ class VideoCardV extends StatelessWidget {
),
const SizedBox(width: 2),
],
if (videoItem.isFollowed == 1) ...[
if (videoItem.isFollowed) ...[
const PBadge(
text: '已关注',
stack: 'normal',
@@ -297,18 +259,18 @@ class VideoCardV extends StatelessWidget {
Widget videoStat(context) {
return Row(
children: [
statView(
StatView(
context: context,
theme: 'gray',
view: videoItem.stat.view,
value: videoItem.stat.viewStr,
goto: videoItem.goto,
),
const SizedBox(width: 4),
if (videoItem.goto != 'picture')
statDanMu(
StatDanMu(
context: context,
theme: 'gray',
danmu: videoItem.stat.danmu,
value: videoItem.stat.danmuStr,
),
if (videoItem is RecVideoItemModel) ...<Widget>[
const Spacer(),
@@ -332,7 +294,7 @@ class VideoCardV extends StatelessWidget {
],
if (videoItem is RecVideoItemAppModel &&
videoItem.desc != null &&
videoItem.desc.contains(' · ')) ...<Widget>[
videoItem.desc!.contains(' · ')) ...<Widget>[
const Spacer(),
Expanded(
flex: 0,
@@ -348,7 +310,7 @@ class VideoCardV extends StatelessWidget {
.withOpacity(0.8),
),
text: Utils.shortenChineseDateString(
videoItem.desc.split(' · ').last)),
videoItem.desc!.split(' · ').last)),
)),
const SizedBox(width: 2),
]

View File

@@ -2,7 +2,6 @@ import 'package:PiliPlus/common/widgets/image_save.dart';
import 'package:PiliPlus/models/space/item.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import '../../utils/utils.dart';
import '../constants.dart';
import 'badge.dart';
@@ -21,47 +20,8 @@ class VideoCardVMemberHome extends StatelessWidget {
String goto = videoItem.goto ?? '';
switch (goto) {
case 'bangumi':
// if (videoItem.bangumiBadge == '电影') {
// SmartDialog.showToast('暂不支持电影观看');
// return;
// }
// int epId = videoItem.param;
Utils.viewBangumi(epId: videoItem.param);
// SmartDialog.showLoading(msg: '资源获取中');
// var result = await SearchHttp.bangumiInfo(seasonId: null, epId: epId);
// SmartDialog.dismiss();
// if (result['status']) {
// var bangumiDetail = result['data'];
// EpisodeItem episode = result['data'].episodes.first;
// int? epId = result['data'].userStatus?.progress?.lastEpId;
// if (epId == null) {
// epId = episode.epId;
// } else {
// for (var item in result['data'].episodes) {
// if (item.epId == epId) {
// episode = item;
// break;
// }
// }
// }
// String bvid = episode.bvid!;
// int cid = episode.cid!;
// String pic = episode.cover!;
// String seasonId = bangumiDetail.seasonId;
// dynamic heroTag = Utils.makeHeroTag(cid);
// Get.toNamed(
// '/video?bvid=$bvid&cid=$cid&seasonId=$seasonId&epId=$epId',
// arguments: {
// 'pic': pic,
// 'heroTag': heroTag,
// 'videoType': SearchType.media_bangumi,
// },
// );
// } else {
// SmartDialog.showToast(result['msg']);
// }
// break;
break;
case 'av':
if (videoItem.isPgc == true && videoItem.uri?.isNotEmpty == true) {
if (Utils.viewPgcFromUri(videoItem.uri!)) {
@@ -69,8 +29,8 @@ class VideoCardVMemberHome extends StatelessWidget {
}
}
String bvid = videoItem.bvid ?? '';
Get.toNamed(
'/video?bvid=$bvid&cid=${videoItem.firstCid}',
Utils.toViewPage(
'bvid=$bvid&cid=${videoItem.firstCid}',
arguments: {
// 'videoItem': videoItem,
'pic': videoItem.cover,

View File

@@ -1,3 +1,4 @@
import 'package:PiliPlus/models/model_video.dart';
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart';
@@ -21,16 +22,16 @@ class VideoCustomAction {
}
class VideoCustomActions {
dynamic videoItem;
BaseSimpleVideoItemModel videoItem;
BuildContext context;
late List<VideoCustomAction> actions;
VoidCallback? onRemove;
VideoCustomActions(this.videoItem, this.context, [this.onRemove]) {
actions = [
if ((videoItem.bvid as String?)?.isNotEmpty == true) ...[
if (videoItem.bvid?.isNotEmpty == true) ...[
VideoCustomAction(
videoItem.bvid,
videoItem.bvid!,
'copy',
Stack(
children: [
@@ -39,7 +40,7 @@ class VideoCustomActions {
],
),
() {
Utils.copyText(videoItem.bvid);
Utils.copyText(videoItem.bvid!);
},
),
VideoCustomAction(
@@ -68,8 +69,7 @@ class VideoCustomActions {
VideoCustomAction(
'不感兴趣', 'dislike', Icon(MdiIcons.thumbDownOutline, size: 16),
() async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
String? accessKey = Accounts.get(AccountType.recommend).accessKey;
if (accessKey == null || accessKey == "") {
SmartDialog.showToast("请退出账号后重新登录");
return;
@@ -85,7 +85,7 @@ class VideoCustomActions {
SmartDialog.showToast("未能获取dislikeReasons或feedbacks");
return;
}
Widget actionButton(DislikeReason? r, FeedbackReason? f) {
Widget actionButton(Reason? r, Reason? f) {
return SearchText(
text: r?.name ?? f?.name ?? '未知',
onTap: (_) async {
@@ -259,13 +259,11 @@ class VideoCustomActions {
TextButton(
onPressed: () async {
var res = await VideoHttp.relationMod(
mid: videoItem.owner.mid,
mid: videoItem.owner.mid!,
act: 5,
reSrc: 11,
);
List<int> blackMidsList = GStorage.blackMidsList;
blackMidsList.insert(0, videoItem.owner.mid);
GStorage.setBlackMidsList(blackMidsList);
GStorage.setBlackMid(videoItem.owner.mid!);
Get.back();
SmartDialog.showToast(res['msg'] ?? '成功');
},

View File

@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
Widget videoProgressIndicator(double progress) => ClipRect(
clipper: ProgressClipper(),
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10),
),
child: LinearProgressIndicator(
minHeight: 10,
value: progress,
),
),
);
class ProgressClipper extends CustomClipper<Rect> {
@override
Rect getClip(Size size) {
return Rect.fromLTWH(0, 6, size.width, size.height - 6);
}
@override
bool shouldReclip(CustomClipper<Rect> oldClipper) {
return false;
}
}

View File

@@ -1,299 +0,0 @@
//
// Generated code. Do not modify.
// source: bilibili/app/dynamic/v1/dynamic.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'dynamic.pb.dart' as $0;
export 'dynamic.pb.dart';
@$pb.GrpcServiceName('bilibili.app.dynamic.v1.Dynamic')
class DynamicClient extends $grpc.Client {
static final _$dynVideo = $grpc.ClientMethod<$0.DynVideoReq, $0.DynVideoReqReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynVideo',
($0.DynVideoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynVideoReqReply.fromBuffer(value));
static final _$dynDetails = $grpc.ClientMethod<$0.DynDetailsReq, $0.DynDetailsReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynDetails',
($0.DynDetailsReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynDetailsReply.fromBuffer(value));
static final _$sVideo = $grpc.ClientMethod<$0.SVideoReq, $0.SVideoReply>(
'/bilibili.app.dynamic.v1.Dynamic/SVideo',
($0.SVideoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.SVideoReply.fromBuffer(value));
static final _$dynTab = $grpc.ClientMethod<$0.DynTabReq, $0.DynTabReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynTab',
($0.DynTabReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynTabReply.fromBuffer(value));
static final _$dynOurCitySwitch = $grpc.ClientMethod<$0.DynOurCitySwitchReq, $0.NoReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynOurCitySwitch',
($0.DynOurCitySwitchReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.NoReply.fromBuffer(value));
static final _$dynOurCity = $grpc.ClientMethod<$0.DynOurCityReq, $0.DynOurCityReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynOurCity',
($0.DynOurCityReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynOurCityReply.fromBuffer(value));
static final _$dynVideoPersonal = $grpc.ClientMethod<$0.DynVideoPersonalReq, $0.DynVideoPersonalReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynVideoPersonal',
($0.DynVideoPersonalReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynVideoPersonalReply.fromBuffer(value));
static final _$dynUpdOffset = $grpc.ClientMethod<$0.DynUpdOffsetReq, $0.NoReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynUpdOffset',
($0.DynUpdOffsetReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.NoReply.fromBuffer(value));
static final _$dynRed = $grpc.ClientMethod<$0.DynRedReq, $0.DynRedReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynRed',
($0.DynRedReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynRedReply.fromBuffer(value));
static final _$dynMixUpListViewMore = $grpc.ClientMethod<$0.NoReq, $0.DynMixUpListViewMoreReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynMixUpListViewMore',
($0.NoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynMixUpListViewMoreReply.fromBuffer(value));
static final _$dynMixUpListSearch = $grpc.ClientMethod<$0.DynMixUpListSearchReq, $0.DynMixUpListSearchReply>(
'/bilibili.app.dynamic.v1.Dynamic/DynMixUpListSearch',
($0.DynMixUpListSearchReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DynMixUpListSearchReply.fromBuffer(value));
static final _$ourCityClickReport = $grpc.ClientMethod<$0.OurCityClickReportReq, $0.OurCityClickReportReply>(
'/bilibili.app.dynamic.v1.Dynamic/OurCityClickReport',
($0.OurCityClickReportReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.OurCityClickReportReply.fromBuffer(value));
static final _$geoCoder = $grpc.ClientMethod<$0.GeoCoderReq, $0.GeoCoderReply>(
'/bilibili.app.dynamic.v1.Dynamic/GeoCoder',
($0.GeoCoderReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.GeoCoderReply.fromBuffer(value));
DynamicClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.DynVideoReqReply> dynVideo($0.DynVideoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynVideo, request, options: options);
}
$grpc.ResponseFuture<$0.DynDetailsReply> dynDetails($0.DynDetailsReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynDetails, request, options: options);
}
$grpc.ResponseFuture<$0.SVideoReply> sVideo($0.SVideoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$sVideo, request, options: options);
}
$grpc.ResponseFuture<$0.DynTabReply> dynTab($0.DynTabReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynTab, request, options: options);
}
$grpc.ResponseFuture<$0.NoReply> dynOurCitySwitch($0.DynOurCitySwitchReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynOurCitySwitch, request, options: options);
}
$grpc.ResponseFuture<$0.DynOurCityReply> dynOurCity($0.DynOurCityReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynOurCity, request, options: options);
}
$grpc.ResponseFuture<$0.DynVideoPersonalReply> dynVideoPersonal($0.DynVideoPersonalReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynVideoPersonal, request, options: options);
}
$grpc.ResponseFuture<$0.NoReply> dynUpdOffset($0.DynUpdOffsetReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynUpdOffset, request, options: options);
}
$grpc.ResponseFuture<$0.DynRedReply> dynRed($0.DynRedReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynRed, request, options: options);
}
$grpc.ResponseFuture<$0.DynMixUpListViewMoreReply> dynMixUpListViewMore($0.NoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynMixUpListViewMore, request, options: options);
}
$grpc.ResponseFuture<$0.DynMixUpListSearchReply> dynMixUpListSearch($0.DynMixUpListSearchReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dynMixUpListSearch, request, options: options);
}
$grpc.ResponseFuture<$0.OurCityClickReportReply> ourCityClickReport($0.OurCityClickReportReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$ourCityClickReport, request, options: options);
}
$grpc.ResponseFuture<$0.GeoCoderReply> geoCoder($0.GeoCoderReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$geoCoder, request, options: options);
}
}
@$pb.GrpcServiceName('bilibili.app.dynamic.v1.Dynamic')
abstract class DynamicServiceBase extends $grpc.Service {
$core.String get $name => 'bilibili.app.dynamic.v1.Dynamic';
DynamicServiceBase() {
$addMethod($grpc.ServiceMethod<$0.DynVideoReq, $0.DynVideoReqReply>(
'DynVideo',
dynVideo_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynVideoReq.fromBuffer(value),
($0.DynVideoReqReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynDetailsReq, $0.DynDetailsReply>(
'DynDetails',
dynDetails_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynDetailsReq.fromBuffer(value),
($0.DynDetailsReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.SVideoReq, $0.SVideoReply>(
'SVideo',
sVideo_Pre,
false,
false,
($core.List<$core.int> value) => $0.SVideoReq.fromBuffer(value),
($0.SVideoReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynTabReq, $0.DynTabReply>(
'DynTab',
dynTab_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynTabReq.fromBuffer(value),
($0.DynTabReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynOurCitySwitchReq, $0.NoReply>(
'DynOurCitySwitch',
dynOurCitySwitch_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynOurCitySwitchReq.fromBuffer(value),
($0.NoReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynOurCityReq, $0.DynOurCityReply>(
'DynOurCity',
dynOurCity_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynOurCityReq.fromBuffer(value),
($0.DynOurCityReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynVideoPersonalReq, $0.DynVideoPersonalReply>(
'DynVideoPersonal',
dynVideoPersonal_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynVideoPersonalReq.fromBuffer(value),
($0.DynVideoPersonalReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynUpdOffsetReq, $0.NoReply>(
'DynUpdOffset',
dynUpdOffset_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynUpdOffsetReq.fromBuffer(value),
($0.NoReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynRedReq, $0.DynRedReply>(
'DynRed',
dynRed_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynRedReq.fromBuffer(value),
($0.DynRedReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.NoReq, $0.DynMixUpListViewMoreReply>(
'DynMixUpListViewMore',
dynMixUpListViewMore_Pre,
false,
false,
($core.List<$core.int> value) => $0.NoReq.fromBuffer(value),
($0.DynMixUpListViewMoreReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DynMixUpListSearchReq, $0.DynMixUpListSearchReply>(
'DynMixUpListSearch',
dynMixUpListSearch_Pre,
false,
false,
($core.List<$core.int> value) => $0.DynMixUpListSearchReq.fromBuffer(value),
($0.DynMixUpListSearchReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.OurCityClickReportReq, $0.OurCityClickReportReply>(
'OurCityClickReport',
ourCityClickReport_Pre,
false,
false,
($core.List<$core.int> value) => $0.OurCityClickReportReq.fromBuffer(value),
($0.OurCityClickReportReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.GeoCoderReq, $0.GeoCoderReply>(
'GeoCoder',
geoCoder_Pre,
false,
false,
($core.List<$core.int> value) => $0.GeoCoderReq.fromBuffer(value),
($0.GeoCoderReply value) => value.writeToBuffer()));
}
$async.Future<$0.DynVideoReqReply> dynVideo_Pre($grpc.ServiceCall call, $async.Future<$0.DynVideoReq> request) async {
return dynVideo(call, await request);
}
$async.Future<$0.DynDetailsReply> dynDetails_Pre($grpc.ServiceCall call, $async.Future<$0.DynDetailsReq> request) async {
return dynDetails(call, await request);
}
$async.Future<$0.SVideoReply> sVideo_Pre($grpc.ServiceCall call, $async.Future<$0.SVideoReq> request) async {
return sVideo(call, await request);
}
$async.Future<$0.DynTabReply> dynTab_Pre($grpc.ServiceCall call, $async.Future<$0.DynTabReq> request) async {
return dynTab(call, await request);
}
$async.Future<$0.NoReply> dynOurCitySwitch_Pre($grpc.ServiceCall call, $async.Future<$0.DynOurCitySwitchReq> request) async {
return dynOurCitySwitch(call, await request);
}
$async.Future<$0.DynOurCityReply> dynOurCity_Pre($grpc.ServiceCall call, $async.Future<$0.DynOurCityReq> request) async {
return dynOurCity(call, await request);
}
$async.Future<$0.DynVideoPersonalReply> dynVideoPersonal_Pre($grpc.ServiceCall call, $async.Future<$0.DynVideoPersonalReq> request) async {
return dynVideoPersonal(call, await request);
}
$async.Future<$0.NoReply> dynUpdOffset_Pre($grpc.ServiceCall call, $async.Future<$0.DynUpdOffsetReq> request) async {
return dynUpdOffset(call, await request);
}
$async.Future<$0.DynRedReply> dynRed_Pre($grpc.ServiceCall call, $async.Future<$0.DynRedReq> request) async {
return dynRed(call, await request);
}
$async.Future<$0.DynMixUpListViewMoreReply> dynMixUpListViewMore_Pre($grpc.ServiceCall call, $async.Future<$0.NoReq> request) async {
return dynMixUpListViewMore(call, await request);
}
$async.Future<$0.DynMixUpListSearchReply> dynMixUpListSearch_Pre($grpc.ServiceCall call, $async.Future<$0.DynMixUpListSearchReq> request) async {
return dynMixUpListSearch(call, await request);
}
$async.Future<$0.OurCityClickReportReply> ourCityClickReport_Pre($grpc.ServiceCall call, $async.Future<$0.OurCityClickReportReq> request) async {
return ourCityClickReport(call, await request);
}
$async.Future<$0.GeoCoderReply> geoCoder_Pre($grpc.ServiceCall call, $async.Future<$0.GeoCoderReq> request) async {
return geoCoder(call, await request);
}
$async.Future<$0.DynVideoReqReply> dynVideo($grpc.ServiceCall call, $0.DynVideoReq request);
$async.Future<$0.DynDetailsReply> dynDetails($grpc.ServiceCall call, $0.DynDetailsReq request);
$async.Future<$0.SVideoReply> sVideo($grpc.ServiceCall call, $0.SVideoReq request);
$async.Future<$0.DynTabReply> dynTab($grpc.ServiceCall call, $0.DynTabReq request);
$async.Future<$0.NoReply> dynOurCitySwitch($grpc.ServiceCall call, $0.DynOurCitySwitchReq request);
$async.Future<$0.DynOurCityReply> dynOurCity($grpc.ServiceCall call, $0.DynOurCityReq request);
$async.Future<$0.DynVideoPersonalReply> dynVideoPersonal($grpc.ServiceCall call, $0.DynVideoPersonalReq request);
$async.Future<$0.NoReply> dynUpdOffset($grpc.ServiceCall call, $0.DynUpdOffsetReq request);
$async.Future<$0.DynRedReply> dynRed($grpc.ServiceCall call, $0.DynRedReq request);
$async.Future<$0.DynMixUpListViewMoreReply> dynMixUpListViewMore($grpc.ServiceCall call, $0.NoReq request);
$async.Future<$0.DynMixUpListSearchReply> dynMixUpListSearch($grpc.ServiceCall call, $0.DynMixUpListSearchReq request);
$async.Future<$0.OurCityClickReportReply> ourCityClickReport($grpc.ServiceCall call, $0.OurCityClickReportReq request);
$async.Future<$0.GeoCoderReply> geoCoder($grpc.ServiceCall call, $0.GeoCoderReq request);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,259 +0,0 @@
//
// Generated code. Do not modify.
// source: bilibili/main/community/reply/v1/reply.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'reply.pb.dart' as $0;
export 'reply.pb.dart';
@$pb.GrpcServiceName('bilibili.main.community.reply.v1.Reply')
class ReplyClient extends $grpc.Client {
static final _$mainList = $grpc.ClientMethod<$0.MainListReq, $0.MainListReply>(
'/bilibili.main.community.reply.v1.Reply/MainList',
($0.MainListReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.MainListReply.fromBuffer(value));
static final _$detailList = $grpc.ClientMethod<$0.DetailListReq, $0.DetailListReply>(
'/bilibili.main.community.reply.v1.Reply/DetailList',
($0.DetailListReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DetailListReply.fromBuffer(value));
static final _$dialogList = $grpc.ClientMethod<$0.DialogListReq, $0.DialogListReply>(
'/bilibili.main.community.reply.v1.Reply/DialogList',
($0.DialogListReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DialogListReply.fromBuffer(value));
static final _$previewList = $grpc.ClientMethod<$0.PreviewListReq, $0.PreviewListReply>(
'/bilibili.main.community.reply.v1.Reply/PreviewList',
($0.PreviewListReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PreviewListReply.fromBuffer(value));
static final _$searchItemPreHook = $grpc.ClientMethod<$0.SearchItemPreHookReq, $0.SearchItemPreHookReply>(
'/bilibili.main.community.reply.v1.Reply/SearchItemPreHook',
($0.SearchItemPreHookReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.SearchItemPreHookReply.fromBuffer(value));
static final _$searchItem = $grpc.ClientMethod<$0.SearchItemReq, $0.SearchItemReply>(
'/bilibili.main.community.reply.v1.Reply/SearchItem',
($0.SearchItemReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.SearchItemReply.fromBuffer(value));
static final _$atSearch = $grpc.ClientMethod<$0.AtSearchReq, $0.AtSearchReply>(
'/bilibili.main.community.reply.v1.Reply/AtSearch',
($0.AtSearchReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.AtSearchReply.fromBuffer(value));
static final _$replyInfo = $grpc.ClientMethod<$0.ReplyInfoReq, $0.ReplyInfoReply>(
'/bilibili.main.community.reply.v1.Reply/ReplyInfo',
($0.ReplyInfoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.ReplyInfoReply.fromBuffer(value));
static final _$userCallback = $grpc.ClientMethod<$0.UserCallbackReq, $0.UserCallbackReply>(
'/bilibili.main.community.reply.v1.Reply/UserCallback',
($0.UserCallbackReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.UserCallbackReply.fromBuffer(value));
static final _$shareRepliesInfo = $grpc.ClientMethod<$0.ShareRepliesInfoReq, $0.ShareRepliesInfoResp>(
'/bilibili.main.community.reply.v1.Reply/ShareRepliesInfo',
($0.ShareRepliesInfoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.ShareRepliesInfoResp.fromBuffer(value));
static final _$suggestEmotes = $grpc.ClientMethod<$0.SuggestEmotesReq, $0.SuggestEmotesResp>(
'/bilibili.main.community.reply.v1.Reply/SuggestEmotes',
($0.SuggestEmotesReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.SuggestEmotesResp.fromBuffer(value));
ReplyClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.MainListReply> mainList($0.MainListReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$mainList, request, options: options);
}
$grpc.ResponseFuture<$0.DetailListReply> detailList($0.DetailListReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$detailList, request, options: options);
}
$grpc.ResponseFuture<$0.DialogListReply> dialogList($0.DialogListReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dialogList, request, options: options);
}
$grpc.ResponseFuture<$0.PreviewListReply> previewList($0.PreviewListReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$previewList, request, options: options);
}
$grpc.ResponseFuture<$0.SearchItemPreHookReply> searchItemPreHook($0.SearchItemPreHookReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$searchItemPreHook, request, options: options);
}
$grpc.ResponseFuture<$0.SearchItemReply> searchItem($0.SearchItemReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$searchItem, request, options: options);
}
$grpc.ResponseFuture<$0.AtSearchReply> atSearch($0.AtSearchReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$atSearch, request, options: options);
}
$grpc.ResponseFuture<$0.ReplyInfoReply> replyInfo($0.ReplyInfoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$replyInfo, request, options: options);
}
$grpc.ResponseFuture<$0.UserCallbackReply> userCallback($0.UserCallbackReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$userCallback, request, options: options);
}
$grpc.ResponseFuture<$0.ShareRepliesInfoResp> shareRepliesInfo($0.ShareRepliesInfoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$shareRepliesInfo, request, options: options);
}
$grpc.ResponseFuture<$0.SuggestEmotesResp> suggestEmotes($0.SuggestEmotesReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$suggestEmotes, request, options: options);
}
}
@$pb.GrpcServiceName('bilibili.main.community.reply.v1.Reply')
abstract class ReplyServiceBase extends $grpc.Service {
$core.String get $name => 'bilibili.main.community.reply.v1.Reply';
ReplyServiceBase() {
$addMethod($grpc.ServiceMethod<$0.MainListReq, $0.MainListReply>(
'MainList',
mainList_Pre,
false,
false,
($core.List<$core.int> value) => $0.MainListReq.fromBuffer(value),
($0.MainListReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DetailListReq, $0.DetailListReply>(
'DetailList',
detailList_Pre,
false,
false,
($core.List<$core.int> value) => $0.DetailListReq.fromBuffer(value),
($0.DetailListReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DialogListReq, $0.DialogListReply>(
'DialogList',
dialogList_Pre,
false,
false,
($core.List<$core.int> value) => $0.DialogListReq.fromBuffer(value),
($0.DialogListReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PreviewListReq, $0.PreviewListReply>(
'PreviewList',
previewList_Pre,
false,
false,
($core.List<$core.int> value) => $0.PreviewListReq.fromBuffer(value),
($0.PreviewListReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.SearchItemPreHookReq, $0.SearchItemPreHookReply>(
'SearchItemPreHook',
searchItemPreHook_Pre,
false,
false,
($core.List<$core.int> value) => $0.SearchItemPreHookReq.fromBuffer(value),
($0.SearchItemPreHookReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.SearchItemReq, $0.SearchItemReply>(
'SearchItem',
searchItem_Pre,
false,
false,
($core.List<$core.int> value) => $0.SearchItemReq.fromBuffer(value),
($0.SearchItemReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.AtSearchReq, $0.AtSearchReply>(
'AtSearch',
atSearch_Pre,
false,
false,
($core.List<$core.int> value) => $0.AtSearchReq.fromBuffer(value),
($0.AtSearchReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ReplyInfoReq, $0.ReplyInfoReply>(
'ReplyInfo',
replyInfo_Pre,
false,
false,
($core.List<$core.int> value) => $0.ReplyInfoReq.fromBuffer(value),
($0.ReplyInfoReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.UserCallbackReq, $0.UserCallbackReply>(
'UserCallback',
userCallback_Pre,
false,
false,
($core.List<$core.int> value) => $0.UserCallbackReq.fromBuffer(value),
($0.UserCallbackReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ShareRepliesInfoReq, $0.ShareRepliesInfoResp>(
'ShareRepliesInfo',
shareRepliesInfo_Pre,
false,
false,
($core.List<$core.int> value) => $0.ShareRepliesInfoReq.fromBuffer(value),
($0.ShareRepliesInfoResp value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.SuggestEmotesReq, $0.SuggestEmotesResp>(
'SuggestEmotes',
suggestEmotes_Pre,
false,
false,
($core.List<$core.int> value) => $0.SuggestEmotesReq.fromBuffer(value),
($0.SuggestEmotesResp value) => value.writeToBuffer()));
}
$async.Future<$0.MainListReply> mainList_Pre($grpc.ServiceCall call, $async.Future<$0.MainListReq> request) async {
return mainList(call, await request);
}
$async.Future<$0.DetailListReply> detailList_Pre($grpc.ServiceCall call, $async.Future<$0.DetailListReq> request) async {
return detailList(call, await request);
}
$async.Future<$0.DialogListReply> dialogList_Pre($grpc.ServiceCall call, $async.Future<$0.DialogListReq> request) async {
return dialogList(call, await request);
}
$async.Future<$0.PreviewListReply> previewList_Pre($grpc.ServiceCall call, $async.Future<$0.PreviewListReq> request) async {
return previewList(call, await request);
}
$async.Future<$0.SearchItemPreHookReply> searchItemPreHook_Pre($grpc.ServiceCall call, $async.Future<$0.SearchItemPreHookReq> request) async {
return searchItemPreHook(call, await request);
}
$async.Future<$0.SearchItemReply> searchItem_Pre($grpc.ServiceCall call, $async.Future<$0.SearchItemReq> request) async {
return searchItem(call, await request);
}
$async.Future<$0.AtSearchReply> atSearch_Pre($grpc.ServiceCall call, $async.Future<$0.AtSearchReq> request) async {
return atSearch(call, await request);
}
$async.Future<$0.ReplyInfoReply> replyInfo_Pre($grpc.ServiceCall call, $async.Future<$0.ReplyInfoReq> request) async {
return replyInfo(call, await request);
}
$async.Future<$0.UserCallbackReply> userCallback_Pre($grpc.ServiceCall call, $async.Future<$0.UserCallbackReq> request) async {
return userCallback(call, await request);
}
$async.Future<$0.ShareRepliesInfoResp> shareRepliesInfo_Pre($grpc.ServiceCall call, $async.Future<$0.ShareRepliesInfoReq> request) async {
return shareRepliesInfo(call, await request);
}
$async.Future<$0.SuggestEmotesResp> suggestEmotes_Pre($grpc.ServiceCall call, $async.Future<$0.SuggestEmotesReq> request) async {
return suggestEmotes(call, await request);
}
$async.Future<$0.MainListReply> mainList($grpc.ServiceCall call, $0.MainListReq request);
$async.Future<$0.DetailListReply> detailList($grpc.ServiceCall call, $0.DetailListReq request);
$async.Future<$0.DialogListReply> dialogList($grpc.ServiceCall call, $0.DialogListReq request);
$async.Future<$0.PreviewListReply> previewList($grpc.ServiceCall call, $0.PreviewListReq request);
$async.Future<$0.SearchItemPreHookReply> searchItemPreHook($grpc.ServiceCall call, $0.SearchItemPreHookReq request);
$async.Future<$0.SearchItemReply> searchItem($grpc.ServiceCall call, $0.SearchItemReq request);
$async.Future<$0.AtSearchReply> atSearch($grpc.ServiceCall call, $0.AtSearchReq request);
$async.Future<$0.ReplyInfoReply> replyInfo($grpc.ServiceCall call, $0.ReplyInfoReq request);
$async.Future<$0.UserCallbackReply> userCallback($grpc.ServiceCall call, $0.UserCallbackReq request);
$async.Future<$0.ShareRepliesInfoResp> shareRepliesInfo($grpc.ServiceCall call, $0.ShareRepliesInfoReq request);
$async.Future<$0.SuggestEmotesResp> suggestEmotes($grpc.ServiceCall call, $0.SuggestEmotesReq request);
}

View File

@@ -1,99 +0,0 @@
//
// Generated code. Do not modify.
// source: playeronline.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'playeronline.pb.dart' as $0;
export 'playeronline.pb.dart';
@$pb.GrpcServiceName('bilibili.app.playeronline.v1.PlayerOnline')
class PlayerOnlineClient extends $grpc.Client {
static final _$playerOnline = $grpc.ClientMethod<$0.PlayerOnlineReq, $0.PlayerOnlineReply>(
'/bilibili.app.playeronline.v1.PlayerOnline/PlayerOnline',
($0.PlayerOnlineReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PlayerOnlineReply.fromBuffer(value));
static final _$premiereInfo = $grpc.ClientMethod<$0.PremiereInfoReq, $0.PremiereInfoReply>(
'/bilibili.app.playeronline.v1.PlayerOnline/PremiereInfo',
($0.PremiereInfoReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PremiereInfoReply.fromBuffer(value));
static final _$reportWatch = $grpc.ClientMethod<$0.ReportWatchReq, $0.NoReply>(
'/bilibili.app.playeronline.v1.PlayerOnline/ReportWatch',
($0.ReportWatchReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.NoReply.fromBuffer(value));
PlayerOnlineClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.PlayerOnlineReply> playerOnline($0.PlayerOnlineReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$playerOnline, request, options: options);
}
$grpc.ResponseFuture<$0.PremiereInfoReply> premiereInfo($0.PremiereInfoReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$premiereInfo, request, options: options);
}
$grpc.ResponseFuture<$0.NoReply> reportWatch($0.ReportWatchReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$reportWatch, request, options: options);
}
}
@$pb.GrpcServiceName('bilibili.app.playeronline.v1.PlayerOnline')
abstract class PlayerOnlineServiceBase extends $grpc.Service {
$core.String get $name => 'bilibili.app.playeronline.v1.PlayerOnline';
PlayerOnlineServiceBase() {
$addMethod($grpc.ServiceMethod<$0.PlayerOnlineReq, $0.PlayerOnlineReply>(
'PlayerOnline',
playerOnline_Pre,
false,
false,
($core.List<$core.int> value) => $0.PlayerOnlineReq.fromBuffer(value),
($0.PlayerOnlineReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.PremiereInfoReq, $0.PremiereInfoReply>(
'PremiereInfo',
premiereInfo_Pre,
false,
false,
($core.List<$core.int> value) => $0.PremiereInfoReq.fromBuffer(value),
($0.PremiereInfoReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.ReportWatchReq, $0.NoReply>(
'ReportWatch',
reportWatch_Pre,
false,
false,
($core.List<$core.int> value) => $0.ReportWatchReq.fromBuffer(value),
($0.NoReply value) => value.writeToBuffer()));
}
$async.Future<$0.PlayerOnlineReply> playerOnline_Pre($grpc.ServiceCall call, $async.Future<$0.PlayerOnlineReq> request) async {
return playerOnline(call, await request);
}
$async.Future<$0.PremiereInfoReply> premiereInfo_Pre($grpc.ServiceCall call, $async.Future<$0.PremiereInfoReq> request) async {
return premiereInfo(call, await request);
}
$async.Future<$0.NoReply> reportWatch_Pre($grpc.ServiceCall call, $async.Future<$0.ReportWatchReq> request) async {
return reportWatch(call, await request);
}
$async.Future<$0.PlayerOnlineReply> playerOnline($grpc.ServiceCall call, $0.PlayerOnlineReq request);
$async.Future<$0.PremiereInfoReply> premiereInfo($grpc.ServiceCall call, $0.PremiereInfoReq request);
$async.Future<$0.NoReply> reportWatch($grpc.ServiceCall call, $0.ReportWatchReq request);
}

View File

@@ -1,59 +0,0 @@
//
// Generated code. Do not modify.
// source: bilibili/app/show/popular/v1/popular.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'popular.pb.dart' as $0;
export 'popular.pb.dart';
@$pb.GrpcServiceName('bilibili.app.show.v1.Popular')
class PopularClient extends $grpc.Client {
static final _$index = $grpc.ClientMethod<$0.PopularResultReq, $0.PopularReply>(
'/bilibili.app.show.v1.Popular/Index',
($0.PopularResultReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.PopularReply.fromBuffer(value));
PopularClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.PopularReply> index($0.PopularResultReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$index, request, options: options);
}
}
@$pb.GrpcServiceName('bilibili.app.show.v1.Popular')
abstract class PopularServiceBase extends $grpc.Service {
$core.String get $name => 'bilibili.app.show.v1.Popular';
PopularServiceBase() {
$addMethod($grpc.ServiceMethod<$0.PopularResultReq, $0.PopularReply>(
'Index',
index_Pre,
false,
false,
($core.List<$core.int> value) => $0.PopularResultReq.fromBuffer(value),
($0.PopularReply value) => value.writeToBuffer()));
}
$async.Future<$0.PopularReply> index_Pre($grpc.ServiceCall call, $async.Future<$0.PopularResultReq> request) async {
return index(call, await request);
}
$async.Future<$0.PopularReply> index($grpc.ServiceCall call, $0.PopularResultReq request);
}

View File

@@ -1,159 +0,0 @@
//
// Generated code. Do not modify.
// source: bilibili/community/service/dm/v1/dm.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:async' as $async;
import 'dart:core' as $core;
import 'package:grpc/service_api.dart' as $grpc;
import 'package:protobuf/protobuf.dart' as $pb;
import 'dm.pb.dart' as $0;
export 'dm.pb.dart';
@$pb.GrpcServiceName('bilibili.community.service.dm.v1.DM')
class DMClient extends $grpc.Client {
static final _$dmSegMobile = $grpc.ClientMethod<$0.DmSegMobileReq, $0.DmSegMobileReply>(
'/bilibili.community.service.dm.v1.DM/DmSegMobile',
($0.DmSegMobileReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DmSegMobileReply.fromBuffer(value));
static final _$dmView = $grpc.ClientMethod<$0.DmViewReq, $0.DmViewReply>(
'/bilibili.community.service.dm.v1.DM/DmView',
($0.DmViewReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DmViewReply.fromBuffer(value));
static final _$dmPlayerConfig = $grpc.ClientMethod<$0.DmPlayerConfigReq, $0.Response>(
'/bilibili.community.service.dm.v1.DM/DmPlayerConfig',
($0.DmPlayerConfigReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.Response.fromBuffer(value));
static final _$dmSegOtt = $grpc.ClientMethod<$0.DmSegOttReq, $0.DmSegOttReply>(
'/bilibili.community.service.dm.v1.DM/DmSegOtt',
($0.DmSegOttReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DmSegOttReply.fromBuffer(value));
static final _$dmSegSDK = $grpc.ClientMethod<$0.DmSegSDKReq, $0.DmSegSDKReply>(
'/bilibili.community.service.dm.v1.DM/DmSegSDK',
($0.DmSegSDKReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DmSegSDKReply.fromBuffer(value));
static final _$dmExpoReport = $grpc.ClientMethod<$0.DmExpoReportReq, $0.DmExpoReportRes>(
'/bilibili.community.service.dm.v1.DM/DmExpoReport',
($0.DmExpoReportReq value) => value.writeToBuffer(),
($core.List<$core.int> value) => $0.DmExpoReportRes.fromBuffer(value));
DMClient($grpc.ClientChannel channel,
{$grpc.CallOptions? options,
$core.Iterable<$grpc.ClientInterceptor>? interceptors})
: super(channel, options: options,
interceptors: interceptors);
$grpc.ResponseFuture<$0.DmSegMobileReply> dmSegMobile($0.DmSegMobileReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmSegMobile, request, options: options);
}
$grpc.ResponseFuture<$0.DmViewReply> dmView($0.DmViewReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmView, request, options: options);
}
$grpc.ResponseFuture<$0.Response> dmPlayerConfig($0.DmPlayerConfigReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmPlayerConfig, request, options: options);
}
$grpc.ResponseFuture<$0.DmSegOttReply> dmSegOtt($0.DmSegOttReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmSegOtt, request, options: options);
}
$grpc.ResponseFuture<$0.DmSegSDKReply> dmSegSDK($0.DmSegSDKReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmSegSDK, request, options: options);
}
$grpc.ResponseFuture<$0.DmExpoReportRes> dmExpoReport($0.DmExpoReportReq request, {$grpc.CallOptions? options}) {
return $createUnaryCall(_$dmExpoReport, request, options: options);
}
}
@$pb.GrpcServiceName('bilibili.community.service.dm.v1.DM')
abstract class DMServiceBase extends $grpc.Service {
$core.String get $name => 'bilibili.community.service.dm.v1.DM';
DMServiceBase() {
$addMethod($grpc.ServiceMethod<$0.DmSegMobileReq, $0.DmSegMobileReply>(
'DmSegMobile',
dmSegMobile_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmSegMobileReq.fromBuffer(value),
($0.DmSegMobileReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DmViewReq, $0.DmViewReply>(
'DmView',
dmView_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmViewReq.fromBuffer(value),
($0.DmViewReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DmPlayerConfigReq, $0.Response>(
'DmPlayerConfig',
dmPlayerConfig_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmPlayerConfigReq.fromBuffer(value),
($0.Response value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DmSegOttReq, $0.DmSegOttReply>(
'DmSegOtt',
dmSegOtt_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmSegOttReq.fromBuffer(value),
($0.DmSegOttReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DmSegSDKReq, $0.DmSegSDKReply>(
'DmSegSDK',
dmSegSDK_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmSegSDKReq.fromBuffer(value),
($0.DmSegSDKReply value) => value.writeToBuffer()));
$addMethod($grpc.ServiceMethod<$0.DmExpoReportReq, $0.DmExpoReportRes>(
'DmExpoReport',
dmExpoReport_Pre,
false,
false,
($core.List<$core.int> value) => $0.DmExpoReportReq.fromBuffer(value),
($0.DmExpoReportRes value) => value.writeToBuffer()));
}
$async.Future<$0.DmSegMobileReply> dmSegMobile_Pre($grpc.ServiceCall call, $async.Future<$0.DmSegMobileReq> request) async {
return dmSegMobile(call, await request);
}
$async.Future<$0.DmViewReply> dmView_Pre($grpc.ServiceCall call, $async.Future<$0.DmViewReq> request) async {
return dmView(call, await request);
}
$async.Future<$0.Response> dmPlayerConfig_Pre($grpc.ServiceCall call, $async.Future<$0.DmPlayerConfigReq> request) async {
return dmPlayerConfig(call, await request);
}
$async.Future<$0.DmSegOttReply> dmSegOtt_Pre($grpc.ServiceCall call, $async.Future<$0.DmSegOttReq> request) async {
return dmSegOtt(call, await request);
}
$async.Future<$0.DmSegSDKReply> dmSegSDK_Pre($grpc.ServiceCall call, $async.Future<$0.DmSegSDKReq> request) async {
return dmSegSDK(call, await request);
}
$async.Future<$0.DmExpoReportRes> dmExpoReport_Pre($grpc.ServiceCall call, $async.Future<$0.DmExpoReportReq> request) async {
return dmExpoReport(call, await request);
}
$async.Future<$0.DmSegMobileReply> dmSegMobile($grpc.ServiceCall call, $0.DmSegMobileReq request);
$async.Future<$0.DmViewReply> dmView($grpc.ServiceCall call, $0.DmViewReq request);
$async.Future<$0.Response> dmPlayerConfig($grpc.ServiceCall call, $0.DmPlayerConfigReq request);
$async.Future<$0.DmSegOttReply> dmSegOtt($grpc.ServiceCall call, $0.DmSegOttReq request);
$async.Future<$0.DmSegSDKReply> dmSegSDK($grpc.ServiceCall call, $0.DmSegSDKReq request);
$async.Future<$0.DmExpoReportRes> dmExpoReport($grpc.ServiceCall call, $0.DmExpoReportReq request);
}

View File

@@ -1,57 +0,0 @@
import 'package:PiliPlus/grpc/app/dynamic/v1/dynamic.pbgrpc.dart' as v1;
import 'package:PiliPlus/grpc/app/dynamic/v2/dynamic.pbgrpc.dart' as v2;
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pbgrpc.dart';
import 'package:PiliPlus/grpc/app/playeronline/v1/playeronline.pbgrpc.dart';
import 'package:PiliPlus/grpc/app/show/popular/v1/popular.pbgrpc.dart';
import 'package:grpc/grpc.dart';
class GrpcClient {
ClientChannel? _channel;
PlayerOnlineClient? _playerOnlineClient;
PopularClient? _popularClient;
ReplyClient? _replyClient;
v2.DynamicClient? _dynamicClientV2;
v1.DynamicClient? _dynamicClientV1;
GrpcClient._internal() {
_channel = ClientChannel(
'grpc.biliapi.net',
port: 443,
options: const ChannelOptions(
credentials: ChannelCredentials.secure(),
),
);
}
static final GrpcClient _instance = GrpcClient._internal();
static GrpcClient get instance => _instance;
PlayerOnlineClient get playerOnlineClient {
_playerOnlineClient ??= PlayerOnlineClient(_channel!);
return _playerOnlineClient!;
}
PopularClient get popularClient {
_popularClient ??= PopularClient(_channel!);
return _popularClient!;
}
ReplyClient get replyClient {
_replyClient ??= ReplyClient(_channel!);
return _replyClient!;
}
v2.DynamicClient get dynamicClientV2 {
_dynamicClientV2 ??= v2.DynamicClient(_channel!);
return _dynamicClientV2!;
}
v1.DynamicClient get dynamicClientV1 {
_dynamicClientV1 ??= v1.DynamicClient(_channel!);
return _dynamicClientV1!;
}
Future<void> shutdown() async {
await _channel?.shutdown();
}
}

View File

@@ -1,130 +1,182 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/grpc/app/dynamic/v1/dynamic.pb.dart';
import 'package:PiliPlus/grpc/app/dynamic/v2/dynamic.pb.dart';
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
import 'package:PiliPlus/grpc/app/playeronline/v1/playeronline.pbgrpc.dart';
import 'package:PiliPlus/grpc/app/playeronline/v1/playeronline.pb.dart';
import 'package:PiliPlus/grpc/app/show/popular/v1/popular.pb.dart';
import 'package:PiliPlus/grpc/device/device.pb.dart';
import 'package:PiliPlus/grpc/dm/v1/dm.pb.dart';
import 'package:PiliPlus/grpc/fawkes/fawkes.pb.dart';
import 'package:PiliPlus/grpc/grpc_client.dart';
import 'package:PiliPlus/grpc/locale/locale.pb.dart';
import 'package:PiliPlus/grpc/metadata/metadata.pb.dart';
import 'package:PiliPlus/grpc/network/network.pb.dart' as network;
import 'package:PiliPlus/grpc/restriction/restriction.pb.dart';
import 'package:PiliPlus/http/init.dart';
import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/utils/login.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:archive/archive.dart';
import 'package:dio/dio.dart';
import 'package:fixnum/src/int64.dart';
import 'package:flutter/material.dart';
import 'package:grpc/grpc.dart';
import 'package:protobuf/protobuf.dart' show GeneratedMessage;
class GrpcUrl {
static const playerOnline =
'/bilibili.app.playeronline.v1.PlayerOnline/PlayerOnline';
static const popular = '/bilibili.app.show.v1.Popular/Index';
static const dialogList =
'/bilibili.main.community.reply.v1.Reply/DialogList';
static const detailList =
'/bilibili.main.community.reply.v1.Reply/DetailList';
static const replyInfo = '/bilibili.main.community.reply.v1.Reply/ReplyInfo';
static const mainList = '/bilibili.main.community.reply.v1.Reply/MainList';
static const dynSpace = '/bilibili.app.dynamic.v2.Dynamic/DynSpace';
static const dynRed = '/bilibili.app.dynamic.v1.Dynamic/DynRed';
static const dmSegMobile = '/bilibili.community.service.dm.v1.DM/DmSegMobile';
}
class GrpcRepo {
static final bool _isLogin = GStorage.userInfo.get('userInfoCache') != null;
static final int? _mid = GStorage.userInfo.get('userInfoCache')?.mid;
static final String? _accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
static const gzipEncoder = GZipEncoder();
static const gzipDecoder = GZipDecoder();
static final String? _accessKey = Accounts.main.accessKey;
static const _build = 1462100;
static const _biliChannel = 'bili';
static const _mobiApp = 'android_hd';
static const _phone = 'phone';
static final _eId = _isLogin ? Utils.genAuroraEid(_mid!) : '';
static final _buvid = LoginUtils.buvid();
static final _buvid = LoginUtils.buvid;
static final _traceId = Utils.genTraceId();
static final _sessionId = Utils.generateRandomString(8);
static final Map<String, String> metadata = {
static final Map<String, String> headers = {
Headers.contentTypeHeader: 'application/grpc',
'grpc-encoding': 'gzip',
'gzip-accept-encoding': 'gzip,identity',
'user-agent': '${Constants.userAgent} grpc-java-cronet/1.36.1',
'x-bili-gaia-vtoken': '',
'x-bili-aurora-eid': _isLogin ? _eId : '',
'x-bili-mid': _isLogin ? _mid.toString() : '0',
'x-bili-aurora-zone': '',
'x-bili-trace-id': _traceId,
if (_isLogin) 'authorization': 'identify_v1 $_accessKey',
if (_accessKey != null) 'authorization': 'identify_v1 $_accessKey',
'buvid': _buvid,
'bili-http-engine': 'cronet',
'te': 'trailers',
'x-bili-fawkes-req-bin': base64Encode((FawkesReq()
..appkey = _mobiApp
..env = 'prod'
..sessionId = _sessionId)
'x-bili-fawkes-req-bin': base64Encode(
FawkesReq(appkey: _mobiApp, env: 'prod', sessionId: _sessionId)
.writeToBuffer()),
'x-bili-metadata-bin': base64Encode(Metadata(
accessKey: _accessKey ?? '',
mobiApp: _mobiApp,
device: _phone,
build: _build,
channel: _biliChannel,
buvid: _buvid,
platform: _mobiApp,
).writeToBuffer()),
'x-bili-device-bin': base64Encode(Device(
appId: 1,
build: _build,
buvid: _buvid,
mobiApp: _mobiApp,
platform: _mobiApp,
device: _phone,
channel: _biliChannel,
brand: _phone,
model: _phone,
osver: '14',
fpLocal: '',
fpRemote: '',
versionName: _build.toString(),
fp: '',
fts: Int64())
.writeToBuffer()),
'x-bili-metadata-bin': base64Encode((Metadata()
..accessKey = _accessKey ?? ''
..mobiApp = _mobiApp
..device = _phone
..build = _build
..channel = _biliChannel
..buvid = _buvid
..platform = _mobiApp)
'x-bili-network-bin': base64Encode(network.Network(
type: network.NetworkType.WIFI,
tf: network.TFType.TF_UNKNOWN,
oid: '')
.writeToBuffer()),
'x-bili-device-bin': base64Encode((Device()
..appId = 1
..build = _build
..buvid = _buvid
..mobiApp = _mobiApp
..platform = _mobiApp
..device = _phone
..channel = _biliChannel
..brand = _phone
..model = _phone
..osver = '14'
..fpLocal = ''
..fpRemote = ''
..versionName = _build.toString()
..fp = ''
..fts = Int64())
'x-bili-restriction-bin': base64Encode(Restriction(
teenagersMode: false,
lessonsMode: false,
mode: ModeType.NORMAL,
review: false,
disableRcmd: false,
basicMode: false)
.writeToBuffer()),
'x-bili-network-bin': base64Encode((network.Network()
..type = network.NetworkType.WIFI
..tf = network.TFType.TF_UNKNOWN
..oid = '')
.writeToBuffer()),
'x-bili-restriction-bin': base64Encode((Restriction()
..teenagersMode = false
..lessonsMode = false
..mode = ModeType.NORMAL
..review = false
..disableRcmd = false
..basicMode = false)
.writeToBuffer()),
'x-bili-locale-bin': base64Encode((Locale()
..cLocale = LocaleIds(language: 'zh', region: 'CN')
..sLocale = LocaleIds(language: 'zh', region: 'CN')
..simCode = ''
..timezone = 'Asia/Shanghai')
'x-bili-locale-bin': base64Encode(Locale(
cLocale: LocaleIds(language: 'zh', region: 'CN'),
sLocale: LocaleIds(language: 'zh', region: 'CN'),
simCode: '',
timezone: 'Asia/Shanghai')
.writeToBuffer()),
'x-bili-exps-bin': '',
};
static final CallOptions options = CallOptions(metadata: metadata);
static final unprintableRegExp = RegExp(r"[^\u4e00-\u9fa5UP]");
static Future _request(Function request) async {
try {
return await request();
} catch (e) {
dynamic defMsg() => {'status': false, 'msg': e.toString()};
if (e is GrpcError) {
try {
String msg = utf8.decode(
e.details?.firstOrNull?.getFieldOrNull(2),
allowMalformed: true,
);
msg =
msg.replaceAll(RegExp(r"[^a-zA-Z0-9\u4e00-\u9fa5,.;?,。;!?]"), '');
if (msg.isNotEmpty) {
return {'status': false, 'msg': msg};
} else {
return defMsg();
}
} catch (e1) {
debugPrint(e1.toString());
return defMsg();
}
static Uint8List compressProtobuf(Uint8List proto) {
proto = gzipEncoder.encodeBytes(proto, level: 0);
var byteLength = ByteData(4);
byteLength.setInt32(0, proto.length, Endian.big);
var compressed = Uint8List(5 + proto.length);
compressed[0] = 1;
compressed.setRange(1, 5, byteLength.buffer.asUint8List());
compressed.setAll(5, proto);
return compressed;
}
static Uint8List decompressProtobuf(Uint8List data) {
var length = ByteData.sublistView(data, 1, 5).getInt32(0, Endian.big);
if (data[0] == 1) {
return gzipDecoder.decodeBytes(data.sublist(5, length + 5));
} else {
return data.sublist(5, length + 5);
}
}
static Future<Map<String, dynamic>> _request(
url, GeneratedMessage request, Function grpcParser,
{Function? onSuccess}) async {
final response = await Request().post(HttpString.appBaseUrl + url,
data: compressProtobuf(request.writeToBuffer()),
options: Options(headers: headers, responseType: ResponseType.bytes));
if (response.data is Map) {
return {'status': false, 'msg': response.data['message']};
}
if (response.headers.value('Grpc-Status') == '0') {
try {
Uint8List data = response.data;
data = decompressProtobuf(data);
final grpcResponse = grpcParser(data);
return {
'status': true,
'data': onSuccess == null ? grpcResponse : onSuccess(grpcResponse),
};
} catch (e) {
return {'status': false, 'msg': e.toString()};
}
} else {
try {
String msg = response.headers.value('Grpc-Status-Details-Bin') ?? '';
if (msg != '') {
while (msg.length % 4 != 0) {
msg += '=';
}
msg = utf8
.decode(base64Decode(msg), allowMalformed: true)
.replaceAll(unprintableRegExp, '');
}
return {'status': false, 'msg': msg};
} catch (e) {
return {'status': false, 'msg': e.toString()};
}
return defMsg();
}
}
@@ -132,22 +184,16 @@ class GrpcRepo {
int aid = 0,
int cid = 0,
}) async {
return await _request(() async {
final request = PlayerOnlineReq()
..aid = Int64(aid)
..cid = Int64(cid)
..playOpen = true;
final response = await GrpcClient.instance.playerOnlineClient
.playerOnline(request, options: options);
return {'status': true, 'data': response.totalNumberText};
});
return await _request(
GrpcUrl.playerOnline,
PlayerOnlineReq(aid: Int64(aid), cid: Int64(cid), playOpen: true),
PlayerOnlineReply.fromBuffer,
onSuccess: (response) => response.totalNumberText);
}
static Future popular(int idx) async {
return await _request(() async {
final request = PopularResultReq()..idx = Int64(idx);
final response = await GrpcClient.instance.popularClient
.index(request, options: options);
return await _request(GrpcUrl.popular, PopularResultReq(idx: Int64(idx)),
PopularReply.fromBuffer, onSuccess: (response) {
response.items.retainWhere((item) => item.smallCoverV5.base.goto == 'av');
return {'status': true, 'data': response.items};
});
@@ -161,17 +207,15 @@ class GrpcRepo {
required CursorReq cursor,
DetailListScene scene = DetailListScene.REPLY,
}) async {
return await _request(() async {
final request = DialogListReq()
..oid = Int64(oid)
..type = Int64(type)
..root = Int64(root)
..rpid = Int64(rpid)
..cursor = cursor;
final response = await GrpcClient.instance.replyClient
.dialogList(request, options: options);
return {'status': true, 'data': response};
});
return await _request(
GrpcUrl.dialogList,
DialogListReq(
oid: Int64(oid),
type: Int64(type),
root: Int64(root),
rpid: Int64(rpid),
cursor: cursor),
DialogListReply.fromBuffer);
}
static Future detailList({
@@ -182,29 +226,22 @@ class GrpcRepo {
required CursorReq cursor,
DetailListScene scene = DetailListScene.REPLY,
}) async {
return await _request(() async {
final request = DetailListReq()
..oid = Int64(oid)
..type = Int64(type)
..root = Int64(root)
..rpid = Int64(rpid)
..cursor = cursor
..scene = scene;
final response = await GrpcClient.instance.replyClient
.detailList(request, options: options);
return {'status': true, 'data': response};
});
return await _request(
GrpcUrl.detailList,
DetailListReq(
oid: Int64(oid),
type: Int64(type),
root: Int64(root),
rpid: Int64(rpid),
cursor: cursor,
scene: scene),
DetailListReply.fromBuffer);
}
static Future replyInfo({
required int rpid,
}) async {
return await _request(() async {
final request = ReplyInfoReq()..rpid = Int64(rpid);
final response = await GrpcClient.instance.replyClient
.replyInfo(request, options: options);
return {'status': true, 'data': response.reply};
});
static Future replyInfo({required int rpid}) async {
return await _request(GrpcUrl.replyInfo, ReplyInfoReq(rpid: Int64(rpid)),
ReplyInfoReply.fromBuffer,
onSuccess: (response) => response.reply);
}
static Future mainList({
@@ -212,40 +249,39 @@ class GrpcRepo {
required int oid,
required CursorReq cursor,
}) async {
return await _request(() async {
final request = MainListReq()
..oid = Int64(oid)
..type = Int64(type)
..rpid = Int64(0)
..cursor = cursor;
final response = await GrpcClient.instance.replyClient
.mainList(request, options: options);
return {'status': true, 'data': response};
});
return await _request(
GrpcUrl.mainList,
MainListReq(
oid: Int64(oid), type: Int64(type), rpid: Int64(0), cursor: cursor),
MainListReply.fromBuffer);
}
static Future dynSpace({
required int uid,
required int page,
}) async {
return await _request(() async {
final request = DynSpaceReq()
..hostUid = Int64(uid)
..localTime = 8
..page = Int64(page)
..from = 'space';
final DynSpaceRsp response = await GrpcClient.instance.dynamicClientV2
.dynSpace(request, options: options);
return {'status': true, 'data': response};
});
return await _request(
GrpcUrl.dynSpace,
DynSpaceReq(
hostUid: Int64(uid),
localTime: 8,
page: Int64(page),
from: 'space'),
DynSpaceRsp.fromBuffer);
}
static Future dynRed() async {
return await _request(() async {
final request = DynRedReq()..tabOffset.add(TabOffset(tab: 1));
final DynRedReply response = await GrpcClient.instance.dynamicClientV1
.dynRed(request, options: options);
return {'status': true, 'data': response.dynRedItem.count.toInt()};
});
return await _request(GrpcUrl.dynRed,
DynRedReq(tabOffset: [TabOffset(tab: 1)]), DynRedReply.fromBuffer,
onSuccess: (response) => response.dynRedItem.count.toInt());
}
static Future dmSegMobile(
{required int cid, required int segmentIndex, int type = 1}) async {
return await _request(
GrpcUrl.dmSegMobile,
DmSegMobileReq(
oid: Int64(cid), segmentIndex: Int64(segmentIndex), type: type),
DmSegMobileReply.fromBuffer);
}
}

View File

@@ -49,7 +49,7 @@ class Api {
/// aid num 稿件avid 必要(可选) avid与bvid任选一个
/// bvid str 稿件bvid 必要(可选) avid与bvid任选一个
// https://api.bilibili.com/x/web-interface/archive/has/like
static const String hasLikeVideo = '/x/web-interface/archive/has/like';
// static const String hasLikeVideo = '/x/web-interface/archive/has/like';
static const String bangumiLikeCoinFav = '/pgc/season/episode/community';
@@ -79,7 +79,19 @@ class Api {
/// aid num 稿件avid 必要(可选) avid与bvid任选一个
/// bvid str 稿件bvid 必要(可选) avid与bvid任选一个
/// https://api.bilibili.com/x/web-interface/archive/coins
static const String hasCoinVideo = '/x/web-interface/archive/coins';
// static const String hasCoinVideo = '/x/web-interface/archive/coins';
/// 收藏夹 详情
/// media_id 当前收藏夹id 搜索全部时为默认收藏夹id
/// pn int 当前页
/// ps int pageSize
/// keyword String 搜索词
/// order String 排序方式 view 最多播放 mtime 最近收藏 pubtime 最近投稿
/// tid int 分区id
/// platform web
/// type 0 当前收藏夹 1 全部收藏夹
// https://api.bilibili.com/x/v3/fav/resource/list?media_id=76614671&pn=1&ps=20&keyword=&order=mtime&type=0&tid=0
static const String favResourceList = '/x/v3/fav/resource/list';
// 收藏视频双端POST
// access_key str APP登录Token APP方式必要
@@ -96,10 +108,18 @@ class Api {
static const String delFav = '/x/v3/fav/resource/batch-del';
static const String copyFav = '/x/v3/fav/resource/copy';
static const String moveFav = '/x/v3/fav/resource/move';
static const String cleanFav = '/x/v3/fav/resource/clean';
static const String sortFav = '/x/v3/fav/resource/sort';
// 判断视频是否被收藏双端GET
/// aid
// https://api.bilibili.com/x/v2/fav/video/favoured
static const String hasFavVideo = '/x/v2/fav/video/favoured';
// static const String hasFavVideo = '/x/v2/fav/video/favoured';
// 分享视频 Web端 POST
// https://api.bilibili.com/x/web-interface/share/add
@@ -123,10 +143,6 @@ class Api {
// rid num 目标 视频稿件avid
static const String favFolder = '/x/v3/fav/folder/created/list-all';
static const String copyFav = '/x/v3/fav/resource/copy';
static const String moveFav = '/x/v3/fav/resource/move';
static const String copyToview = '/x/v2/history/toview/copy';
static const String moveToview = '/x/v2/history/toview/move';
@@ -135,7 +151,9 @@ class Api {
static const String relatedList = '/x/web-interface/archive/related';
// 查询用户与自己关系_仅查关注
static const String hasFollow = '/x/relation';
static const String relation = '/x/relation';
static const String relations = '/x/relation/relations';
// 操作用户关系
static const String relationMod = '/x/relation/modify';
@@ -190,20 +208,6 @@ class Api {
static const String deleteFolder = '/x/v3/fav/folder/del';
static const String cleanFav = '/x/v3/fav/resource/clean';
/// 收藏夹 详情
/// media_id 当前收藏夹id 搜索全部时为默认收藏夹id
/// pn int 当前页
/// ps int pageSize
/// keyword String 搜索词
/// order String 排序方式 view 最多播放 mtime 最近收藏 pubtime 最近投稿
/// tid int 分区id
/// platform web
/// type 0 当前收藏夹 1 全部收藏夹
// https://api.bilibili.com/x/v3/fav/resource/list?media_id=76614671&pn=1&ps=20&keyword=&order=mtime&type=0&tid=0
static const String userFavFolderDetail = '/x/v3/fav/resource/list';
// 正在直播的up & 关注的up
// https://api.bilibili.com/x/polymer/web-dynamic/v1/portal
static const String followUp = '/x/polymer/web-dynamic/v1/portal';
@@ -257,6 +261,11 @@ class Api {
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/video/report.md
static const String heartBeat = '/x/click-interface/web/heartbeat';
static const String historyReport = '/x/v2/history/report';
static const String roomEntryAction =
'${HttpString.liveBaseUrl}/xlive/web-room/v1/index/roomEntryAction';
static const String mediaListHistory = '/x/v1/medialist/history';
// 查询视频分P列表 (avid/bvid转cid)
@@ -265,6 +274,9 @@ class Api {
// 番剧/剧集明细
static const String bangumiInfo = '/pgc/view/web/season';
// https://api.bilibili.com/pgc/season/episode/web/info?ep_id=12345678
static const String episodeInfo = '/pgc/season/episode/web/info';
// 全部关注的up
// vmid 用户id pn 页码 ps 每页个数最大50 order: desc
// order_type 排序规则 最近访问传空,最常访问传 attention
@@ -274,10 +286,6 @@ class Api {
// https://api.bilibili.com/x/relation/tag?mid=17340771&tagid=-10&pn=1&ps=20
static const String tagFollowings = '/x/relation/tag';
// 关注分类
// https://api.bilibili.com/x/relation/tags
static const String followingsClass = '/x/relation/tags';
// 搜索follow
static const followSearch = '/x/relation/followings/search';
@@ -403,14 +411,11 @@ class Api {
'/pgc/season/index/result?st=1&order=3&season_version=-1&spoken_language_type=-1&area=-1&is_finish=-1&copyright=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&sort=0&season_type=1&pagesize=20&type=1';
// 我的追番/追剧 ?type=1&pn=1&ps=15
static const String bangumiFollow = '/x/space/bangumi/follow/list';
static const String bangumiFollowList = '/x/space/bangumi/follow/list';
// 黑名单
static const String blackLst = '/x/relation/blacks';
// 移除黑名单
static const String removeBlack = '/x/relation/modify';
// github 获取最新版
static const String latestApp =
'https://api.github.com/repos/bggRGjQaUbCoE/PiliPlus/releases';
@@ -419,7 +424,7 @@ class Api {
// https://api.bilibili.com/x/player/online/total?aid=913663681&cid=1203559746&bvid=BV1MM4y1s7NZ&ts=56427838
static const String onlineTotal = '/x/player/online/total';
static const String webDanmaku = '/x/v2/dm/web/seg.so';
// static const String webDanmaku = '/x/v2/dm/web/seg.so';
// 发送视频弹幕
//https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/danmaku/action.md
@@ -468,12 +473,9 @@ class Api {
static const String msgFeedAt = '/x/msgfeed/at';
//https://api.bilibili.com/x/msgfeed/like?platform=web&build=0&mobi_app=web
static const String msgFeedLike = '/x/msgfeed/like';
//https://message.bilibili.com/x/sys-msg/query_user_notify?csrf=xxxx&csrf=xxxx&page_size=20&build=0&mobi_app=web
static const String msgSysUserNotify =
'${HttpString.messageBaseUrl}/x/sys-msg/query_user_notify';
//https://message.bilibili.com/x/sys-msg/query_unified_notify?csrf=xxxx&csrf=xxxx&page_size=10&build=0&mobi_app=web
static const String msgSysUnifiedNotify =
'${HttpString.messageBaseUrl}/x/sys-msg/query_unified_notify';
//https://message.bilibili.com/x/sys-msg/query_notify_list?page_size=20&cursor=xxx
static const String msgSysNotify =
'${HttpString.messageBaseUrl}/x/sys-msg/query_notify_list';
// 系统信息光标更新(已读标记)
//https://message.bilibili.com/x/sys-msg/update_cursor?csrf=xxxx&csrf=xxxx&cursor=1705288500000000000&has_up=0&build=0&mobi_app=web
@@ -619,12 +621,14 @@ class Api {
/// 申请二维码(TV端)
static const getTVCode =
'https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code';
'${HttpString.passBaseUrl}/x/passport-tv-login/qrcode/auth_code';
///扫码登录TV端
static const qrcodePoll =
'${HttpString.passBaseUrl}/x/passport-tv-login/qrcode/poll';
static const logout = '${HttpString.passBaseUrl}/login/exit/v2';
/// 置顶视频
static const getTopVideoApi = '/x/space/top/arc';
@@ -639,9 +643,6 @@ class Api {
/// 最近点赞的视频
static const getRecentLikeVideoApi = '/x/space/like/video';
/// 最近追番
static const getRecentBangumiApi = '/x/space/bangumi/follow/list';
/// 用户专栏
static const getMemberSeasonsApi = '/x/polymer/web-space/home/seasons_series';
@@ -662,7 +663,7 @@ class Api {
static const getUnreadDynamic = '/x/web-interface/dynamic/entrance';
/// 用户动态主页
static const dynamicSpmPrefix = 'https://space.bilibili.com/1/dynamic';
static const dynamicSpmPrefix = '${HttpString.spaceBaseUrl}/1/dynamic';
/// 激活buvid3
static const activateBuvidApi = '/x/internal/gaia-gateway/ExClimbWuzhi';
@@ -673,9 +674,6 @@ class Api {
/// 我的订阅-合集详情
static const favSeasonList = '/x/space/fav/season/list';
/// 我的订阅-播单详情
static const favResourceList = '/x/v3/fav/resource/list';
/// 发送私信
static const String sendMsg = '${HttpString.tUrl}/web_im/v1/web_im/send_msg';
@@ -708,6 +706,7 @@ class Api {
static const String uploadImage = '/x/upload/web/image';
// 点赞投币收藏关注
static const String videoRelation = '/x/web-interface/archive/relation';
static const String seasonFav = '/x/v3/fav/season/'; // + fav unfav
@@ -718,4 +717,31 @@ class Api {
/// 我的关注 - 正在直播
static const String getFollowingLive =
'${HttpString.liveBaseUrl}/xlive/web-ucenter/user/following';
static const String pgcIndexCondition = '/pgc/season/index/condition';
static const String pgcIndexResult = '/pgc/season/index/result';
static const String archiveNoteList = '/x/note/publish/list/archive';
static const String noteList = '/x/note/list';
static const String userNoteList = '/x/note/publish/list/user';
static const String addNote = '/x/note/add';
static const String delNote = '/x/note/del';
static const String delPublishNote = '/x/note/publish/del';
static const String archiveNote = '/x/note/list/archive';
static const String favArticle = '/x/polymer/web-dynamic/v1/opus/feed/fav';
static const String communityAction =
'/x/community/cosmo/interface/simple_action';
static const String delFavArticle = '/x/article/favorites/del';
static const String addFavArticle = '/x/article/favorites/add';
}

View File

@@ -1,9 +1,55 @@
import 'package:PiliPlus/http/loading_state.dart';
import '../models/bangumi/list.dart';
import '../models/bangumi/pgc_index/condition.dart';
import 'index.dart';
class BangumiHttp {
static Future<LoadingState> pgcIndexResult({
required int page,
required Map<String, dynamic> params,
seasonType,
type,
indexType,
}) async {
dynamic res = await Request().get(
Api.pgcIndexResult,
queryParameters: {
...params,
if (seasonType != null) 'season_type': seasonType,
if (type != null) 'type': type,
if (indexType != null) 'index_type': indexType,
'page': page,
'pagesize': 21,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> pgcIndexCondition({
seasonType,
type,
indexType,
}) async {
dynamic res = await Request().get(
Api.pgcIndexCondition,
queryParameters: {
if (seasonType != null) 'season_type': seasonType,
if (type != null) 'type': type,
if (indexType != null) 'index_type': indexType,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(Condition.fromJson(res.data['data']));
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> bangumiList({
int? page,
int? indexType,
@@ -21,19 +67,24 @@ class BangumiHttp {
}
}
static Future<LoadingState> bangumiFollow({
dynamic mid,
static Future<LoadingState> bangumiFollowList({
required dynamic mid,
required int type,
required int pn,
int? followStatus,
}) async {
var res = await Request().get(Api.bangumiFollow, queryParameters: {
var res = await Request().get(Api.bangumiFollowList, queryParameters: {
'vmid': mid,
'type': type,
if (followStatus != null) 'follow_status': followStatus,
'pn': pn,
});
if (res.data['code'] == 0) {
BangumiListDataModel data =
BangumiListDataModel.fromJson(res.data['data']);
if (followStatus != null) {
return LoadingState.success(data.list);
}
return LoadingState.success(data);
} else {
return LoadingState.error(res.data['message']);

View File

@@ -19,31 +19,4 @@ class BlackHttp {
return LoadingState.error(res.data['message']);
}
}
// 移除黑名单
static Future removeBlack({required int fid}) async {
var res = await Request().post(
Api.removeBlack,
queryParameters: {
'act': 6,
'csrf': await Request.getCsrf(),
'fid': fid,
'jsonp': 'jsonp',
're_src': 116,
},
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': [],
'msg': '操作成功',
};
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
}
}
}

View File

@@ -9,37 +9,4 @@ class HttpString {
static const String dynamicShareBaseUrl = 'https://t.bilibili.com';
static const String spaceBaseUrl = 'https://space.bilibili.com';
static const String sponsorBlockBaseUrl = 'https://www.bsbsb.top';
static const List<int> validateStatusCodes = [
302,
304,
307,
400,
401,
403,
404,
405,
409,
412,
500,
503,
504,
509,
616,
617,
625,
626,
628,
629,
632,
643,
650,
652,
658,
662,
688,
689,
701,
799,
8888
];
}

View File

@@ -1,34 +1,49 @@
import 'package:PiliPlus/grpc/dm/v1/dm.pb.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/grpc/grpc_repo.dart';
import 'package:dio/dio.dart';
import 'index.dart';
class DanmakaHttp {
class DanmakuHttp {
// 获取视频弹幕
static Future queryDanmaku({
required int cid,
required int segmentIndex,
required bool mergeDanmaku,
int queryCount = 1,
}) async {
// 构建参数对象
Map<String, int> params = {
'type': 1,
'oid': cid,
'segment_index': segmentIndex,
};
var response = await Request().get(
Api.webDanmaku,
queryParameters: params,
options: Options(responseType: ResponseType.bytes),
);
if (response.statusCode != 200 || response.data == null) {
return DmSegMobileReply();
final response =
await GrpcRepo.dmSegMobile(cid: cid, segmentIndex: segmentIndex);
if (!response['status']) {
if (queryCount >= 3) {
return {'status': false};
} else {
await Future.delayed(const Duration(seconds: 1));
return await queryDanmaku(
cid: cid,
segmentIndex: segmentIndex,
mergeDanmaku: mergeDanmaku,
queryCount: ++queryCount,
);
}
}
DmSegMobileReply data = DmSegMobileReply.fromBuffer(response.data);
if (mergeDanmaku) {
data.elems.unique((item) => item.content);
DmSegMobileReply data = response['data'];
if (mergeDanmaku && data.elems.isNotEmpty) {
final Map counts = <String, int>{};
data.elems.retainWhere((item) {
int? count = counts[item.content];
counts[item.content] = count != null ? count + 1 : 1;
return count == null;
});
for (DanmakuElem item in data.elems) {
item.clearAttr();
final count = counts[item.content];
if (count != 1) {
item.attr = count;
}
}
}
return data;
return {'status': true, 'data': data};
}
static Future shootDanmaku({

View File

@@ -39,7 +39,8 @@ class DanmakuFilterHttp {
}
}
static Future danmakuFilterAdd({required String filter, required int type}) async {
static Future danmakuFilterAdd(
{required String filter, required int type}) async {
var res = await Request().post(
Api.danmakuFilterAdd,
queryParameters: {
@@ -51,7 +52,7 @@ class DanmakuFilterHttp {
if (res.data['code'] == 0) {
return {
'status': true,
'data': Rule.fromJson(res.data['data']),
'data': SimpleRule.fromJson(res.data['data']),
};
} else {
return {

View File

@@ -1,4 +1,7 @@
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:dio/dio.dart';
import '../models/dynamics/result.dart';
import '../models/dynamics/up.dart';
@@ -24,6 +27,15 @@ class DynamicsHttp {
if (res.data['code'] == 0) {
try {
DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']);
if (GStorage.antiGoodsDyn) {
data.items?.removeWhere(
(item) =>
item.orig?.modules?.moduleDynamic?.additional?.type ==
'ADDITIONAL_TYPE_GOODS' ||
item.modules?.moduleDynamic?.additional?.type ==
'ADDITIONAL_TYPE_GOODS',
);
}
return LoadingState.success(data);
} catch (err) {
return LoadingState.error(err.toString());
@@ -78,13 +90,23 @@ class DynamicsHttp {
//
static Future dynamicDetail({
String? id,
dynamic id,
dynamic rid,
dynamic type,
bool clearCookie = false,
}) async {
var res = await Request().get(Api.dynamicDetail, queryParameters: {
'timezone_offset': -480,
'id': id,
'features': 'itemOpusStyle',
});
var res = await Request().get(
Api.dynamicDetail,
queryParameters: {
'timezone_offset': -480,
if (id != null) 'id': id,
if (rid != null) 'rid': rid,
if (type != null) 'type': type,
'features': 'itemOpusStyle',
},
options:
clearCookie ? Options(extra: {'account': AnonymousAccount()}) : null,
);
if (res.data['code'] == 0) {
try {
return {

View File

@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:PiliPlus/models/dynamics/article_content_model.dart';
import 'package:PiliPlus/utils/url_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:html/dom.dart' as dom;
@@ -13,12 +14,21 @@ class HtmlHttp {
var response = await Request().get(
"https://www.bilibili.com/opus/$id",
extra: {'ua': 'pc'},
options: Options(
followRedirects: false,
validateStatus: (status) => true,
),
);
if (response.data is! String && response.data is! List<int>) {
return;
}
try {
if (response.data.contains('Redirecting to')) {
String? cvid = RegExp(r'cv\d+').firstMatch(response.data)?.group(0);
if (cvid != null) {
return await reqReadHtml(cvid, dynamicType, false);
}
RegExp regex = RegExp(r'//([\w\.]+)/(\w+)/(\w+)');
Match match = regex.firstMatch(response.data)!;
String matchedString = match.group(0)!;
@@ -48,10 +58,11 @@ class HtmlHttp {
String opusContent =
opusDetail.querySelector('.opus-module-content')!.innerHtml;
String? test;
test = opusDetail
.querySelector('.horizontal-scroll-album__pic__img')
?.innerHtml ??
'';
try {
test = opusDetail
.querySelector('.horizontal-scroll-album__pic__img')!
.innerHtml;
} catch (_) {}
String commentId = opusDetail
.querySelector('.bili-comment-container')!
@@ -64,7 +75,7 @@ class HtmlHttp {
'avatar': avatar,
'uname': uname,
'updateTime': updateTime,
'content': test + opusContent,
'content': (test ?? '') + opusContent,
'commentId': int.parse(commentId)
};
} catch (err) {
@@ -73,7 +84,15 @@ class HtmlHttp {
}
// read
static Future reqReadHtml(id, dynamicType) async {
static Future reqReadHtml(id, dynamicType, [bool redirect = true]) async {
if (redirect) {
String? redirectUrl = await UrlUtils.parseRedirectUrl(
'https://www.bilibili.com/$dynamicType/$id/');
if (redirectUrl != null) {
return await reqHtml(redirectUrl.split('/').last, dynamicType);
}
}
var response = await Request().get(
"https://www.bilibili.com/$dynamicType/$id/",
extra: {'ua': 'pc'},

View File

@@ -3,124 +3,85 @@ import 'dart:convert';
import 'dart:developer';
import 'dart:io';
import 'dart:math' show Random;
import 'package:cookie_jar/cookie_jar.dart';
import 'package:PiliPlus/build_config.dart';
import 'package:PiliPlus/http/retry_interceptor.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart';
import 'package:archive/archive.dart';
import 'package:brotli/brotli.dart';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
import 'package:flutter/material.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import '../utils/storage.dart';
import '../utils/utils.dart';
import 'api.dart';
import 'constants.dart';
import 'interceptor.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart' as web;
class Request {
static const _gzipDecoder = GZipDecoder();
static const _brotilDecoder = BrotliDecoder();
static final Request _instance = Request._internal();
static late CookieManager cookieManager;
static late AccountManager accountManager;
static late final Dio dio;
factory Request() => _instance;
late bool enableSystemProxy;
late String systemProxyHost;
late String systemProxyPort;
static final RegExp spmPrefixExp =
static final _rand = Random();
static final RegExp _spmPrefixExp =
RegExp(r'<meta name="spm_prefix" content="([^"]+?)">');
/// 设置cookie
static setCookie() async {
final String cookiePath = await Utils.getCookiePath();
final PersistCookieJar cookieJar = PersistCookieJar(
ignoreExpires: true,
storage: FileStorage(cookiePath),
);
cookieManager = CookieManager(cookieJar);
dio.interceptors.add(cookieManager);
dio.interceptors.add(ApiInterceptor());
final List<Cookie> cookies = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.baseUrl));
for (Cookie item in cookies) {
await web.CookieManager().setCookie(
url: web.WebUri(item.domain ?? ''),
name: item.name,
value: item.value,
path: item.path ?? '',
domain: item.domain,
isSecure: item.secure,
isHttpOnly: item.httpOnly,
);
}
final userInfo = GStorage.userInfo.get('userInfoCache');
if (userInfo != null && userInfo.mid != null) {
final List<Cookie> cookie2 = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.tUrl));
if (cookie2.isEmpty) {
try {
await Request().get(HttpString.tUrl);
} catch (e) {
log("setCookie, ${e.toString()}");
}
}
}
setOptionsHeaders(userInfo, userInfo != null && userInfo.mid != null);
try {
await buvidActivate();
} catch (e) {
log("setCookie, ${e.toString()}");
}
// final String cookieString = cookies
// .map((Cookie cookie) => '${cookie.name}=${cookie.value}')
// .join('; ');
// dio.options.headers['cookie'] = cookieString;
static Future<void> setCookie() async {
accountManager = AccountManager();
dio.interceptors.add(accountManager);
await Accounts.refresh();
final List<Cookie> cookies = Accounts.main.cookieJar.toList();
final webManager = web.CookieManager();
await Future.wait(cookies.map((item) => webManager.setCookie(
url: web.WebUri(item.domain ?? ''),
name: item.name,
value: item.value,
path: item.path ?? '',
domain: item.domain,
isSecure: item.secure,
isHttpOnly: item.httpOnly,
)));
}
// 从cookie中获取 csrf token
static Future<String> getCsrf() async {
List<Cookie> cookies = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.apiBaseUrl));
String token = '';
if (cookies.where((e) => e.name == 'bili_jct').isNotEmpty) {
token = cookies.firstWhere((e) => e.name == 'bili_jct').value;
}
return token;
return Accounts.main.csrf;
}
static setOptionsHeaders(userInfo, bool status) {
if (status) {
dio.options.headers['x-bili-mid'] = userInfo.mid.toString();
dio.options.headers['x-bili-aurora-eid'] =
IdUtils.genAuroraEid(userInfo.mid);
static Future<void> buvidActive(Account account) async {
// 这样线程不安全, 但仍按预期进行
if (account.activited) return;
account.activited = true;
try {
final html = await Request().get(Api.dynamicSpmPrefix,
options: Options(extra: {'account': account}));
final String spmPrefix = _spmPrefixExp.firstMatch(html.data)!.group(1)!;
final String randPngEnd = base64.encode(
List<int>.generate(32, (_) => _rand.nextInt(256)) +
List<int>.filled(4, 0) +
[73, 69, 78, 68] +
List<int>.generate(4, (_) => _rand.nextInt(256)));
String jsonData = json.encode({
'3064': 1,
'39c8': '$spmPrefix.fp.risk',
'3c43': {
'adca': 'Linux',
'bfe9': randPngEnd.substring(randPngEnd.length - 50),
},
});
await Request().post(Api.activateBuvidApi,
data: {'payload': jsonData},
options: Options(contentType: Headers.jsonContentType));
} catch (e) {
log("setCookie, $e");
}
dio.options.headers['env'] = 'prod';
dio.options.headers['app-key'] = 'android64';
dio.options.headers['x-bili-aurora-zone'] = 'sh001';
dio.options.headers['referer'] = 'https://www.bilibili.com/';
}
static Future buvidActivate() async {
var html = await Request().get(Api.dynamicSpmPrefix);
String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!;
Random rand = Random();
String randPngEnd = base64.encode(
List<int>.generate(32, (_) => rand.nextInt(256)) +
List<int>.filled(4, 0) +
[73, 69, 78, 68] +
List<int>.generate(4, (_) => rand.nextInt(256)));
String jsonData = json.encode({
'3064': 1,
'39c8': '$spmPrefix.fp.risk',
'3c43': {
'adca': 'Linux',
'bfe9': randPngEnd.substring(randPngEnd.length - 50),
},
});
await Request().post(Api.activateBuvidApi,
data: {'payload': jsonData},
options: Options(contentType: 'application/json'));
}
/*
@@ -129,62 +90,89 @@ class Request {
Request._internal() {
//BaseOptions、Options、RequestOptions 都可以配置参数,优先级别依次递增,且可以根据优先级别覆盖参数
BaseOptions options = BaseOptions(
//请求基地址,可以包含子路径
baseUrl: HttpString.apiBaseUrl,
//连接服务器超时时间,单位是毫秒.
connectTimeout: const Duration(milliseconds: 12000),
//响应流上前后两次接受到数据的间隔,单位为毫秒。
receiveTimeout: const Duration(milliseconds: 12000),
//Http请求头.
headers: {},
);
enableSystemProxy = GStorage.setting
.get(SettingBoxKey.enableSystemProxy, defaultValue: false) as bool;
systemProxyHost =
GStorage.setting.get(SettingBoxKey.systemProxyHost, defaultValue: '');
systemProxyPort =
GStorage.setting.get(SettingBoxKey.systemProxyPort, defaultValue: '');
dio = Dio(options);
/// fix 第三方登录 302重定向 跟iOS代理问题冲突
// ..httpClientAdapter = Http2Adapter(
// ConnectionManager(
// idleTimeout: const Duration(milliseconds: 10000),
// onClientCreate: (context, ClientSetting config) =>
// config.onBadCertificate = (_) => true,
// ),
// );
/// 设置代理
if (enableSystemProxy) {
dio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
final HttpClient client = HttpClient();
// Config the client.
client.findProxy = (Uri uri) {
// return 'PROXY host:port';
return 'PROXY $systemProxyHost:$systemProxyPort';
};
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
return client;
//请求基地址,可以包含子路径
baseUrl: HttpString.apiBaseUrl,
//连接服务器超时时间,单位是毫秒.
connectTimeout: const Duration(milliseconds: 10000),
//响应流上前后两次接受到数据的间隔,单位为毫秒。
receiveTimeout: const Duration(milliseconds: 10000),
//Http请求头.
headers: {
'connection': 'keep-alive',
'accept-encoding': 'br,gzip',
'user-agent': 'Dart/3.6 (dart:io)', // Http2Adapter不会自动添加标头
'referer': HttpString.baseUrl,
'env': 'prod',
'app-key': 'android64',
'x-bili-aurora-zone': 'sh001',
},
);
responseDecoder: responseDecoder, // Http2Adapter没有自动解压
persistentConnection: true);
final bool enableSystemProxy = GStorage.setting
.get(SettingBoxKey.enableSystemProxy, defaultValue: false);
final String systemProxyHost = GStorage.defaultSystemProxyHost;
final String systemProxyPort = GStorage.defaultSystemProxyPort;
final http11Adapter = IOHttpClientAdapter(createHttpClient: () {
final client = HttpClient()
..idleTimeout = const Duration(seconds: 15)
..autoUncompress = false; // Http2Adapter没有自动解压, 统一行为
// 设置代理
if (enableSystemProxy) {
client.findProxy = (_) => 'PROXY $systemProxyHost:$systemProxyPort';
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
return client;
});
late Uri proxy;
if (enableSystemProxy) {
proxy = Uri(
scheme: 'http',
host: systemProxyHost,
port: int.parse(systemProxyPort));
}
dio = Dio(options)
..httpClientAdapter =
GStorage.setting.get(SettingBoxKey.enableHttp2, defaultValue: false)
? Http2Adapter(
ConnectionManager(
idleTimeout: const Duration(seconds: 15),
onClientCreate: enableSystemProxy
? (_, config) {
config
..proxy = proxy
..onBadCertificate = (_) => true;
}
: GStorage.badCertificateCallback
? (_, config) {
config.onBadCertificate = (_) => true;
}
: null),
fallbackAdapter: http11Adapter)
: http11Adapter;
// 先于其他Interceptor
if (GStorage.retryCount > 0) {
dio.interceptors
.add(RetryInterceptor(GStorage.retryCount, GStorage.retryDelay));
}
// 日志拦截器 输出请求、响应内容
// dio.interceptors.add(LogInterceptor(
// request: false,
// requestHeader: false,
// responseHeader: false,
// ));
if (BuildConfig.isDebug) {
dio.interceptors.add(LogInterceptor(
request: false,
requestHeader: false,
responseHeader: false,
));
}
dio.transformer = BackgroundTransformer();
dio.options.validateStatus = (int? status) {
return status! >= 200 && status < 300 ||
HttpString.validateStatusCodes.contains(status);
return status! >= 200 && status < 300;
};
}
@@ -213,7 +201,7 @@ class Request {
} on DioException catch (e) {
Response errResponse = Response(
data: {
'message': await ApiInterceptor.dioError(e)
'message': await AccountManager.dioError(e)
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
statusCode: -1,
requestOptions: RequestOptions(),
@@ -242,7 +230,7 @@ class Request {
} on DioException catch (e) {
Response errResponse = Response(
data: {
'message': await ApiInterceptor.dioError(e)
'message': await AccountManager.dioError(e)
}, // 将自定义 Map 数据赋值给 Response 的 data 属性
statusCode: -1,
requestOptions: RequestOptions(),
@@ -267,7 +255,7 @@ class Request {
return response.data;
} on DioException catch (e) {
debugPrint('downloadFile error: $e');
return Future.error(ApiInterceptor.dioError(e));
return Future.error(AccountManager.dioError(e));
}
}
@@ -281,20 +269,31 @@ class Request {
token.cancel("cancelled");
}
String headerUa({type = 'mob'}) {
String headerUa = '';
if (type == 'mob') {
if (Platform.isIOS) {
headerUa =
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 Safari/604.1';
} else {
headerUa =
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36';
}
} else {
headerUa =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15';
static String headerUa({type = 'mob'}) {
return switch (type) {
'mob' => Platform.isIOS
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200'
: 'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36',
'android' =>
'Mozilla/5.0 (Linux; Android 10; SM-G975F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Mobile Safari/537.36',
'ios' =>
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Mobile/15E148 BiliApp/62000200',
_ =>
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Safari/605.1.15'
};
}
static String responseDecoder(List<int> responseBytes, RequestOptions options,
ResponseBody responseBody) {
switch (responseBody.headers['content-encoding']?.firstOrNull) {
case 'gzip':
return utf8.decode(_gzipDecoder.decodeBytes(responseBytes),
allowMalformed: true);
case 'br':
return utf8.decode(_brotilDecoder.convert(responseBytes),
allowMalformed: true);
default:
return utf8.decode(responseBytes, allowMalformed: true);
}
return headerUa;
}
}

View File

@@ -1,139 +0,0 @@
import 'package:PiliPlus/http/api.dart';
import 'package:PiliPlus/pages/mine/controller.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
class ApiInterceptor extends Interceptor {
static const List<String> anonymityList = [
Api.videoUrl,
Api.videoIntro,
Api.relatedList,
Api.replyList,
Api.replyReplyList,
Api.searchSuggest,
Api.searchByType,
Api.heartBeat,
Api.ab2c,
Api.bangumiInfo,
Api.liveRoomInfo,
Api.onlineTotal,
Api.webDanmaku,
Api.dynamicDetail,
Api.aiConclusion,
Api.getSeasonDetailApi,
Api.liveRoomDmToken,
Api.liveRoomDmPrefetch,
];
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
void onRemoveCookie() {
options.headers.remove('x-bili-mid');
options.headers.remove('x-bili-aurora-eid');
options.headers.remove('x-bili-aurora-zone');
options.headers['cookie'] = '';
options.queryParameters.remove('access_key');
options.queryParameters.remove('csrf');
options.queryParameters.remove('csrf_token');
if (options.data is Map) {
options.data.remove('access_key');
options.data.remove('csrf');
options.data.remove('csrf_token');
}
}
if (options.extra['clearCookie'] == true) {
onRemoveCookie();
} else if (MineController.anonymity.value) {
String uri = options.uri.toString();
for (var i in anonymityList) {
// 如果请求的url包含无痕列表中的url则清空cookie
// 但需要保证匹配到url的后半部分不再出现/符号,否则会误伤
int index = uri.indexOf(i);
if (index == -1) continue;
if (uri.lastIndexOf('/') >= index + i.length) continue;
//SmartDialog.showToast('触发无痕模式\n\n$i\n\n${options.uri}');
onRemoveCookie();
break;
}
}
handler.next(options);
}
// @override
// void onResponse(Response response, ResponseInterceptorHandler handler) {
// try {
// if (response.statusCode == 302) {
// final List<String> locations = response.headers['location']!;
// if (locations.isNotEmpty) {
// if (locations.first.startsWith('https://www.mcbbs.net')) {
// debugPrint('ApiInterceptor@@@@@: ${locations.first}');
// final Uri uri = Uri.parse(locations.first);
// final String? accessKey = uri.queryParameters['access_key'];
// final String? mid = uri.queryParameters['mid'];
// try {
// GStorage.localCache.put(LocalCacheKey.accessKey,
// <String, String?>{'mid': mid, 'value': accessKey});
// } catch (_) {}
// }
// }
// }
// } catch (err) {
// debugPrint('ApiInterceptor: $err');
// }
// handler.next(response);
// }
@override
void onError(DioException err, ErrorInterceptorHandler handler) async {
// 处理网络请求错误
// handler.next(err);
String url = err.requestOptions.uri.toString();
debugPrint('🌹🌹ApiInterceptor: $url');
if (url.contains('heartbeat') ||
url.contains('seg.so') ||
url.contains('online/total') ||
url.contains('github') ||
(url.contains('skipSegments') && err.requestOptions.method == 'GET')) {
// skip
} else {
SmartDialog.showToast(
await dioError(err) + url,
displayType: SmartToastType.onlyRefresh,
displayTime: const Duration(milliseconds: 1200),
);
}
super.onError(err, handler);
}
static Future<String> dioError(DioException error) async {
switch (error.type) {
case DioExceptionType.badCertificate:
return '证书有误!';
case DioExceptionType.badResponse:
return '服务器异常,请稍后重试!';
case DioExceptionType.cancel:
return '请求已被取消,请重新请求';
case DioExceptionType.connectionError:
return '连接错误,请检查网络设置';
case DioExceptionType.connectionTimeout:
return '网络连接超时,请检查网络设置';
case DioExceptionType.receiveTimeout:
return '响应超时,请稍后重试!';
case DioExceptionType.sendTimeout:
return '发送请求超时,请检查网络设置';
case DioExceptionType.unknown:
final String res =
(await Connectivity().checkConnectivity()).first.title;
return '$res网络异常 ${error.error}';
}
}
}
extension _ConnectivityResultExt on ConnectivityResult {
String get title => ['蓝牙', 'Wi-Fi', '局域', '流量', '', '代理', '其他'][index];
}

View File

@@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:crypto/crypto.dart';
import 'package:dio/dio.dart';
import 'package:encrypt/encrypt.dart';
@@ -9,11 +10,9 @@ import '../utils/utils.dart';
import 'index.dart';
class LoginHttp {
static String deviceId = LoginUtils.genDeviceId();
static String buvid = LoginUtils.buvid();
static String host = 'passport.bilibili.com';
static Map<String, String> headers = {
'Host': host,
static final String deviceId = LoginUtils.genDeviceId();
static final String buvid = LoginUtils.buvid;
static final Map<String, String> headers = {
'buvid': buvid,
'env': 'prod',
'app-key': 'android_hd',
@@ -27,21 +26,14 @@ class LoginHttp {
static Future<Map<String, dynamic>> getHDcode() async {
var params = {
'appkey': Constants.appKey,
// 'local_id': 'Y952A395BB157D305D8A8340FC2AAECECE17',
'local_id': '0',
//精确到秒的时间戳
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'platform': 'android',
'mobi_app': 'android_hd',
};
String sign = Utils.appSign(
params,
Constants.appKey,
Constants.appSec,
);
var res = await Request()
.post(Api.getTVCode, queryParameters: {...params, 'sign': sign});
Utils.appSign(params);
var res = await Request().post(Api.getTVCode, queryParameters: params);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
@@ -52,18 +44,12 @@ class LoginHttp {
static Future codePoll(String authCode) async {
var params = {
'appkey': Constants.appKey,
'auth_code': authCode,
'local_id': '0',
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
};
String sign = Utils.appSign(
params,
Constants.appKey,
Constants.appSec,
);
var res = await Request()
.post(Api.qrcodePoll, queryParameters: {...params, 'sign': sign});
Utils.appSign(params);
var res = await Request().post(Api.qrcodePoll, queryParameters: params);
return {
'status': res.data['code'] == 0,
'code': res.data['code'],
@@ -106,7 +92,6 @@ class LoginHttp {
}) async {
int timestamp = DateTime.now().millisecondsSinceEpoch;
var data = {
'appkey': Constants.appKey,
'build': '2001100',
'buvid': buvid,
'c_locale': 'zh_CN',
@@ -129,15 +114,11 @@ class LoginHttp {
'tel': tel,
'ts': (timestamp ~/ 1000).toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
Utils.appSign(data);
var res = await Request().post(
Api.appSmsCode,
data: {...data, 'sign': sign},
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
headers: headers,
@@ -211,7 +192,6 @@ class LoginHttp {
Encrypter(RSA(publicKey: publicKey)).encrypt(salt + password).base64;
Map<String, String> data = {
'appkey': Constants.appKey,
'bili_local_id': deviceId,
'build': '2001100',
'buvid': buvid,
@@ -224,7 +204,7 @@ class LoginHttp {
'device_platform': 'Android14vivo',
'disable_rcmd': '0',
'dt': Uri.encodeComponent(Encrypter(RSA(publicKey: publicKey))
.encrypt(LoginUtils.generateRandomString(16))
.encrypt(Utils.generateRandomString(16))
.base64),
'from_pv': 'main.homepage.avatar-nologin.all.click',
'from_url': Uri.encodeComponent('bilibili://pegasus/promo'),
@@ -242,15 +222,7 @@ class LoginHttp {
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'username': username,
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
data.map((key, value) {
return MapEntry<String, dynamic>(key, value);
});
Utils.appSign(data);
var res = await Request().post(
Api.loginByPwdApi,
data: data,
@@ -287,7 +259,6 @@ class LoginHttp {
}) async {
dynamic publicKey = RSAKeyParser().parse(key);
Map<String, String> data = {
'appkey': Constants.appKey,
'bili_local_id': deviceId,
'build': '2001100',
'buvid': buvid,
@@ -304,7 +275,7 @@ class LoginHttp {
// 'device_tourist_id': '',
'disable_rcmd': '0',
'dt': Uri.encodeComponent(Encrypter(RSA(publicKey: publicKey))
.encrypt(LoginUtils.generateRandomString(16))
.encrypt(Utils.generateRandomString(16))
.base64),
'from_pv': 'main.my-information.my-login.0.click',
'from_url': Uri.encodeComponent('bilibili://user_center/mine'),
@@ -316,15 +287,7 @@ class LoginHttp {
'tel': tel,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
data.map((key, value) {
return MapEntry<String, dynamic>(key, value);
});
Utils.appSign(data);
var res = await Request().post(
Api.logInByAppSms,
data: data,
@@ -404,12 +367,7 @@ class LoginHttp {
if (geeValidate != null) 'gee_validate': geeValidate,
if (recaptchaToken != null) 'recaptcha_token': recaptchaToken,
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
Utils.appSign(data);
var res = await Request().post(
Api.safeCenterSmsCode,
data: data,
@@ -449,12 +407,7 @@ class LoginHttp {
'source': source,
'captcha_key': captchaKey,
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
Utils.appSign(data);
var res = await Request().post(
Api.safeCenterSmsVerify,
data: data,
@@ -500,15 +453,7 @@ class LoginHttp {
// 'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
data.map((key, value) {
return MapEntry<String, dynamic>(key, value);
});
Utils.appSign(data);
var res = await Request().post(
Api.oauth2AccessToken,
data: data,
@@ -529,4 +474,15 @@ class LoginHttp {
};
}
}
static Future<Map> logout(Account account) async {
dynamic res = await Request().post(
Api.logout,
data: {'biliCSRF': account.csrf},
options: Options(
contentType: Headers.formUrlEncodedContentType,
extra: {'account': account}),
);
return {'status': res.data['code'] == 0, 'msg': res.data['message']};
}
}

View File

@@ -65,11 +65,7 @@ class MemberHttp {
required int mid,
required int page,
}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
Map<String, String> data = {
if (accessKey?.isNotEmpty == true) 'access_key': accessKey!,
'appkey': Constants.appKey,
'build': '1462100',
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -79,24 +75,13 @@ class MemberHttp {
'ps': '10',
's_locale': 'zh_CN',
'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'vmid': mid.toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
int? _mid = GStorage.userInfo.get('userInfoCache')?.mid;
dynamic res = await Request().get(
Api.spaceArticle,
queryParameters: data,
options: Options(
headers: {
'env': 'prod',
'app-key': 'android_hd',
'x-bili-mid': _mid,
'bili-http-engine': 'cronet',
'user-agent': Constants.userAgent,
},
@@ -112,11 +97,7 @@ class MemberHttp {
static Future<LoadingState> spaceFav({
required int mid,
}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
Map<String, String> data = {
if (accessKey?.isNotEmpty == true) 'access_key': accessKey!,
'appkey': Constants.appKey,
'build': '1462100',
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -124,24 +105,13 @@ class MemberHttp {
'platform': 'android',
's_locale': 'zh_CN',
'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'up_mid': mid.toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
int? _mid = GStorage.userInfo.get('userInfoCache')?.mid;
dynamic res = await Request().get(
Api.spaceFav,
queryParameters: data,
options: Options(
headers: {
'env': 'prod',
'app-key': 'android_hd',
'x-bili-mid': _mid,
'bili-http-engine': 'cronet',
'user-agent': Constants.userAgent,
},
@@ -184,12 +154,8 @@ class MemberHttp {
int? seasonId,
int? seriesId,
}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
Map<String, String> data = {
if (accessKey?.isNotEmpty == true) 'access_key': accessKey!,
if (aid != null) 'aid': aid.toString(),
'appkey': Constants.appKey,
'build': '1462100',
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -205,32 +171,19 @@ class MemberHttp {
if (order != null) 'order': order,
if (sort != null) 'sort': sort,
'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'vmid': mid.toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
int? _mid = GStorage.userInfo.get('userInfoCache')?.mid;
dynamic res = await Request().get(
type == ContributeType.video
? Api.spaceArchive
: type == ContributeType.charging
? Api.spaceChargingArchive
: type == ContributeType.season
? Api.spaceSeason
: type == ContributeType.series
? Api.spaceSeries
: Api.spaceBangumi,
switch (type) {
ContributeType.video => Api.spaceArchive,
ContributeType.charging => Api.spaceChargingArchive,
ContributeType.season => Api.spaceSeason,
ContributeType.series => Api.spaceSeries,
ContributeType.bangumi => Api.spaceBangumi,
},
queryParameters: data,
options: Options(
headers: {
'env': 'prod',
'app-key': 'android_hd',
'x-bili-mid': _mid,
'bili-http-engine': 'cronet',
'user-agent': Constants.userAgent,
},
@@ -246,11 +199,7 @@ class MemberHttp {
static Future<LoadingState> space({
int? mid,
}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
Map<String, String> data = {
if (accessKey?.isNotEmpty == true) 'access_key': accessKey!,
'appkey': Constants.appKey,
'build': '1462100',
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -258,24 +207,13 @@ class MemberHttp {
'platform': 'android',
's_locale': 'zh_CN',
'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'vmid': mid.toString(),
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
int? _mid = GStorage.userInfo.get('userInfoCache')?.mid;
dynamic res = await Request().get(
Api.space,
queryParameters: data,
options: Options(
headers: {
'env': 'prod',
'app-key': 'android_hd',
'x-bili-mid': _mid,
'bili-http-engine': 'cronet',
'user-agent': Constants.userAgent,
},
@@ -294,7 +232,7 @@ class MemberHttp {
dynamic wwebid,
}) async {
space(mid: mid);
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'mid': mid,
'token': token,
'platform': 'web',
@@ -334,8 +272,13 @@ class MemberHttp {
}
static Future memberCardInfo({int? mid}) async {
var res = await Request()
.get(Api.memberCardInfo, queryParameters: {'mid': mid, 'photo': true});
var res = await Request().get(
Api.memberCardInfo,
queryParameters: {
'mid': mid,
'photo': false,
},
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -359,7 +302,7 @@ class MemberHttp {
}) async {
String dmImgStr = Utils.base64EncodeRandomString(16, 64);
String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128);
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'mid': mid,
'ps': ps,
'tid': tid,
@@ -397,10 +340,13 @@ class MemberHttp {
}
// 用户动态
static Future<LoadingState> memberDynamic({String? offset, int? mid}) async {
static Future<LoadingState> memberDynamic({
String? offset,
int? mid,
}) async {
String dmImgStr = Utils.base64EncodeRandomString(16, 64);
String dmCoverImgStr = Utils.base64EncodeRandomString(32, 128);
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'offset': offset ?? '',
'host_mid': mid,
'timezone_offset': '-480',
@@ -416,7 +362,15 @@ class MemberHttp {
});
var res = await Request().get(Api.memberDynamic, queryParameters: params);
if (res.data['code'] == 0) {
return LoadingState.success(DynamicsDataModel.fromJson(res.data['data']));
DynamicsDataModel data = DynamicsDataModel.fromJson(res.data['data']);
if (GStorage.antiGoodsDyn) {
data.items?.removeWhere((item) =>
item.orig?.modules?.moduleDynamic?.additional?.type ==
'ADDITIONAL_TYPE_GOODS' ||
item.modules?.moduleDynamic?.additional?.type ==
'ADDITIONAL_TYPE_GOODS');
}
return LoadingState.success(data);
} else {
Map errMap = {
-352: '风控校验失败,请检查登录状态',
@@ -593,8 +547,8 @@ class MemberHttp {
}
// 最近投币
static Future getRecentCoinVideo({required int mid}) async {
Map params = await WbiSign().makSign({
static Future<LoadingState> getRecentCoinVideo({required int mid}) async {
Map params = await WbiSign.makSign({
'mid': mid,
'gaia_source': 'main_web',
'web_location': 333.999,
@@ -610,24 +564,17 @@ class MemberHttp {
},
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data']
.map<MemberCoinsDataModel>((e) => MemberCoinsDataModel.fromJson(e))
.toList(),
};
return LoadingState.success(res.data['data']
.map<MemberCoinsDataModel>((e) => MemberCoinsDataModel.fromJson(e))
.toList());
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
// 最近点赞
static Future getRecentLikeVideo({required int mid}) async {
Map params = await WbiSign().makSign({
static Future<LoadingState> getRecentLikeVideo({required int mid}) async {
Map params = await WbiSign.makSign({
'mid': mid,
'gaia_source': 'main_web',
'web_location': 333.999,
@@ -643,16 +590,11 @@ class MemberHttp {
},
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': MemberSeasonsDataModel.fromJson(res.data['data']['items_lists'])
};
return LoadingState.success(res.data['data']['list']
.map<MemberCoinsDataModel>((e) => MemberCoinsDataModel.fromJson(e))
.toList());
} else {
return {
'status': false,
'data': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
@@ -724,7 +666,7 @@ class MemberHttp {
'name': name,
'web_location': 333.999,
};
Map params = await WbiSign().makSign(data);
Map params = await WbiSign.makSign(data);
var res = await Request().get(Api.followSearch, queryParameters: {
...data,
'w_rid': params['w_rid'],

View File

@@ -1,8 +1,14 @@
import 'dart:math';
import 'package:PiliPlus/http/constants.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/msg/msgfeed_at_me.dart';
import 'package:PiliPlus/models/msg/msgfeed_like_me.dart';
import 'package:PiliPlus/models/msg/msgfeed_reply_me.dart';
import 'package:PiliPlus/models/msg/msgfeed_sys_msg.dart';
import 'package:PiliPlus/pages/dynamics/view.dart' show ReplyOption;
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';
import '../models/msg/account.dart';
import '../models/msg/session.dart';
@@ -11,100 +17,70 @@ import 'api.dart';
import 'init.dart';
class MsgHttp {
static Future msgFeedReplyMe({int cursor = -1, int cursorTime = -1}) async {
static Future<LoadingState> msgFeedReplyMe(
{int cursor = -1, int cursorTime = -1}) async {
var res = await Request().get(Api.msgFeedReply, queryParameters: {
'id': cursor == -1 ? null : cursor,
'reply_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
MsgFeedReplyMe data = MsgFeedReplyMe.fromJson(res.data['data']);
return LoadingState.success(data);
} else {
return {
'status': false,
'date': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
static Future msgFeedAtMe({int cursor = -1, int cursorTime = -1}) async {
static Future<LoadingState> msgFeedAtMe(
{int cursor = -1, int cursorTime = -1}) async {
var res = await Request().get(Api.msgFeedAt, queryParameters: {
'id': cursor == -1 ? null : cursor,
'at_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
MsgFeedAtMe data = MsgFeedAtMe.fromJson(res.data['data']);
return LoadingState.success(data);
} else {
return {
'status': false,
'date': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
static Future msgFeedLikeMe({int cursor = -1, int cursorTime = -1}) async {
static Future<LoadingState> msgFeedLikeMe(
{int cursor = -1, int cursorTime = -1}) async {
var res = await Request().get(Api.msgFeedLike, queryParameters: {
'id': cursor == -1 ? null : cursor,
'like_time': cursorTime == -1 ? null : cursorTime,
'platform': 'android',
'mobi_app': 'android',
'build': '8350200',
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
MsgFeedLikeMe data = MsgFeedLikeMe.fromJson(res.data['data']);
return LoadingState.success(data);
} else {
return {
'status': false,
'date': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
static Future msgFeedSysUserNotify() async {
String csrf = await Request.getCsrf();
var res = await Request().get(Api.msgSysUserNotify, queryParameters: {
'csrf': csrf,
'page_size': 20,
static Future<LoadingState> msgFeedNotify(
{int cursor = -1, int pageSize = 20}) async {
var res = await Request().get(Api.msgSysNotify, queryParameters: {
'cursor': cursor == -1 ? null : cursor,
'page_size': pageSize,
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
List<SystemNotifyList>? list = (res.data['data'] as List?)
?.map((e) => SystemNotifyList.fromJson(e))
.toList();
return LoadingState.success(list);
} else {
return {
'status': false,
'date': [],
'msg': res.data['message'],
};
}
}
static Future msgFeedSysUnifiedNotify() async {
String csrf = await Request.getCsrf();
var res = await Request().get(Api.msgSysUnifiedNotify, queryParameters: {
'csrf': csrf,
'page_size': 10,
});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
};
} else {
return {
'status': false,
'date': [],
'msg': res.data['message'],
};
return LoadingState.error(res.data['message']);
}
}
@@ -144,11 +120,13 @@ class MsgHttp {
static Future createDynamic({
dynamic mid,
dynamic dynIdStr, // repost
dynamic dynIdStr, // repost dyn
dynamic rid, // repost video
dynamic dynType,
dynamic rawText,
List? pics,
int? publishTime,
ReplyOption replyOption = ReplyOption.allow,
ReplyOption? replyOption,
int? privatePub,
}) async {
String csrf = await Request.getCsrf();
@@ -171,17 +149,21 @@ class MsgHttp {
}
]
},
if (dynIdStr == null)
if (replyOption != null || publishTime != null)
"option": {
if (publishTime != null) "timer_pub_time": publishTime,
if (replyOption == ReplyOption.close) "close_comment": 1,
if (replyOption == ReplyOption.choose) "up_choose_comment": 1,
if (replyOption == ReplyOption.close)
"close_comment": 1
else if (replyOption == ReplyOption.choose)
"up_choose_comment": 1,
},
"scene": dynIdStr != null
? 4
: pics != null
? 2
: 1,
"scene": rid != null
? 5
: dynIdStr != null
? 4
: pics != null
? 2
: 1,
if (privatePub != null)
'create_option': {
'private_pub': privatePub,
@@ -189,16 +171,27 @@ class MsgHttp {
if (pics != null) 'pics': pics,
"attach_card": null,
"upload_id":
"${mid}_${DateTime.now().millisecondsSinceEpoch ~/ 1000}_${Random().nextInt(9000) + 1000}",
"${rid != null ? 0 : mid}_${DateTime.now().millisecondsSinceEpoch ~/ 1000}_${Random().nextInt(9000) + 1000}",
"meta": {
"app_meta": {"from": "create.dynamic.web", "mobi_app": "web"}
}
},
if (dynIdStr != null) "web_repost_src": {"dyn_id_str": dynIdStr}
if (dynIdStr != null || rid != null)
"web_repost_src": {
if (dynIdStr != null) "dyn_id_str": dynIdStr,
if (rid != null)
"revs_id": {
"dyn_type": dynType,
"rid": rid,
}
}
},
);
if (res.data['code'] == 0) {
return {'status': true};
return {
'status': true,
'data': res.data['data'],
};
} else {
return {
'status': false,
@@ -238,22 +231,24 @@ class MsgHttp {
dynamic path,
String? category,
String? biz,
CancelToken? cancelToken,
}) async {
String csrf = await Request.getCsrf();
Map<String, dynamic> data = await WbiSign().makSign({
'file_up': await MultipartFile.fromFile(path),
final file = await MultipartFile.fromFile(path);
Map<String, dynamic> data = {
'file_up': file,
if (category != null) 'category': category,
if (biz != null) 'biz': biz,
'csrf': csrf,
});
'csrf': await Request.getCsrf(),
};
var res = await Request().post(
Api.uploadBfs,
data: FormData.fromMap(data),
cancelToken: cancelToken,
);
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'],
'data': res.data['data']..['img_size'] = file.length,
};
} else {
return {
@@ -267,7 +262,7 @@ class MsgHttp {
dynamic content,
) async {
String csrf = await Request.getCsrf();
Map<String, dynamic> data = await WbiSign().makSign({
Map<String, dynamic> data = await WbiSign.makSign({
'dynamic_id': 0,
'type': 4,
'rid': 0,
@@ -293,7 +288,7 @@ class MsgHttp {
dynamic dynamicId,
) async {
String csrf = await Request.getCsrf();
Map<String, dynamic> data = await WbiSign().makSign({
Map<String, dynamic> data = await WbiSign.makSign({
'dynamic_id': dynamicId,
'csrf_token': csrf,
'csrf': csrf,
@@ -316,7 +311,7 @@ class MsgHttp {
dynamic talkerId,
) async {
String csrf = await Request.getCsrf();
Map<String, dynamic> data = await WbiSign().makSign({
Map<String, dynamic> data = await WbiSign.makSign({
'talker_id': talkerId,
'session_type': 1,
'build': 0,
@@ -369,7 +364,7 @@ class MsgHttp {
int opType,
) async {
String csrf = await Request.getCsrf();
Map<String, dynamic> data = await WbiSign().makSign({
Map<String, dynamic> data = await WbiSign.makSign({
'talker_id': talkerId,
'session_type': 1,
'op_type': opType,
@@ -404,7 +399,7 @@ class MsgHttp {
params['end_ts'] = endTs;
}
Map signParams = await WbiSign().makSign(params);
Map signParams = await WbiSign.makSign(params);
var res = await Request().get(Api.sessionList, queryParameters: signParams);
if (res.data['code'] == 0) {
try {
@@ -457,7 +452,7 @@ class MsgHttp {
static Future sessionMsg({
int? talkerId,
}) async {
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'talker_id': talkerId,
'session_type': 1,
'size': 20,
@@ -490,7 +485,7 @@ class MsgHttp {
int? ackSeqno,
}) async {
String csrf = await Request.getCsrf();
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'talker_id': talkerId,
'session_type': 1,
'ack_seqno': ackSeqno,
@@ -541,7 +536,7 @@ class MsgHttp {
'csrf_token': csrf,
'csrf': csrf,
};
Map<String, dynamic> params = await WbiSign().makSign(base);
Map<String, dynamic> params = await WbiSign.makSign(base);
var res = await Request().post(Api.sendMsg,
queryParameters: <String, dynamic>{
'w_sender_uid': params['msg[sender_uid]'],
@@ -560,44 +555,43 @@ class MsgHttp {
return {
'status': false,
'date': [],
'msg': "message: ${res.data['message']},"
" msg: ${res.data['msg']},"
" code: ${res.data['code']}",
'msg': res.data['message'] ?? res.data['msg'],
};
}
}
static String getDevId() {
final List<String> b = [
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'A',
'B',
'C',
'D',
'E',
'F'
];
final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
for (int i = 0; i < s.length; i++) {
if ('-' == s[i] || '4' == s[i]) {
continue;
}
final int randomInt = Random().nextInt(16);
if ('x' == s[i]) {
s[i] = b[randomInt];
} else {
s[i] = b[3 & randomInt | 8];
}
}
return s.join();
return Uuid().v4();
// final List<String> b = [
// '0',
// '1',
// '2',
// '3',
// '4',
// '5',
// '6',
// '7',
// '8',
// '9',
// 'A',
// 'B',
// 'C',
// 'D',
// 'E',
// 'F'
// ];
// final List<String> s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split('');
// for (int i = 0; i < s.length; i++) {
// if ('-' == s[i] || '4' == s[i]) {
// continue;
// }
// final int randomInt = Random().nextInt(16);
// if ('x' == s[i]) {
// s[i] = b[randomInt];
// } else {
// s[i] = b[3 & randomInt | 8];
// }
// }
// return s.join();
}
}

View File

@@ -1,7 +1,11 @@
import 'package:PiliPlus/common/constants.dart';
import 'package:PiliPlus/grpc/app/main/community/reply/v1/reply.pb.dart';
import 'package:PiliPlus/grpc/grpc_repo.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/video/reply/item.dart';
import 'package:PiliPlus/utils/accounts/account.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart';
import 'package:dio/dio.dart';
import '../models/video/reply/data.dart';
@@ -10,7 +14,11 @@ import 'api.dart';
import 'init.dart';
class ReplyHttp {
static Options get _options => Options(extra: {'clearCookie': true});
static Options get _options =>
Options(extra: {'account': AnonymousAccount()});
static RegExp replyRegExp =
RegExp(GStorage.banWordForReply, caseSensitive: false);
static Future<LoadingState> replyList({
required bool isLogin,
@@ -19,7 +27,8 @@ class ReplyHttp {
required int type,
required int page,
int sort = 1,
required String banWordForReply,
required bool antiGoodsReply,
bool? enableFilter,
}) async {
var res = !isLogin
? await Request().get(
@@ -46,18 +55,16 @@ class ReplyHttp {
);
if (res.data['code'] == 0) {
ReplyData replyData = ReplyData.fromJson(res.data['data']);
if (banWordForReply.isNotEmpty) {
if (enableFilter != false && replyRegExp.pattern.isNotEmpty) {
// topReplies
if (replyData.topReplies?.isNotEmpty == true) {
replyData.topReplies!.removeWhere((item) {
bool hasMatch = RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content?.message ?? '');
bool hasMatch = replyRegExp.hasMatch(item.content?.message ?? '');
// remove subreplies
if (hasMatch.not) {
if (item.replies?.isNotEmpty == true) {
item.replies!.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content?.message ?? ''));
replyRegExp.hasMatch(item.content?.message ?? ''));
}
}
return hasMatch;
@@ -67,14 +74,43 @@ class ReplyHttp {
// replies
if (replyData.replies?.isNotEmpty == true) {
replyData.replies!.removeWhere((item) {
bool hasMatch = RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content?.message ?? '');
bool hasMatch = replyRegExp.hasMatch(item.content?.message ?? '');
// remove subreplies
if (hasMatch.not) {
if (item.replies?.isNotEmpty == true) {
item.replies!.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content?.message ?? ''));
replyRegExp.hasMatch(item.content?.message ?? ''));
}
}
return hasMatch;
});
}
}
// antiGoodsReply
if (antiGoodsReply) {
// topReplies
if (replyData.topReplies?.isNotEmpty == true) {
replyData.topReplies!.removeWhere((item) {
bool hasMatch = needRemove(item);
// remove subreplies
if (hasMatch.not) {
if (item.replies?.isNotEmpty == true) {
item.replies!.removeWhere(needRemove);
}
}
return hasMatch;
});
}
// replies
if (replyData.replies?.isNotEmpty == true) {
replyData.replies!.removeWhere((item) {
bool hasMatch = needRemove(item);
// remove subreplies
if (hasMatch.not) {
if (item.replies?.isNotEmpty == true) {
item.replies!.removeWhere(needRemove);
}
}
return hasMatch;
@@ -91,30 +127,50 @@ class ReplyHttp {
int type = 1,
required int oid,
required CursorReq cursor,
required String banWordForReply,
required bool antiGoodsReply,
}) async {
dynamic res = await GrpcRepo.mainList(type: type, oid: oid, cursor: cursor);
if (res['status']) {
MainListReply mainListReply = res['data'];
if (banWordForReply.isNotEmpty) {
// keyword filter
if (replyRegExp.pattern.isNotEmpty) {
// upTop
if (mainListReply.hasUpTop() &&
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(mainListReply.upTop.content.message)) {
replyRegExp.hasMatch(mainListReply.upTop.content.message)) {
mainListReply.clearUpTop();
}
// replies
if (mainListReply.replies.isNotEmpty) {
mainListReply.replies.removeWhere((item) {
bool hasMatch = RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content.message);
bool hasMatch = replyRegExp.hasMatch(item.content.message);
// remove subreplies
if (hasMatch.not) {
if (item.replies.isNotEmpty) {
item.replies.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content.message));
item.replies.removeWhere(
(item) => replyRegExp.hasMatch(item.content.message));
}
}
return hasMatch;
});
}
}
// antiGoodsReply
if (antiGoodsReply) {
// upTop
if (mainListReply.hasUpTop() && needRemoveGrpc(mainListReply.upTop)) {
mainListReply.clearUpTop();
}
// replies
if (mainListReply.replies.isNotEmpty) {
mainListReply.replies.removeWhere((item) {
bool hasMatch = needRemoveGrpc(item);
// remove subreplies
if (hasMatch.not) {
if (item.replies.isNotEmpty) {
item.replies.removeWhere(needRemoveGrpc);
}
}
return hasMatch;
@@ -127,14 +183,46 @@ class ReplyHttp {
}
}
// ref BiliRoamingX
static bool needRemoveGrpc(ReplyInfo reply) {
if ((reply.content.url.isNotEmpty &&
reply.content.url.values.any((url) {
return url.hasExtra() &&
(url.extra.goodsCmControl == 1 ||
url.extra.goodsItemId != 0 ||
url.extra.goodsPrefetchedCache.isNotEmpty);
})) ||
reply.content.message.contains(Constants.goodsUrlPrefix)) {
return true;
}
return false;
}
static bool needRemove(ReplyItemModel reply) {
try {
if ((reply.content?.jumpUrl?.isNotEmpty == true &&
reply.content!.jumpUrl!.values.any((url) {
return url['extra'] != null &&
(url['extra']['goods_cm_control'] == 1 ||
url['extra']['goods_item_id'] != 0 ||
url['extra']['goods_prefetched_cache'].isNotEmpty);
})) ||
reply.content?.message?.contains(Constants.goodsUrlPrefix) == true) {
return true;
}
} catch (_) {}
return false;
}
static Future<LoadingState> replyReplyList({
required bool isLogin,
required int oid,
required int root,
required int pageNum,
required int type,
required String banWordForReply,
required bool antiGoodsReply,
bool? isCheck,
bool? filterBanWord,
}) async {
var res = await Request().get(
Api.replyReplyList,
@@ -150,11 +238,15 @@ class ReplyHttp {
);
if (res.data['code'] == 0) {
ReplyReplyData replyData = ReplyReplyData.fromJson(res.data['data']);
if (banWordForReply.isNotEmpty) {
if (filterBanWord != false && replyRegExp.pattern.isNotEmpty) {
if (replyData.replies?.isNotEmpty == true) {
replyData.replies!.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content?.message ?? ''));
replyData.replies!.removeWhere(
(item) => replyRegExp.hasMatch(item.content?.message ?? ''));
}
}
if (antiGoodsReply) {
if (replyData.replies?.isNotEmpty == true) {
replyData.replies!.removeWhere(needRemove);
}
}
return LoadingState.success(replyData);
@@ -173,7 +265,7 @@ class ReplyHttp {
required int root,
required int rpid,
required CursorReq cursor,
required String banWordForReply,
required bool antiGoodsReply,
}) async {
dynamic res = await GrpcRepo.detailList(
type: type,
@@ -184,11 +276,15 @@ class ReplyHttp {
);
if (res['status']) {
DetailListReply detailListReply = res['data'];
if (banWordForReply.isNotEmpty) {
if (replyRegExp.pattern.isNotEmpty) {
if (detailListReply.root.replies.isNotEmpty) {
detailListReply.root.replies.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content.message));
detailListReply.root.replies.removeWhere(
(item) => replyRegExp.hasMatch(item.content.message));
}
}
if (antiGoodsReply) {
if (detailListReply.root.replies.isNotEmpty) {
detailListReply.root.replies.removeWhere(needRemoveGrpc);
}
}
return LoadingState.success(detailListReply);
@@ -203,7 +299,7 @@ class ReplyHttp {
required int root,
required int rpid,
required CursorReq cursor,
required String banWordForReply,
required bool antiGoodsReply,
}) async {
dynamic res = await GrpcRepo.dialogList(
type: type,
@@ -214,11 +310,15 @@ class ReplyHttp {
);
if (res['status']) {
DialogListReply dialogListReply = res['data'];
if (banWordForReply.isNotEmpty) {
if (replyRegExp.pattern.isNotEmpty) {
if (dialogListReply.replies.isNotEmpty) {
dialogListReply.replies.removeWhere((item) =>
RegExp(banWordForReply, caseSensitive: false)
.hasMatch(item.content.message));
dialogListReply.replies.removeWhere(
(item) => replyRegExp.hasMatch(item.content.message));
}
}
if (antiGoodsReply) {
if (dialogListReply.replies.isNotEmpty) {
dialogListReply.replies.removeWhere(needRemoveGrpc);
}
}
return LoadingState.success(dialogListReply);

View File

@@ -0,0 +1,34 @@
import 'package:dio/dio.dart';
import 'index.dart';
class RetryInterceptor extends Interceptor {
final int _count;
final int _delay;
RetryInterceptor(this._count, this._delay);
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
if (err.response != null) return handler.next(err);
switch (err.type) {
case DioExceptionType.connectionError:
case DioExceptionType.connectionTimeout:
case DioExceptionType.sendTimeout:
if ((err.requestOptions.extra['_rt'] ??= 0) < _count) {
Future.delayed(
Duration(
milliseconds: ++err.requestOptions.extra['_rt'] * _delay),
() => Request.dio
.fetch(err.requestOptions)
.then(handler.resolve)
.onError<DioException>((error, _) => handler.reject(error)));
} else {
handler.next(err);
}
return;
default:
return handler.next(err);
}
}
}

View File

@@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:PiliPlus/utils/extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:PiliPlus/http/loading_state.dart';
@@ -105,11 +106,11 @@ class SearchHttp {
try {
switch (searchType) {
case SearchType.video:
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
if (res.data['data']['result'] != null) {
for (var i in res.data['data']['result']) {
// 屏蔽推广和拉黑用户
i['available'] = !blackMidsList.contains(i['mid']);
i['available'] = !blackMids.contains(i['mid']);
}
}
data = SearchVideoModel.fromJson(res.data['data']);
@@ -140,17 +141,19 @@ class SearchHttp {
}
}
static Future<int> ab2c({dynamic aid, dynamic bvid}) async {
static Future<int> ab2c({dynamic aid, dynamic bvid, int? part}) async {
Map<String, dynamic> data = {};
if (aid != null) {
data['aid'] = aid;
} else if (bvid != null) {
data['bvid'] = bvid;
}
final dynamic res = await Request()
.get(Api.ab2c, queryParameters: <String, dynamic>{...data});
final dynamic res = await Request().get(Api.ab2c, queryParameters: data);
if (res.data['code'] == 0) {
return res.data['data'].first['cid'];
return part != null
? ((res.data['data'] as List).getOrNull(part - 1)?['cid'] ??
res.data['data'].first['cid'])
: res.data['data'].first['cid'];
} else {
SmartDialog.showToast("ab2c error: ${res.data['message']}");
return -1;
@@ -173,6 +176,20 @@ class SearchHttp {
}
}
static Future<LoadingState> episodeInfo({int? epId}) async {
final dynamic res = await Request().get(
Api.episodeInfo,
queryParameters: {
if (epId != null) 'ep_id': epId,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<Map<String, dynamic>> bangumiInfo({
dynamic seasonId,
dynamic epId,
@@ -183,8 +200,8 @@ class SearchHttp {
} else if (epId != null) {
data['ep_id'] = epId;
}
final dynamic res = await Request()
.get(Api.bangumiInfo, queryParameters: <String, dynamic>{...data});
final dynamic res =
await Request().get(Api.bangumiInfo, queryParameters: data);
if (res.data['code'] == 0) {
return {

View File

@@ -1,5 +1,6 @@
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/video/later.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import '../common/constants.dart';
@@ -62,6 +63,30 @@ class UserHttp {
}
}
static Future sortFav({
required dynamic mediaId,
required List<String> sort,
}) async {
Map<String, dynamic> data = {
'media_id': mediaId,
'sort': sort.join(','),
'csrf': await Request.getCsrf(),
};
Utils.appSign(data);
var res = await Request().post(
Api.sortFav,
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
static Future cleanFav({
required dynamic mediaId,
}) async {
@@ -152,7 +177,7 @@ class UserHttp {
String keyword = '',
String order = 'mtime',
int type = 0}) async {
var res = await Request().get(Api.userFavFolderDetail, queryParameters: {
var res = await Request().get(Api.favResourceList, queryParameters: {
'media_id': mediaId,
'pn': pn,
'ps': ps,
@@ -174,11 +199,16 @@ class UserHttp {
var res = await Request().get(Api.seeYouLater);
if (res.data['code'] == 0) {
if (res.data['data']['count'] == 0) {
return LoadingState.success([]);
return LoadingState.success({
'list': [],
'count': 0,
});
}
List<HotVideoItemModel> list = [];
for (var i in res.data['data']['list']) {
list.add(HotVideoItemModel.fromJson(i));
if (res.data['data']?['list'] != null) {
for (var i in res.data['data']['list']) {
list.add(HotVideoItemModel.fromJson(i));
}
}
return LoadingState.success({
'list': list,
@@ -191,11 +221,12 @@ class UserHttp {
// 观看历史
static Future<LoadingState> historyList({
required String type,
int? max,
int? viewAt,
}) async {
var res = await Request().get(Api.historyList, queryParameters: {
'type': 'all',
'type': type,
'ps': 20,
'max': max ?? 0,
'view_at': viewAt ?? 0,
@@ -340,7 +371,7 @@ class UserHttp {
static Future hasFollow(int mid) async {
var res = await Request().get(
Api.hasFollow,
Api.relation,
queryParameters: {
'fid': mid,
},
@@ -353,7 +384,7 @@ class UserHttp {
}
// // 相互关系查询
// static Future relationSearch(int mid) async {
// Map params = await WbiSign().makSign({
// Map params = await WbiSign.makSign({
// 'mid': mid,
// 'token': '',
// 'platform': 'web',
@@ -437,6 +468,84 @@ class UserHttp {
}
}
static Future<LoadingState> favArticle({
required int page,
}) async {
var res = await Request().get(Api.favArticle, queryParameters: {
'page_size': 20,
'page': page,
});
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']?['items']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future addFavArticle({
required int id,
}) async {
var res = await Request().post(
Api.addFavArticle,
data: {
'id': id,
'csrf': await Request.getCsrf(),
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
static Future delFavArticle({
required int id,
}) async {
var res = await Request().post(
Api.delFavArticle,
data: {
'id': id,
'csrf': await Request.getCsrf(),
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
static Future communityAction({
required dynamic opusId,
required dynamic action,
}) async {
var res = await Request().post(
Api.communityAction,
queryParameters: {
'csrf': await Request.getCsrf(),
},
data: {
"entity": {
"object_id_str": opusId,
"type": {"biz": 2}
},
"action": action, // 3 fav, 4 unfav
},
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
static Future favResourceList({
required int id,
required int pn,

View File

@@ -18,9 +18,7 @@ import '../models/video_detail_res.dart';
import '../utils/id_utils.dart';
import '../utils/recommend_filter.dart';
import '../utils/storage.dart';
import '../utils/utils.dart';
import '../utils/wbi_sign.dart';
import '../pages/mine/controller.dart';
import 'api.dart';
import 'init.dart';
import 'login.dart';
@@ -32,6 +30,8 @@ import 'login.dart';
class VideoHttp {
static bool enableRcmdDynamic =
GStorage.setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
static RegExp zoneRegExp =
RegExp(GStorage.banWordForZone, caseSensitive: false);
// 首页推荐视频
static Future<LoadingState> rcmdVideoList(
@@ -50,12 +50,11 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<RecVideoItemModel> list = [];
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
for (var i in res.data['data']['item']) {
//过滤掉live与ad以及拉黑用户
if (i['goto'] == 'av' &&
(i['owner'] != null &&
!blackMidsList.contains(i['owner']['mid']))) {
(i['owner'] != null && !blackMids.contains(i['owner']['mid']))) {
RecVideoItemModel videoItem = RecVideoItemModel.fromJson(i);
if (!RecommendFilter.filter(videoItem)) {
list.add(videoItem);
@@ -69,15 +68,8 @@ class VideoHttp {
}
// 添加额外的loginState变量模拟未登录状态
static Future<LoadingState> rcmdVideoListApp(
{bool loginStatus = true, required int freshIdx}) async {
static Future<LoadingState> rcmdVideoListApp({required int freshIdx}) async {
Map<String, String> data = {
'access_key': loginStatus
? (GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'] ??
'')
: '',
'appkey': Constants.appKey,
'build': '1462100',
'c_locale': 'zh_CN',
'channel': 'yingyongbao',
@@ -104,21 +96,12 @@ class VideoHttp {
's_locale': 'zh_CN',
'splash_id': '',
'statistics': Constants.statistics,
'ts': (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(),
'voice_balance': '0'
};
String sign = Utils.appSign(
data,
Constants.appKey,
Constants.appSec,
);
data['sign'] = sign;
var res = await Request().get(
Api.recommendListApp,
queryParameters: data,
options: Options(headers: {
'Host': 'app.bilibili.com',
'buvid': LoginHttp.buvid,
'fp_local':
'1111111111111111111111111111111111111111111111111111111111111111',
@@ -136,21 +119,19 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<RecVideoItemAppModel> list = [];
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
for (var i in res.data['data']['items']) {
// 屏蔽推广和拉黑用户
if (i['card_goto'] != 'ad_av' &&
i['card_goto'] != 'ad_web_s' &&
i['ad_info'] == null &&
(!enableRcmdDynamic ? i['card_goto'] != 'picture' : true) &&
(i['args'] != null &&
!blackMidsList.contains(i['args']['up_id']))) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['args']['rname'])) {
continue;
}
(i['args'] != null && !blackMids.contains(i['args']['up_id']))) {
// if (zoneRegExp.pattern.isNotEmpty &&
// i['args']?['rname'] != null &&
// zoneRegExp.hasMatch(i['args']['rname'])) {
// continue;
// }
RecVideoItemAppModel videoItem = RecVideoItemAppModel.fromJson(i);
if (!RecommendFilter.filter(videoItem)) {
list.add(videoItem);
@@ -172,16 +153,15 @@ class VideoHttp {
);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
for (var i in res.data['data']['list']) {
if (!blackMidsList.contains(i['owner']['mid']) &&
if (!blackMids.contains(i['owner']['mid']) &&
!RecommendFilter.filterTitle(i['title']) &&
!RecommendFilter.filterLikeRatio(
i['stat']['like'], i['stat']['view'])) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['tname'])) {
if (zoneRegExp.pattern.isNotEmpty &&
i['tname'] != null &&
zoneRegExp.hasMatch(i['tname'])) {
continue;
}
list.add(HotVideoItemModel.fromJson(i));
@@ -197,9 +177,9 @@ class VideoHttp {
dynamic res = await GrpcRepo.popular(idx);
if (res['status']) {
List<card.Card> list = [];
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
for (card.Card item in res['data']) {
if (!blackMidsList.contains(item.smallCoverV5.up.id.toInt())) {
if (!blackMids.contains(item.smallCoverV5.up.id.toInt())) {
list.add(item);
}
}
@@ -228,24 +208,22 @@ class VideoHttp {
'qn': qn ?? 80,
// 获取所有格式的视频
'fnval': 4048,
};
// 免登录查看1080p
if ((GStorage.userInfo.get('userInfoCache') == null ||
MineController.anonymity.value) &&
GStorage.setting.get(SettingBoxKey.p1080, defaultValue: true)) {
data['try_look'] = 1;
}
Map params = await WbiSign().makSign({
...data,
'fourk': 1,
'voice_balance': 1,
'gaia_source': 'pre-load',
'web_location': 1550101,
});
};
late final usePgcApi = forcePgcApi == true || GStorage.isLogin;
// 免登录查看1080p
if (!Accounts.get(AccountType.video).isLogin &&
GStorage.setting.get(SettingBoxKey.p1080, defaultValue: true)) {
data['try_look'] = 1;
}
Map params = await WbiSign.makSign(data);
late final usePgcApi =
forcePgcApi == true || Accounts.get(AccountType.video).isLogin;
try {
var res = await Request().get(
@@ -327,7 +305,7 @@ class VideoHttp {
data: {
'platform': 'web',
'season_id': seasonId,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
@@ -371,13 +349,11 @@ class VideoHttp {
var res =
await Request().get(Api.relatedList, queryParameters: {'bvid': bvid});
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
for (var i in res.data['data']) {
HotVideoItemModel videoItem = HotVideoItemModel.fromJson(i);
if (!RecommendFilter.filter(videoItem, relatedVideos: true)) {
list.add(videoItem);
}
}
final items =
(res.data['data'] as List).map((i) => HotVideoItemModel.fromJson(i));
final list = RecommendFilter.applyFilterToRelatedVideos
? items.where((i) => !RecommendFilter.filterAll(i)).toList()
: items.toList();
return LoadingState.success(list);
} else {
return LoadingState.error(res.data['message']);
@@ -398,41 +374,43 @@ class VideoHttp {
}
// 获取点赞状态
static Future hasLikeVideo({required String bvid}) async {
var res =
await Request().get(Api.hasLikeVideo, queryParameters: {'bvid': bvid});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': []};
}
}
// static Future hasLikeVideo({required String bvid}) async {
// var res =
// await Request().get(Api.hasLikeVideo, queryParameters: {'bvid': bvid});
// if (res.data['code'] == 0) {
// return {'status': true, 'data': res.data['data']};
// } else {
// return {'status': false, 'data': []};
// }
// }
// 获取投币状态
static Future hasCoinVideo({required String bvid}) async {
var res =
await Request().get(Api.hasCoinVideo, queryParameters: {'bvid': bvid});
debugPrint('res: $res');
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': []};
}
}
// static Future hasCoinVideo({required String bvid}) async {
// var res =
// await Request().get(Api.hasCoinVideo, queryParameters: {'bvid': bvid});
// if (res.data['code'] == 0) {
// return {'status': true, 'data': res.data['data']};
// } else {
// return {'status': false, 'data': []};
// }
// }
// 投币
static Future coinVideo({required String bvid, required int multiply}) async {
static Future coinVideo({
required String bvid,
required int multiply,
int selectLike = 0,
}) async {
var res = await Request().post(
Api.coinVideo,
queryParameters: {
'aid': IdUtils.bv2av(bvid),
data: {
'aid': IdUtils.bv2av(bvid).toString(),
// 'bvid': bvid,
'multiply': multiply,
'select_like': 0,
'access_key': GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'],
// 'csrf': await Request.getCsrf(),
'multiply': multiply.toString(),
'select_like': selectLike.toString(),
// 'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
@@ -442,27 +420,30 @@ class VideoHttp {
}
// 获取收藏状态
static Future hasFavVideo({required int aid}) async {
var res =
await Request().get(Api.hasFavVideo, queryParameters: {'aid': aid});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': []};
}
}
// static Future hasFavVideo({required int aid}) async {
// var res =
// await Request().get(Api.hasFavVideo, queryParameters: {'aid': aid});
// if (res.data['code'] == 0) {
// return {'status': true, 'data': res.data['data']};
// } else {
// return {'status': false, 'data': []};
// }
// }
// 一键三连 bangumi
static Future triple({dynamic epId}) async {
static Future triple({dynamic epId, required dynamic seasonId}) async {
var res = await Request().post(
Api.triple,
data: {
'ep_id': epId,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
headers: {
'Content-Type': Headers.formUrlEncodedContentType,
'origin': 'https://www.bilibili.com',
'referer': 'https://www.bilibili.com/bangumi/play/ss$seasonId',
'user-agent': Request.headerUa(type: 'pc'),
},
),
);
@@ -483,10 +464,15 @@ class VideoHttp {
'ramval': 0,
'source': 'web_normal',
'ga': 1,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
headers: {
'origin': 'https://www.bilibili.com',
'referer': 'https://www.bilibili.com/video/$bvid',
'user-agent': Request.headerUa(type: 'pc'),
},
),
);
if (res.data['code'] == 0) {
@@ -498,18 +484,19 @@ class VideoHttp {
// (取消)点赞
static Future likeVideo({required String bvid, required bool type}) async {
var res = await Request().post(Api.likeVideo, queryParameters: {
'aid': IdUtils.bv2av(bvid),
'like': type ? 0 : 1,
'access_key': GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'],
}
// queryParameters: {
// 'bvid': bvid,
// 'like': type ? 1 : 2,
// 'csrf': await Request.getCsrf(),
// },
);
var res = await Request().post(
Api.likeVideo,
data: {
'aid': IdUtils.bv2av(bvid).toString(),
'like': type ? '0' : '1',
},
options: Options(contentType: Headers.formUrlEncodedContentType),
// queryParameters: {
// 'bvid': bvid,
// 'like': type ? 1 : 2,
// 'csrf': Accounts.main.csrf,
// },
);
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
@@ -519,18 +506,16 @@ class VideoHttp {
// (取消)点踩
static Future dislikeVideo({required String bvid, required bool type}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
if (Accounts.main.accessKey.isNullOrEmpty) {
return {'status': false, 'msg': "请退出账号后重新登录"};
}
var res = await Request().post(
Api.dislikeVideo,
queryParameters: {
'aid': IdUtils.bv2av(bvid),
'dislike': type ? 0 : 1,
'access_key': accessKey,
data: {
'aid': IdUtils.bv2av(bvid).toString(),
'dislike': type ? '0' : '1',
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
if (res.data is! String && res.data['code'] == 0) {
return {'status': true};
@@ -548,9 +533,7 @@ class VideoHttp {
required int id,
int? reasonId,
int? feedbackId}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
if (Accounts.get(AccountType.recommend).accessKey.isNullOrEmpty) {
return {'status': false, 'msg': "请退出账号后重新登录"};
}
assert((reasonId != null) ^ (feedbackId != null));
@@ -560,10 +543,8 @@ class VideoHttp {
// 'mid': mid,
if (reasonId != null) 'reason_id': reasonId,
if (feedbackId != null) 'feedback_id': feedbackId,
'build': 1,
'build': '1',
'mobi_app': 'android',
'access_key': accessKey,
'appkey': Constants.appKey,
});
if (res.data['code'] == 0) {
return {'status': true};
@@ -578,9 +559,7 @@ class VideoHttp {
required int id,
int? reasonId,
int? feedbackId}) async {
String? accessKey = GStorage.localCache
.get(LocalCacheKey.accessKey, defaultValue: {})['value'];
if (accessKey == null || accessKey == "") {
if (Accounts.get(AccountType.recommend).accessKey.isNullOrEmpty) {
return {'status': false, 'msg': "请退出账号后重新登录"};
}
// assert ((reasonId != null) ^ (feedbackId != null));
@@ -590,10 +569,8 @@ class VideoHttp {
// 'mid': mid,
if (reasonId != null) 'reason_id': reasonId,
if (feedbackId != null) 'feedback_id': feedbackId,
'build': 1,
'build': '1',
'mobi_app': 'android',
'access_key': accessKey,
'appkey': Constants.appKey,
});
if (res.data['code'] == 0) {
return {'status': true};
@@ -613,7 +590,7 @@ class VideoHttp {
'resources': ids?.join(','),
'media_id': delIds,
'platform': 'web',
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
@@ -638,7 +615,7 @@ class VideoHttp {
'type': type ?? 2,
'add_media_ids': addIds ?? '',
'del_media_ids': delIds ?? '',
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
@@ -661,7 +638,7 @@ class VideoHttp {
// 'resources': '$epId:24',
// 'add_media_ids': addIds ?? '',
// 'del_media_ids': delIds ?? '',
// 'csrf': await Request.getCsrf(),
// 'csrf': Accounts.main.csrf,
// },
// options: Options(
// headers: {
@@ -698,7 +675,7 @@ class VideoHttp {
if (mid != null) 'mid': mid,
'resources': resources.join(','),
'platform': 'web',
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(contentType: Headers.formUrlEncodedContentType),
);
@@ -772,7 +749,7 @@ class VideoHttp {
'message': message,
if (pictures != null) 'pictures': jsonEncode(pictures),
if (syncToDynamic == true) 'sync_to_dynamic': 1,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
};
var res = await Request().post(
Api.replyAdd,
@@ -795,7 +772,7 @@ class VideoHttp {
'type': type, //type.index
'oid': oid,
'rpid': rpid,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
});
log(res.toString());
if (res.data['code'] == 0) {
@@ -805,25 +782,33 @@ class VideoHttp {
}
}
// 查询是否关注up
static Future hasFollow({required int mid}) async {
var res = await Request().get(Api.hasFollow, queryParameters: {'fid': mid});
if (res.data['code'] == 0) {
return {'status': true, 'data': res.data['data']};
} else {
return {'status': false, 'data': []};
}
}
// 操作用户关系
static Future relationMod(
{required int mid, required int act, required int reSrc}) async {
var res = await Request().post(Api.relationMod, queryParameters: {
'fid': mid,
'act': act,
're_src': reSrc,
'csrf': await Request.getCsrf(),
});
var res = await Request().post(
Api.relationMod,
data: {
'fid': mid,
'act': act,
're_src': reSrc,
'gaia_source': 'web_main',
'spmid': '333.999.0.0',
'extend_content': {
"entity": "user",
"entity_id": mid,
'fp': Request.headerUa(type: 'pc'),
},
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
headers: {
'origin': 'https://space.bilibili.com',
'referer': 'https://space.bilibili.com/$mid/dynamic',
'user-agent': Request.headerUa(type: 'pc'),
},
),
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
@@ -831,6 +816,32 @@ class VideoHttp {
}
}
static Future roomEntryAction({
roomId,
}) async {
await Request().post(
Api.roomEntryAction,
queryParameters: {
'csrf': await Request.getCsrf(),
},
data: {
'room_id': roomId,
'platform': 'pc',
},
);
}
static Future historyReport({
aid,
type,
}) async {
await Request().post(Api.historyReport, queryParameters: {
if (aid != null) 'aid': aid,
if (type != null) 'type': type,
'csrf': Accounts.main.csrf,
});
}
// 视频播放进度
static Future heartBeat({
bvid,
@@ -849,7 +860,7 @@ class VideoHttp {
if (epid != null) 'type': 4,
if (subType != null) 'sub_type': subType,
'played_time': progress,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
});
}
@@ -862,7 +873,7 @@ class VideoHttp {
'desc': desc,
'oid': oid,
'upper_mid': upperMid,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
});
}
@@ -870,7 +881,7 @@ class VideoHttp {
static Future bangumiAdd({int? seasonId}) async {
var res = await Request().post(Api.bangumiAdd, queryParameters: {
'season_id': seasonId,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
});
if (res.data['code'] == 0) {
return {
@@ -891,7 +902,7 @@ class VideoHttp {
static Future bangumiDel({int? seasonId}) async {
var res = await Request().post(Api.bangumiDel, queryParameters: {
'season_id': seasonId,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
});
if (res.data['code'] == 0) {
return {
@@ -909,15 +920,15 @@ class VideoHttp {
}
static Future bangumiUpdate({
dynamic seasonId,
dynamic status,
required List seasonId,
required dynamic status,
}) async {
var res = await Request().post(
Api.bangumiUpdate,
data: {
'season_id': seasonId,
'season_id': seasonId.join(','),
'status': status,
'csrf': await Request.getCsrf(),
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
@@ -948,7 +959,7 @@ class VideoHttp {
int? cid,
int? upMid,
}) async {
Map params = await WbiSign().makSign({
Map params = await WbiSign.makSign({
'bvid': bvid,
'cid': cid,
'up_mid': upMid,
@@ -994,23 +1005,18 @@ class VideoHttp {
*/
return {
'status': true,
'data': data['subtitle']['subtitles'],
'subtitles': data['subtitle']['subtitles'],
'view_points': data['view_points'],
// 'last_play_time': data['last_play_time'],
'last_play_cid': data['last_play_cid'],
'interaction': data['interaction'],
};
} else {
return {'status': false, 'data': [], 'msg': res.data['message']};
return {'status': false, 'msg': res.data['message']};
}
}
static Future vttSubtitles(List subtitlesJson) async {
if (subtitlesJson.isEmpty) {
return [];
}
List<Map<String, String>> subtitlesVtt = [];
static Future vttSubtitles(subtile) async {
String subtitleTimecode(num seconds) {
int h = (seconds / 3600).floor();
int m = ((seconds % 3600) / 60).floor();
@@ -1028,56 +1034,12 @@ class VideoHttp {
});
}
for (var i in subtitlesJson) {
var res =
await Request().get("https://${i['subtitle_url'].split('//')[1]}");
/*
{
"font_size": 0.4,
"font_color": "#FFFFFF",
"background_alpha": 0.5,
"background_color": "#9C27B0",
"Stroke": "none",
"type": "AIsubtitle",
"lang": "zh",
"version": "v1.6.0.4",
"body": [
{
"from": 0.5,
"to": 1.58,
"sid": 1,
"location": 2,
"content": "很多人可能不知道",
"music": 0.0
},
……,
{
"from": 558.629,
"to": 560.22,
"sid": 280,
"location": 2,
"content": "我们下期再见",
"music": 0.0
}
]
}
*/
if (res.data != null && res.data?['body'] is List) {
String vttData = await compute(processList, res.data['body'] as List);
subtitlesVtt.add({
'language': i['lan'],
'title': i['lan_doc'],
'text': vttData,
});
} else {
// SmartDialog.showToast("字幕${i['lan_doc']}加载失败, ${res.data['message']}");
debugPrint('字幕${i['lan_doc']}加载失败, ${res.data['message']}');
}
var res = await Request().get("https:${subtile['subtitle_url']}");
if (res.data?['body'] is List) {
return await compute(processList, res.data['body'] as List);
}
if (subtitlesVtt.isNotEmpty) {
subtitlesVtt.insert(0, {'language': '', 'title': '关闭字幕', 'text': ""});
}
return subtitlesVtt;
return null;
}
// 视频排行
@@ -1086,16 +1048,15 @@ class VideoHttp {
var res = await Request().get(rankApi);
if (res.data['code'] == 0) {
List<HotVideoItemModel> list = [];
List<int> blackMidsList = GStorage.blackMidsList;
Set<int> blackMids = GStorage.blackMids;
for (var i in res.data['data']['list']) {
if (!blackMidsList.contains(i['owner']['mid']) &&
if (!blackMids.contains(i['owner']['mid']) &&
!RecommendFilter.filterTitle(i['title']) &&
!RecommendFilter.filterLikeRatio(
i['stat']['like'], i['stat']['view'])) {
String banWordForZone = GStorage.banWordForZone;
if (banWordForZone.isNotEmpty &&
RegExp(banWordForZone, caseSensitive: false)
.hasMatch(i['tname'])) {
if (zoneRegExp.pattern.isNotEmpty &&
i['tname'] != null &&
zoneRegExp.hasMatch(i['tname'])) {
continue;
}
list.add(HotVideoItemModel.fromJson(i));
@@ -1106,4 +1067,132 @@ class VideoHttp {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> getVideoNoteList({
dynamic oid,
dynamic uperMid,
required int page,
}) async {
var res = await Request().get(
Api.archiveNoteList,
queryParameters: {
'csrf': Accounts.main.csrf,
'oid': oid,
'oid_type': 0,
'pn': page,
'ps': 10,
if (uperMid != null) 'uper_mid': uperMid,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> noteList({
required int page,
}) async {
var res = await Request().get(
Api.noteList,
queryParameters: {
'pn': page,
'ps': 10,
'csrf': Accounts.main.csrf,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']?['list']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> userNoteList({
required int page,
}) async {
var res = await Request().get(
Api.userNoteList,
queryParameters: {
'pn': page,
'ps': 10,
'csrf': Accounts.main.csrf,
},
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']?['list']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future<LoadingState> addNote({
required oid,
required String title,
required String summary,
}) async {
String noteId = '';
try {
final res = await Request().get(Api.archiveNote, queryParameters: {
'oid': oid,
'oid_type': 0,
'csrf': Accounts.main.csrf,
});
if (res.data['code'] == 0) {
if (res.data['data']['noteIds'] != null) {
noteId = res.data['data']['noteIds'].first;
}
}
} catch (_) {}
final res = await Request().post(
Api.addNote,
data: {
'cont_len': summary.length,
'note_id': noteId,
'oid': oid,
'oid_type': 0,
'platform': 'web',
'title': title,
'summary': summary,
'content': jsonEncode([
{"insert": summary},
]),
'from': 'close',
'hash': DateTime.now().millisecondsSinceEpoch,
'tags': '',
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
if (res.data['code'] == 0) {
return LoadingState.success(res.data['data']?['list']);
} else {
return LoadingState.error(res.data['message']);
}
}
static Future delNote({
required bool isPublish,
required List noteIds,
}) async {
final res = await Request().post(
isPublish ? Api.delPublishNote : Api.delNote,
data: {
isPublish ? 'cvids' : 'note_ids': noteIds.join(','),
'csrf': Accounts.main.csrf,
},
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
if (res.data['code'] == 0) {
return {'status': true};
} else {
return {'status': false, 'msg': res.data['message']};
}
}
}

View File

@@ -1,7 +1,9 @@
import 'dart:io';
import 'package:PiliPlus/build_config.dart';
import 'package:PiliPlus/pages/video/detail/view_v.dart';
import 'package:PiliPlus/utils/cache_manage.dart';
import 'package:PiliPlus/utils/utils.dart';
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
import 'package:flutter/services.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
@@ -52,15 +54,11 @@ void main() async {
],
);
}
if (GStorage.badCertificateCallback) {
HttpOverrides.global = _CustomHttpOverrides();
}
HttpOverrides.global = _CustomHttpOverrides();
await setupServiceLocator();
Request();
await Request.setCookie();
RecommendFilter();
SmartDialog.config.loading =
SmartConfigLoading(backType: SmartBackType.normal);
// 异常捕获 logo记录
final String buildConfig = '''\n
Build Time: ${BuildConfig.buildTime}
@@ -118,6 +116,8 @@ class MyApp extends StatelessWidget {
Box get setting => GStorage.setting;
static ThemeData? darkThemeData;
@override
Widget build(BuildContext context) {
// 主题色
@@ -177,17 +177,18 @@ class MyApp extends StatelessWidget {
// tones: FlexTones.soft(Brightness.dark),
);
}
// 图片缓存
// PaintingBinding.instance.imageCache.maximumSizeBytes = 1000 << 20;
return GetMaterialApp(
// showSemanticsDebugger: true,
title: 'PiliPlus',
theme: _getThemeData(
theme: Utils.getThemeData(
colorScheme: lightColorScheme,
isDynamic: lightDynamic != null && isDynamicColor,
variant: variant,
),
darkTheme: _getThemeData(
darkTheme: Utils.getThemeData(
colorScheme: darkColorScheme,
isDynamic: darkDynamic != null && isDynamicColor,
isDark: true,
@@ -204,92 +205,42 @@ class MyApp extends StatelessWidget {
fallbackLocale: const Locale("zh", "CN"),
getPages: Routes.getPages,
home: const MainApp(),
builder: (BuildContext context, Widget? child) {
return FlutterSmartDialog(
toastBuilder: (String msg) => CustomToast(msg: msg),
child: MediaQuery(
builder: FlutterSmartDialog.init(
toastBuilder: (String msg) => CustomToast(msg: msg),
loadingBuilder: (msg) => LoadingWidget(msg: msg),
builder: (context, child) {
return MediaQuery(
data: MediaQuery.of(context)
.copyWith(textScaler: TextScaler.linear(textScale)),
child: child!,
),
);
},
);
},
),
navigatorObservers: [
FlutterSmartDialog.observer,
VideoDetailPage.routeObserver,
VideoDetailPageV.routeObserver,
MainApp.routeObserver,
],
);
}),
);
}
ThemeData _getThemeData({
required ColorScheme colorScheme,
required bool isDynamic,
bool isDark = false,
required FlexSchemeVariant variant,
}) {
return ThemeData(
colorScheme: colorScheme,
useMaterial3: true,
appBarTheme: AppBarTheme(
elevation: 0,
titleSpacing: 0,
centerTitle: false,
scrolledUnderElevation: 0,
backgroundColor: isDynamic ? null : colorScheme.surface,
titleTextStyle: TextStyle(fontSize: 16, color: colorScheme.onSurface),
),
navigationBarTheme: NavigationBarThemeData(
surfaceTintColor: isDynamic ? colorScheme.onSurfaceVariant : null,
),
snackBarTheme: SnackBarThemeData(
actionTextColor: colorScheme.primary,
backgroundColor: colorScheme.secondaryContainer,
closeIconColor: colorScheme.secondary,
contentTextStyle: TextStyle(color: colorScheme.secondary),
elevation: 20,
),
pageTransitionsTheme: const PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: ZoomPageTransitionsBuilder(
allowEnterRouteSnapshotting: false,
),
},
),
popupMenuTheme: PopupMenuThemeData(
surfaceTintColor: isDynamic ? colorScheme.onSurfaceVariant : null,
),
cardTheme: CardTheme(
elevation: 1,
surfaceTintColor: isDynamic
? colorScheme.onSurfaceVariant
: isDark
? colorScheme.onSurfaceVariant
: null,
shadowColor: Colors.transparent,
),
// dialogTheme: DialogTheme(
// surfaceTintColor: isDark ? colorScheme.onSurfaceVariant : null,
// ),
progressIndicatorTheme: ProgressIndicatorThemeData(
refreshBackgroundColor: colorScheme.onSecondary,
),
dialogTheme: DialogTheme(
titleTextStyle: TextStyle(
fontSize: 18,
color: colorScheme.onSurface,
),
),
);
}
}
class _CustomHttpOverrides extends HttpOverrides {
final badCertificateCallback =
BuildConfig.isDebug || GStorage.badCertificateCallback;
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback =
final client = super.createHttpClient(context)
// ..maxConnectionsPerHost = 32
..idleTimeout = const Duration(seconds: 15);
if (badCertificateCallback) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
return client;
}
}

View File

@@ -175,6 +175,7 @@ class EpisodeItem {
this.subtitle,
this.title,
this.vid,
this.showTitle,
});
int? aid;
@@ -205,6 +206,7 @@ class EpisodeItem {
String? subtitle;
String? title;
String? vid;
String? showTitle;
EpisodeItem.fromJson(Map<String, dynamic> json) {
aid = json['aid'];
@@ -235,6 +237,7 @@ class EpisodeItem {
subtitle = json['subtitle'];
title = json['title'];
vid = json['vid'];
showTitle = json['show_title'];
}
}

View File

@@ -8,18 +8,16 @@ class BangumiListDataModel {
});
int? hasNext;
List? list;
List<BangumiListItemModel>? list;
int? num;
int? size;
int? total;
BangumiListDataModel.fromJson(Map<String, dynamic> json) {
hasNext = json['has_next'];
list = json['list'] != null
? json['list']
.map<BangumiListItemModel>((e) => BangumiListItemModel.fromJson(e))
.toList()
: [];
list = (json['list'] as List?)
?.map<BangumiListItemModel>((e) => BangumiListItemModel.fromJson(e))
.toList();
num = json['num'];
size = json['size'];
total = json['total'];
@@ -46,6 +44,7 @@ class BangumiListItemModel {
this.title,
this.titleIcon,
this.progress,
this.newEp,
});
String? badge;
@@ -64,9 +63,11 @@ class BangumiListItemModel {
String? subTitle;
String? title;
String? titleIcon;
Map? newEp;
String? progress;
bool? checked;
BangumiListItemModel.fromJson(Map<String, dynamic> json) {
badge = json['badge'] == '' ? null : json['badge'];
badgeType = json['badge_type'];
@@ -84,7 +85,7 @@ class BangumiListItemModel {
subTitle = json['sub_title'];
title = json['title'];
titleIcon = json['title_icon'];
newEp = json['new_ep'];
progress = json['progress'];
}
}

View File

@@ -0,0 +1,70 @@
class Condition {
List<Filter>? filter;
List<Order>? order;
Condition({
this.filter,
this.order,
});
Condition.fromJson(Map json) {
filter = (json['filter'] as List?)
?.map((item) => Filter.fromJson(item))
.toList();
order =
(json['order'] as List?)?.map((item) => Order.fromJson(item)).toList();
}
}
class Order {
String? field;
String? name;
String? sort;
Order({
this.field,
this.name,
this.sort,
});
Order.fromJson(Map json) {
field = json['field'];
name = json['name'];
sort = json['sort'];
}
}
class Filter {
String? field;
String? name;
List<Values>? values;
Filter({
this.field,
this.name,
this.values,
});
Filter.fromJson(Map json) {
field = json['field'];
name = json['name'];
values = (json['values'] as List?)
?.map((item) => Values.fromJson(item))
.toList();
}
}
class Values {
String? keyword;
String? name;
Values({
this.keyword,
this.name,
});
Values.fromJson(Map json) {
keyword = json['keyword'];
name = json['name'];
}
}

View File

@@ -1,7 +0,0 @@
// 首页推荐类型
enum RcmdType { web, app, notLogin }
extension RcmdTypeExtension on RcmdType {
String get values => ['web', 'app', 'notLogin'][index];
String get labels => ['web端', 'app端', '游客模式'][index];
}

View File

@@ -8,7 +8,7 @@ class PostSegmentModel {
required this.category,
required this.actionType,
});
Pair<int, int> segment;
Pair<double, double> segment;
SegmentType category;
ActionType actionType;
}

View File

@@ -1,5 +1,7 @@
import 'dart:ui';
import 'package:PiliPlus/models/common/sponsor_block/action_type.dart';
enum SegmentType {
sponsor,
selfpromo,
@@ -13,6 +15,74 @@ enum SegmentType {
exclusive_access
}
// List<SegmentType> _actionType2SegmentType(ActionType actionType) {
// return switch (actionType) {
// ActionType.skip => [
// SegmentType.sponsor,
// SegmentType.selfpromo,
// SegmentType.interaction,
// SegmentType.intro,
// SegmentType.outro,
// SegmentType.preview,
// SegmentType.filler,
// ],
// ActionType.mute => [
// SegmentType.sponsor,
// SegmentType.selfpromo,
// SegmentType.interaction,
// SegmentType.intro,
// SegmentType.outro,
// SegmentType.preview,
// SegmentType.music_offtopic,
// SegmentType.filler,
// ],
// ActionType.full => [
// SegmentType.sponsor,
// SegmentType.selfpromo,
// SegmentType.exclusive_access,
// ],
// ActionType.poi => [
// SegmentType.poi_highlight,
// ],
// };
// }
List<ActionType> segmentType2ActionType(SegmentType segmentType) {
return switch (segmentType) {
SegmentType.sponsor => [ActionType.skip, ActionType.mute, ActionType.full],
SegmentType.selfpromo => [
ActionType.skip,
ActionType.mute,
ActionType.full
],
SegmentType.interaction => [
ActionType.skip,
ActionType.mute,
],
SegmentType.intro => [
ActionType.skip,
ActionType.mute,
],
SegmentType.outro => [
ActionType.skip,
ActionType.mute,
],
SegmentType.preview => [
ActionType.skip,
ActionType.mute,
],
SegmentType.music_offtopic => [
ActionType.skip,
],
SegmentType.poi_highlight => [ActionType.poi],
SegmentType.filler => [
ActionType.skip,
ActionType.mute,
],
SegmentType.exclusive_access => [ActionType.full],
};
}
extension SegmentTypeExt on SegmentType {
/// from https://github.com/hanydd/BilibiliSponsorBlock/blob/master/public/_locales/zh_CN/messages.json
String get title => [

View File

@@ -14,7 +14,7 @@ class DynamicsDataModel {
DynamicsDataModel.fromJson(Map<String, dynamic> json) {
hasMore = json['has_more'];
items = json['items']
items = (json['items'] as List?)
?.map<DynamicItemModel>((e) => DynamicItemModel.fromJson(e))
.toList();
offset = json['offset'];
@@ -35,47 +35,23 @@ class DynamicItemModel {
Map? basic;
dynamic idStr;
ItemModulesModel? modules;
ItemOrigModel? orig;
DynamicItemModel? orig;
String? type;
bool? visible;
bool? isForwarded;
DynamicItemModel.fromJson(Map<String, dynamic> json) {
basic = json['basic'];
idStr = json['id_str'];
modules = ItemModulesModel.fromJson(json['modules']);
orig = json['orig'] != null ? ItemOrigModel.fromJson(json['orig']) : null;
orig =
json['orig'] != null ? DynamicItemModel.fromJson(json['orig']) : null;
orig?.isForwarded = true;
type = json['type'];
visible = json['visible'];
}
}
class ItemOrigModel {
ItemOrigModel({
this.basic,
this.isStr,
this.modules,
this.type,
this.visible,
this.idStr,
});
Map? basic;
String? isStr;
ItemModulesModel? modules;
String? type;
bool? visible;
dynamic idStr;
ItemOrigModel.fromJson(Map<String, dynamic> json) {
basic = json['basic'];
isStr = json['is_str'];
modules = ItemModulesModel.fromJson(json['modules']);
type = json['type'];
visible = json['visible'];
idStr = json['id_str'];
}
}
// 单个动态详情
class ItemModulesModel {
ItemModulesModel({
@@ -364,7 +340,9 @@ class Good {
Good.fromJson(Map<String, dynamic> json) {
headIcon = json['head_icon'];
headText = json['head_text'];
items = json['items'].map<GoodItem>((e) => GoodItem.fromJson(e)).toList();
items = (json['items'] as List?)
?.map<GoodItem>((e) => GoodItem.fromJson(e))
.toList();
jumpUrl = json['jump_url'];
}
}
@@ -409,11 +387,9 @@ class DynamicDescModel {
String? text;
DynamicDescModel.fromJson(Map<String, dynamic> json) {
richTextNodes = json['rich_text_nodes'] != null
? json['rich_text_nodes']
.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList()
: [];
richTextNodes = (json['rich_text_nodes'] as List?)
?.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList();
text = json['text'];
}
}
@@ -434,6 +410,7 @@ class DynamicMajorModel {
this.common,
this.music,
this.blocked,
this.medialist,
});
DynamicArchiveModel? archive;
@@ -452,6 +429,7 @@ class DynamicMajorModel {
Map? common;
Map? music;
Map? blocked;
Map? medialist;
DynamicMajorModel.fromJson(Map<String, dynamic> json) {
archive = json['archive'] != null
@@ -478,6 +456,7 @@ class DynamicMajorModel {
common = json['common'] ?? {};
music = json['music'] ?? {};
blocked = json['blocked'];
medialist = json['medialist'];
}
}
@@ -557,12 +536,9 @@ class DynamicDrawModel {
DynamicDrawModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
// ignore: prefer_null_aware_operators
items = json['items'] != null
? json['items']
.map<DynamicDrawItemModel>((e) => DynamicDrawItemModel.fromJson(e))
.toList()
: null;
items = (json['items'] as List?)
?.map<DynamicDrawItemModel>((e) => DynamicDrawItemModel.fromJson(e))
.toList();
}
}
@@ -580,7 +556,7 @@ class DynamicOpusModel {
String? title;
DynamicOpusModel.fromJson(Map<String, dynamic> json) {
jumpUrl = json['jump_url'];
pics = json['pics']
pics = (json['pics'] as List?)
?.map<OpusPicsModel>((e) => OpusPicsModel.fromJson(e))
.toList();
summary =
@@ -599,8 +575,8 @@ class SummaryModel {
String? text;
SummaryModel.fromJson(Map<String, dynamic> json) {
richTextNodes = json['rich_text_nodes']
.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
richTextNodes = (json['rich_text_nodes'] as List?)
?.map<RichTextNodeItem>((e) => RichTextNodeItem.fromJson(e))
.toList();
text = json['text'];
}
@@ -638,11 +614,15 @@ class Emoji {
});
String? iconUrl;
String? webpUrl;
String? gifUrl;
double? size;
String? text;
int? type;
Emoji.fromJson(Map<String, dynamic> json) {
iconUrl = json['icon_url'];
webpUrl = json['webp_url'];
gifUrl = json['gif_url'];
size = json['size'].toDouble();
text = json['text'];
type = json['type'];

View File

@@ -12,9 +12,9 @@ class FollowUpModel {
liveUsers = json['live_users'] != null
? LiveUsers.fromJson(json['live_users'])
: null;
upList = json['up_list'] != null
? json['up_list'].map<UpItem>((e) => UpItem.fromJson(e)).toList()
: [];
upList = (json['up_list'] as List?)
?.map<UpItem>((e) => UpItem.fromJson(e))
.toList();
}
}
@@ -32,8 +32,8 @@ class LiveUsers {
LiveUsers.fromJson(Map<String, dynamic> json) {
count = json['count'];
group = json['group'];
items = json['items']
.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
items = (json['items'] as List?)
?.map<LiveUserItem>((e) => LiveUserItem.fromJson(e))
.toList();
}
}

View File

@@ -9,8 +9,8 @@ class FansDataModel {
FansDataModel.fromJson(Map<String, dynamic> json) {
total = json['total'];
list = json['list']
.map<FansItemModel>((e) => FansItemModel.fromJson(e))
list = (json['list'] as List?)
?.map<FansItemModel>((e) => FansItemModel.fromJson(e))
.toList();
}
}

View File

@@ -9,9 +9,10 @@ class FollowDataModel {
FollowDataModel.fromJson(Map<String, dynamic> json) {
total = json['total'] ?? 0;
list = json['list']
.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
.toList();
list = (json['list'] as List?)
?.map<FollowItemModel>((e) => FollowItemModel.fromJson(e))
.toList() ??
[];
}
}

View File

@@ -17,9 +17,9 @@ class LatestDataModel {
url = json['url'];
tagName = json['tag_name'];
createdAt = json['created_at'];
assets = json['assets'] != null
? json['assets'].map<AssetItem>((e) => AssetItem.fromJson(e)).toList()
: [];
assets = (json['assets'] as List?)
?.map<AssetItem>((e) => AssetItem.fromJson(e))
.toList();
body = json['body'];
}
}

View File

@@ -1,60 +1,20 @@
import 'package:PiliPlus/models/model_rec_video_item.dart';
import 'package:PiliPlus/models/model_video.dart';
import 'package:PiliPlus/utils/id_utils.dart';
import 'package:PiliPlus/utils/utils.dart';
class RecVideoItemAppModel {
RecVideoItemAppModel({
this.id,
this.aid,
this.bvid,
this.cid,
this.pic,
this.stat,
this.duration,
this.title,
this.isFollowed,
this.owner,
this.rcmdReason,
this.goto,
this.param,
this.uri,
this.talkBack,
this.bangumiView,
this.bangumiFollow,
this.bangumiBadge,
this.cardType,
this.adInfo,
this.threePoint,
this.desc,
});
class RecVideoItemAppModel extends BaseRecVideoItemModel {
int? id;
int? aid;
String? bvid;
int? cid;
String? pic;
RcmdStat? stat;
int? duration;
String? title;
int? isFollowed;
RcmdOwner? owner;
String? rcmdReason;
String? goto;
int? param;
String? uri;
String? talkBack;
// 番剧
String? bangumiView;
String? bangumiFollow;
String? bangumiBadge;
String? cardType;
Map? adInfo;
ThreePoint? threePoint;
String? desc;
RecVideoItemAppModel.fromJson(Map<String, dynamic> json) {
id = json['player_args'] != null
? json['player_args']['aid']
: int.parse(json['param'] ?? '-1');
: int.tryParse(json['param'] ?? '-1');
aid = id;
bvid = json['bvid'] ??
(json['player_args'] != null
@@ -70,21 +30,22 @@ class RecVideoItemAppModel {
title = json['title'];
owner = RcmdOwner.fromJson(json);
rcmdReason = json['bottom_rcmd_reason'] ?? json['top_rcmd_reason'];
if (rcmdReason != null && rcmdReason!.contains('')) {
// 有时能在推荐原因里获得点赞数
(stat as RcmdStat).like = Utils.parseNum(rcmdReason!);
}
// 由于app端api并不会直接返回与owner的关注状态
// 所以借用推荐原因是否为“已关注”、“新关注”判别关注状态从而与web端接口等效
isFollowed = (rcmdReason == '关注') || (rcmdReason == '新关注') ? 1 : 0;
isFollowed = const {'已关注', '关注'}.contains(rcmdReason);
// 如果是就无需再显示推荐原因交由view统一处理即可
if (isFollowed == 1) {
rcmdReason = null;
}
if (isFollowed) rcmdReason = null;
goto = json['goto'];
param = int.parse(json['param']);
uri = json['uri'];
talkBack = json['talk_back'];
if (json['goto'] == 'bangumi') {
bangumiView = json['cover_left_text_1'];
bangumiFollow = json['cover_left_text_2'];
bangumiBadge = json['cover_right_text'];
}
@@ -95,30 +56,37 @@ class RecVideoItemAppModel {
: null;
desc = json['desc'];
}
// @override
// int? get pubdate => null;
}
class RcmdStat {
RcmdStat({
this.view,
this.like,
this.danmu,
});
String? view;
String? like;
String? danmu;
class RcmdStat implements BaseStat {
@override
int? like;
@override
int? get view => Utils.parseNum(viewStr);
@override
int? get danmu => Utils.parseNum(danmuStr);
@override
late String viewStr;
@override
late String danmuStr;
RcmdStat.fromJson(Map<String, dynamic> json) {
view = json["cover_left_text_1"];
danmu = json['cover_left_text_2'] ?? '-';
viewStr = json["cover_left_text_1"];
danmuStr = json['cover_left_text_2'];
}
@override
set danmu(_) {}
@override
set view(_) {}
}
class RcmdOwner {
RcmdOwner({this.name, this.mid});
String? name;
int? mid;
class RcmdOwner extends BaseOwner {
RcmdOwner.fromJson(Map<String, dynamic> json) {
name = json['goto'] == 'av'
? json['args']['up_name']
@@ -130,63 +98,26 @@ class RcmdOwner {
}
class ThreePoint {
ThreePoint({
this.dislikeReasons,
this.feedbacks,
this.watchLater,
});
List<DislikeReason>? dislikeReasons;
List<FeedbackReason>? feedbacks;
List<Reason>? dislikeReasons;
List<Reason>? feedbacks;
int? watchLater;
ThreePoint.fromJson(Map<String, dynamic> json) {
if (json['dislike_reasons'] != null) {
dislikeReasons = [];
json['dislike_reasons'].forEach((v) {
dislikeReasons!.add(DislikeReason.fromJson(v));
});
}
if (json['feedbacks'] != null) {
feedbacks = [];
json['feedbacks'].forEach((v) {
feedbacks!.add(FeedbackReason.fromJson(v));
});
}
dislikeReasons = (json['dislike_reasons'] as List?)
?.map((v) => Reason.fromJson(v))
.toList();
feedbacks =
(json['feedbacks'] as List?)?.map((v) => Reason.fromJson(v)).toList();
watchLater = json['watch_later'];
}
}
class DislikeReason {
DislikeReason({
this.id,
this.name,
this.toast,
});
class Reason {
int? id;
String? name;
String? toast;
DislikeReason.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
toast = json['toast'];
}
}
class FeedbackReason {
FeedbackReason({
this.id,
this.name,
this.toast,
});
int? id;
String? name;
String? toast;
FeedbackReason.fromJson(Map<String, dynamic> json) {
Reason.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
toast = json['toast'];

View File

@@ -2,7 +2,6 @@ enum LiveQuality {
dolby,
super4K,
origin,
veryHigh,
bluRay,
superHD,
smooth,
@@ -37,6 +36,7 @@ extension VideoQualityDesc on LiveQuality {
'原画',
'蓝光',
'超清',
'高清',
'流畅',
];
get description => _descList[index];

View File

@@ -45,9 +45,12 @@ class Playurl {
Playurl.fromJson(Map<String, dynamic> json) {
cid = json['cid'];
gQnDesc =
json['g_qn_desc'].map<GQnDesc>((e) => GQnDesc.fromJson(e)).toList();
stream = json['stream'].map<Streams>((e) => Streams.fromJson(e)).toList();
gQnDesc = (json['g_qn_desc'] as List?)
?.map<GQnDesc>((e) => GQnDesc.fromJson(e))
.toList();
stream = (json['stream'] as List?)
?.map<Streams>((e) => Streams.fromJson(e))
.toList();
}
}
@@ -83,8 +86,9 @@ class Streams {
Streams.fromJson(Map<String, dynamic> json) {
protocolName = json['protocol_name'];
format =
json['format'].map<FormatItem>((e) => FormatItem.fromJson(e)).toList();
format = (json['format'] as List?)
?.map<FormatItem>((e) => FormatItem.fromJson(e))
.toList();
}
}
@@ -99,7 +103,9 @@ class FormatItem {
FormatItem.fromJson(Map<String, dynamic> json) {
formatName = json['format_name'];
codec = json['codec'].map<CodecItem>((e) => CodecItem.fromJson(e)).toList();
codec = (json['codec'] as List?)
?.map<CodecItem>((e) => CodecItem.fromJson(e))
.toList();
}
}
@@ -129,8 +135,8 @@ class CodecItem {
currentQn = json['current_qn'];
acceptQn = json['accept_qn'];
baseUrl = json['base_url'];
urlInfo = json['url_info']
.map<UrlInfoItem>((e) => UrlInfoItem.fromJson(e))
urlInfo = (json['url_info'] as List?)
?.map<UrlInfoItem>((e) => UrlInfoItem.fromJson(e))
.toList();
hdrQn = json['hdr_n'];
dolbyType = json['dolby_type'];

View File

@@ -1,3 +1,7 @@
import 'package:PiliPlus/utils/utils.dart';
import '../model_video.dart';
class MemberArchiveDataModel {
MemberArchiveDataModel({
this.list,
@@ -27,8 +31,8 @@ class ArchiveListModel {
? Map.from(json['tlist']).map((k, v) =>
MapEntry<String, TListItemModel>(k, TListItemModel.fromJson(v)))
: {};
vlist = json['vlist']
.map<VListItemModel>((e) => VListItemModel.fromJson(e))
vlist = (json['vlist'] as List?)
?.map<VListItemModel>((e) => VListItemModel.fromJson(e))
.toList();
}
}
@@ -51,114 +55,60 @@ class TListItemModel {
}
}
class VListItemModel {
VListItemModel({
this.comment,
this.typeid,
this.play,
this.pic,
this.subtitle,
this.description,
this.copyright,
this.title,
this.review,
this.author,
this.mid,
this.created,
this.pubdate,
this.length,
this.duration,
this.videoReview,
this.aid,
this.bvid,
this.cid,
this.hideClick,
this.isChargingSrc,
this.rcmdReason,
this.owner,
});
class VListItemModel extends BaseVideoItemModel {
int? comment;
int? typeid;
int? play;
String? pic;
String? subtitle;
String? description;
String? copyright;
String? title;
int? review;
String? author;
int? mid;
int? created;
int? pubdate;
String? length;
String? duration;
int? videoReview;
int? aid;
String? bvid;
int? cid;
bool? hideClick;
bool? isChargingSrc;
Stat? stat;
String? rcmdReason;
Owner? owner;
VListItemModel.fromJson(Map<String, dynamic> json) {
comment = json['comment'];
typeid = json['typeid'];
play = json['play'];
pic = json['pic'];
subtitle = json['subtitle'];
description = json['description'];
desc = json['description'];
copyright = json['copyright'];
title = json['title'];
review = json['review'];
author = json['author'];
mid = json['mid'];
created = json['created'];
pubdate = json['created'];
length = json['length'];
duration = json['length'];
videoReview = json['video_review'];
if (json['length'] != null) duration = Utils.duration(json['length']);
aid = json['aid'];
bvid = json['bvid'];
cid = null;
hideClick = json['hide_click'];
isChargingSrc = json['is_charging_arc'];
stat = Stat.fromJson(json);
rcmdReason = null;
owner = Owner.fromJson(json);
stat = VListStat.fromJson(json);
owner = VListOwner.fromJson(json);
}
// @override
// int? cid = null;
// @override
// String? rcmdReason = null;
// @override
// String? goto;
// @override
// bool isFollowed;
// @override
// String? uri;
}
class VListOwner extends BaseOwner {
VListOwner.fromJson(Map<String, dynamic> json) {
mid = json["mid"];
name = json["author"];
}
}
class Stat {
Stat({
this.view,
this.danmu,
});
int? view;
int? danmu;
Stat.fromJson(Map<String, dynamic> json) {
class VListStat extends BaseStat {
VListStat.fromJson(Map<String, dynamic> json) {
view = json["play"];
danmu = json['video_review'];
}
}
class Owner {
Owner({
this.mid,
this.name,
this.face,
});
int? mid;
String? name;
String? face;
Owner.fromJson(Map<String, dynamic> json) {
mid = json["mid"];
name = json["author"];
face = '';
}
}

View File

@@ -1,89 +1,26 @@
class MemberCoinsDataModel {
MemberCoinsDataModel({
this.aid,
this.bvid,
this.cid,
this.coins,
this.copyright,
this.ctime,
this.desc,
this.duration,
this.owner,
this.pic,
this.pubLocation,
this.pubdate,
this.resourceType,
this.state,
this.subtitle,
this.time,
this.title,
this.tname,
this.videos,
this.view,
this.danmaku,
});
import '../model_hot_video_item.dart';
int? aid;
String? bvid;
int? cid;
int? coins;
int? copyright;
int? ctime;
String? desc;
int? duration;
Owner? owner;
String? pic;
String? pubLocation;
int? pubdate;
String? resourceType;
int? state;
class MemberCoinsDataModel extends HotVideoItemModel {
String? subtitle;
int? coins;
int? time;
String? title;
String? tname;
int? videos;
int? view;
int? danmaku;
// int? get view => stat.view;
// int? get danmaku => stat.danmu;
MemberCoinsDataModel.fromJson(Map<String, dynamic> json) {
aid = json['aid'];
bvid = json['bvid'];
cid = json['cid'];
MemberCoinsDataModel.fromJson(Map<String, dynamic> json)
: super.fromJson(json) {
coins = json['coins'];
copyright = json['copyright'];
ctime = json['ctime'];
desc = json['desc'];
duration = json['duration'];
owner = Owner.fromJson(json['owner']);
pic = json['pic'];
pubLocation = json['pub_location'];
pubdate = json['pubdate'];
resourceType = json['resource_type'];
state = json['state'];
subtitle = json['subtitle'];
time = json['time'];
title = json['title'];
tname = json['tname'];
videos = json['videos'];
view = json['stat']['view'];
danmaku = json['stat']['danmaku'];
}
}
class Owner {
Owner({
this.mid,
this.name,
this.face,
});
int? mid;
String? name;
String? face;
Owner.fromJson(Map<String, dynamic> json) {
mid = json['mid'];
name = json['name'];
face = json['face'];
// view = json['stat']['view'];
// danmaku = json['stat']['danmaku'];
}
// @override
// String? goto;
// @override
// bool isFollowed;
// @override
// String? rcmdReason;
// @override
// String? uri;
}

View File

@@ -9,11 +9,9 @@ class MemberSeasonsDataModel {
MemberSeasonsDataModel.fromJson(Map<String, dynamic> json) {
page = json['page'];
seasonsList = json['seasons_list'] != null
? json['seasons_list']
.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
.toList()
: [];
seasonsList = (json['seasons_list'] as List?)
?.map<MemberSeasonsList>((e) => MemberSeasonsList.fromJson(e))
.toList();
}
}
@@ -31,11 +29,9 @@ class MemberSeasonsList {
Map? page;
MemberSeasonsList.fromJson(Map<String, dynamic> json) {
archives = json['archives'] != null
? json['archives']
.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
.toList()
: [];
archives = (json['archives'] as List?)
?.map<MemberArchiveItem>((e) => MemberArchiveItem.fromJson(e))
.toList();
meta = MamberMeta.fromJson(json['meta']);
page = json['page'];
}

View File

@@ -1,66 +1,23 @@
import './model_owner.dart';
import 'model_owner.dart';
import 'model_rec_video_item.dart';
import 'model_video.dart';
class HotVideoItemModel {
HotVideoItemModel({
this.aid,
this.cid,
this.bvid,
this.videos,
this.tid,
this.tname,
this.copyright,
this.pic,
this.title,
this.pubdate,
this.ctime,
this.desc,
this.state,
this.duration,
this.middionId,
this.owner,
this.stat,
this.vDynamic,
this.dimension,
this.shortLinkV2,
this.firstFrame,
this.pubLocation,
this.seasontype,
this.isOgv,
this.rcmdReason,
this.checked,
this.pgcLabel,
this.redirectUrl,
});
int? aid;
int? cid;
String? bvid;
// 稍后再看, 排行榜等网页返回也使用该类
class HotVideoItemModel extends BaseRecVideoItemModel {
int? videos;
int? tid;
String? tname;
int? copyright;
String? pic;
String? title;
int? pubdate;
int? ctime;
String? desc;
int? state;
int? duration;
int? middionId;
Owner? owner;
Stat? stat;
String? vDynamic;
Dimension? dimension;
String? shortLinkV2;
String? firstFrame;
String? pubLocation;
int? seasontype;
bool? isOgv;
RcmdReason? rcmdReason;
bool? checked;
String? pgcLabel;
String? redirectUrl;
bool? checked; // 手动设置的
HotVideoItemModel.fromJson(Map<String, dynamic> json) {
aid = json["aid"];
cid = json["cid"];
@@ -76,97 +33,62 @@ class HotVideoItemModel {
desc = json["desc"];
state = json["state"];
duration = json["duration"];
middionId = json["middion_id"];
owner = Owner.fromJson(json["owner"]);
stat = Stat.fromJson(json['stat']);
vDynamic = json["vDynamic"];
dimension = Dimension.fromMap(json['dimension']);
shortLinkV2 = json["short_link_v2"];
stat = HotStat.fromJson(json['stat']);
dimension = Dimension.fromJson(json['dimension']);
firstFrame = json["first_frame"];
pubLocation = json["pub_location"];
seasontype = json["seasontype"];
isOgv = json["isOgv"];
rcmdReason = json['rcmd_reason'] != '' && json['rcmd_reason'] != null
? RcmdReason.fromJson(json['rcmd_reason'])
: null;
dynamic rcmd = json['rcmd_reason'];
rcmdReason = rcmd is Map ? rcmd['content'] : rcmd; // 相关视频里rcmd为String,
if (rcmdReason?.isEmpty == true) rcmdReason = null;
pgcLabel = json['pgc_label'];
redirectUrl = json['redirect_url'];
// uri = json['uri']; // 仅在稍后再看存在
}
// @override
// get isFollowed => false;
// @override
// get goto => 'av';
// @override
// get uri => 'bilibili://video/$aid';
}
class Stat {
Stat({
this.aid,
this.view,
this.danmu,
this.reply,
this.favorite,
this.coin,
this.share,
this.nowRank,
this.hisRank,
this.like,
this.dislike,
this.vt,
this.vv,
});
int? aid;
int? view;
int? danmu;
class HotStat extends Stat {
int? reply;
int? favorite;
int? coin;
int? share;
int? nowRank;
int? hisRank;
int? like;
int? dislike;
int? vt;
int? vv;
Stat.fromJson(Map<String, dynamic> json) {
aid = json["aid"];
view = json["view"];
danmu = json['danmaku'];
HotStat.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
reply = json["reply"];
favorite = json["favorite"];
coin = json['coin'];
share = json["share"];
nowRank = json["now_rank"];
hisRank = json['his_rank'];
like = json["like"];
dislike = json["dislike"];
vt = json['vt'];
vv = json["vv"];
}
}
class Dimension {
Dimension({this.width, this.height, this.rotate});
// class RcmdReason {
// RcmdReason({
// this.rcornerMark,
// this.content,
// });
int? width;
int? height;
int? rotate;
// int? rcornerMark;
// String? content = '';
Dimension.fromMap(Map<String, dynamic> json) {
width = json["width"];
height = json["height"];
rotate = json["rotate"];
}
}
class RcmdReason {
RcmdReason({
this.rcornerMark,
this.content,
});
int? rcornerMark;
String? content = '';
RcmdReason.fromJson(Map<String, dynamic> json) {
rcornerMark = json["corner_mark"];
content = json["content"] ?? '';
}
}
// RcmdReason.fromJson(Map<String, dynamic> json) {
// rcornerMark = json["corner_mark"];
// content = json["content"] ?? '';
// }
// }

View File

@@ -1,17 +1,21 @@
import 'package:hive/hive.dart';
import 'model_video.dart';
part 'model_owner.g.dart';
@HiveType(typeId: 3)
class Owner {
class Owner implements BaseOwner {
Owner({
this.mid,
this.name,
this.face,
});
@HiveField(0)
@override
int? mid;
@HiveField(1)
@override
String? name;
@HiveField(2)
String? face;

View File

@@ -1,55 +1,19 @@
import './model_owner.dart';
import 'package:hive/hive.dart';
import 'model_video.dart';
part 'model_rec_video_item.g.dart';
@HiveType(typeId: 0)
class RecVideoItemModel {
RecVideoItemModel({
this.id,
this.bvid,
this.cid,
this.goto,
this.uri,
this.pic,
this.title,
this.duration,
this.pubdate,
this.owner,
this.stat,
this.isFollowed,
this.rcmdReason,
});
@HiveField(0)
int? id = -1;
@HiveField(1)
String? bvid = '';
@HiveField(2)
int? cid = -1;
@HiveField(3)
String? goto = '';
@HiveField(4)
String? uri = '';
@HiveField(5)
String? pic = '';
@HiveField(6)
String? title = '';
@HiveField(7)
int? duration = -1;
@HiveField(8)
int? pubdate = -1;
@HiveField(9)
Owner? owner;
@HiveField(10)
Stat? stat;
@HiveField(11)
int? isFollowed;
@HiveField(12)
abstract class BaseRecVideoItemModel extends BaseVideoItemModel {
String? goto;
String? uri;
String? rcmdReason;
// app推荐专属
int? param;
String? bangumiBadge;
}
class RecVideoItemModel extends BaseRecVideoItemModel {
RecVideoItemModel.fromJson(Map<String, dynamic> json) {
id = json["id"];
aid = json["id"];
bvid = json["bvid"];
cid = json["cid"];
goto = json["goto"];
@@ -60,34 +24,15 @@ class RecVideoItemModel {
pubdate = json["pubdate"];
owner = Owner.fromJson(json["owner"]);
stat = Stat.fromJson(json["stat"]);
isFollowed = json["is_followed"] ?? 0;
isFollowed = json["is_followed"] == 1;
// rcmdReason = json["rcmd_reason"] != null
// ? RcmdReason.fromJson(json["rcmd_reason"])
// : RcmdReason(content: '');
rcmdReason = json["rcmd_reason"]?['content'];
}
}
@HiveType(typeId: 1)
class Stat {
Stat({
this.view,
this.like,
this.danmu,
});
@HiveField(0)
int? view;
@HiveField(1)
int? like;
@HiveField(2)
int? danmu;
Stat.fromJson(Map<String, dynamic> json) {
// 无需在model中转换以保留原始数据在view层处理即可
view = json["view"];
like = json["like"];
danmu = json['danmaku'];
}
// @override
// String? get desc => null;
}
// @HiveType(typeId: 2)
@@ -96,10 +41,8 @@ class Stat {
// this.reasonType,
// this.content,
// });
// @HiveField(0)
// int? reasonType;
// @HiveField(1)
// String? content = '';
// // int? reasonType;
// // String? content;
//
// RcmdReason.fromJson(Map<String, dynamic> json) {
// reasonType = json["reason_type"];

View File

@@ -1,154 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'model_rec_video_item.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class RecVideoItemModelAdapter extends TypeAdapter<RecVideoItemModel> {
@override
final int typeId = 0;
@override
RecVideoItemModel read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return RecVideoItemModel(
id: fields[0] as int?,
bvid: fields[1] as String?,
cid: fields[2] as int?,
goto: fields[3] as String?,
uri: fields[4] as String?,
pic: fields[5] as String?,
title: fields[6] as String?,
duration: fields[7] as int?,
pubdate: fields[8] as int?,
owner: fields[9] as Owner?,
stat: fields[10] as Stat?,
isFollowed: fields[11] as int?,
rcmdReason: fields[12] as String?,
);
}
@override
void write(BinaryWriter writer, RecVideoItemModel obj) {
writer
..writeByte(13)
..writeByte(0)
..write(obj.id)
..writeByte(1)
..write(obj.bvid)
..writeByte(2)
..write(obj.cid)
..writeByte(3)
..write(obj.goto)
..writeByte(4)
..write(obj.uri)
..writeByte(5)
..write(obj.pic)
..writeByte(6)
..write(obj.title)
..writeByte(7)
..write(obj.duration)
..writeByte(8)
..write(obj.pubdate)
..writeByte(9)
..write(obj.owner)
..writeByte(10)
..write(obj.stat)
..writeByte(11)
..write(obj.isFollowed)
..writeByte(12)
..write(obj.rcmdReason);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RecVideoItemModelAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
class StatAdapter extends TypeAdapter<Stat> {
@override
final int typeId = 1;
@override
Stat read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return Stat(
view: fields[0] as int?,
like: fields[1] as int?,
danmu: fields[2] as int?,
);
}
@override
void write(BinaryWriter writer, Stat obj) {
writer
..writeByte(3)
..writeByte(0)
..write(obj.view)
..writeByte(1)
..write(obj.like)
..writeByte(2)
..write(obj.danmu);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is StatAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
//
// class RcmdReasonAdapter extends TypeAdapter<RcmdReason> {
// @override
// final int typeId = 2;
//
// @override
// RcmdReason read(BinaryReader reader) {
// final numOfFields = reader.readByte();
// final fields = <int, dynamic>{
// for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
// };
// return RcmdReason(
// reasonType: fields[0] as int?,
// content: fields[1] as String?,
// );
// }
//
// @override
// void write(BinaryWriter writer, RcmdReason obj) {
// writer
// ..writeByte(2)
// ..writeByte(0)
// ..write(obj.reasonType)
// ..writeByte(1)
// ..write(obj.content);
// }
//
// @override
// int get hashCode => typeId.hashCode;
//
// @override
// bool operator ==(Object other) =>
// identical(this, other) ||
// other is RcmdReasonAdapter &&
// runtimeType == other.runtimeType &&
// typeId == other.typeId;
// }

View File

@@ -0,0 +1,59 @@
import 'package:PiliPlus/utils/utils.dart';
abstract class BaseSimpleVideoItemModel {
late String title;
String? bvid;
int? cid;
String? pic;
int duration = -1;
late BaseOwner owner;
late BaseStat stat;
}
abstract class BaseVideoItemModel extends BaseSimpleVideoItemModel {
int? aid;
String? desc;
int? pubdate;
bool isFollowed = false;
}
abstract class BaseOwner {
int? mid;
String? name;
}
abstract class BaseStat {
int? view;
int? like;
int? danmu;
String get viewStr => Utils.numFormat(view);
String get danmuStr => Utils.numFormat(danmu);
}
class Stat extends BaseStat {
Stat.fromJson(Map<String, dynamic> json) {
view = json["view"];
like = json["like"];
danmu = json['danmaku'];
}
}
class PlayStat extends BaseStat {
PlayStat.fromJson(Map<String, dynamic> json) {
view = json['play'];
danmu = json['danmaku'];
}
}
class Dimension {
int? width;
int? height;
int? rotate;
Dimension.fromJson(Map<String, dynamic> json) {
width = json["width"];
height = json["height"];
rotate = json["rotate"];
}
}

View File

@@ -5,8 +5,7 @@ class MsgFeedLikeMe {
MsgFeedLikeMe({latest, total});
MsgFeedLikeMe.fromJson(Map<String, dynamic> json) {
latest =
json['latest'] != null ? Latest.fromJson(json['latest']) : null;
latest = json['latest'] != null ? Latest.fromJson(json['latest']) : null;
total = json['total'] != null ? Total.fromJson(json['total']) : null;
}
@@ -50,13 +49,7 @@ class LikeMeItems {
int? likeTime;
int? noticeState;
LikeMeItems(
{id,
users,
item,
counts,
likeTime,
noticeState});
LikeMeItems({id, users, item, counts, likeTime, noticeState});
LikeMeItems.fromJson(Map<String, dynamic> json) {
id = json['id'];
@@ -92,13 +85,7 @@ class Users {
String? midLink;
bool? follow;
Users(
{mid,
fans,
nickname,
avatar,
midLink,
follow});
Users({mid, fans, nickname, avatar, midLink, follow});
Users.fromJson(Map<String, dynamic> json) {
mid = json['mid'];
@@ -139,19 +126,19 @@ class Item {
Item(
{itemId,
pid,
type,
business,
businessId,
replyBusinessId,
likeBusinessId,
title,
desc,
image,
uri,
detailName,
nativeUri,
ctime});
pid,
type,
business,
businessId,
replyBusinessId,
likeBusinessId,
title,
desc,
image,
uri,
detailName,
nativeUri,
ctime});
Item.fromJson(Map<String, dynamic> json) {
itemId = json['item_id'];
@@ -197,8 +184,7 @@ class Total {
Total({cursor, items});
Total.fromJson(Map<String, dynamic> json) {
cursor =
json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
cursor = json['cursor'] != null ? Cursor.fromJson(json['cursor']) : null;
if (json['items'] != null) {
items = <LikeMeItems>[];
json['items'].forEach((v) {
@@ -235,4 +221,4 @@ class Cursor {
data['time'] = time;
return data;
}
}
}

View File

@@ -1,27 +1,3 @@
class MsgFeedSysMsg {
List<SystemNotifyList>? systemNotifyList;
MsgFeedSysMsg({this.systemNotifyList});
MsgFeedSysMsg.fromJson(Map<String, dynamic> json) {
if (json['system_notify_list'] != null) {
systemNotifyList = <SystemNotifyList>[];
json['system_notify_list'].forEach((v) {
systemNotifyList!.add(SystemNotifyList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (systemNotifyList != null) {
data['system_notify_list'] =
systemNotifyList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class SystemNotifyList {
int? id;
int? cursor;

View File

@@ -12,7 +12,7 @@ class SessionDataModel {
int? hasMore;
SessionDataModel.fromJson(Map<String, dynamic> json) {
sessionList = json['session_list']
sessionList = (json['session_list'] as List?)
?.map<SessionList>((e) => SessionList.fromJson(e))
.toList();
hasMore = json['has_more'];
@@ -175,8 +175,8 @@ class SessionMsgDataModel {
List<dynamic>? eInfos;
SessionMsgDataModel.fromJson(Map<String, dynamic> json) {
messages = json['messages']
.map<MessageItem>((e) => MessageItem.fromJson(e))
messages = (json['messages'] as List?)
?.map<MessageItem>((e) => MessageItem.fromJson(e))
.toList();
hasMore = json['has_more'];
minSeqno = json['min_seqno'];

View File

@@ -12,8 +12,8 @@ class HotSearchModel {
List<HotSearchItem>? list;
HotSearchModel.fromJson(Map<String, dynamic> json) {
list = json['list']
.map<HotSearchItem>((e) => HotSearchItem.fromJson(e))
list = (json['list'] as List?)
?.map<HotSearchItem>((e) => HotSearchItem.fromJson(e))
.toList();
}
}

View File

@@ -1,86 +1,41 @@
import 'package:PiliPlus/utils/em.dart';
import 'package:PiliPlus/utils/utils.dart';
class SearchVideoModel {
SearchVideoModel({
this.numResults,
this.list,
});
import '../model_owner.dart';
import '../model_video.dart';
class SearchVideoModel {
int? numResults;
List<SearchVideoItemModel>? list;
SearchVideoModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result']
list = (json['result'] as List?)
?.where((e) => e['available'] == true)
?.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.map<SearchVideoItemModel>((e) => SearchVideoItemModel.fromJson(e))
.toList();
}
}
class SearchVideoItemModel {
SearchVideoItemModel({
this.type,
this.id,
this.cid,
// this.author,
this.mid,
// this.typeid,
// this.typename,
this.arcurl,
this.aid,
this.bvid,
this.title,
this.description,
this.pic,
// this.play,
this.videoReview,
// this.favorites,
this.tag,
// this.review,
this.pubdate,
this.senddate,
this.duration,
// this.viewType,
// this.like,
// this.upic,
// this.danmaku,
this.owner,
this.stat,
this.rcmdReason,
});
class SearchVideoItemModel extends BaseVideoItemModel {
String? type;
int? id;
int? cid;
// String? author;
int? mid;
// String? typeid;
// String? typename;
String? arcurl;
int? aid;
String? bvid;
List? title;
// List? titleList;
String? description;
String? pic;
// String? play;
int? videoReview;
// int? videoReview;
// String? favorites;
String? tag;
// String? review;
int? pubdate;
int? senddate;
int? duration;
int? ctime;
// String? duration;
// String? viewType;
// String? like;
// String? upic;
// String? danmaku;
Owner? owner;
Stat? stat;
String? rcmdReason;
List<Map<String, String>>? titleList;
SearchVideoItemModel.fromJson(Map<String, dynamic> json) {
type = json['type'];
@@ -88,43 +43,35 @@ class SearchVideoItemModel {
arcurl = json['arcurl'];
aid = json['aid'];
bvid = json['bvid'];
mid = json['mid'];
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
title = Em.regTitle(json['title']);
description = json['description'];
titleList = Em.regTitle(json['title']);
title = titleList!.map((i) => i['text']!).join();
desc = json['description'];
pic = json['pic'] != null && json['pic'].startsWith('//')
? 'https:${json['pic']}'
: json['pic'] ?? '';
videoReview = json['video_review'];
pubdate = json['pubdate'];
senddate = json['senddate'];
ctime = json['senddate'];
duration = Utils.duration(json['duration']);
owner = Owner.fromJson(json);
stat = Stat.fromJson(json);
owner = SearchOwner.fromJson(json);
stat = SearchStat.fromJson(json);
}
// @override
// String? goto;
// @override
// bool isFollowed;
// @override
// String? uri;
}
class Stat {
Stat({
this.view,
this.danmu,
this.favorite,
this.reply,
this.like,
});
// 播放量
int? view;
// 弹幕数
int? danmu;
class SearchStat extends BaseStat {
// 收藏数
int? favorite;
// 评论数
int? reply;
// 喜欢
int? like;
Stat.fromJson(Map<String, dynamic> json) {
SearchStat.fromJson(Map<String, dynamic> json) {
view = json['play'];
danmu = json['danmaku'];
favorite = json['favorite'];
@@ -133,17 +80,8 @@ class Stat {
}
}
class Owner {
Owner({
this.mid,
this.name,
this.face,
});
int? mid;
String? name;
String? face;
Owner.fromJson(Map<String, dynamic> json) {
class SearchOwner extends Owner {
SearchOwner.fromJson(Map<String, dynamic> json) {
mid = json["mid"];
name = json["author"];
face = json['upic'];
@@ -161,7 +99,7 @@ class SearchUserModel {
SearchUserModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result']
list = (json['result'] as List?)
?.map<SearchUserItemModel>((e) => SearchUserItemModel.fromJson(e))
.toList();
}
@@ -301,7 +239,7 @@ class SearchLiveItemModel {
rankScore = json['rank_score'];
roomid = json['roomid'];
attentions = json['attentions'];
cateName = Em.regCate(json['cate_name']) ?? '';
cateName = Em.regCate(json['cate_name']);
}
}
@@ -316,12 +254,10 @@ class SearchMBangumiModel {
SearchMBangumiModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result'] != null
? json['result']
.map<SearchMBangumiItemModel>(
(e) => SearchMBangumiItemModel.fromJson(e))
.toList()
: [];
list = (json['result'] as List?)
?.map<SearchMBangumiItemModel>(
(e) => SearchMBangumiItemModel.fromJson(e))
.toList();
}
}
@@ -420,12 +356,9 @@ class SearchArticleModel {
SearchArticleModel.fromJson(Map<String, dynamic> json) {
numResults = (json['numResults'] as num?)?.toInt();
list = json['result'] != null
? json['result']
.map<SearchArticleItemModel>(
(e) => SearchArticleItemModel.fromJson(e))
.toList()
: [];
list = (json['result'] as List?)
?.map<SearchArticleItemModel>((e) => SearchArticleItemModel.fromJson(e))
.toList();
}
}

View File

@@ -11,8 +11,8 @@ class SearchSuggestModel {
String? term;
SearchSuggestModel.fromJson(Map<String, dynamic> json) {
tag = json['tag']
.map<SearchSuggestItem>(
tag = (json['tag'] as List?)
?.map<SearchSuggestItem>(
(e) => SearchSuggestItem.fromJson(e, json['term']))
.toList();
}

View File

@@ -1,105 +1,90 @@
import 'package:json_annotation/json_annotation.dart';
import '../model_owner.dart';
import '../model_video.dart';
import 'badge.dart';
import 'cursor_attr.dart';
import 'three_point.dart';
part 'item.g.dart';
@JsonSerializable()
class Item {
String? title;
class Item extends BaseSimpleVideoItemModel {
String? subtitle;
String? tname;
String? cover;
@JsonKey(name: 'cover_icon')
String? get cover => pic; // 不知道哪里使用了cover
String? coverIcon;
String? uri;
String? param;
String? goto;
String? length;
int? duration;
@JsonKey(name: 'is_popular')
bool? isPopular;
@JsonKey(name: 'is_steins')
bool? isSteins;
@JsonKey(name: 'is_ugcpay')
bool? isUgcpay;
@JsonKey(name: 'is_cooperation')
bool? isCooperation;
@JsonKey(name: 'is_pgc')
bool? isPgc;
@JsonKey(name: 'is_live_playback')
bool? isLivePlayback;
@JsonKey(name: 'is_pugv')
bool? isPugv;
@JsonKey(name: 'is_fold')
bool? isFold;
@JsonKey(name: 'is_oneself')
bool? isOneself;
int? play;
int? danmaku;
int? ctime;
@JsonKey(name: 'ugc_pay')
int? ugcPay;
String? author;
bool? state;
String? bvid;
int? videos;
@JsonKey(name: 'three_point')
List<ThreePoint>? threePoint;
@JsonKey(name: 'first_cid')
int? firstCid;
@JsonKey(name: 'cursor_attr')
CursorAttr? cursorAttr;
@JsonKey(name: 'view_content')
String? viewContent;
@JsonKey(name: 'icon_type')
int? iconType;
@JsonKey(name: 'publish_time_text')
String? publishTimeText;
List<Badge>? badges;
Map? season;
Map? history;
Item({
this.title,
this.subtitle,
this.tname,
this.cover,
this.coverIcon,
this.uri,
this.param,
this.goto,
this.length,
this.duration,
this.isPopular,
this.isSteins,
this.isUgcpay,
this.isCooperation,
this.isPgc,
this.isLivePlayback,
this.isPugv,
this.isFold,
this.isOneself,
this.play,
this.danmaku,
this.ctime,
this.ugcPay,
this.author,
this.state,
this.bvid,
this.videos,
this.threePoint,
this.firstCid,
this.cursorAttr,
this.viewContent,
this.iconType,
this.publishTimeText,
this.badges,
this.season,
});
factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
Map<String, dynamic> toJson() => _$ItemToJson(this);
Item.fromJson(Map<String, dynamic> json) {
title = json['title'];
subtitle = json['subtitle'];
tname = json['tname'];
pic = json['cover'];
coverIcon = json['cover_icon'];
uri = json['uri'];
param = json['param'];
goto = json['goto'];
length = json['length'];
duration = json['duration'] ?? -1;
isPopular = json['is_popular'];
isSteins = json['is_steins'];
isUgcpay = json['is_ugcpay'];
isCooperation = json['is_cooperation'];
isPgc = json['is_pgc'];
isLivePlayback = json['is_live_playback'];
isPugv = json['is_pugv'];
isFold = json['is_fold'];
isOneself = json['is_oneself'];
ctime = json['ctime'];
ugcPay = json['ugc_pay'];
state = json['state'];
bvid = json['bvid'];
videos = json['videos'];
threePoint = (json['three_point'] as List<dynamic>?)
?.map((e) => ThreePoint.fromJson(e as Map<String, dynamic>))
.toList();
cid = json['first_cid'];
cursorAttr = json['cursor_attr'] == null
? null
: CursorAttr.fromJson(json['cursor_attr'] as Map<String, dynamic>);
iconType = json['icon_type'];
publishTimeText = json['publish_time_text'];
badges = (json['badges'] as List<dynamic>?)
?.map((e) => Badge.fromJson(e as Map<String, dynamic>))
.toList();
season = json['season'];
history = json['history'];
stat = PlayStat.fromJson(json);
owner = Owner(mid: 0, name: json['author']);
}
}
class UserStat extends PlayStat {
String? _viewStr;
@override
String get viewStr => _viewStr ?? super.viewStr;
UserStat.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
_viewStr = json['view_content'];
}
}

View File

@@ -1,89 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'item.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Item _$ItemFromJson(Map<String, dynamic> json) => Item(
title: json['title'] as String?,
subtitle: json['subtitle'] as String?,
tname: json['tname'] as String?,
cover: json['cover'] as String?,
coverIcon: json['cover_icon'] as String?,
uri: json['uri'] as String?,
param: json['param'] as String?,
goto: json['goto'] as String?,
length: json['length'] as String?,
duration: (json['duration'] as num?)?.toInt(),
isPopular: json['is_popular'] as bool?,
isSteins: json['is_steins'] as bool?,
isUgcpay: json['is_ugcpay'] as bool?,
isCooperation: json['is_cooperation'] as bool?,
isPgc: json['is_pgc'] as bool?,
isLivePlayback: json['is_live_playback'] as bool?,
isPugv: json['is_pugv'] as bool?,
isFold: json['is_fold'] as bool?,
isOneself: json['is_oneself'] as bool?,
play: (json['play'] as num?)?.toInt(),
danmaku: (json['danmaku'] as num?)?.toInt(),
ctime: (json['ctime'] as num?)?.toInt(),
ugcPay: (json['ugc_pay'] as num?)?.toInt(),
author: json['author'] as String?,
state: json['state'] as bool?,
bvid: json['bvid'] as String?,
videos: (json['videos'] as num?)?.toInt(),
threePoint: (json['three_point'] as List<dynamic>?)
?.map((e) => ThreePoint.fromJson(e as Map<String, dynamic>))
.toList(),
firstCid: (json['first_cid'] as num?)?.toInt(),
cursorAttr: json['cursor_attr'] == null
? null
: CursorAttr.fromJson(json['cursor_attr'] as Map<String, dynamic>),
viewContent: json['view_content'] as String?,
iconType: (json['icon_type'] as num?)?.toInt(),
publishTimeText: json['publish_time_text'] as String?,
badges: (json['badges'] as List<dynamic>?)
?.map((e) => Badge.fromJson(e as Map<String, dynamic>))
.toList(),
season: json['season'],
);
Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
'title': instance.title,
'subtitle': instance.subtitle,
'tname': instance.tname,
'cover': instance.cover,
'cover_icon': instance.coverIcon,
'uri': instance.uri,
'param': instance.param,
'goto': instance.goto,
'length': instance.length,
'duration': instance.duration,
'is_popular': instance.isPopular,
'is_steins': instance.isSteins,
'is_ugcpay': instance.isUgcpay,
'is_cooperation': instance.isCooperation,
'is_pgc': instance.isPgc,
'is_live_playback': instance.isLivePlayback,
'is_pugv': instance.isPugv,
'is_fold': instance.isFold,
'is_oneself': instance.isOneself,
'play': instance.play,
'danmaku': instance.danmaku,
'ctime': instance.ctime,
'ugc_pay': instance.ugcPay,
'author': instance.author,
'state': instance.state,
'bvid': instance.bvid,
'videos': instance.videos,
'three_point': instance.threePoint,
'first_cid': instance.firstCid,
'cursor_attr': instance.cursorAttr,
'view_content': instance.viewContent,
'icon_type': instance.iconType,
'publish_time_text': instance.publishTimeText,
'badges': instance.badges,
'season': instance.season,
};

View File

@@ -8,8 +8,8 @@ class BlackListDataModel {
int? total;
BlackListDataModel.fromJson(Map<String, dynamic> json) {
list = json['list']
.map<BlackListItem>((e) => BlackListItem.fromJson(e))
list = (json['list'] as List?)
?.map<BlackListItem>((e) => BlackListItem.fromJson(e))
.toList();
total = json['total'];
}

View File

@@ -1,5 +1,5 @@
class DanmakuBlockDataModel {
List<Rule>? rule;
List<SimpleRule>? rule;
String? toast;
int? valid;
int? ver;
@@ -7,88 +7,22 @@ class DanmakuBlockDataModel {
DanmakuBlockDataModel({this.rule, this.toast, this.valid, this.ver});
DanmakuBlockDataModel.fromJson(Map<String, dynamic> json) {
if (json['rule'] != null) {
rule = <Rule>[];
json['rule'].forEach((v) {
rule!.add(Rule.fromJson(v));
});
}
rule = (json['rule'] as List?)?.map((v) => SimpleRule.fromJson(v)).toList();
toast = json['toast'];
valid = json['valid'];
ver = json['ver'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (rule != null) {
data['rule'] = rule!.map((v) => v.toJson()).toList();
}
data['toast'] = toast;
data['valid'] = valid;
data['ver'] = ver;
return data;
}
}
class Rule {
int? id;
int? mid;
int? type;
String? filter;
String? comment;
int? ctime;
int? mtime;
Rule(
{this.id,
this.mid,
this.type,
this.filter,
this.comment,
this.ctime,
this.mtime});
Rule.fromJson(Map<String, dynamic> json) {
id = json['id'];
mid = json['mid'];
type = json['type'];
filter = json['filter'];
comment = json['comment'];
ctime = json['ctime'];
mtime = json['mtime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['mid'] = mid;
data['type'] = type;
data['filter'] = filter;
data['comment'] = comment;
data['ctime'] = ctime;
data['mtime'] = mtime;
return data;
}
}
class SimpleRule {
final int id;
final int type;
String filter;
late final int id;
late final int type;
late String filter;
SimpleRule(this.id, this.type, this.filter);
Map<String, dynamic> toMap() {
return {
'id': id,
'type': type,
'filter': filter,
};
}
factory SimpleRule.fromMap(Map<String, dynamic> map) {
return SimpleRule(
map['id'],
map['type'],
map['filter'],
);
SimpleRule.fromJson(Map<String, dynamic> json) {
id = json['id'];
type = json['type'];
filter = json['filter'];
}
}

View File

@@ -0,0 +1,44 @@
import 'package:PiliPlus/grpc/dm/v1/dm.pb.dart';
class RuleFilter {
static final _regExp = RegExp(r'^/(.*)/$');
List<String> dmFilterString = [];
List<RegExp> dmRegExp = [];
Set<String> dmUid = {};
int count = 0;
RuleFilter(this.dmFilterString, this.dmRegExp, this.dmUid, [int? count]) {
this.count =
count ?? dmFilterString.length + dmRegExp.length + dmUid.length;
}
RuleFilter.fromRuleTypeEntires(
Iterable<MapEntry<int, Map<int, String>>> rules) {
for (var rule in rules) {
switch (rule.key) {
case 0:
dmFilterString.addAll(rule.value.values);
break;
case 1:
dmRegExp.addAll(rule.value.values.map((i) => RegExp(
_regExp.matchAsPrefix(i)?.group(1) ?? i,
caseSensitive: false)));
break;
case 2:
dmUid.addAll(rule.value.values);
break;
}
}
count = dmFilterString.length + dmRegExp.length + dmUid.length;
}
RuleFilter.empty();
bool retain(DanmakuElem elem) {
return !(dmUid.contains(elem.midHash) ||
dmFilterString.any((i) => elem.content.contains(i)) ||
dmRegExp.any((i) => i.hasMatch(elem.content)));
}
}

View File

@@ -0,0 +1,36 @@
import 'package:PiliPlus/models/user/danmaku_rule.dart';
import 'package:hive/hive.dart';
class RuleFilterAdapter extends TypeAdapter<RuleFilter> {
@override
final int typeId = 12;
@override
RuleFilter read(BinaryReader reader) {
return RuleFilter(
reader.readStringList(),
reader
.readStringList()
.map((i) => RegExp(i, caseSensitive: false))
.toList(),
reader.readStringList().toSet());
}
@override
void write(BinaryWriter writer, RuleFilter obj) {
writer
..writeStringList(obj.dmFilterString)
..writeStringList(obj.dmRegExp.map((i) => i.pattern).toList())
..writeStringList(obj.dmUid.toList());
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is RuleFilterAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}

View File

@@ -1,83 +1,45 @@
import 'package:PiliPlus/models/model_owner.dart';
import 'package:PiliPlus/models/user/fav_folder.dart';
import '../model_owner.dart';
import '../model_video.dart';
import 'fav_folder.dart';
class FavDetailData {
FavDetailData({
this.info,
this.medias,
this.hasMore,
});
FavFolderItemData? info;
List<FavDetailItemData>? medias;
List<FavDetailItemData>? list;
List<FavDetailItemData>? get medias => list;
bool? hasMore;
FavDetailData.fromJson(Map<String, dynamic> json) {
info =
json['info'] == null ? null : FavFolderItemData.fromJson(json['info']);
medias = json['medias'] != null
? json['medias']
.map<FavDetailItemData>((e) => FavDetailItemData.fromJson(e))
.toList()
: [];
list = (json['medias'] as List?)
?.map<FavDetailItemData>((e) => FavDetailItemData.fromJson(e))
.toList();
hasMore = json['has_more'];
}
}
class FavDetailItemData {
FavDetailItemData({
this.id,
this.type,
this.title,
this.pic,
this.intro,
this.page,
this.duration,
this.owner,
this.attr,
this.cntInfo,
this.link,
this.ctime,
this.pubdate,
this.favTime,
this.bvId,
this.bvid,
// this.season,
this.ogv,
this.stat,
this.cid,
this.epId,
this.checked,
});
class FavDetailItemData extends BaseVideoItemModel {
int? id;
int? type;
String? title;
String? pic;
String? intro;
int? page;
int? duration;
Owner? owner;
// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/docs/fav/list.md
// | attr | num | 失效 | 0: 正常9: up自己删除1: 其他原因删除 |
int? attr;
Map? cntInfo;
String? link;
int? ctime;
int? pubdate;
int? favTime;
String? bvId;
String? bvid;
Map? ogv;
Stat? stat;
int? cid;
String? epId;
bool? checked;
FavDetailItemData.fromJson(Map<String, dynamic> json) {
id = json['id'];
aid = id;
type = json['type'];
title = json['title'];
pic = json['cover'];
intro = json['intro'];
desc = json['intro'];
page = json['page'];
duration = json['duration'];
owner = Owner.fromJson(json['upper']);
@@ -87,38 +49,18 @@ class FavDetailItemData {
ctime = json['ctime'];
pubdate = json['pubtime'];
favTime = json['fav_time'];
bvId = json['bv_id'];
bvid = json['bvid'];
ogv = json['ogv'];
stat = Stat.fromJson(json['cnt_info']);
cid = json['ugc'] != null ? json['ugc']['first_cid'] : null;
stat = PlayStat.fromJson(json['cnt_info']);
cid = json['ugc']?['first_cid'];
if (json['link'] != null && json['link'].contains('/bangumi')) {
epId = resolveEpId(json['link']);
}
}
String resolveEpId(url) {
RegExp regex = RegExp(r'\d+');
Iterable<Match> matches = regex.allMatches(url);
List<String> numbers = [];
for (Match match in matches) {
numbers.add(match.group(0)!);
}
return numbers[0];
}
}
class Stat {
Stat({
this.view,
this.danmu,
});
int? view;
int? danmu;
Stat.fromJson(Map<String, dynamic> json) {
view = json['play'];
danmu = json['danmaku'];
}
static final _digitRegExp = RegExp(r'\d+');
String resolveEpId(String url) => _digitRegExp.firstMatch(url)!.group(0)!;
// @override
// bool isFollowed;
}

View File

@@ -11,11 +11,10 @@ class FavFolderData {
FavFolderData.fromJson(Map<String, dynamic> json) {
count = json['count'];
list = json['list'] != null
? json['list']
.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
.toList()
: [FavFolderItemData()];
list = (json['list'] as List?)
?.map<FavFolderItemData>((e) => FavFolderItemData.fromJson(e))
.toList() ??
[FavFolderItemData()];
hasMore = json['has_more'];
}
}

Some files were not shown because too many files have changed in this diff Show More