Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 1.91 KB

NOTES.md

File metadata and controls

81 lines (60 loc) · 1.91 KB

release 步骤

  • 完成 features
  • 完成 changelog
  • npm version patch
  • git push origin --all && git push origin --tags

Todo

  • 弹幕预览
  • modal antd

实现细节

授权

'https://passport.bilibili.com/login/app/third?appkey=27eb53fc9058f8c3' +
'&api=https%3A%2F%2Fwww.mcbbs.net%2Ftemplate%2Fmcbbs%2Fimage%2Fspecial_photo_bg.png&sign=04224646d1fea004e79606d3b038c84a',
{
method: 'GET',
credentials: 'include',
}

拿到 confirm_uri, 创建一个 iframe, iframe 会向当前窗口 postMessage 从 message 中拿到 access token, 并存储

// 用于获取授权
if (location.href.startsWith('https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png?')) {
  window.stop()

  if (window.top === window) {
    // a window
    window.opener?.postMessage(location.href, 'https://www.bilibili.com')
  } else {
    // a iframe
    window.top?.postMessage(location.href, 'https://www.bilibili.com')
  }

  return
}

match & include

Tampermonkey/tampermonkey#1560

  • ViolentMonkey 对于 @match query 不参与匹配
  • TamperMonkey 对于 @match query 参与匹配

所以得写成, ?* 是为了 TamperMonkey 支持

@match '*://www.bilibili.com/',
@match 'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png',
@match '*://www.bilibili.com/?*',
@match 'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png?*',

或者干脆用 Include

include: [
  'https://www.bilibili.com',
  'https://www.bilibili.com/',
  'https://www.bilibili.com?*',
  'https://www.bilibili.com/?*',
  'https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png?*',
],

antd + rc-field-form

rc-field-form + async-validator 无效引入

  • rc-field-form/es/index.js 有 side effects
  • rc-field-form/es/Field.js 也有, class Field 的 static props, 被编译成 defineProps, 表现为 side effects

如果需要移除, 需从 rc-field-form 的 build 着手