message: Fix biliplus redirect url
diff: import { videoChange } from '@/core/observer'
  import { DefaultWidget } from '@/ui'
  -export default Vue.extend({
  - components: {
  - DefaultWidget,
  - },
  - data() {
  - return {
  - url: '',
  +const videoRegex = /\/(video|medialist\/play)\/([^\/]+\/)?(av[\d]+|BV.+)/i
  +interface BiliplusRedirectProvider {
  + condition: () => boolean
  + getUrl: (host: string, updateUrl: (url: string) => void) => string
  }
  +const redirectProviders: BiliplusRedirectProvider[] = [
  + {
  + condition: () => window.location.host === 'space.bilibili.com',
  + getUrl: host => document.URL.replace('space.bilibili.com/', `${host}/space/`),
  },
  - created() {
  - const host = 'www.biliplus.com'
  - const videoRegex = /\/video\/(av[\d]+|BV.+)/i
  - if (window.location.host === 'space.bilibili.com') {
  - this.url = document.URL.replace('space.bilibili.com/', `${host}/space/`)
  - } else if (document.URL.includes('/bangumi/play')) {
  - this.url = `https://${host}${window.location.pathname}${window.location.search}`
  + {
  + condition: () => window.location.host === 'space.bilibili.com',
  + getUrl: host => document.URL.replace('space.bilibili.com/', `${host}/space/`),
  + },
  + {
  + condition: () => document.URL.includes('/bangumi/play'),
  + getUrl: (host, updateUrl) => {
  videoChange(() => {
  const aid = unsafeWindow.aid || (() => {
  const link = document.querySelector('.av-link,.info-sec-av') as HTMLElement
  @@ -31,14 +32,37 @@ export default Vue.extend({
  })()
  const url = `https://${host}/video/av${aid}/`
  if (document.URL !== url) {
  - this.href = url
  + updateUrl(url)
  } else {
  - this.href = ''
  + updateUrl('')
  }
  })
  - } else if (videoRegex.test(document.URL)) {
  - const [, id] = document.URL.match(videoRegex)
  - this.url = `https://${host}/video/${id}/`
  + return `https://${host}${window.location.pathname}${window.location.search}`
  + },
  + },
  + {
  + condition: () => videoRegex.test(document.URL),
  + getUrl: host => {
  + const id = document.URL.match(videoRegex)[3]
  + return `https://${host}/video/${id}/`
  + },
  + },
  +]
  +export default Vue.extend({
  + components: {
  + DefaultWidget,
  + },
  + data() {
  + return {
  + url: '',
  + }
  + },
  + created() {
  + const host = 'www.biliplus.com'
  + const updateUrl = (url: string) => (this.url = url)
  + const provider = redirectProviders.find(p => p.condition())
  + if (provider) {
  + updateUrl(provider.getUrl(host, updateUrl))
  } else {
  videoChange(() => {
  this.url = document.URL.replace(window.location.host, host)
  