diff --git a/src/main/window.ts b/src/main/window.ts index d588c74790..c15a8a9133 100644 --- a/src/main/window.ts +++ b/src/main/window.ts @@ -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 } diff --git a/src/renderer/src/lib/url-to-iframe.ts b/src/renderer/src/lib/url-to-iframe.ts index dbb2f7c4d0..8f2f1327cc 100644 --- a/src/renderer/src/lib/url-to-iframe.ts +++ b/src/renderer/src/lib/url-to-iframe.ts @@ -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", diff --git a/src/renderer/src/modules/entry-column/video-item.tsx b/src/renderer/src/modules/entry-column/video-item.tsx index d97edc2be2..dba352a0bc 100644 --- a/src/renderer/src/modules/entry-column/video-item.tsx +++ b/src/renderer/src/modules/entry-column/video-item.tsx @@ -37,7 +37,7 @@ export function VideoItem({ entryId, entryPreview, translation }: UniversalItemP // eslint-disable-next-line @eslint-react/dom/no-missing-iframe-sandbox