feat: bili player
This commit is contained in:
@@ -100,6 +100,19 @@ export function createWindow(
|
||||
},
|
||||
)
|
||||
|
||||
window.webContents.session.webRequest.onBeforeRequest(async (details, callback) => {
|
||||
const { url } = details
|
||||
|
||||
if (url.startsWith("https://s1.hdslb.com/bfs/seed/jinkela/short/player/player-util.js")) {
|
||||
callback({
|
||||
cancel: false,
|
||||
redirectURL: `https://assets.follow.is/player-util.js`,
|
||||
})
|
||||
} else {
|
||||
callback({ cancel: false })
|
||||
}
|
||||
})
|
||||
|
||||
return window
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const urlToIframe = (url?: string | null) => {
|
||||
if (url?.match(/\/\/www.bilibili.com\/video\/BV\w+/)) {
|
||||
return `https://player.bilibili.com/player.html?${new URLSearchParams({
|
||||
return `https://www.bilibili.com/blackboard/newplayer.html?${new URLSearchParams({
|
||||
isOutside: "true",
|
||||
autoplay: "true",
|
||||
danmaku: "true",
|
||||
|
||||
@@ -37,7 +37,7 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP
|
||||
// eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox
|
||||
<iframe
|
||||
src={iframeSrc}
|
||||
className={cn("pointer-events-none aspect-video w-full shrink-0 rounded-md bg-black object-cover", isActive && "rounded-b-none")}
|
||||
className={cn("aspect-video w-full shrink-0 rounded-md bg-black object-cover", isActive && "rounded-b-none")}
|
||||
/>
|
||||
) : (
|
||||
<Image
|
||||
|
||||
Reference in New Issue
Block a user