mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-06-19 22:50:22 +08:00
- contentScripts: 仅在支持的视频平台(B 站 / YouTube / 抖音 / 快手)注入悬浮 BiliNote 按钮,点击通过 webext-bridge 发 'bilinote-start' 给 background - background: 处理 bilinote-start 与右键菜单点击;调 /api/generate_note;写 chrome.storage;自动打开侧边栏。logic/storage 是 Vue 反应式版本,service worker 不能 import,因此把常量抽到 logic/constants.ts - contextMenus: onInstalled 时注册"用 BiliNote 总结此视频",限定 4 个支持平台域名 - 浏览器 Cookie 同步:options 页加按钮,按平台读 chrome.cookies.getAll,序列化为 'name=value; ...' 后 POST 给后端 /api/update_downloader_cookie。chrome.cookies + contextMenus 权限补到 manifest - 侧边栏(P3 首版):从 storage 读最近任务并轮询,复用 TaskProgress + MarkdownView。markmap 思维导图与 RAG 问答推到后续 - 修 P1 endpoint 拼错的 bug:/api/get_models_by_provider 实际是 /api/model_enable,404 来自这里 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
876 B
TypeScript
25 lines
876 B
TypeScript
import { createApp } from 'vue'
|
|
import App from './views/App.vue'
|
|
import { setupApp } from '~/logic/common-setup'
|
|
import { detectPlatform } from '~/logic/platform'
|
|
|
|
// 只在支持的视频平台上挂悬浮按钮,避免污染其他网站
|
|
(() => {
|
|
if (!detectPlatform(window.location.href))
|
|
return
|
|
|
|
const container = document.createElement('div')
|
|
container.id = __NAME__
|
|
const root = document.createElement('div')
|
|
const styleEl = document.createElement('link')
|
|
const shadowDOM = container.attachShadow?.({ mode: __DEV__ ? 'open' : 'closed' }) || container
|
|
styleEl.setAttribute('rel', 'stylesheet')
|
|
styleEl.setAttribute('href', browser.runtime.getURL('dist/contentScripts/style.css'))
|
|
shadowDOM.appendChild(styleEl)
|
|
shadowDOM.appendChild(root)
|
|
document.body.appendChild(container)
|
|
const app = createApp(App)
|
|
setupApp(app)
|
|
app.mount(root)
|
|
})()
|