lxfater / BilibiliSummary

A chrome extension helps you summary video on bilibili.
BSD 3-Clause "New" or "Revised" License
713 stars 54 forks source link

添加Firefox支持 #16

Open zsbai opened 1 year ago

zsbai commented 1 year ago

尝试自己转换了一下出错,问了chatgpt貌似需要修改一些api

这个错误是因为 Firefox 和 Chrome 在拓展插件的实现上存在一些差异,导致某些 API 的支持不同。其中 "/background/service_worker" 是 Chrome 所支持的,但并不被 Firefox 支持。换句话说,你的代码中使用了这个 API,所以在 Firefox 上运行时就会报错。

要解决这个问题,你需要找到替代品或者调整你的代码适应 Firefox 的 API。一种可能的解决方案是使用 Firefox 支持的 background scripts 代替 service worker。具体来说,你可以创建一个名为 background.js 的文件,并将其在 manifest.json 中声明为 background.scripts,像这样:

"background": {
  "scripts": ["background.js"]
}

然后在 background.js 中编写你需要的代码。请注意,Firefox 的 background scripts 与 Chrome 的 service worker 有许多不同之处,因此你需要仔细阅读文档以确保你的代码正确运行。