Merge branch 'preview-fixes' of https://github.com/the1812/Bilibili-Evolved into preview-fixes

This commit is contained in:
the1812 2022-11-13 14:51:23 +08:00
commit df11e442fa

View File

@ -33,7 +33,7 @@ enum CopyIdType {
Bvid = 'bvid',
}
const copyIds = [CopyIdType.Aid, CopyIdType.Bvid]
type LinkProvider = (context: { id: string; url: string; query: string }) => string
type LinkProvider = (context: { id: string; query: string }) => string
const linkProviders: LinkProvider[] = [
// , festival
({ id, query }) => {
@ -50,7 +50,17 @@ const linkProviders: LinkProvider[] = [
return null
},
//
({ id, url, query }) => url.replace(/\/[^\/]+$/, `/${id}`) + query,
({ id, query }) => {
const params = new URLSearchParams(query)
const newQuery = new URLSearchParams()
for (const key of ['p', 't']) {
const value = params.get(key)
if (value) {
newQuery.set(key, value)
}
}
return `https://www.bilibili.com/video/${id}${newQuery ? `?${newQuery.toString()}` : ''}`
},
]
export default Vue.extend({
components: { VIcon },