Remove deprecated live iframe (#5055)

This commit is contained in:
the1812 2025-04-03 09:07:14 +08:00
parent 81ef584251
commit 7e61d3f283
5 changed files with 28 additions and 12 deletions

View File

@ -4,10 +4,10 @@ import { ranking } from './ranking/ranking'
import { userInfo } from './user-info/user-info'
import { logo } from './logo/logo'
import { home } from './home/home'
import { livesIframe, mangaIframe } from './iframe/iframe'
import { mangaIframe } from './iframe/iframe'
import { games } from './games/games'
import { blanks } from './flexible-blank/flexible-blank'
import { bangumi, music, shop, match, creations } from './simple-links/simple-links'
import { bangumi, music, shop, match, creations, lives } from './simple-links/simple-links'
import { upload } from './upload/upload'
import { search } from './search/search'
import { feeds } from './feeds/feeds'
@ -25,7 +25,7 @@ export const getBuiltInItems = (): CustomNavbarItemInit[] => [
ranking,
music,
games,
livesIframe,
lives,
shop,
match,
mangaIframe,

View File

@ -3,6 +3,7 @@ import { addComponentListener } from '@/core/settings'
import { isIframe, isNotHtml, matchUrlPattern, mountVueComponent } from '@/core/utils'
import { setupNotifyStyle } from './notify-style'
import { setupLinkPopupContentAlignStyle } from './link-popup-content-align-style'
import { migrateOrders } from './orders-migration'
export const entry: ComponentEntry = async ({ metadata: { name } }) => {
// const url = document.URL.replace(location.search, '')
@ -50,6 +51,7 @@ export const entry: ComponentEntry = async ({ metadata: { name } }) => {
if (matchUrlPattern('https://www.bilibili.com/account/history')) {
document.body.classList.add('history-page')
}
migrateOrders()
const CustomNavbar = await import('./CustomNavbar.vue')
const customNavbar: Vue & {
styles: string[]

View File

@ -21,15 +21,6 @@ const getIframeItem = (config: NavbarIframeConfig): CustomNavbarItemInit & Navba
noPopupPadding: true,
transparentPopup: true,
})
export const livesIframe = getIframeItem({
src: 'https://live.bilibili.com/blackboard/dropdown-menu.html',
href: 'https://live.bilibili.com',
width: 528,
height: 266,
lazy: true,
displayName: '直播',
iframeName: 'lives',
})
export const mangaIframe = getIframeItem({
src: 'https://manga.bilibili.com/eden/bilibili-nav-panel.html',
href: 'https://manga.bilibili.com',

View File

@ -0,0 +1,18 @@
import { getComponentSettings } from '@/core/settings'
import type { CustomNavbarOptions } from '.'
export const migrateOrders = () => {
const migrations = [
['gamesIframe', 'games'],
['livesIframe', 'lives'],
]
const { options } = getComponentSettings<CustomNavbarOptions>('customNavbar')
migrations.forEach(([from, to]) => {
const oldOrder = options.order[from]
if (oldOrder !== undefined) {
options.order[to] = oldOrder
delete options.order[from]
}
})
}

View File

@ -42,3 +42,8 @@ export const creations = getSimpleLinkItem({
displayName: '创作中心',
href: 'https://member.bilibili.com/platform/home',
})
export const lives = getSimpleLinkItem({
name: 'lives',
displayName: '直播',
href: 'https://live.bilibili.com',
})