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) this.allTypes = Object.entries(feedsCardTypes)
.concat(Object.entries(specialTypes)) .concat(Object.entries(specialTypes))
.filter(([, type]) => type.id <= 2048) .filter(([, type]) => type.id <= 2048 && type.id > 0)
.map(([name, type]) => [name, lodash.clone(type)]) .map(([name, type]) => [name, lodash.clone(type)])
cardsManager = await forEachFeedsCard({ cardsManager = await forEachFeedsCard({
added: card => { added: card => {

View File

@ -15,6 +15,12 @@ const feedsCardTypeMap = {
DynamicTypeArticle: feedsCardTypes.column, DynamicTypeArticle: feedsCardTypes.column,
DynamicTypeMusic: feedsCardTypes.audio, DynamicTypeMusic: feedsCardTypes.audio,
DynamicTypeLiveRcmd: feedsCardTypes.liveRecord, 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[]) => const combineText = (...texts: string[]) =>
@ -23,7 +29,7 @@ const combineText = (...texts: string[]) =>
.join('\n') .join('\n')
.trim() .trim()
const getType = (rawType: string): FeedsCardType => const getType = (rawType: string): FeedsCardType =>
feedsCardTypeMap[pascalCase(rawType)] ?? feedsCardTypeMap.DynamicTypeWord feedsCardTypeMap[pascalCase(rawType)] ?? feedsCardTypes.unknown
const getText = (dynamicModule: any, cardType: FeedsCardType) => { const getText = (dynamicModule: any, cardType: FeedsCardType) => {
const isOpusModule = Object.hasOwn(dynamicModule, 'paragraphs') const isOpusModule = Object.hasOwn(dynamicModule, 'paragraphs')
if (isOpusModule) { if (isOpusModule) {

View File

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