Skip to content

Commit

Permalink
Merge branch 'preview-fixes' into master-cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Sep 7, 2023
2 parents e8ae8d7 + a963bca commit dea0a98
Show file tree
Hide file tree
Showing 19 changed files with 194 additions and 118 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# 更新日志

## v2.8.4-preview
`2023-09-07`

包含 [v2.7.6](https://github.com/the1812/Bilibili-Evolved/releases/tag/v2.7.6) 的所有更新内容.

- `直播间网页全屏自适应` 支持自定义侧边栏宽度. (#4216)
- 修复 `直播勋章快速更换` 获取头衔列表时报错. (#4403)

## v2.7.6
`2023-09-07`

更新了动态相关的 API 地址, 修复番剧无法加载的问题. (#4305)


## v2.8.3-preview
`2023-08-26`

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

[🐛 版本历史与更新日志](CHANGELOG.md)

[📌 更新计划](https://github.com/users/the1812/projects/1/views/3)

[📕 文档站点](https://bilibili-evolved-doc.vercel.app/)
> 文档站点由 [FoundTheWOUT](https://github.com/FoundTheWOUT) 开发, [点此进入 GitHub 仓库](https://github.com/FoundTheWOUT/bilibili-evolved-doc).
> 文档站点由 [Waua](https://github.com/FoundTheWOUT) 开发, [点此进入 GitHub 仓库](https://github.com/FoundTheWOUT/bilibili-evolved-doc).
[📖 参与开发](CONTRIBUTING.md)

Expand Down
3 changes: 3 additions & 0 deletions doc/donate.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ https://afdian.net/@the1812?tab=sponsor

| 时间 | 用户名 | 单号后4位 | 金额 |
| ------------------- | --------------------- | --------- | ------- |
| 2023.08.29 12:38:40 | 匿名 | 3584 | ¥2.33 |
| 2023.08.27 05:41:58 | 匿名 | 3000 | ¥20.00 |
| 2023.08.27 05:41:35 | 匿名 | 2195 | ¥20.00 |
| 2023.08.12 10:51:24 | *| 3198 | ¥5.00 |
| 2023.07.18 11:52:59 | *] | 4858 | ¥5.00 |
| 2023.07.15 13:42:33 | *| 0971 | ¥50.00 |
Expand Down
2 changes: 1 addition & 1 deletion doc/features/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
"type": "component",
"name": "playerIntersectionActions",
"displayName": "播放器位置动作",
"description": "by [@FoundTheWOUT](https://github.com/FoundTheWOUT)\n\n设置当播放器移出视图的位置变化时执行的动作.",
"description": "by [@Waua](https://github.com/FoundTheWOUT)\n\n设置当播放器移出视图的位置变化时执行的动作.",
"fullRelativePath": "../../registry/dist/components/video/player/intersection-actions.js",
"fullAbsolutePath": "registry/dist/components/video/player/intersection-actions.js"
},
Expand Down
2 changes: 1 addition & 1 deletion doc/features/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ by [@JLoeve](https://github.com/LonelySteve)

**GitHub:** [`Stable`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/registry/dist/components/video/player/intersection-actions.js) / [`Preview`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/registry/dist/components/video/player/intersection-actions.js)

by [@FoundTheWOUT](https://github.com/FoundTheWOUT)
by [@Waua](https://github.com/FoundTheWOUT)

设置当播放器移出视图的位置变化时执行的动作.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</template>
<script lang="ts">
import { TabControl, VIcon } from '@/ui'
import { feedsCardTypes } from '@/components/feeds/api'
import { FeedsCardType, feedsCardTypes } from '@/components/feeds/api'
import { getNotifyCount } from '@/components/feeds/notify'
import { popperMixin } from '../mixins'
import { tabs } from './tabs/tabs'
Expand Down Expand Up @@ -45,7 +45,11 @@ export default Vue.extend({
if (tab.name === 'live') {
return
}
const count = await getNotifyCount(feedsCardTypes[tab.name].id.toString())
const feedsCardType = feedsCardTypes[tab.name] as FeedsCardType
if (!feedsCardType.apiType) {
return
}
const count = await getNotifyCount(feedsCardType.apiType)
tab.count = count
console.log(tab)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ export default Vue.extend({
},
mixins: [
nextPageMixin(feedsCardTypes.bangumi, (card: any) => {
const cardJson = JSON.parse(card.card)
const pgc = lodash.get(card, 'modules.module_dynamic.major.pgc')
const author = lodash.get(card, 'modules.module_author')
return {
id: card.desc.dynamic_id_str,
title: cardJson.apiSeasonInfo.title,
coverUrl: cardJson.apiSeasonInfo.cover,
epCoverUrl: cardJson.cover,
epTitle: cardJson.new_desc,
url: cardJson.url,
id: card.id_str,
title: author.name,
coverUrl: author.face,
epCoverUrl: pgc.cover,
epTitle: pgc.title.replace(new RegExp(`^${author.name}:`), ''),
url: pgc.jump_url,
get new() {
return isNewID(this.id)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ export default Vue.extend({
},
mixins: [
nextPageMixin(feedsCardTypes.column, (card: any) => {
const cardJson = JSON.parse(card.card)
const article = lodash.get(card, 'modules.module_dynamic.major.article')
const author = lodash.get(card, 'modules.module_author')
return {
id: card.desc.dynamic_id_str,
cvID: cardJson.id,
title: cardJson.title,
upName: cardJson.author.name,
upFaceUrl: cardJson.author.face,
upID: cardJson.author.mid,
description: cardJson.summary,
covers: cardJson.image_urls,
originalCovers: cardJson.origin_image_urls,
id: card.id_str,
cvID: article.id.toString(),
title: article.title,
upName: author.name,
upFaceUrl: author.face,
upID: author.mid,
description: article.desc,
covers: article.covers,
originalCovers: article.covers,
get new() {
return isNewID(this.id)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</template>
<script lang="ts">
import { VideoCard } from '@/components/feeds/video-card'
import { formatDuration, formatCount } from '@/core/utils/formatters'
import { formatDuration, formatCount, parseDuration } from '@/core/utils/formatters'
import { isNewID } from '@/components/feeds/notify'
import { feedsCardTypes, groupVideoFeeds } from '@/components/feeds/api'
import VideoCardComponent from '@/components/feeds/VideoCard.vue'
Expand Down Expand Up @@ -80,24 +80,25 @@ export default Vue.extend({
},
mixins: [
nextPageMixin(feedsCardTypes.video, (card: any) => {
const cardJson = JSON.parse(card.card)
const archive = lodash.get(card, 'modules.module_dynamic.major.archive')
const author = lodash.get(card, 'modules.module_author')
return {
id: card.desc.dynamic_id_str,
aid: cardJson.aid,
bvid: card.desc.bvid,
videoUrl: `https://www.bilibili.com/${card.desc.bvid}`,
coverUrl: cardJson.pic,
title: cardJson.title,
duration: cardJson.duration,
durationText: formatDuration(cardJson.duration),
description: cardJson.desc,
pubTime: formatPubTime(cardJson.pubdate * 1000),
pubTimeText: formatPubTimeText(cardJson.pubdate * 1000),
upFaceUrl: card.desc.user_profile.info.face,
upName: card.desc.user_profile.info.uname,
upID: card.desc.user_profile.info.uid,
id: card.id_str,
aid: archive.aid,
bvid: archive.bvid,
videoUrl: `https://www.bilibili.com/${archive.bvid}`,
coverUrl: archive.cover,
title: archive.title,
duration: parseDuration(archive.duration_text),
durationText: formatDuration(parseDuration(archive.duration_text)),
description: archive.desc,
pubTime: formatPubTime(author.pub_ts * 1000),
pubTimeText: formatPubTimeText(author.pub_ts * 1000),
upFaceUrl: author.face,
upName: author.name,
upID: author.mid,
watchlater: true,
playCount: formatCount(cardJson.stat.view),
playCount: formatCount(archive.stat.play),
get new() {
return isNewID(this.id)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
applyContentFilter,
isPreOrderedVideo,
} from '@/components/feeds/api'
import { descendingStringSort } from '@/core/utils/sort'
import { descendingBigIntSort } from '@/core/utils/sort'
import { logError } from '@/core/utils/log'
import { setLatestID } from '@/components/feeds/notify'
import { VLoading, VEmpty, ScrollTrigger } from '@/ui'
Expand Down Expand Up @@ -33,7 +33,7 @@ export const nextPageMixin = <MappedItem extends { id: string }, RawItem>(
},
computed: {
sortedCards() {
return ([...this.cards] as MappedItem[]).sort(descendingStringSort(it => it.id))
return ([...this.cards] as MappedItem[]).sort(descendingBigIntSort(it => it.id))
},
},
async created() {
Expand All @@ -56,12 +56,12 @@ export const nextPageMixin = <MappedItem extends { id: string }, RawItem>(
this.hasMorePage = false
throw new Error(json.message)
}
const jsonCards = lodash.get(json, 'data.cards', []).map(jsonMapper) as MappedItem[]
const jsonCards = lodash.get(json, 'data.items', []).map(jsonMapper) as MappedItem[]

let concatCards = applyContentFilter(
cards
.concat(jsonCards)
.sort(descendingStringSort(it => it.id))
.sort(descendingBigIntSort(it => it.id))
.filter(card => !isPreOrderedVideo(card)),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum IntersectionMode {
export const component = defineComponentMetadata({
name: 'playerIntersectionActions',
author: {
name: 'FoundTheWOUT',
name: 'Waua',
link: 'https://github.com/FoundTheWOUT',
},
tags: [componentsTags.video],
Expand Down
2 changes: 1 addition & 1 deletion src/client/common.meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.7.5",
"version": "2.7.6",
"author": "Grant Howard, Coulomb-G",
"copyright": "[year], Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/components/feeds/VideoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
:title="topic.name"
class="topic"
target="_blank"
:href="'https://t.bilibili.com/topic/name/' + topic.name + '/feed'"
:href="topic.url || 'https://t.bilibili.com/topic/name/' + topic.name + '/feed'"
>
<VIcon icon="mdi-tag-outline" :size="14" />
<div class="topic-name">
Expand Down
107 changes: 60 additions & 47 deletions src/components/feeds/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getUID, pascalCase } from '@/core/utils'
import { getJsonWithCredentials } from '@/core/ajax'
import { formatCount, formatDuration } from '@/core/utils/formatters'
import { formatCount, formatDuration, parseDuration } from '@/core/utils/formatters'
import { watchlaterList } from '@/components/video/watchlater'
import { getData, registerData } from '@/plugins/data'
import { descendingStringSort } from '@/core/utils/sort'
Expand Down Expand Up @@ -66,15 +66,19 @@ export const withContentFilter =
* @param afterID 返回指定ID之前的动态历史, 省略则返回最新的动态
*/
export const getFeedsUrl = (type: FeedsCardType | string, afterID?: string | number) => {
const params = new URLSearchParams()
if (typeof type === 'string') {
return `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${getUID()}&type_list=${type}`
params.set('type', type)
} else if (type.apiType) {
params.set('type', type.apiType)
} else {
console.warn(`unknown apiType for ${type.name}`)
params.set('type', 'all')
}
const id = type.id.toString()
let api = `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=${getUID()}&type_list=${id}`
if (afterID) {
api = `https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_history?uid=${getUID()}&offset_dynamic_id=${afterID}&type=${id}`
params.set('offset', afterID.toString())
}
return api
return `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?${params.toString()}`
}
/**
* 获取动态
Expand All @@ -100,59 +104,68 @@ export const getVideoFeeds = withContentFilter(
if (json.code !== 0) {
throw new Error(json.message)
}
const dataCards = json.data.cards as any[]
const dataCardsWithoutPreOrder = dataCards.filter(it => !isPreOrderedVideo(JSON.parse(it.card)))
const dataCards = json.data.items as any[]
if (type === 'video') {
return groupVideoFeeds(
dataCards.map((c: any): VideoCard => {
const card = JSON.parse(c.card)
const topics = lodash.get(c, 'display.topic_info.topic_details', []).map((it: any) => ({
id: it.topic_id,
name: it.topic_name,
}))
dataCards.map((card: any): VideoCard => {
const archive = lodash.get(card, 'modules.module_dynamic.major.archive')
const author = lodash.get(card, 'modules.module_author')
const dynamic = lodash.get(card, 'modules.module_dynamic.desc.text', '')
const stat = lodash.get(card, 'modules.module_stat')
const topics = (
lodash.get(card, 'modules.module_dynamic.desc.rich_text_nodes', []) as any[]
)
.filter(node => node.type === 'RICH_TEXT_NODE_TYPE_TOPIC')
.map(node => {
return {
id: node.text,
name: node.text,
url: node.jump_url,
}
})
return {
id: c.desc.dynamic_id_str,
aid: card.aid,
bvid: c.desc.bvid || card.bvid,
title: card.title,
upID: c.desc.user_profile.info.uid,
upName: c.desc.user_profile.info.uname,
upFaceUrl: c.desc.user_profile.info.face,
coverUrl: card.pic,
description: card.desc,
timestamp: c.timestamp,
time: new Date(c.timestamp * 1000),
id: card.id_str,
aid: archive.aid,
bvid: archive.bvid,
title: archive.title,
upFaceUrl: author.face,
upName: author.name,
upID: author.mid,
coverUrl: archive.cover,
description: archive.desc,
timestamp: author.pub_ts * 1000,
time: new Date(author.pub_ts * 1000),
topics,
dynamic: card.dynamic,
like: formatCount(c.desc.like),
duration: card.duration,
durationText: formatDuration(card.duration, 0),
playCount: formatCount(card.stat.view),
danmakuCount: formatCount(card.stat.danmaku),
watchlater: watchlaterList.includes(card.aid),
dynamic,
like: formatCount(stat.like.count),
duration: parseDuration(archive.duration_text),
durationText: formatDuration(parseDuration(archive.duration_text)),
playCount: formatCount(archive.stat.play),
danmakuCount: formatCount(archive.stat.danmaku),
watchlater: watchlaterList.includes(archive.aid),
}
}),
)
}
if (type === 'bangumi') {
return dataCardsWithoutPreOrder.map((c: any): VideoCard => {
const card = JSON.parse(c.card)
return dataCards.map((card: any): VideoCard => {
const pgc = lodash.get(card, 'modules.module_dynamic.major.pgc')
const author = lodash.get(card, 'modules.module_author')
const stat = lodash.get(card, 'modules.module_stat')
return {
id: c.desc.dynamic_id_str,
aid: card.aid,
bvid: c.desc.bvid || card.bvid,
epID: card.episode_id,
title: card.new_desc,
upName: card.apiSeasonInfo.title,
upFaceUrl: card.apiSeasonInfo.cover,
coverUrl: card.cover,
id: card.id_str,
epID: pgc.epid,
title: pgc.title.replace(new RegExp(`^${author.name}:`), ''),
upName: author.name,
upFaceUrl: author.face,
coverUrl: pgc.cover,
description: '',
timestamp: c.timestamp,
time: new Date(c.timestamp * 1000),
like: formatCount(c.desc.like),
timestamp: author.pub_ts * 1000,
time: new Date(author.pub_ts * 1000),
like: formatCount(stat.like.count),
durationText: '',
playCount: formatCount(card.play_count),
danmakuCount: formatCount(card.bullet_count),
playCount: formatCount(pgc.stat.play),
danmakuCount: formatCount(pgc.stat.danmaku),
watchlater: false,
}
})
Expand Down
Loading

0 comments on commit dea0a98

Please sign in to comment.