MCPcopy Index your code
hub / github.com/auto-novel/addon

github.com/auto-novel/addon @v1.8.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.8.1 ↗ · + Follow
174 symbols 452 edges 31 files 4 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Addon

GPL-3.0 cd-addon GitHub Downloads (all assets, all releases) GitHub Downloads (all assets, all releases)

这是一个用于轻小说机翻站的用户侧 Chrome/Firefox 插件(Manifest v3), 旨在扩展机翻站的功能,例如第三方翻译、智能导入、前端爬虫。

使用说明

翻译和导入功能:

支持机翻站的文库自动导入,有道翻译功能。

阅读器外部资源

处理 Pixiv 之类的文章中引用的图片等外部资源,绕过服务器 Referer 限制。

跳转功能

在机翻站支持的小说网站的小说页面上右键选择选项,可以直接跳转到对应的机翻站页面。 也可以直接点击浏览器右上角的机翻站插件的图标。

认证信息转移

AutoNovel 开发阶段本地启动的 pnpm dev 站点,右键可以将主站的认证信息复制到 localhost:5173 中,实现登录。

安装

打开最新版本的发布页,下载和浏览器对应的 zip 文件。

国产浏览器绝大多数使用的是Chrome内核,请参考Chrome的安装方式。但是有些浏览器(比如搜狗)不提供从本地文件安装插件,这种无法使用。

[!CAUTION]

注意,如果在机翻站使用【需要将机翻站网址加入浏览器广告拦截扩展的白名单

解释:这是因为有道的 rlog api 被 adblock 拦截。机翻站调用 rlog 时也会被拦截,导致后续请求失败。

机翻站本身无任何广告。

Chrome

  • 将 zip 文件解压到文件夹。
  • 打开 Chrome 浏览器,进入 chrome://extensions/ 页面。
  • 打开 开发者模式,选择 加载已解压的扩展程序,选择解压的目录(包含 manifest.json 文件)。
  • 安装后不能删除解压目录。

Chrome安装步骤

Edge

安装步骤参考 Chrome。

Edge安装步骤

Firefox

自动更新版

[!note] 注意,插件可能会被 firefox 下架,但是安装后即使下架也能用(手动重新启用即可)。

  • 从最新的下载页面中下载 addon-${version}-firefox.xpi 文件。
  • 打开 Firefox 浏览器,进入 about:addons
  • 将 xpi 文件直接拖入浏览器页面中,即可安装。

单次安装

  • 打开 Firefox 浏览器,进入 about:debugging#/runtime/this-firefox 页面。
  • 点击 临时加载附加组件 按钮,选择之前下载的 zip 文件。
  • 安装后不能删除 zip 文件,每次打开浏览器都需要重新加载。

移动端

想在手机上安装插件翻译的朋友,可以试试 Kiwi、Yandex 等浏览器,安装步骤和 Chrome 类似,注意下载请到官网下载。

如何测试插件是否工作

  • 进入 https://n.novelia.cc/wenku-edit
  • 使用任意 Amazon 文库地址,例如:https://www.amazon.co.jp/dp/4048926667
  • 选择导入
  • 检查是否导入成功:中文标题非空,简介是中文而非日文。

如果存在问题,请手动打开一次对应的 Amazon 页面和 dict.youdao.com 页面获取用户凭证或者过人机验证。

之后刷新 wenku-edit 页面,重试导入流程。

API

插件会将扩展函数挂载到 window.Addon 上,类型如下:

type AddonCapabilityVersion = `${number}.${number}.${number}`;

type AddonCapabilityManifest = {
  [capability: string]: AddonCapabilityVersion | AddonCapabilityManifest;
};

type InfoResult = {
  version: string;
  homepage_url: string;
};

type CookieStatus = Partial<browser.cookies.Cookie> & {
  name: string;
};

type TabFetchOptions = {
  tabUrl: string;
  tabId?: number;
  forceNewTab?: boolean;
  forceWaitForLoad?: boolean;
  closeTimeout?: number;
};

type TabDomQueryOptions = {
  tabId?: number;
  forceNewTab?: boolean;
  forceWaitForLoad?: boolean;
  closeTimeout?: number;
};

type DomQueryResults = {
  tabId: number;
  results: string[];
  readyState: DocumentReadyState;
};

interface AddonApi {
  version: string;

  /** 兼容旧名称,等同于 capabilities。 */
  compat: AddonCapabilityManifest;

  /** 插件能力清单,可用于按版本判断功能是否可用。 */
  capabilities: AddonCapabilityManifest;

  info(): Promise<InfoResult>;

  cookiesStatus(params: {
    url?: string;
    domain?: string;
    partitionKey?: browser.cookies.CookiePartitionKey;
    keys: string[] | '*';
  }): Promise<Record<string, CookieStatus | null>>;

  cookiesPatch(params: {
    url: string;
    /** value 为 null 时删除对应 cookie。 */
    patches: Record<string, CookieStatus | null>;
  }): Promise<void>;

  fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;

  tabFetch(
    options: TabFetchOptions,
    input: string | URL | Request,
    init?: RequestInit,
  ): Promise<Response>;

  tabDomQuery(params: {
    tabUrl: string;
    selector: string;
    options?: TabDomQueryOptions;
  }): Promise<DomQueryResults>;

  spoofFetch(
    baseUrl: string,
    input: string | URL | Request,
    init?: RequestInit,
  ): Promise<Response>;
}

declare global {
  interface Window {
    Addon?: AddonApi;
  }
}

开发说明

> pnpm install  # 安装依赖
> pnpm prepare  # 设置 husky git hooks
> pnpm dev      # 打开调试浏览器

免责声明

[!caution]

  • 声明:本工具旨在学习与交流,按“现状”提供。用户应确保其使用行为已获得必要授权并符合适用法律与目标网站政策,否则请立即停止使用。
  • 本免责声明可能不时更新。用户继续使用本工具即视为接受更新后的条款。建议用户定期查阅最新版本。

安全声明

[!note]

  • 构建与透明性
  • 本工具的 release 版本由 GitHub Actions 自动构建打包,完全基于公开的开源代码生成。源代码遵循 GPL‑3.0 协议开源,欢迎审计与复现构建流程。
  • 通信与数据上报
  • 本工具仅通过机翻站接口上报用户声明要求爬取的数据,不与除该接口以外的任何第三方服务器建立通信连接。
  • 本地数据与隐私
  • 本工具不读取、收集或存储用户的 Cookies、浏览记录等敏感信息,也不在本地或远端保存任何相关数据。
  • 漏洞发现与披露
  • 如发现安全漏洞或潜在风险,请提交至本项目的安全问题通道/私密 Issue

Extension points exported contracts — how you extend this code

PersistConstructorOptions (Interface)
(no doc)
src/utils/persist.ts
Window (Interface)
(no doc)
src/entrypoints/inject/index.ts
MessagePing (Interface)
(no doc)
src/rpc/types.ts
TestCase (Interface)
(no doc)
src/entrypoints/options/test.ts
MessageRequest (Interface)
(no doc)
src/rpc/types.ts
MessageResponse (Interface)
(no doc)
src/rpc/types.ts
LogEntry (Interface)
(no doc)
src/rpc/types.ts
DebugLogPayload (Interface)
(no doc)
src/rpc/types.ts

Core symbols most depended-on inside this repo

get
called by 27
src/utils/persist.ts
debugLog
called by 27
src/utils/log/backend.ts
set
called by 20
src/utils/persist.ts
newError
called by 9
src/utils/tools.ts
buildApiEndpoint
called by 9
src/entrypoints/inject/client.ts
snapshot
called by 5
src/utils/persist.ts
add
called by 5
src/utils/resource.ts
remove
called by 5
src/utils/resource.ts

Shape

Function 103
Method 46
Class 12
Interface 10
Enum 3

Languages

TypeScript99%
Python1%

Modules by API surface

src/utils/resource.ts21 symbols
src/utils/persist.ts20 symbols
src/rpc/types.ts14 symbols
src/utils/log/backend.ts12 symbols
src/entrypoints/inject/client.ts12 symbols
src/utils/rate-limit.ts11 symbols
src/utils/tools.ts10 symbols
src/utils/api/tab.ts10 symbols
src/utils/log/export.ts9 symbols
src/utils/dnr.ts8 symbols
src/utils/log/shared.ts6 symbols
src/utils/api/cookies.ts6 symbols

For agents

$ claude mcp add addon \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact