From e73ae0e3a6deb26f847952e804c8f6514881fa80 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 28 Jan 2024 01:54:54 +0800 Subject: [PATCH] fix: handle `History` video url location part #223 --- src/components/TopBar/components/HistoryPop.vue | 2 +- src/contentScripts/views/History/History.vue | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/TopBar/components/HistoryPop.vue b/src/components/TopBar/components/HistoryPop.vue index 35f29a54..d33f2c3b 100644 --- a/src/components/TopBar/components/HistoryPop.vue +++ b/src/components/TopBar/components/HistoryPop.vue @@ -114,7 +114,7 @@ function getHistoryUrl(item: HistoryItem) { // Video if (activatedTab.value === 0) { if (item.history.business === HistoryType.PGC) - return item.uri + return removeHttpFromUrl(item.uri) if (item.history.business === HistoryType.Archive && item?.videos && item.videos > 0) return `//www.bilibili.com/video/${item.history.bvid}?p=${item.history.page}` return `//www.bilibili.com/video/${item.history.bvid}` diff --git a/src/contentScripts/views/History/History.vue b/src/contentScripts/views/History/History.vue index fadd1747..15b25863 100644 --- a/src/contentScripts/views/History/History.vue +++ b/src/contentScripts/views/History/History.vue @@ -2,7 +2,6 @@ import { useDateFormat } from '@vueuse/core' import { useI18n } from 'vue-i18n' -// import type { HistoryItem } from './types' import { getCSRF, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main' import { calcCurrentTime } from '~/utils/dataFormatter' import emitter from '~/utils/mitt' @@ -158,8 +157,10 @@ function getHistoryUrl(item: HistoryItem) { return removeHttpFromUrl(item.uri) } // video - else if (item.history.business === 'archive') { - return removeHttpFromUrl(item.history.bvid) + else if (item.history.business === Business.ARCHIVE) { + if (item?.videos && item.videos > 0) + return `//www.bilibili.com/video/${item.history.bvid}?p=${item.history.page}` + return item.history.bvid } else if (item.history.business === 'live') { return `//live.bilibili.com/${item.history.oid}`