Update feeds card types (#5135)

This commit is contained in:
the1812 2025-04-08 22:40:18 +08:00
parent a4a4c066c2
commit e556982770
3 changed files with 25 additions and 3 deletions

View File

@ -146,7 +146,7 @@ export default Vue.extend({
}
this.allTypes = Object.entries(feedsCardTypes)
.concat(Object.entries(specialTypes))
.filter(([, type]) => type.id <= 2048)
.filter(([, type]) => type.id <= 2048 && type.id > 0)
.map(([name, type]) => [name, lodash.clone(type)])
cardsManager = await forEachFeedsCard({
added: card => {

View File

@ -15,6 +15,12 @@ const feedsCardTypeMap = {
DynamicTypeArticle: feedsCardTypes.column,
DynamicTypeMusic: feedsCardTypes.audio,
DynamicTypeLiveRcmd: feedsCardTypes.liveRecord,
DynamicTypeCourses: feedsCardTypes.courses,
DynamicTypeOpus: feedsCardTypes.textWithImages,
DynamicTypeLive: feedsCardTypes.live,
DynamicTypeMedialist: feedsCardTypes.mediaList,
DynamicTypeSubscription: feedsCardTypes.mediaList,
DynamicTypeUgcSeason: feedsCardTypes.ugcSeason,
}
const combineText = (...texts: string[]) =>
@ -23,7 +29,7 @@ const combineText = (...texts: string[]) =>
.join('\n')
.trim()
const getType = (rawType: string): FeedsCardType =>
feedsCardTypeMap[pascalCase(rawType)] ?? feedsCardTypeMap.DynamicTypeWord
feedsCardTypeMap[pascalCase(rawType)] ?? feedsCardTypes.unknown
const getText = (dynamicModule: any, cardType: FeedsCardType) => {
const isOpusModule = Object.hasOwn(dynamicModule, 'paragraphs')
if (isOpusModule) {

View File

@ -15,6 +15,10 @@ export interface RepostFeedsCardType extends FeedsCardType {
name: '转发'
}
export const feedsCardTypes = {
unknown: {
id: 0,
name: '未知',
},
repost: {
id: 1,
name: '转发',
@ -78,8 +82,20 @@ export const feedsCardTypes = {
id: 4300,
name: '收藏夹',
},
courses: {
id: 2044,
name: '课程',
},
live: {
id: 2045,
name: '直播',
},
ugcSeason: {
id: 2046,
name: '合集',
},
liveRecord: {
id: 2047, // FIXME: 暂时随便写个 id 了, 这个东西目前找不到 type
id: 2047,
name: '开播记录',
},
} satisfies Record<string, FeedsCardType>