chore: 整理 third-party Dark Reader 目录并移除本地说明文件跟踪
This commit is contained in:
+3
-2
@@ -21,5 +21,6 @@ workplace/*
|
||||
scripts/output/
|
||||
scripts/.browser-profile/
|
||||
|
||||
# Dark Reader 源码下载目录(构建依赖已 vendor 到 ui/vendor/darkreader)
|
||||
docs/darkreader/
|
||||
# 本地项目说明文件,不入库
|
||||
AGENTS.md
|
||||
CLAUDE.md
|
||||
|
||||
@@ -1,177 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## 项目概述
|
||||
|
||||
Halo 暗色模式插件 — 为 Halo 2.25 后台管理面板提供深色/浅色模式切换。不修改 Halo 核心代码,完全通过插件机制实现。
|
||||
|
||||
**核心技术栈**:Java(插件骨架,编译目标 21)、Vue 3 + TypeScript(前端 UI)、OKLCH 色彩空间(CSS 变量体系)、Gradle(构建)。
|
||||
|
||||
**⚠️ 构建环境**:本机没有 JDK 21,构建必须使用 JDK 25(路径已硬编码在 `gradle.properties` 的 `org.gradle.java.home`)。`options.release = 21` 保证字节码兼容 Halo API。不要改回 toolchain 方式——那会因找不到 JDK 21 而失败。
|
||||
|
||||
## 常用命令
|
||||
|
||||
```bash
|
||||
# 后端 — 启用插件并启动 Halo 开发服务器(需要 Docker)
|
||||
./gradlew haloServer
|
||||
|
||||
# 后端 — 构建插件 JAR(产物在 build/libs/)
|
||||
./gradlew build
|
||||
|
||||
# 前端 — 进入 ui/ 开发
|
||||
cd ui && pnpm install
|
||||
|
||||
# 前端 — 开发模式(watch 构建)
|
||||
pnpm dev
|
||||
|
||||
# 前端 — 生产构建
|
||||
pnpm build
|
||||
|
||||
# 前端 — 类型检查
|
||||
pnpm type-check
|
||||
|
||||
# 前端 — Lint(oxlint + eslint)
|
||||
pnpm lint
|
||||
|
||||
# 前端 — 格式化
|
||||
pnpm prettier
|
||||
|
||||
# 前端 — 单元测试
|
||||
pnpm test:unit
|
||||
|
||||
# 后端 — 仅运行 Java 测试
|
||||
./gradlew test
|
||||
```
|
||||
|
||||
## 架构概览
|
||||
|
||||
```
|
||||
halo-dark-mode-plugin/
|
||||
├── 后端 (Java/Gradle) ← 插件骨架,极简
|
||||
│ ├── DarkModePlugin.java ← 继承 BasePlugin,仅 start()/stop()
|
||||
│ └── plugin.yaml ← 插件清单(声明式元数据 + 版本约束)
|
||||
│
|
||||
├── 前端 (Vue 3 / TypeScript) ← 核心实现
|
||||
│ ├── index.ts ← definePlugin() 入口,注册路由+组件
|
||||
│ ├── darkreader-engine.ts ← Dark Reader 通用暗色引擎
|
||||
│ ├── injector.ts ← ThemeToggle 侧边栏注入器(MutationObserver 方案)
|
||||
│ ├── composables/
|
||||
│ │ ├── useDarkMode.ts ← 单例状态管理(light/dark/auto + localStorage 持久化)
|
||||
│ │ └── useSystemPreference.ts ← matchMedia 系统偏好监听
|
||||
│ ├── components/
|
||||
│ │ └── ThemeToggle.vue ← 侧边栏切换按钮
|
||||
│ ├── views/
|
||||
│ │ └── SettingsView.vue ← 设置页面(浅色/深色/跟随系统 三选一)
|
||||
│ └── styles/
|
||||
│ ├── index.css ← 样式入口(@import 聚合)
|
||||
│ ├── variables.css ← 40+ CSS 变量(:root 浅色 + [data-halo-theme="dark"] 深色)
|
||||
│ └── overrides/
|
||||
│ ├── halo-core.css ← ★ 核心:真实 DOM 类名覆盖(最重要)
|
||||
│ ├── layout.css ← 侧边栏/内容区/页脚
|
||||
│ ├── components.css ← 旧版组件类覆盖(部分已失效,见下)
|
||||
│ ├── forms.css / editor.css / scrollbar.css / utilities.css
|
||||
│
|
||||
└── 构建链
|
||||
└── processUiResources ← Gradle task: ui/dist/ → resources/main/ui/
|
||||
```
|
||||
|
||||
## 关键设计决策
|
||||
|
||||
### 主题切换机制
|
||||
|
||||
- **触发方式**:`document.documentElement` 上设置/移除 `data-halo-theme="dark"` 属性
|
||||
- **主引擎**:Dark Reader(本地 vendored 于 `ui/vendor/darkreader`,API 包由
|
||||
`npm run api` 构建),监听 `useDarkMode().isDark`,深色时 `enable()`,浅色时
|
||||
`disable()`,可自动分析 Halo 核心与第三方插件的动态 DOM
|
||||
- **CSS 变量体系**:所有颜色通过 `--halo-*` 前缀的 CSS 自定义属性控制,一个语义变量对应一个视觉属性
|
||||
- **颜色空间**:全部使用 OKLCH(感知均匀,暗色模式天然适配)
|
||||
- **暗色配色策略**:用亮度层次区分背景(越"高"的层越亮),中性色含微量蓝色调,强调色略降饱和
|
||||
- **CSS 覆盖定位**:现有 `overrides/` 仅作为 Dark Reader 的兼容层与兜底,
|
||||
不再逐页新增手工转换规则;新页面残留统一交给 Dark Reader 处理
|
||||
|
||||
### ⚠️ 最关键的教训:Halo 2.25 用 UnoCSS,不是 Tailwind
|
||||
|
||||
Halo 2.25 的 Console 实际使用 **UnoCSS**(hash 类如 `uno-*`)加 **BEM 语义aliyun "curl -sI --max-time 5 http://localhost/ 2>&1 |类**。**不要写 `.bg-white`、`.text-gray-900`、`.v-card` 这类 Tailwind/Vuetify 原子选择器**——它们在真实 DOM 中不存在,覆盖会静默失效。
|
||||
|
||||
真实 DOM 里的容器类名(已被 `halo-core.css` 覆盖):
|
||||
|
||||
| 语义 | 真实类名 |
|
||||
| ------------------- | --------------------------------------------------------------------------------------------- |
|
||||
| 页面顶栏 | `.page-header` / `.page-header__title-text` |
|
||||
| 列表卡片容器 | `.card-wrapper` |
|
||||
| 文章/用户列表项标题 | `.entity-field-title` / `.entity-field-title-body` |
|
||||
| 分页 | `.pagination` / `.pagination__btn` |
|
||||
| 标签 | `.tag-default` / `.tag-content` |
|
||||
| 模态框 | `.modal-content` / `.modal-header` / `.modal-body` / `.modal-footer` |
|
||||
| 详情页描述项 | `.description-item-wrapper` / `.description-item__label` / `.description-item__content` |
|
||||
| Toast | `.toast-container .toast-body` |
|
||||
| 用户头像 | `.avatar-wrapper` / `.avatar-circle` |
|
||||
|
||||
新增覆盖时:**先到真实环境确认类名,不要凭经验写**。
|
||||
|
||||
### 覆盖策略(重写后)
|
||||
|
||||
`halo-core.css` 是主要覆盖文件,按语义类精准覆盖。它包含三类规则:
|
||||
|
||||
1. **BEM 语义类**(如 `.card-wrapper`)— 直接 `[data-halo-theme="dark"] .card-wrapper { background-color: var(--halo-bg-card) }`
|
||||
2. **通用 UnoCSS 工具类**(如 `.bg-gray-50`、`.hover:text-gray-600`)— 批量覆盖文字/背景/边框
|
||||
3. **根背景兜底** — `html, body { background-color: var(--halo-bg-body) !important }`(body 不设暗色会在溢出时露白)
|
||||
|
||||
`components.css` 等旧文件里的 Tailwind/Vuetify 选择器部分已失效,保留但优先维护 `halo-core.css`。
|
||||
|
||||
### 状态管理
|
||||
|
||||
- `useDarkMode()` 是**模块级单例** — 所有组件共享同一份 `theme` ref 和 `isDark` computed
|
||||
- 三个主题模式:`light` / `dark` / `auto`(跟随系统)
|
||||
- 持久化:`localStorage` key `halo-dark-mode-theme`,默认 `auto`
|
||||
- FOUC 防护:插件 bundle 顶部同步执行脚本,DOM 渲染前设置 `data-halo-theme`
|
||||
|
||||
### ThemeToggle 侧边栏注入
|
||||
|
||||
Halo 扩展点系统**没有侧边栏插槽**。`injector.ts` 用 `MutationObserver` 监听 `.sidebar__profile` 元素出现,在其上方插入容器并挂载 `ThemeToggle.vue` 组件。这是当前 Halo 插件体系下的合理变通方案。
|
||||
|
||||
### 前端入口
|
||||
|
||||
- `definePlugin()` 从 `@halo-dev/ui-shared` 导入(非旧版 `@halo-dev/console-shared`)
|
||||
- 路由使用 `() => import(...)` 懒加载
|
||||
- 构建使用 `@halo-dev/ui-plugin-bundler-kit` 的 `viteConfig()` 包装器
|
||||
|
||||
### 后端
|
||||
|
||||
后端极简 — `DarkModePlugin extends BasePlugin` 仅含 `start()`/`stop()` 生命周期钩子。所有核心逻辑在前端。插件不依赖后端 Setting API。
|
||||
|
||||
## 打包约定(必须)
|
||||
|
||||
每次执行 `./gradlew build` 打 JAR 前,**必须先递增版本标签**:
|
||||
|
||||
1. 修改 `gradle.properties` 中的 `version`(如 `1.0.2` → `1.0.3`)
|
||||
2. 同步更新 `src/main/java/run/halo/darkmode/DarkModePlugin.java` 的 `@since`
|
||||
3. 构建完成后核对 `build/libs/plugin-dark-mode-<新版本>.jar` 存在,且 JAR 内的
|
||||
`ui/style.css`、`ui/main.js` 包含本次改动(用关键字检查,例如新增类名)
|
||||
4. 向用户交付时明确给出新 JAR 路径和版本号,避免线上仍加载旧 bundle 的混淆
|
||||
## 验证工作流(必须)
|
||||
|
||||
对 CSS 覆盖的任何改动,都要在**真实 Halo 环境**验证,不能只靠 `vite build` 通过:
|
||||
|
||||
1. 打开官方 demo 站 `https://demo.halocms.site/console`,登录 `demo / P@ssw0rd123..`
|
||||
2. 用 Playwright 的 `page.addStyleTag({ path: 'ui/build/dist/style.css' })` 注入构建产物,并 `document.documentElement.setAttribute('data-halo-theme', 'dark')`
|
||||
3. 遍历页面,扫描 `main *` 中残留的白色背景(`rgb(255,255,255)` 且尺寸 >100×40)和深色文字(`rgb(17,24,39)` 等)元素,记录其真实类名
|
||||
4. 新增覆盖后重新构建、重新注入、重新扫描,直到零残留
|
||||
5. 最终 `./gradlew build` 打 JAR,确认 `ui/style.css` 已更新
|
||||
|
||||
第三方插件页面(链接/订阅/瞬间等)在 demo 站已装,可一并验证。
|
||||
|
||||
## Playwright 自动化验证(workplace/)
|
||||
|
||||
`workplace/` 目录包含基于 Playwright 的自动化验证工具(未提交到 git):
|
||||
|
||||
- **`login_wait.py`** — 启动带持久化配置的 Edge 窗口,打开 `https://blog.liuhangyv.top/console/login`,等待用户手动登录后将会话 cookie 保存到 `pw-profile/`。超时 280 秒。
|
||||
- **`pw-profile/`** — Edge 浏览器持久化用户数据目录,登录后会话保留供后续 Playwright 脚本复用。
|
||||
- **`roleTemplates.yaml`** — 预留的角色模板配置(当前为空)。
|
||||
|
||||
典型流程:先运行 `login_wait.py` 登录,再编写 Playwright 脚本复用 `pw-profile` 中的会话进行页面扫描。
|
||||
|
||||
## README.md
|
||||
|
||||
用户向 README,包含功能介绍、快速开始、构建命令和项目结构图。
|
||||
@@ -7,14 +7,15 @@ Halo 2.25 暗色模式插件 — 为 Halo 后台管理面板提供深色/浅色
|
||||
- ☀️/🌙 **三种模式**:浅色、深色、跟随系统
|
||||
- 💾 **偏好持久化**:自动记忆用户选择(localStorage),刷新不丢失
|
||||
- 🖥️ **系统偏好跟随**:切换系统外观时自动响应
|
||||
- ⚡ **瞬间切换**:CSS 变量瞬时生效,无可见闪烁
|
||||
- 🔍 **Dark Reader 引擎**:内置成熟的开源暗色转换引擎,自动分析页面 CSS 与 DOM,第三方插件页面的黑字/白底也能自动转换
|
||||
- 🧩 **侧边栏注入**:切换按钮自动出现在侧边栏底部(UserProfileBanner 上方)
|
||||
- ⚙️ **设置页面**:提供详细的模式选择界面(菜单 → 偏好设置 → 深色模式)
|
||||
- 🔍 **Dark Reader 引擎**:内置成熟的开源暗色转换引擎,自动分析页面 CSS 与 DOM,
|
||||
第三方插件页面的黑字/白底也能自动转换,不再依赖逐页手工覆盖
|
||||
- 🎨 **OKLCH 色彩空间**:感知均匀,暗色模式天然适配,WCAG AA 对比度保证
|
||||
- 📦 **零后端依赖**:纯前端实现,不需要后端 API
|
||||
- ✅ **覆盖已验证**:仪表盘、内容管理(文章/页面/评论)、链接、订阅、瞬间、用户、主题、设置、编辑器、模态框等页面已针对 Halo 2.25 真实 DOM 逐一验证
|
||||
|
||||
## 第三方依赖
|
||||
|
||||
- [Dark Reader](https://github.com/darkreader/darkreader) `4.9.129`,使用 [MIT License](https://github.com/darkreader/darkreader/blob/main/LICENSE)。
|
||||
作为插件的暗色转换引擎,源码已整理到 `third-party/darkreader/`,构建时由 `ui/package.json` 通过本地文件依赖引用。
|
||||
|
||||
## 开发环境
|
||||
|
||||
@@ -68,7 +69,11 @@ pnpm test:unit # 单元测试
|
||||
│ └── resources/
|
||||
│ └── plugin.yaml # 插件清单
|
||||
│
|
||||
├── third-party/
|
||||
│ └── darkreader/ # Dark Reader 4.9.129(MIT)
|
||||
│
|
||||
└── ui/
|
||||
├── package.json # 通过 file:../third-party/darkreader 引用 Dark Reader
|
||||
└── src/
|
||||
├── index.ts # definePlugin 入口
|
||||
├── darkreader-engine.ts # Dark Reader 通用暗色引擎
|
||||
@@ -82,17 +87,9 @@ pnpm test:unit # 单元测试
|
||||
│ └── SettingsView.vue # 设置页面
|
||||
└── styles/
|
||||
├── index.css # 样式入口
|
||||
├── variables.css # 40+ CSS 变量(浅色 + 深色)
|
||||
└── overrides/
|
||||
├── halo-core.css # ★ 核心:真实 DOM 类名覆盖
|
||||
├── layout.css # 侧边栏/内容区/页脚
|
||||
├── components.css # 组件类覆盖
|
||||
├── forms.css # FormKit 表单
|
||||
├── editor.css # 富文本编辑器
|
||||
├── scrollbar.css # 滚动条
|
||||
└── utilities.css # 通用工具类
|
||||
└── variables.css # 插件自身 UI 变量
|
||||
```
|
||||
|
||||
## 许可证
|
||||
|
||||
[GPL-3.0](./LICENSE) © LHY
|
||||
[GPL-3.0](./LICENSE) © LHY
|
||||
@@ -0,0 +1,157 @@
|
||||
# Halo 暗色模式残留排查报告
|
||||
|
||||
> 排查时间:2026-08-07
|
||||
> 排查环境:腾讯云生产站 `blog.liuhangyv.top`(Halo Pro 2.24.2)
|
||||
> 排查方式:Playwright 自动化全路由扫描,共 92 个后台路由
|
||||
|
||||
## 一、结论摘要
|
||||
|
||||
1. **部署版本没有问题**。服务端实际加载的 `bundle.css` 与本仓库 `ui/build/dist/style.css` 的 194 条暗色规则完全一致,不存在"部署了旧包"的情况。
|
||||
2. **73 个后台路由存在深浅色残留**,19 个路由完全干净(主要是 Shop 插件全家桶、快照页、权限页)。
|
||||
3. 残留可归纳为 **3 类根因**:
|
||||
- 插件 CSS 加载顺序在最前,同特异性规则被后加载的 Halo 核心样式覆盖;
|
||||
- UnoCSS 哈希类前缀已从 `i-*` 变为 `uno-*`,现有兜底规则匹配不到;
|
||||
- 第三方插件页面(AstraHub、RSS 订阅、私密文章、AI 评论等)基本没有覆盖。
|
||||
|
||||
## 二、扫描方法与产物
|
||||
|
||||
### 方法
|
||||
|
||||
1. Playwright 启动持久化 Edge 上下文,复用已登录会话;
|
||||
2. 从 Vue Router 读取全部注册路由(92 个),逐页加载;
|
||||
3. 每页强制 `data-halo-theme="dark"`,等待网络空闲后扫描;
|
||||
4. 扫描规则:可见且尺寸大于 50×20 的元素,背景 RGB 均 >235 记为浅色背景残留,直接文本颜色 RGB 均 <70 记为深色文字残留;
|
||||
5. 每页截图存档,结果按页面 + 元素分组去重。
|
||||
|
||||
### 产物(均在 `workplace/`)
|
||||
|
||||
| 文件 | 说明 |
|
||||
|------|------|
|
||||
| `scan_dark.py` | 全路由扫描脚本 |
|
||||
| `scan-results.json` | 原始扫描结果(92 页 × 元素级) |
|
||||
| `aggregate.txt` | 按元素/类名/问题聚合后的明细 |
|
||||
| `shots/*.png` | 92 页深色模式截图 |
|
||||
| `deployed-bundle.css` | 服务端实际部署的 CSS 快照 |
|
||||
| `probe_conflict.py` / `fetch_bundle.py` | 样式表加载顺序与版本对比脚本 |
|
||||
|
||||
## 三、总体数据
|
||||
|
||||
| 指标 | 数值 |
|
||||
|------|------|
|
||||
| 扫描路由数 | 92 |
|
||||
| 存在残留的路由 | 73 |
|
||||
| 完全干净的路由 | 19 |
|
||||
| 去重后的残留组 | 134 |
|
||||
| 页面 × 元素残留条目 | 256 |
|
||||
| 影响页面最多的残留 | 侧边栏 `.menu-item-title.active` 高亮背景(68 页) |
|
||||
| 次多 | `.empty-title` 深色文字(16 页) |
|
||||
|
||||
无残留的 19 个路由:`/console/403`、Shop 插件全部 11 个页面、`/console/app-store/privacy-policy`、`/console/posts/snapshots`、`/console/single-pages/snapshots`、`/console/users/auth-providers`、`/console/users/roles`。
|
||||
|
||||
## 四、根因分析
|
||||
|
||||
### 根因 1(P0):插件 CSS 加载顺序在最前,同特异性规则被 Halo 核心样式覆盖
|
||||
|
||||
**证据**(来自 `probe_conflict.py`):
|
||||
|
||||
- 插件 `bundle.css` 是 `document.styleSheets` 的第 0 张表;
|
||||
- Halo 核心样式 `process-bar-DsZ2lvXx.css` 是第 9 张表,加载更晚;
|
||||
- 双方存在同特异性规则,CSS 级联规则让"后加载者"胜出:
|
||||
|
||||
| 规则 | 特异性 | 结果 |
|
||||
|------|--------|------|
|
||||
| Halo:`.description-item-wrapper .description-item__label { color: rgb(17 24 39) }` | (0,2,0) | 胜出 |
|
||||
| 插件:`[data-halo-theme="dark"] .description-item__label { color: var(--halo-text-secondary) }` | (0,2,0) | 被覆盖 |
|
||||
|
||||
**受影响页面**:`/console/overview`、`/console/schedule-calendar`、`/console/theme` 的详情描述项(名称、Halo、站点地址等文字仍是深色)。
|
||||
|
||||
**修复建议**:
|
||||
|
||||
- 对这类核心语义类统一加 `!important`;
|
||||
- 或把前缀从 `[data-halo-theme="dark"]` 提升为 `html[data-halo-theme="dark"]`,把特异性从 (0,2,0) 提高到 (0,2,1)。
|
||||
|
||||
推荐两者并用(提高特异性 + `!important` 双保险),因为 Halo 核心样式后续仍可能继续调整。
|
||||
|
||||
### 根因 2(P0):UnoCSS 哈希类前缀已变化,现有兜底规则失效
|
||||
|
||||
**证据**:
|
||||
|
||||
- 大量残留元素的类名是 `uno-*` 前缀(如 `uno-ga61as`、`uno-529526`、`uno-b60d0h`);
|
||||
- `plugin-pages.css` 中的兜底规则只覆盖 `[class*="i-"]`,这是旧版 UnoCSS 的哈希前缀;
|
||||
- 部署 CSS 探针确认:`menu-item-title`、`empty-title`、`alert-wrapper` 三个关键字在暗色规则中完全不存在。
|
||||
|
||||
**受影响页面**:AI Foundation 全家桶(每页 3–24 处)、数据迁移、装备/关注/照片/时间线/投票的卡片头部"新增"栏、SummaraidGPT 等。
|
||||
|
||||
**修复建议**:
|
||||
|
||||
- 新增 `[class*="uno-"]` 的兜底覆盖(背景、文字、边框三件套),并加 `!important`;
|
||||
- 保留 `i-*` 规则,因为扫描中仍有少量 `i-*` 哈希(如 `.i-p4hnaq`)在真实页面出现,两个前缀并存。
|
||||
|
||||
### 根因 3(P0):核心语义类缺覆盖
|
||||
|
||||
以下类在部署 CSS 中**完全没有暗色规则**,属于新增覆盖而非覆盖失效:
|
||||
|
||||
| 类名 | 残留内容 | 影响页面 |
|
||||
|------|----------|----------|
|
||||
| `.menu-item-title.active` | 高亮背景 `rgb(243,244,246)` | 68 页 |
|
||||
| `.empty-title` | 文字 `rgb(17,24,39)` | 16 页 |
|
||||
| `.alert-wrapper` / `.alert-default` | 背景 `rgb(249,250,251)` | 3 页(概览、许可证、导入) |
|
||||
| `.description-item__label/content` | 文字 `rgb(17,24,39)` | 3 页(同特异性失效,见根因 1) |
|
||||
|
||||
**修复建议**:
|
||||
|
||||
- 侧边栏高亮:覆盖 `.menu-item-title.active`(含 `:hover`),用 `--halo-menu-item-active` 变量;
|
||||
- 空状态:覆盖 `.empty-title`,用 `--halo-text-secondary`;
|
||||
- 提示条:覆盖 `.alert-wrapper` 及各变体的背景/边框/文字。
|
||||
|
||||
### 根因 4(P1):第三方插件页面几乎未覆盖
|
||||
|
||||
| 插件/页面 | 残留类名 | 说明 |
|
||||
|-----------|----------|------|
|
||||
| AstraHub + 心愿便签 | `.ah-card`、`.ah-topbar`、`.ah-float-nav`、`.ah-topbar-brand` | 两插件共用同一套 `ah-*` UI,覆盖一次可同时生效 |
|
||||
| RSS 订阅 | `.subscription-panel`、`.feed-toolbar`、`.feed-status-tabs`、`.feed-stream`、`.feed-brief__title` | 整个页面几乎整片浅色 |
|
||||
| 私密文章 | `.focus-card`、`.overview-card`、`.list-card`、`.empty-state` | 半透明白背景叠在深色上,文字也是深色 |
|
||||
| AI 评论自动处理 | `.setting-panel`、`.form-row`、`.sidebar-card`、`.tabs-wrap`、`.list-col`、`.reply-card` | 设置页和日志页整片浅色 |
|
||||
| 数据工坊 | `.modal-content`、`.uno-*` 卡片 | 弹窗与主内容区均残留 |
|
||||
| 代码注入器 | `.uno-*` 侧栏/编辑区 | 整页浅色 |
|
||||
| Meilisearch 概览 | `.uno-*` | 卡片与标题残留 |
|
||||
| 日志查看器 | `.monaco-editor`、`.margin`、`.lines-content` | **Monaco Editor 自带独立主题系统**,仅靠 CSS 覆盖很难稳定 |
|
||||
| 导入/存储工具 | `.uno-*` | 提示卡片、分页栏残留 |
|
||||
|
||||
**修复建议**:
|
||||
|
||||
- `ah-*`、`feed-*`、`focus-card/overview-card/list-card`、`setting-panel/form-row/sidebar-card` 等语义类按插件页面补 `!important` 规则;
|
||||
- Monaco 不要硬啃 CSS,优先在 JS 里监听主题切换并调用 `monaco.editor.setTheme('vs-dark')`,或加载官方 dark 主题 CSS;
|
||||
- 每个插件补完后再跑一次 `scan_dark.py` 验证零残留。
|
||||
|
||||
### 根因 5(P2):历史遗留规则与自相矛盾的选择器
|
||||
|
||||
- `components.css` 中大量 `.v-*`(Vuetify 类)在 Halo 2.25 的真实 DOM 中不存在,属无效规则(CLAUDE.md 已记录);
|
||||
- `[class*="tag-"]`、`[class*="modal"]` 等宽泛匹配容易误伤,建议逐步收紧;
|
||||
- `utilities.css` 与 `halo-core.css` 对链接色的规则互相覆盖,最终生效结果不明确;
|
||||
- `halo-core.css` 的 `html, body` 编译后为 `[data-halo-theme="dark"] html`,该选择器**永远不匹配**(html 元素不会是其自身的后代),根背景兜底实际只靠 `body` 一条,页面在特殊滚动场景下仍有露白风险。
|
||||
|
||||
## 五、修复优先级清单
|
||||
|
||||
### P0(一次重构后全站收益最大)
|
||||
|
||||
1. 全局暗色规则前缀从 `[data-halo-theme="dark"]` 升级为 `html[data-halo-theme="dark"]`;
|
||||
2. 核心语义类(`.page-header`、`.card-wrapper`、`.description-item-*`、`.table` 等)加 `!important`;
|
||||
3. 新增 `.menu-item-title.active`、`.empty-title`、`.alert-wrapper` 覆盖;
|
||||
4. 新增 `[class*="uno-"]` 兜底三件套;
|
||||
5. 修正根背景规则,让 `html` 本身也参与暗色。
|
||||
|
||||
### P1(按插件逐个补齐并复扫)
|
||||
|
||||
6. `ah-*`、`feed-*`、私密文章、AI 评论插件语义类覆盖;
|
||||
7. Monaco 主题切换接入;
|
||||
8. 数据工坊、代码注入器、Meilisearch、导入/存储工具等 `uno-*` 页面复查。
|
||||
|
||||
### P2(清理)
|
||||
|
||||
9. 删除失效的 Vuetify 类规则,收敛宽泛匹配;
|
||||
10. 统一链接色规则,消除重复/冲突。
|
||||
|
||||
## 六、完整残留明细
|
||||
|
||||
见 `workplace/aggregate.txt`(134 组,含影响页面列表),原始数据见 `workplace/scan-results.json`。
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
version=1.0.3
|
||||
version=1.0.4
|
||||
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
|
||||
org.gradle.java.home=D:/settings/Language/Java/jdk-25.0.1
|
||||
|
||||
@@ -10,7 +10,7 @@ import run.halo.app.plugin.PluginContext;
|
||||
* <p>Only one main class extending {@link BasePlugin} is allowed per plugin.</p>
|
||||
*
|
||||
* @author LHY
|
||||
* @since 1.0.3
|
||||
* @since 1.0.4
|
||||
*/
|
||||
@Component
|
||||
public class DarkModePlugin extends BasePlugin {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
* text=auto
|
||||
|
||||
*.* text eol=lf
|
||||
src/config/*.json text eol=crlf
|
||||
|
||||
*.png binary
|
||||
*.ttf binary
|
||||
+1
@@ -0,0 +1 @@
|
||||
open_collective: darkreader
|
||||
@@ -0,0 +1,76 @@
|
||||
name: Broken Website Report
|
||||
description: Create a report about a website issue you experienced while using Dark Reader.
|
||||
title: "[Broken Website] Replace with title"
|
||||
labels: ["Broken Website"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Place a brief description in the title of this report.
|
||||
|
||||
Thank you for taking the time to report this website issue.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Prerequisites
|
||||
options:
|
||||
- label: I [searched for any existing report](https://github.com/darkreader/darkreader/issues?q=is%3Aissue) about this website issue to avoid opening a duplicate.
|
||||
required: true
|
||||
- label: I can reproduce this website issue in a new, unmodified web browser profile with Dark Reader installed as the only extension.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Website Issue Description
|
||||
description: Provide a clear and concise description of this website issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Website Address
|
||||
description: Provide the website address.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps To Reproduce
|
||||
description: Provide steps to reproduce this website issue.
|
||||
placeholder: |
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: Add screenshots to help explain this website issue, if applicable.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Web Browser name and version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Dark Reader version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Provide any additional information about this website issue.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,92 @@
|
||||
name: Bug Report
|
||||
description: Create a report about a bug you experienced while using Dark Reader.
|
||||
title: "[Bug] Replace with title"
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Place a brief description in the title of this report.
|
||||
|
||||
Thank you for taking the time to report this bug.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Prerequisites
|
||||
options:
|
||||
- label: I [searched for any existing report](https://github.com/darkreader/darkreader/issues?q=is%3Aissue) about this bug to avoid opening a duplicate.
|
||||
required: true
|
||||
- label: I can reproduce this bug in a new, unmodified web browser profile with Dark Reader installed as the only extension.
|
||||
required: true
|
||||
- label: I understand I need to use the [Broken Website Report template](https://github.com/darkreader/darkreader/issues/new?assignees=&labels=Broken+Website&template=broken-website-report.yml&title=%5BBroken+Website%5D+Replace+with+title) if this bug I am reporting occurs on a single website.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug Description
|
||||
description: Provide a clear and concise description of this bug.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Website Address
|
||||
description: Provide the website address.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps To Reproduce
|
||||
description: Provide steps to reproduce this bug.
|
||||
placeholder: |
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: Provide a clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: Provide a clear and concise description of what happened.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: Add screenshots to help explain this bug, if applicable.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Web Browser name and version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Dark Reader version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Provide any additional information about this bug.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions
|
||||
url: https://github.com/darkreader/darkreader/discussions
|
||||
about: Ask a question about Dark Reader.
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Feature Request
|
||||
description: Create a feature request to enhance the experience using Dark Reader.
|
||||
title: "[Feature Request] Replace with title"
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Place a brief description in the title of this feature request.
|
||||
|
||||
Thank you for taking the time to create this feature request.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Prerequisites
|
||||
options:
|
||||
- label: I [searched for any existing report](https://github.com/darkreader/darkreader/issues?q=is%3Aissue) about this feature request to avoid opening a duplicate.
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Is this feature request related to a problem?
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Feature Request Description
|
||||
description: Provide a clear and concise description of this feature request with any problems and solutions.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: Add screenshots to help explain this feature request, if applicable.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Provide any additional information about this feature request.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,103 @@
|
||||
name: Performance Issue Report
|
||||
description: Create a report about a performance issue you experienced while using Dark Reader.
|
||||
title: "[Performance Issue] Replace with title"
|
||||
labels: ["Performance Issue"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Place a brief description in the title of this report.
|
||||
|
||||
Thank you for taking the time to report this performance issue.
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Prerequisites
|
||||
options:
|
||||
- label: I [searched for any existing report](https://github.com/darkreader/darkreader/issues?q=is%3Aissue) about this performance issue to avoid opening a duplicate.
|
||||
required: true
|
||||
- label: I have restarted the web browser to check if that resolved this performance issue.
|
||||
required: true
|
||||
- label: I can reproduce this performance issue in a new, unmodified web browser profile with Dark Reader installed as the only extension.
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Performance Issue Description
|
||||
description: Provide a clear and concise description of this performance issue.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Website Address
|
||||
description: Provide the website address.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps To Reproduce
|
||||
description: Provide steps to reproduce this performance issue.
|
||||
placeholder: |
|
||||
1. [First Step]
|
||||
2. [Second Step]
|
||||
3. [and so on...]
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Performance Profile
|
||||
description: Provide a link to a [Chromium](https://developer.chrome.com/docs/devtools/evaluate-performance/reference/) or [Firefox](https://profiler.firefox.com/) profile.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: Add screenshots to help explain this performance issue, if applicable.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating System
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Web Browser name and version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Dark Reader version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Does this happen when Dark Reader is disabled?
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Does this happen in other web browsers?
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Provide any additional information about this performance issue.
|
||||
validations:
|
||||
required: false
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
groups:
|
||||
github-actions:
|
||||
patterns:
|
||||
- "*"
|
||||
@@ -0,0 +1,48 @@
|
||||
name: Create binary for release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
retention_days:
|
||||
description: 'Retention duration (in days)'
|
||||
required: true
|
||||
default: '1'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build the extension
|
||||
run: npm run release
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
build/release/darkreader-*
|
||||
|
||||
- name: Upload built artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
path: build/release/darkreader-*
|
||||
retention-days: ${{ inputs.retention_days }}
|
||||
@@ -0,0 +1,123 @@
|
||||
name: Run browser tests
|
||||
|
||||
on:
|
||||
# Runs for pushes, pull requests, and manual triggers.
|
||||
# (Dooes not run when only some config is changed.)
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'src/config/*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
paths-ignore:
|
||||
- 'src/config/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_results_retention_days:
|
||||
description: 'Test results retention (in days)'
|
||||
required: true
|
||||
default: '7'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test-browser:
|
||||
name: Run browser tests
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# Extended support releases
|
||||
- channel: esr
|
||||
firefox: latest-esr
|
||||
|
||||
# Stable releases
|
||||
- channel: stable
|
||||
chrome: stable
|
||||
firefox: latest
|
||||
coverage: true
|
||||
|
||||
# Beta releases
|
||||
- channel: beta
|
||||
chrome: beta
|
||||
firefox: latest-beta
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Chrome
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: browser-actions/setup-chrome@latest
|
||||
with:
|
||||
chrome-version: ${{ matrix.chrome }}
|
||||
|
||||
- name: Configure Karma with path to Chrome executable
|
||||
if: ${{ matrix.chrome }}
|
||||
run: |
|
||||
chrome --version
|
||||
{ echo CHROME_BIN="$(which chrome)"; echo CHROME_TEST=1; } | tee -a "$GITHUB_ENV"
|
||||
|
||||
- name: Install Firefox
|
||||
if: ${{ matrix.firefox }}
|
||||
uses: browser-actions/setup-firefox@latest
|
||||
with:
|
||||
firefox-version: ${{ matrix.firefox }}
|
||||
- name: Configure Karma with path to Firefox executable
|
||||
if: ${{ matrix.firefox }}
|
||||
run: |
|
||||
firefox --version
|
||||
{ echo FIREFOX_BIN="$(which firefox)"; echo FIREFOX_TEST=1; } | tee -a "$GITHUB_ENV"
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install NPM dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Deps
|
||||
run: cat package-lock.json
|
||||
|
||||
- name: Run injection tests
|
||||
run: npm run test:inject -- --ci --json --outputFile=test-results-inject.json
|
||||
|
||||
- name: Run browser tests on Chromium MV2 build
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:chrome -- --json --outputFile=test-results-chrome.json
|
||||
|
||||
- name: Run browser tests on Chromium MV3 build
|
||||
if: ${{ matrix.chrome }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:chrome-mv3 -- --json --outputFile=test-results-chrome-mv3.json
|
||||
|
||||
- name: Run browser tests on Firefox MV2 build
|
||||
if: ${{ matrix.firefox }}
|
||||
uses: coactions/setup-xvfb@v1
|
||||
with:
|
||||
run: npm run test:firefox -- --json --outputFile=test-results-firefox-mv2.json
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-chrome-${{ matrix.chrome }}-firefox-${{ matrix.firefox }}-coverage-${{ matrix.coverage }}
|
||||
path: test-results-*
|
||||
retention-days: ${{ inputs.test_results_retention_days }}
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Run code tests on Pull Request or Push
|
||||
|
||||
on:
|
||||
# Runs for pushes and pull requests,
|
||||
# but don't run these when only some config is changed.
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths-ignore:
|
||||
- 'src/config/*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
paths-ignore:
|
||||
- 'src/config/**'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
timeout-minutes: 5
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Deps
|
||||
run: cat package-lock.json
|
||||
|
||||
- name: Lint code for code-style errors
|
||||
run: npm run lint
|
||||
|
||||
- name: Check for compatibility issues
|
||||
run: npm run lint:bundle
|
||||
|
||||
- name: Check NPM dependencies
|
||||
run: node tests/dependencies.js
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Unit tests on Pull Request or Push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_results_retention_days:
|
||||
description: 'Test results retention (in days)'
|
||||
required: true
|
||||
default: '7'
|
||||
node_version:
|
||||
description: 'NodeJS version'
|
||||
required: true
|
||||
default: '22.x'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Run tests
|
||||
timeout-minutes: 2
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Node setup
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version || '22.x' }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run test against code
|
||||
run: npm run test:unit -- --json --outputFile=test-results-unit.json
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-results-unit
|
||||
path: test-results-unit.json
|
||||
retention-days: ${{ inputs.test_results_retention_days }}
|
||||
@@ -0,0 +1,46 @@
|
||||
# Build files
|
||||
#-----------------------------------
|
||||
build/
|
||||
darkreader.js
|
||||
darkreader.mjs
|
||||
debug.log
|
||||
src/plus
|
||||
|
||||
# Node.js modules
|
||||
#-----------------------------------
|
||||
node_modules/
|
||||
|
||||
# Test results
|
||||
#-----------------------------------
|
||||
test-results-*.json
|
||||
|
||||
# Code coverage reports
|
||||
#-----------------------------------
|
||||
tests/coverage/
|
||||
tests/browser/coverage/
|
||||
tests/inject/coverage/
|
||||
coverage/
|
||||
|
||||
# IDE and editor configs
|
||||
#-----------------------------------
|
||||
.idea/
|
||||
.vscode/
|
||||
.log/
|
||||
*.code-workspace
|
||||
|
||||
# Cache files
|
||||
#-----------------------------------
|
||||
.eslintcache
|
||||
|
||||
# V8 Profiler logs
|
||||
#-----------------------------------
|
||||
isolate-*-v8.log
|
||||
|
||||
# Deno
|
||||
#-----------------------------------
|
||||
deno.lock
|
||||
deno.json
|
||||
|
||||
# System files
|
||||
#-----------------------------------
|
||||
.DS_Store
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
*
|
||||
|
||||
!darkreader.js
|
||||
!darkreader.mjs
|
||||
!index.d.ts
|
||||
Vendored
+643
@@ -0,0 +1,643 @@
|
||||
# 4.9.129 (July 14, 2026)
|
||||
|
||||
- Improved performance when handling variables references.
|
||||
- Improved image inversion, color and inline style caching.
|
||||
- Fixed high CPU usage when doing unnecessary variable matching (ChatGPT issue).
|
||||
- Fixed circular @import references.
|
||||
|
||||
# 4.9.128 (June 19, 2026)
|
||||
|
||||
- Firefox: Improved adopted style sheets handling performance.
|
||||
- Fixed high CPU usage when handling inline background image variables.
|
||||
- Firefox: Fixed saving Dev Tools changes.
|
||||
- Fixed empty background attribute handling.
|
||||
|
||||
# 4.9.127 (June 5, 2026)
|
||||
|
||||
- Fixed high CPU usage for inline style background image variables.
|
||||
|
||||
# 4.9.126 (June 3, 2026)
|
||||
|
||||
- Optimized image inversion.
|
||||
- Improved dark theme detection.
|
||||
- Chrome: Fixed affecting Picture-in-Picture mode.
|
||||
- Firefox: Fixed adopted style sheets performance (Reddit issue).
|
||||
|
||||
# 4.9.125 (April 28, 2026)
|
||||
|
||||
- Detector Hints editor in Dev Tools.
|
||||
- Per-site editors for all Dev Tools configs.
|
||||
- Dev Tool fix templates.
|
||||
- Fixed Dev Tools fixes not being applied after restart.
|
||||
- Fixed handling border "none" style values.
|
||||
- Fixed dark mode detection for raw text file content.
|
||||
- Fixed removing image sprites in light mode.
|
||||
- Fixed searching for site fixes with ports and RegExps.
|
||||
- Fixed site toggle in Firefox Nightly on Android.
|
||||
- Updated experimental design for Microsoft Edge.
|
||||
|
||||
# 4.9.124 (April 1, 2026)
|
||||
|
||||
- Fixed PDF inversion in Dynamic mode.
|
||||
- Fixed Picture-in-Picture mode icons.
|
||||
- Fixed Google Chats icons.
|
||||
- Fixed text stroke in Filter mode.
|
||||
|
||||
# 4.9.123 (March 1, 2026)
|
||||
|
||||
- Firefox: Disable white flash prevention in iframes (FF 148 issue in Google Docs, CKEditor and others).
|
||||
|
||||
# 4.9.122 (February 27, 2026)
|
||||
|
||||
- Chrome: Fixed PDF inversion in Dynamic mode.
|
||||
- Firefox: Fixed pasting text in Google Docs.
|
||||
- Improved mask image handling.
|
||||
|
||||
# 4.9.121 (February 10, 2026)
|
||||
|
||||
- Fixed sites fixes indexing.
|
||||
|
||||
# 4.9.120 (February 9, 2026)
|
||||
|
||||
- IGNORE CSS URL config property.
|
||||
- Optimized site list search.
|
||||
- Optimized fixes search.
|
||||
- Optimized color parsing.
|
||||
- Optimized PDF URL check.
|
||||
- Fixed overriding background size and position.
|
||||
- Fixed analyzing images with URL encoding.
|
||||
- Fixed analyzing SVG icons with unset size.
|
||||
|
||||
# 4.9.119 (January 14, 2026)
|
||||
|
||||
- Optimized inline style changes.
|
||||
- Support Shadow DOM created from HTML templates.
|
||||
- Fixed Google Maps satellite view.
|
||||
- Fixed SVG icons with unset size or inherited colors.
|
||||
- Fixed font element color attribute values.
|
||||
|
||||
# 4.9.118 (December 8, 2025)
|
||||
|
||||
- Improved RGB colors support in CSS variables.
|
||||
- Extended cross-origin request limitations.
|
||||
|
||||
# 4.9.117 (December 3, 2025)
|
||||
|
||||
- Improved dark theme detection.
|
||||
- Optimized SVG image analysis.
|
||||
- CSS variables support improvements.
|
||||
- Applied cross-origin request limitations.
|
||||
|
||||
# 4.9.116 (November 22, 2025)
|
||||
|
||||
- Improved dark theme detection.
|
||||
- Prevent high CPU usage due to inline style conflicts.
|
||||
- Fixed error messages in Firefox.
|
||||
- Fixed eBay buttons.
|
||||
|
||||
# 4.9.115 (November 14, 2025)
|
||||
|
||||
- Fixed eBay issue (transparent color for unresolved variables).
|
||||
- Improved dark theme detection.
|
||||
|
||||
# 4.9.114 (November 12, 2025)
|
||||
|
||||
- Fixed compatibility with Chrome 144.
|
||||
- Fixed handling CSS for deprecated media.
|
||||
- Fixed breaking on ::picker selector.
|
||||
|
||||
# 4.9.113 (November 4, 2025)
|
||||
|
||||
- Fixed processing unresolved nested CSS variables fallbacks.
|
||||
- Fixed handling same CSS rules inside different @layer rules.
|
||||
- Fixed mobile user interface in Edge.
|
||||
- Fixed Firefox build in different timezones.
|
||||
|
||||
# 4.9.112 (October 15, 2025)
|
||||
|
||||
- Fixed handling fallback values of undefined CSS variables.
|
||||
- Fixed error when Dark Reader styles were removed.
|
||||
- Simplified mobile user interface for Edge.
|
||||
- One-click activation for new UI in Edge.
|
||||
|
||||
# 4.9.110 (July 16, 2025)
|
||||
|
||||
- Fixed breaking certain websites (Bloomberg).
|
||||
- Fixed Google Maps inversion.
|
||||
|
||||
# 4.9.109 (July 7, 2025)
|
||||
|
||||
- Fixed API bundle error.
|
||||
|
||||
# 4.9.108 (July 3, 2025)
|
||||
|
||||
- Fixed crash when parsing invalid complex colors (Linkedin issue).
|
||||
- Fixed breaking when CSS @import can't be loaded.
|
||||
- Fixed compatibility with certain extensions.
|
||||
- Fixed processing background with variables defined later.
|
||||
- Detect dark theme in certain iframes.
|
||||
- Ability to hide payment messages.
|
||||
|
||||
# 4.9.106 (May 6, 2025)
|
||||
|
||||
- Google Docs: use Filter mode instead of Filter+ by default.
|
||||
- Added support for nested CSS rules.
|
||||
- Fixed duplicate CSS files requests.
|
||||
- Fixed ShadowDOM static style injection.
|
||||
- Fixed style injection causing freeze for certain websites.
|
||||
- Fixed handling "initial" CSS color value.
|
||||
|
||||
# 4.9.105 (February 25, 2025)
|
||||
|
||||
- API: Fixed breaking ES5 builds.
|
||||
|
||||
# 4.9.104 (February 19, 2025)
|
||||
|
||||
- API: ES Module bundle.
|
||||
|
||||
# 4.9.103 (February 17, 2025)
|
||||
|
||||
- Added support for more color spaces (Tailwind 4 issues).
|
||||
- Support variables in shorthand border properties of inline styles.
|
||||
- Fixed colors after style overrides were removed (Pinterest issue).
|
||||
- Fixed dark theme detection in background tabs.
|
||||
- Fixed numeric color variables.
|
||||
- Fixed same-origin CSS loading optimization.
|
||||
|
||||
# 4.9.102 (February 10, 2025)
|
||||
|
||||
- MV3: Fixed background cache performance.
|
||||
|
||||
# 4.9.101 (February 7, 2025)
|
||||
|
||||
- Fixed processing stylesheets with multiple CSS imports.
|
||||
|
||||
# 4.9.100 (January 29, 2025)
|
||||
|
||||
- Improved performace of checking available background images.
|
||||
- Optimized image analysis caching.
|
||||
- Fixed processing style sheets with incorrect imports.
|
||||
- Fixed image analysis when extension is re-enabled.
|
||||
- Fixed theme update optimization.
|
||||
|
||||
# 4.9.99 (December 13, 2024)
|
||||
|
||||
- Firefox: Fixed console error.
|
||||
|
||||
# 4.9.98 (December 13, 2024)
|
||||
|
||||
- Firefox: Fixed custom browser theme.
|
||||
|
||||
# 4.9.97 (December 10, 2024)
|
||||
|
||||
- Analyze only background images present on a web page.
|
||||
- Optimized rebuilding theme after configuration changes.
|
||||
- Cache image analysis results and CSS requests.
|
||||
- Improved relative CSS colors support.
|
||||
- Fixed handling custom CSS properties in inline SVGs.
|
||||
- Firefox: Optimized adopted style sheets workaround (Reddit issue).
|
||||
|
||||
# 4.9.96 (October 29, 2024)
|
||||
|
||||
- Dark theme detection improvements.
|
||||
- Fixed overriding styles in Shadow DOM of built-in elements.
|
||||
- Firefox: Fix breaking Microsoft Teams.
|
||||
- Prevent dark content flashes for disabled websites.
|
||||
- Fixed loading styles with imports from same domain.
|
||||
|
||||
# 4.9.95 (October 2, 2024)
|
||||
|
||||
- Fixed Google Calendar scroll bars.
|
||||
- Fixed automation panel.
|
||||
- Added links to mobile apps.
|
||||
|
||||
# 4.9.94 (September 24, 2024)
|
||||
|
||||
- API: Fixed TypeScript builds.
|
||||
- Updated experimental design for Microsoft Edge for Android.
|
||||
|
||||
# 4.9.93 (September 20, 2024)
|
||||
|
||||
- Experimental design for Microsoft Edge for Android.
|
||||
|
||||
# 4.9.92 (September 10, 2024)
|
||||
|
||||
- Detect website's dark theme by default.
|
||||
- Use Filter mode for particular websites by default (Google Docs, Microsoft Office).
|
||||
- Restored scrollbar colors.
|
||||
- Fixed breaking on default selection color.
|
||||
|
||||
# 4.9.90 (September 1, 2024)
|
||||
|
||||
- Fixed "Aw, Snap" in Google Search (Chrome and Edge on Windows).
|
||||
|
||||
# 4.9.89 (August 23, 2024)
|
||||
|
||||
- Removed www part from website URLs.
|
||||
- Enabled automation and dark theme detection by default for mobile version.
|
||||
- Fixed colors for static site fixes.
|
||||
- Apply ignored image selectors for gradients.
|
||||
|
||||
# 4.9.88 (July 11, 2024)
|
||||
|
||||
- Fixed breaking browser panels.
|
||||
|
||||
# 4.9.87 (June 27, 2024)
|
||||
|
||||
- Added link to Settings page.
|
||||
- Fixed CSS editor layout.
|
||||
- Fixed delay when opening settings.
|
||||
- Fixed warnings for protected pages.
|
||||
- Fixed conflicts with Dark Reader based scripts.
|
||||
- Improved fallback color support in CSS variables.
|
||||
- Japanese Help page translation.
|
||||
|
||||
# 4.9.86 (May 30, 2024)
|
||||
|
||||
- CSS variables performance optimizations.
|
||||
- Fixed Manifest V3 bugs.
|
||||
- Fixed loosing control over tabs after update.
|
||||
|
||||
# 4.9.85 (May 14, 2024)
|
||||
|
||||
- Bulgarian translation.
|
||||
- Improved color variables support.
|
||||
- Fixed handling styles with embedded SVGs.
|
||||
- Fixed Inversion Dev Tools.
|
||||
- Fixed inline SVG image analysis.
|
||||
- Fixed overriding icon fonts.
|
||||
|
||||
# 4.9.84 (April 25, 2024)
|
||||
|
||||
- Improved Dev Tools (per site editor).
|
||||
- Improved SVG logos analysis.
|
||||
- Improved large background image analysis.
|
||||
- Fixed IPv6 URL support.
|
||||
- Fixed Mark elements' colors.
|
||||
- Check for CSS @layer support.
|
||||
|
||||
# 4.9.83 (April 10, 2024)
|
||||
|
||||
- Reduced memory consumption.
|
||||
- Fixed iframes background colors.
|
||||
- Optimized CSS @import loading.
|
||||
|
||||
# 4.9.82 (April 5, 2024)
|
||||
|
||||
- Fixed performance issue when detecting @layer and @supports rules.
|
||||
- Improved border colors with CSS variables.
|
||||
- Leave iframes unchanged when dark theme is detected on a web page.
|
||||
|
||||
## 4.9.81 (March 29, 2024)
|
||||
|
||||
- Fixed performance degradation when computer wakes up from sleep mode.
|
||||
- Improved dark theme detection.
|
||||
- Support for CSS layers.
|
||||
- Support for color mixing functions.
|
||||
- Override author's scrollbar colors.
|
||||
- Override color-scheme CSS property.
|
||||
- Fixes for backgrounds with variable colors.
|
||||
- Dynamic mode bug fixes and performance optimizations.
|
||||
|
||||
## 4.9.80 (March 13, 2024)
|
||||
|
||||
- Analyze inline background images for root elements.
|
||||
- Support for "background" attribute.
|
||||
- Fixed performance for asynchronously resolved inline styles.
|
||||
- Fixed freezes and incorrect work on several websites.
|
||||
- Dev Tools: Formatting of CSS fixes.
|
||||
|
||||
## 4.9.79 (February 29, 2024)
|
||||
|
||||
- Use ES2020 for API bundle.
|
||||
|
||||
## 4.9.78 (February 29, 2024)
|
||||
|
||||
- Optimized Adopted Style Sheets changes handling.
|
||||
- Fixed watching for style/link element position changes.
|
||||
- Fixed processing large style elements loaded by chunks.
|
||||
- Fixed enabling the extension with a hotkey after it was disabled automatically.
|
||||
- Fixed sliders in mobile UI.
|
||||
|
||||
## 4.9.77 (February 7, 2024)
|
||||
|
||||
- Firefox: Fixed errors when Adopted Style Sheets were not present.
|
||||
- Fixed breaking on ::view-transition selectors (Airbnb issue).
|
||||
|
||||
## 4.9.76 (January 17, 2024)
|
||||
|
||||
- Improved dark theme detection.
|
||||
- Dynamic mode bug fixes.
|
||||
|
||||
## 4.9.75 (January 12, 2024)
|
||||
|
||||
- Fixed CSS variables processing in inline styles.
|
||||
- Chrome: Improved Adopted Style Sheets support (Bing AI and Copilot issues).
|
||||
- Firefox: Adopted Style Sheets support.
|
||||
- Firefox: Fixed issues with Filter+ mode.
|
||||
- Improved Constructed Style Sheets changes handling.
|
||||
|
||||
## 4.9.74 (January 3, 2024)
|
||||
|
||||
- Improved image analysis performance.
|
||||
- Improved dark theme detection.
|
||||
- Fixed 404 errors when loading images with relative paths.
|
||||
- v5 Preview: Moved settings into a separate page.
|
||||
|
||||
## 4.9.73 (December 6, 2023)
|
||||
|
||||
- Fixed URL subdomain handling.
|
||||
|
||||
## 4.9.72 (December 5, 2023)
|
||||
|
||||
- Fixed Salesforce and Excel Online issues.
|
||||
|
||||
## 4.9.71 (December 5, 2023)
|
||||
|
||||
- Improved subdomain handling in Site List.
|
||||
- Improved dark theme detection.
|
||||
- Fixed page crashes (Slack issue).
|
||||
- Fixed Site List migration.
|
||||
- Reduced image analysis memory usage.
|
||||
|
||||
## 4.9.70 (November 22, 2023)
|
||||
|
||||
- Fixed clearing site lists when synchronization is disabled.
|
||||
|
||||
## 4.9.69 (November 21, 2023)
|
||||
|
||||
- Separated Enabled and Disabled site lists.
|
||||
- Regular expressions support in Site List.
|
||||
- Fixed automation after computer waking up.
|
||||
|
||||
## 4.9.68 (November 13, 2023)
|
||||
|
||||
- Fixed incorrect CSS comment handling (Reddit issue #11583).
|
||||
- Fixed working on domains containing `constructor` part (#11877).
|
||||
|
||||
## 4.9.67 (October 1, 2023)
|
||||
|
||||
- Fixed Site List when there is any URL with port.
|
||||
|
||||
## 4.9.66 (September 25, 2023)
|
||||
|
||||
- Dynamic mode fixes.
|
||||
- UI improvements.
|
||||
|
||||
## 4.9.65 (August 7, 2023)
|
||||
|
||||
- Optimize inline style handling (fixes DuckDuckGo issue).
|
||||
- Added an option to enable/disable the extension for all websites by default.
|
||||
|
||||
## 4.9.64 (June 21, 2023)
|
||||
|
||||
- Using passive event listeners (#11047)
|
||||
- Fixed System Automation on Firefox (#10237)
|
||||
- Fixed News section.
|
||||
|
||||
## 4.9.63 (Apr 10, 2023)
|
||||
|
||||
- Site toggle panel (detect dark theme and shortcut).
|
||||
- App toggle panel (automation and shortcut).
|
||||
- Improved Site List indexing.
|
||||
|
||||
## 4.9.62 (Jan 8, 2023)
|
||||
|
||||
- Fixed a edge case with extracting color numbers, it's now able to extract `rgb(0 0 0/0.04)`. (#10565)
|
||||
- Improved IPv6 check. (#10564)
|
||||
- Faster UI loading. (#10589)
|
||||
|
||||
## 4.9.61 (Jan 2, 2023)
|
||||
|
||||
- Only invert PDFs on mail.google.com and drive.google.com, if the setting for PDF inversion has been enabled. (#10310)
|
||||
- Show in the new UI design when a page is disabled, because it's protected by the browser. (#10338)
|
||||
- Improved restoring Dark Reader elements, when the whole DOM is being overwritten. (#10372)
|
||||
|
||||
## 4.9.60 (Oct 27, 2022)
|
||||
|
||||
- Fixed broken hotkeys.
|
||||
- Improved IP v6 address support.
|
||||
|
||||
## 4.9.59 (Oct 23, 2022)
|
||||
|
||||
- Fixes a issue where `darkreader-fallback` wasn't removed from the DOM, when Dark Reader finds a `<meta name="darkreader-lock">` element.
|
||||
- Be stricter when the user specifies a last slash for a URL in the Site List.
|
||||
- Display a warning that "System" Automation might not work properly in Chromium on Linux and Kiwi on Android.
|
||||
- Workaround for Kiwi file download during settings import, fix opening Dark Reader DevTools.
|
||||
- A button to clear the Site List (v5 Preview UI).
|
||||
|
||||
## 4.9.58 (Sep 22, 2022)
|
||||
|
||||
- Remove newlines from CSS URL values, before handling them.
|
||||
- Better detection for text color property in variables.
|
||||
- es-419 (Latin America & Caribbean Spanish) translation.
|
||||
- Updates to Hebrew and Portuguese (Brazilian) translations.
|
||||
|
||||
## 4.9.57 (Aug 23, 2022)
|
||||
|
||||
- Fix iframes not getting modified when settings were changed.
|
||||
- Fixed registering system automation handlers multiple times.
|
||||
|
||||
## 4.9.56 (Aug 16, 2022)
|
||||
|
||||
- Fix browser theme not changing when automation + scheme behavior was enabled.
|
||||
|
||||
## 4.9.55 (Aug 10, 2022)
|
||||
|
||||
- Fix Google calendar.
|
||||
- Fix Opera/Vivaldi sidebar's getting modified.
|
||||
- Fix incorrect inline background colors when `mask` is explicitly disabled.
|
||||
- Fixed breaking for some old browser versions.
|
||||
|
||||
## 4.9.54 (Aug 10, 2022)
|
||||
|
||||
- Fixed System automation.
|
||||
|
||||
## 4.9.53 (Aug 9, 2022)
|
||||
|
||||
- Don't manage styles that have an empty `href` attribute.
|
||||
- Use `navigator.UserAgentData` when possible.
|
||||
- Add a `<meta name="darkreader-lock">` detector, to disable Dark Reader when detected (only dynamic theme).
|
||||
- Fix filter theme for Firefox v102+
|
||||
- Correctly open static theme editor on Mobile.
|
||||
- Migrate automation settings to its own object.
|
||||
- Correctly handle empty URL's in `background-image` property.
|
||||
- Make color parsing use cache.
|
||||
- Send updates only to affected tabs when toggling sites.
|
||||
- Fixed images with masks (Gmail icons issue).
|
||||
- Background page refactoring.
|
||||
|
||||
## 4.9.52 (June 28, 2022)
|
||||
|
||||
- Correctly handle escaped characters in CSS `url(...)` values.
|
||||
|
||||
## 4.9.51 (May 27, 2022)
|
||||
|
||||
Dynamic mode improvements:
|
||||
|
||||
- Fixed CSS imports that contain `url(...)` and end with `screen`.
|
||||
- Send network responses to correct frames in tabs.
|
||||
- Improved `calc(...)` color handling by using [Shunting Yard algorithm](https://en.wikipedia.org/wiki/Shunting_yard_algorithm).
|
||||
|
||||
New translations:
|
||||
|
||||
- Malay translation.
|
||||
- Telugu translation.
|
||||
|
||||
Other:
|
||||
|
||||
- UI improvements.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.50 (May 1, 2022)
|
||||
|
||||
- Fix working in Firefox Nightly 101.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.48 (Apr 18, 2022)
|
||||
|
||||
- Fix PDF inversion when Auto-detect dark theme option was enabled.
|
||||
- Fix Jira's background.
|
||||
- User's settings validation.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.47 (Mar 14, 2022)
|
||||
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.46 (Mar 10, 2022)
|
||||
|
||||
- v5 Preview: Auto-detect dark theme on websites.
|
||||
- v5 Preview: Option for running dark theme on hidden tabs immediately.
|
||||
- Dynamic mode bug fixes.
|
||||
- Translation improvements.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.45 (Feb 5, 2022)
|
||||
|
||||
- Revert reducing brightness for images (due to some performance issues).
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.44 (Feb 4, 2022)
|
||||
|
||||
- Dynamic mode improvements.
|
||||
- v5 preview: Ability to automate dark/light scheme.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.43 (Dec 7, 2021)
|
||||
|
||||
- Dynamic mode bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.42 (Nov 6, 2021)
|
||||
|
||||
- Fixed slow performance on some websites.
|
||||
- Fixed broken UI for some users.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.41 (Nov 5, 2021)
|
||||
|
||||
- Fixed white flash when page starts loading.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.40 (Nov 3, 2021)
|
||||
|
||||
- Dynamic mode fixes.
|
||||
- Filipino translation (thanks to @IverCoder).
|
||||
- Serbian translation (thanks to Nemanja @nebocoder).
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.39 (Oct 1, 2021)
|
||||
|
||||
- Fixed settings not being saved.
|
||||
- Fixed not working popup for some users.
|
||||
- Dynamic mode performance improvements.
|
||||
- v5 Preview design update.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.37.1 (Sep 23, 2021)
|
||||
|
||||
- Fixed error when applying settings after some time.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.36 (Sep 21, 2021)
|
||||
|
||||
- Fixed regression bugs after 4.9.35 release (hotkeys, Dev Tools, sunrise/sunset).
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.35 (Sep 19, 2021)
|
||||
|
||||
- Preparing the app for work in non-persistent background context.
|
||||
- Dynamic mode bug fixes and performance improvements.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.34 (Jul 7, 2021)
|
||||
|
||||
- Dynamic mode bug fixes and performance improvements.
|
||||
- Minor UI improvements.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.33 (May 28, 2021)
|
||||
|
||||
- Fixed disability to switch on sites in Global Dark List.
|
||||
- Bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.32 (Apr 21, 2021)
|
||||
|
||||
- Dynamic mode bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.31 (Apr 5, 2021)
|
||||
|
||||
- Fixed performance bottleneck for websites with CSS variables.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.30 (Apr 1, 2021)
|
||||
|
||||
- Improved CSS Variables support.
|
||||
- Dynamic mode bug fixes.
|
||||
- Fixed toggle shortcut keys for PDFs.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.29 (Feb 22, 2021)
|
||||
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.27 (Jan 21, 2021)
|
||||
|
||||
- Dynamic mode improvements.
|
||||
- Thunderbird support.
|
||||
- Users' fixes for websites.
|
||||
- Users' translation improvements.
|
||||
|
||||
## 4.9.26 (Nov 26, 2020)
|
||||
|
||||
- Dynamic mode bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.25 (Nov 25, 2020)
|
||||
|
||||
- Dynamic mode bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.24 (Nov 19, 2020)
|
||||
|
||||
- Dynamic mode fixes and performance improvements.
|
||||
- Updates for Dutch translation.
|
||||
- Users' fixes for websites.
|
||||
- Reduced assets size.
|
||||
|
||||
## 4.9.23 (Oct 26, 2020)
|
||||
|
||||
- Fixed missing images on some websites.
|
||||
|
||||
## 4.9.22 (Oct 26, 2020)
|
||||
|
||||
- Fixed high CPU usage caused by conflict with some websites.
|
||||
- Dynamic mode bug fixes.
|
||||
- Users' fixes for websites.
|
||||
|
||||
## 4.9.21 (Sep 26, 2020)
|
||||
|
||||
- Fixed wrongly displaying pages where the extension is disabled.
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
darkreaderapp@gmail.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/inclusion).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
<https://www.contributor-covenant.org/faq>. Translations are available at
|
||||
<https://www.contributor-covenant.org/translations>.
|
||||
+262
@@ -0,0 +1,262 @@
|
||||
<h2 align="center">Contributions</h2>
|
||||
|
||||
<p align="center">You can contribute to and help Dark Reader in many ways. Continue reading to learn how, and thank you in advance!</p>
|
||||
|
||||
## Sponsor
|
||||
|
||||
<a href="https://opencollective.com/darkreader/donate" target="_blank" rel="noreferrer noopener"> <img src="https://opencollective.com/darkreader/donate/button@2x.png?color=blue" width=300 /></a>
|
||||
|
||||
Please sponsor the development of Dark Reader.
|
||||
|
||||
## Translation
|
||||
|
||||
[Improve or suggest](https://github.com/darkreader/darkreader/tree/main/src/_locales) a translation. See the list of [language codes](https://developer.chrome.com/webstore/i18n#localeTable) that we can support.
|
||||
|
||||
## Disabling Dark Reader on your site
|
||||
|
||||
Website pages can request Dark Reader to disable itself by embedding a "Dark Reader lock". The "lock" is a `<meta>` tag with `name` attribute set to `darkreader-lock` which is a child of `<head>` tag in the document.
|
||||
|
||||
### Disabling Dark Reader statically
|
||||
|
||||
Add `<meta name="darkreader-lock">` within your HTML document in `<head>` like so:
|
||||
```html
|
||||
<head>
|
||||
<meta name="darkreader-lock">
|
||||
</head>
|
||||
```
|
||||
|
||||
### Disabling Dark Reader dynamically
|
||||
|
||||
Add the "lock" dynamically like so (assuming browser already parsed enough of the document to create a `head` attribute):
|
||||
```js
|
||||
const lock = document.createElement('meta');
|
||||
lock.name = 'darkreader-lock';
|
||||
document.head.appendChild(lock);
|
||||
```
|
||||
|
||||
## Adding a website that is already dark
|
||||
|
||||
If a website is **already dark** and meets the following requirements:
|
||||
|
||||
- The entire website - including all subpages - is dark by default, regardless of the system's preferred color scheme.
|
||||
- The URL is the actual website address. No redirects of any kind are allowed.
|
||||
- The website is complete and finished. Any website in the design or development phase or any other incomplete status is not permitted. These statuses can include any placeholder web pages or verbiage about coming soon, the website being under construction, the website having moved, etc.
|
||||
|
||||
Then you can **add it to the [dark-sites.config](https://github.com/darkreader/darkreader/blob/main/src/config/dark-sites.config) file**.
|
||||
|
||||
**Please maintain the alphabetical order of the websites listed in this file.**
|
||||
|
||||
## Fixing incorrect inversions
|
||||
|
||||
If any **element** on a web page is **not inverted or styled correctly**, you can fix it by specifying the appropriate [**CSS selector**](https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors). Use the [**dynamic-theme-fixes.config**](https://github.com/darkreader/darkreader/blob/main/src/config/dynamic-theme-fixes.config) file for Dynamic Theme mode and the [**inversion-fixes.config**](https://github.com/darkreader/darkreader/blob/main/src/config/inversion-fixes.config) file for Filter and Filter+ modes.
|
||||
|
||||
**Please maintain the alphabetical order of the websites listed, use short selectors, and preserve the code style in these files.**
|
||||
|
||||
You can learn how to create a fix for the appropriate Dark Reader mode below.
|
||||
|
||||
## How to use the Dev Tools
|
||||
|
||||
Dark Reader includes its own developer tools, allowing easier modification of its rules and quicker previews. The Dev Tools help you **fix minor issues** on a web page. These can include a dark icon on a dark background, removing a bright background, adding a white background to a transparent image, etc.
|
||||
|
||||
Common use cases:
|
||||
|
||||
In **Dynamic mode**, if the page looks partially dark and bright, it is considered a bug. Individual elements or containers might need to be tweaked.
|
||||
|
||||
In **Filter mode**, it is a common practice to invert elements on the page that are already dark.
|
||||
|
||||
The Dev Tools can help you fix these and other rule bugs.
|
||||
|
||||
### Navigating to the Dark Reader Dev Tools
|
||||
|
||||
#### Video walkthrough:
|
||||
https://github.com/user-attachments/assets/76a5d9bc-7553-4e50-acf5-5a9051cec152
|
||||
|
||||
#### Step-by-step instructions:
|
||||
- Open **Chrome Dev Tools** (`F12`) in Chrome or "Inspector" (`Ctrl+Shift+C`) in Firefox.
|
||||
- Click on **element picker** (top-left corner). It is enabled automatically in Firefox.
|
||||
- Pick an incorrectly inverted element.
|
||||
- Choose a **[selector](https://developer.mozilla.org/docs/Web/CSS/CSS_Selectors)** for that element or all similar elements (for example, if it has `class="icon small"`, the selector may look like `.icon`).
|
||||
- Click the **Dark Reader icon** to open the extension's popup window.
|
||||
- Switch to the **More** tab.
|
||||
- Click the **⛭ All settings** button at the bottom.
|
||||
- Switch to the **Advanced** section on the left.
|
||||
- Click the **🛠️ Dev tools** button at the bottom.
|
||||
- (Optional but helpful) Switch to the **Per Site Editor** tab at the bottom and type in the domain name you wish to update or add.
|
||||
- Edit or add a block containing the URL and selectors to invert, using the [rules below](#editor--rule-syntax).
|
||||
- Click **Apply**.
|
||||
- Check how the site looks both in **Light** and **Dark** modes.
|
||||
- If the **fix works**, open **[dynamic-theme-fixes.config](https://github.com/darkreader/darkreader/blob/main/src/config/dynamic-theme-fixes.config)** or **[inversion-fixes.config](https://github.com/darkreader/darkreader/blob/main/src/config/inversion-fixes.config)**.
|
||||
- Click **Edit** (requires being logged in to GitHub).
|
||||
- **Insert your fix** there (copying and pasting it from the Dev Tools). Preserve **alphabetic order** by URL.
|
||||
- Provide a **short description** of what you have done.
|
||||
- Click **Propose file change**.
|
||||
- Review your changes. Click **Create pull request**.
|
||||
- Once you create the pull request, GitHub Actions will run tests behind the scenes to ensure your submission has the right code style. This will take a few minutes.
|
||||
- If you see a **red cross**, click **Details** to see what is wrong and edit the existing Pull Request.
|
||||
- When you see a **green checkmark**, then everything is fine.
|
||||
- A Dark Reader developer will **review** and merge your changes, making them available to all Dark Reader users.
|
||||
|
||||
|
||||
## Editor & Rule Syntax
|
||||
|
||||
```CSS
|
||||
dynamic-theme-fixes.config
|
||||
================================
|
||||
|
||||
example.com
|
||||
|
||||
INVERT
|
||||
.icon
|
||||
|
||||
CSS
|
||||
.wrong-element-colors {
|
||||
background-color: ${white} !important;
|
||||
color: ${black} !important;
|
||||
}
|
||||
|
||||
IGNORE INLINE STYLE
|
||||
.color-picker
|
||||
|
||||
IGNORE IMAGE ANALYSIS
|
||||
.logo
|
||||
```
|
||||
|
||||
### URL
|
||||
|
||||
The fix starts with the domain name, like `example.com`. The `www` part should be ommited.
|
||||
|
||||
If the fix affects a particular subdomain, this exact subdomain should be specified like `sub.domain.com`.
|
||||
|
||||
Some websites have different top level domains depending on the user's location. A `*` can be used like `example.*`.
|
||||
|
||||
If the same fix applies to a website (or similar websites) that can have multiple domain names or subdomains,
|
||||
they can be listed on separate lines, starting with the most popular one:
|
||||
```
|
||||
example.com
|
||||
sub.example.com
|
||||
example.mirror.com
|
||||
```
|
||||
|
||||
The use of `*` wildcard is discouraged; it can only be used as the last resort.
|
||||
|
||||
For
|
||||
|
||||
| Rule | Description | Notes / Examples |
|
||||
|---|---|---|
|
||||
| **INVERT** | Inverts specified elements. | **Dynamic Mode**: INVERT only for dark images that are invisible on dark backgrounds. |
|
||||
| **CSS** | Adds custom CSS to a web page. | `!important` keyword should be specified for each CSS property to prevent overrides by other stylesheets.<br>**Dynamic mode** supports `${COLOR}` template, where `COLOR` is a color value before the inversion. <br>*Example*: `${white}` will become `${black}` in dark mode. |
|
||||
| **IGNORE INLINE STYLE** | Prevents inline style analysis of matched elements. | *Example*: `<p style="color: red">` element's style attribute will not be changed. |
|
||||
| **IGNORE IMAGE ANALYSIS** | Prevents background images from being analyzed for matched selectors. | |
|
||||
|
||||
## Dynamic variables
|
||||
|
||||
When making a fix for background or text colors, instead of using hardcoded colors (like `#fff`, `#000`, `black` or `white`), please use CSS variables that are generated based on the user's settings:
|
||||
|
||||
```CSS
|
||||
dynamic-theme-fixes.config
|
||||
================================
|
||||
example.com
|
||||
|
||||
CSS
|
||||
.logo {
|
||||
background-color: var(--darkreader-neutral-background) !important;
|
||||
}
|
||||
.footer > p {
|
||||
color: var(--darkreader-neutral-text) !important;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Here is a full table of available CSS variables:
|
||||
|
||||
| Variable | Description | Use |
|
||||
|---|---|---|
|
||||
| **`--darkreader-neutral-background`** | Neutral background color that <br>corresponds to the user's settings. | Mostly used for elements that have <br>the wrong background color. |
|
||||
| **`--darkreader-neutral-text`** | Neutral text color that <br>corresponds to the user's settings. | Used for elements with the wrong text color. |
|
||||
| **`--darkreader-selection-background`** | The background color setting <br>defined by the user. | The user's Background Color setting. |
|
||||
| **`--darkreader-selection-text`** | The text color setting <br>defined by the user. | The user's Text Color setting. |
|
||||
|
||||
## Fixes for Filter and Filter+ mode
|
||||
|
||||
```CSS
|
||||
inversion-fixes.config
|
||||
================================
|
||||
|
||||
example.com
|
||||
|
||||
INVERT
|
||||
.icon
|
||||
.button
|
||||
#player
|
||||
|
||||
NO INVERT
|
||||
#player *
|
||||
|
||||
REMOVE BG
|
||||
.bg-photo
|
||||
|
||||
CSS
|
||||
.overlay {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
```
|
||||
|
||||
- Filter and Filter+ work by inverting the entire web page and reverting necessary elements (images, videos, etc.) listed in the `INVERT` section.
|
||||
- If an inverted element contains images or other content that becomes incorrectly displayed, use the `NO INVERT` rule.
|
||||
- `REMOVE BG` removes the background image from an element and forces a black background.
|
||||
|
||||
## Adding new features or fixing bugs
|
||||
|
||||
If you would like to **add a new feature** to Dark Reader or **fix a bug**, please **submit an issue** in GitHub (if there is no existing one), **discuss** it with active contributors, and wait for **approval**.
|
||||
|
||||
To build and debug the extension, **install the [Node.js](https://nodejs.org/)** LTS version.
|
||||
Install development dependencies by running `npm install` in the project's root folder.
|
||||
Then execute `npm run debug`.
|
||||
|
||||
#### Chrome and Edge
|
||||
|
||||
- Open the `chrome://extensions` page.
|
||||
- Disable the official Dark Reader version.
|
||||
- Enable the **Developer mode**.
|
||||
- Click **Load unpacked extension** button.
|
||||
- Navigate to the project's `build/debug/chrome` folder.
|
||||
|
||||
#### Firefox
|
||||
|
||||
- Open the `about:addons` page.
|
||||
- Disable the official Dark Reader version.
|
||||
- Open the `about:debugging#addons` page.
|
||||
- Click the **Load Temporary Add-on** button.
|
||||
- Open the `build/debug/firefox/manifest.json` file.
|
||||
|
||||
If you execute `npm run debug:watch` instead of `npm run debug`, it will automatically recompile the extension after making any code changes.
|
||||
|
||||
## Rules and recommendations
|
||||
|
||||
If a change requires more than **10 lines of code**,
|
||||
please submit an issue on GitHub (if there is no existing one),
|
||||
and **discuss your solution and approach** with active contributors,
|
||||
before performing further changes.
|
||||
|
||||
**Keep the changes simple**.
|
||||
Please use as little code as possible.
|
||||
A single pull request should have a single purpose.
|
||||
|
||||
**Low effort contributions** are not allowed.
|
||||
A contributor should ensure the changes work and solve a real problem.
|
||||
|
||||
Code changes predominantly **generated with AI are not allowed**.
|
||||
All comments and conversations must be held by humans.
|
||||
|
||||
**The following changes are STRICTLY FORBIDDEN**
|
||||
- adding external dependencies
|
||||
- changing the build process
|
||||
- modifying `package.json` and `package-lock.json`
|
||||
|
||||
You can use any text editor or web IDE (for example, [Visual Studio Code](https://code.visualstudio.com/) or [WebStorm](https://www.jetbrains.com/webstorm/)) to edit the code.
|
||||
|
||||
**Please preserve the code style** (e.g. whitespaces). It can be performed automatically by executing `npm run code-style`.
|
||||
|
||||
Run tests by executing `npm test` to verify your changes will pass.
|
||||
|
||||
If your code is ready to be reviewed and merged, please submit a **pull request** and wait for a **review**.
|
||||
Vendored
+225
@@ -0,0 +1,225 @@
|
||||
<p align="center"><a href="https://darkreader.org" target="_blank" rel="noreferrer noopener"><img width="250" alt="Dark Reader's mascot" src="https://raw.githubusercontent.com/darkreader/darkreader.github.io/master/images/darkreader-mascot.svg"></a></p>
|
||||
<p align="center">Dark Reader <strong>analyzes</strong> web pages and aims to <strong>reduce eyestrain</strong> while browsing the web.</p>
|
||||
<br/>
|
||||
<p align="center"><a rel="noreferrer noopener" href="https://chromewebstore.google.com/detail/dark-reader/eimadpbcbfnmbkopoojfekhnkhdbieeh"><img alt="Chrome Web Store" src="https://img.shields.io/badge/Chrome-141e24.svg?&style=for-the-badge&logo=google-chrome&logoColor=white"></a> <a rel="noreferrer noopener" href="https://addons.mozilla.org/firefox/addon/darkreader/"><img alt="Firefox Add-ons" src="https://img.shields.io/badge/Firefox-141e24.svg?&style=for-the-badge&logo=firefox-browser&logoColor=white"></a> <a rel="noreferrer noopener" href="https://darkreader.org/safari/"><img alt="Apple App Store" src="https://img.shields.io/badge/Safari-141e24.svg?&style=for-the-badge&logo=safari&logoColor=white"></a> <a rel="noreferrer noopener" href="https://microsoftedge.microsoft.com/addons/detail/dark-reader/ifoakfbpdcdoeenechcleahebpibofpc/"><img alt="Edge Addons" src="https://img.shields.io/badge/Edge-141e24.svg?&style=for-the-badge&logo=microsoft-edge&logoColor=white"></a> <a el="noreferrer noopener" href="https://addons.thunderbird.net/thunderbird/addon/darkreader"><img alt="Thunderbird" src="https://img.shields.io/badge/Thunderbird-141e24.svg?&style=for-the-badge&logo=thunderbird&logoColor=white"></a>
|
||||
|
||||
<h2 align="center">Dark Reader</h2>
|
||||
<br/>
|
||||
<p align="center">Dark Reader is an <strong>open-source</strong> MIT-licensed <strong>browser extension</strong> designed to analyze web pages. Dark Reader will generate a dark mode that aims to <strong>reduce the eyestrain</strong> of the user. Dark Reader is <strong>feature-rich</strong> and is customizable in many ways throughout the UI.</p>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
## Questions
|
||||
|
||||
Most questions can be answered by reading the [help page](https://darkreader.org/help/).
|
||||
If the help page doesn't answer your question, open up a new [discussion](https://github.com/darkreader/darkreader/discussions).
|
||||
|
||||
## How to contribute
|
||||
|
||||
Read more about contributing to Dark Reader in [CONTRIBUTING.md](https://github.com/darkreader/darkreader/blob/main/CONTRIBUTING.md).
|
||||
|
||||
## Building for use
|
||||
|
||||
Dark Reader build script requires a JavaScript runtime, either NodeJS or Deno. We recommend using NodeJS, Deno support is experimental.
|
||||
|
||||
### Building with NodeJS
|
||||
|
||||
You can install the extension from a file.
|
||||
Install [Node.js](https://nodejs.org/) (we recommend LTS or higher, but any version at or above 15 will work). Download the source code (or check out from git).
|
||||
Open the terminal in the root folder and run:
|
||||
|
||||
- `npm install`
|
||||
- `npm run build` or `npm run build [-- flags]`
|
||||
|
||||
This will create a `build/release/darkreader-chrome.zip` file for use in a Chromium-based browser and a `build/release/darkreader-firefox.xpi` file for use in Firefox.
|
||||
|
||||
You can customize the build process by passing flags to build script. To see all flags, run `npm run build -- --help`.
|
||||
|
||||
### Building with Deno
|
||||
|
||||
You can build Dark Reader with an alternative runtime called [Deno](https://deno.land/). For this run `deno:bootstrap` script (e.g., via `npm run deno:bootstrap` or manually copy the command from `package.json`). Then run the same commands described above.
|
||||
|
||||
Please note that if you encounter the error `Too many open files (os error 24)`, then you should use the newer version of Deno (preferably built from source or canary).
|
||||
|
||||
### Bundling with official Firefox store signatures (experimental)
|
||||
|
||||
Before publication, extension stores provide digital signatures for extensions. These digital signatures certify the integrity of the archive (that the extension bundle did not get corrupted or bit-rotted) and that the extension store performed very basic extension validation.
|
||||
|
||||
Dark Reader repository contains these digital signatures and you can add them to the extension bundle. The following will build Dark Reader for Firefox version 4.9.63:
|
||||
```
|
||||
npm run build -- --firefox --version=4.9.63
|
||||
```
|
||||
|
||||
Please note that only Firefox Add-ons store signatures are present in the repository right now. Also, due to NodeJS and TypeScript version compatibility, one might have to first check out the old revision (commit), then build the extension files, then check out the recent commit and create the bundle (by running only `signature` and `zip` steps).
|
||||
|
||||
## Using Dark Reader on a website
|
||||
|
||||
You can use Dark Reader to enable dark mode on your website!
|
||||
|
||||
- Install the package from NPM (`npm install darkreader`)
|
||||
- or build from the source code (`npm run api`)
|
||||
- or include the script via a CDN such as [unpkg](https://unpkg.com/darkreader/) or [jsDelivr](https://www.jsdelivr.com/package/npm/darkreader)
|
||||
|
||||
Then you can use the following code to control Dark Reader's API:
|
||||
```javascript
|
||||
DarkReader.enable({
|
||||
brightness: 100,
|
||||
contrast: 90,
|
||||
sepia: 10
|
||||
});
|
||||
|
||||
DarkReader.disable();
|
||||
|
||||
// Enable when the system color scheme is dark.
|
||||
DarkReader.auto({
|
||||
brightness: 100,
|
||||
contrast: 90,
|
||||
sepia: 10
|
||||
});
|
||||
|
||||
// Stop watching for the system color scheme.
|
||||
DarkReader.auto(false);
|
||||
|
||||
// Get the generated CSS of Dark Reader returned as a string.
|
||||
const CSS = await DarkReader.exportGeneratedCSS();
|
||||
|
||||
// Check if Dark Reader is enabled.
|
||||
const isEnabled = DarkReader.isEnabled();
|
||||
```
|
||||
|
||||
... or if you are using ES modules:
|
||||
|
||||
```javascript
|
||||
import {
|
||||
enable as enableDarkMode,
|
||||
disable as disableDarkMode,
|
||||
auto as followSystemColorScheme,
|
||||
exportGeneratedCSS as collectCSS,
|
||||
isEnabled as isDarkReaderEnabled
|
||||
} from 'darkreader';
|
||||
|
||||
enableDarkMode({
|
||||
brightness: 100,
|
||||
contrast: 90,
|
||||
sepia: 10,
|
||||
});
|
||||
|
||||
disableDarkMode();
|
||||
|
||||
followSystemColorScheme();
|
||||
|
||||
const CSS = await collectCSS();
|
||||
|
||||
const isEnabled = isDarkReaderEnabled();
|
||||
```
|
||||
|
||||
Be aware that Dark Reader will add the `chrome` object onto the `window` object. These are to stub certain functions that the code will use. They originate from the webextension-api.
|
||||
|
||||
## Site fixes
|
||||
|
||||
Automatically syncing the site fixes for every Dark Reader user was disabled because the GitHub team does not allow using GitHub as a content delivery network (CDN). The storage of these files would be expensive, and making requests to other resources would look suspicious. Each new release of Dark Reader will include the new changes.
|
||||
|
||||
However, this can be manually enabled with the following steps:
|
||||
|
||||
1. Click on the Dark Reader extension icon.
|
||||
2. Click on the `Dev tools` button (in the bottom-right corner).
|
||||
3. Go to `Advanced` and click on the `Preview new design` button.
|
||||
4. Close the developer tools window and click on the Dark Reader extension icon again.
|
||||
5. Go to `Settings` -> `Advanced` and enable the `Synchronize sites fixes` setting.
|
||||
|
||||
To force a synchronization of the sites fixes (when the corresponding setting is enabled), perform the following steps:
|
||||
|
||||
1. Click on the Dark Reader extension icon.
|
||||
2. Go to `Settings` -> `Advanced` -> `Dev tools`.
|
||||
3. For each "Editor" section, click on `Reset changes`, confirm with `OK`, and then click on `Apply`. Afterwards, close the developer tools window and reload the desired page(s).
|
||||
|
||||
## Enable Dark Reader on restricted pages on Mozilla Firefox
|
||||
|
||||
By default, Dark Reader does not work on some websites due to **security restrictions** enforced by Mozilla.
|
||||
|
||||
The following instructions will guide you on how to disable those restrictions.
|
||||
|
||||
**Proceed with caution. This exposes you to a security risk if you do not know what you are doing.**
|
||||
|
||||
**Be sure that you do not have any suspicious or malicious-looking extension installed before proceeding.**
|
||||
|
||||
**These settings will apply to all extensions, and not just Dark Reader.**
|
||||
|
||||
Step 1: change Dark Reader's settings.
|
||||
|
||||
1. Click on the Dark Reader extension icon.
|
||||
2. Click on the `Dev tools` button (in the bottom-right corner).
|
||||
3. Go to `Advanced` and click on the `Preview new design` button.
|
||||
4. Close the developer tools window and click on the Dark Reader extension icon again.
|
||||
5. Go to `Settings` -> `Advanced` and enable the `Enable on restricted pages` setting.
|
||||
|
||||
Step 2: change Firefox's settings.
|
||||
|
||||
- Type `about:config` in the address bar and press Enter.
|
||||
- A warning page may appear. Click `Accept the Risk and Continue` to proceed.
|
||||
- Search for and set `extensions.webextensions.restrictedDomains` to an empty value (if the preference does not exist, create it with `String` as the type).
|
||||
- Set `privacy.resistFingerprinting.block_mozAddonManager` to `true` (if the preference does not exist, create it with `Boolean` as the type).
|
||||
|
||||
After changing the necessary settings for both Dark Reader and Firefox, reload the desired page(s).
|
||||
|
||||
**If you had previously changed any of the following preferences, please reset them to their default values as they are only related to security and are not necessary for Dark Reader to work on restricted websites.**
|
||||
To reset them, click on the reset (or delete icon, if present) icon at the most-right corner of the preference line in `about:config`.
|
||||
- `extensions.webextensions.addons-restricted-domains@mozilla.com.disabled`
|
||||
- `extensions.quarantinedDomains.enabled`
|
||||
- `extensions.quarantinedDomains.list`
|
||||
|
||||
### Clarification about quarantined domains ("Run on sites with restrictions" option)
|
||||
<details><summary>Quarantined domains and Dark Reader — an explanation</summary>
|
||||
|
||||
The option "Run on sites with restrictions", present for some extensions, is only related to quarantined domains and is not needed for Dark Reader to work on restricted websites. In the context of Firefox's source code, "restricted domains" and "quarantined domains" are two separate things.
|
||||
|
||||
**The "restricted domains" list** (controlled by the preference `extensions.webextensions.restrictedDomains`) is the same for all users. It will restrict *all* user-installed extensions (without exceptions) from running on the specified websites. The list is controlled by Mozilla, and, as of December 2024, the list only contains Mozilla-owned domains. Sites that are not on that list will not be affected by those restrictions (meaning that the extensions will be able to run normally).
|
||||
|
||||
**The "quarantined domains" list** (controlled by the preferences `extensions.quarantinedDomains.enabled` and `extensions.quarantinedDomains.list`) contains domains that will run extensions normally, but if Firefox detects suspicious activity from a particular extension it will block that extension on those specific websites. The list is controlled by Mozilla, and, as of December 2024, the list only contains domains related to Internet banking in Brazil. For more information about quarantined domains, see "[Why are some add-ons not allowed on sites restricted by Mozilla?](https://support.mozilla.org/en-US/kb/quarantined-domains)".
|
||||
|
||||
For Dark Reader, the option "Run on sites with restrictions" is not shown because Dark Reader is a [Recommended](https://support.mozilla.org/en-US/kb/recommended-extensions-program) extension by Mozilla. (The "Recommended" status is only relevant for "quarantined domains", and does not affect "restricted domains".)
|
||||
|
||||
The fact that it is a Recommended extension means that it meets the "highest standards of security, functionality, and user experience". The quarantined domains are only related to extension security. Because Dark Reader is considered secure by Mozilla, that option is not shown, meaning **it will always run even on quarantined domains** (but will still obey the "restricted domains" list if it is not empty).
|
||||
|
||||
Regarding quarantined domains specifically, there is this [comment from Firefox's source code](https://searchfox.org/mozilla-central/rev/1838f847aa3bf909c3d34a94a8f0cd7e37fca086/toolkit/components/extensions/Extension.sys.mjs#3470-3471):
|
||||
|
||||
```
|
||||
// Privileged extensions and any extensions with a recommendation state are
|
||||
// exempt from the quarantined domains.
|
||||
```
|
||||
|
||||
A simple way to recapitulate all this information is: "restricted domains" exist to protect Mozilla-owned sites (no user-installed extension will run on them, without exceptions), while "quarantined domains" are meant to protect users from malicious extensions (and it doesn't apply to Dark Reader because it is a Recommended extension).
|
||||
|
||||
</details>
|
||||
|
||||
<h2 align="center">Contributors</h2>
|
||||
<br/>
|
||||
<h3 align="center"><strong>Thank you to all our contributors! Dark Reader exists thanks to you.</strong></h3>
|
||||
<br/>
|
||||
<br/>
|
||||
<p align="center"><a rel="noreferrer noopener" href="https://github.com/darkreader/darkreader/graphs/contributors/"><img src="https://opencollective.com/darkreader/contributors.svg?width=890&button=false"/></a></p>
|
||||
|
||||
<h2 align="center">Backers</h2>
|
||||
<br/>
|
||||
<h3 align="center"><strong>Thank you to all our generous backers! </strong>Support Dark Reader by <a rel="noreferrer noopener" href="https://opencollective.com/darkreader" target="_blank">becoming a backer</a>.</h3>
|
||||
<br/>
|
||||
<br/>
|
||||
<p align="center"><a rel="noreferrer noopener" href="https://opencollective.com/darkreader#backers" target="_blank"><img src="https://opencollective.com/darkreader/backers.svg?width=890&limit=1000"></a></p>
|
||||
|
||||
<h2 align="center">Sponsors</h2>
|
||||
<p>Does your company use Dark Reader? Please ask your manager or the marketing team if your company would be interested in supporting our project. Your support will allow the maintainers to dedicate more time to maintenance and creating new features for everyone. Also, your company's logo will show on <a rel="noreferrer noopener" href="https://github.com/darkreader/darkreader#sponsors" target="_blank">GitHub</a>. Who doesn't want a little extra exposure? <a rel="noreferrer noopener" href="https://opencollective.com/darkreader" target="_blank">Here's the info</a>.</p>
|
||||
|
||||
<h3 align="center"><strong>Thank you to all our wonderful sponsors!</strong></h3>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/0/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/1/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/2/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/3/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/4/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/5/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/6/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/7/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/8/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/9/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/darkreader/sponsor/10/website" target="_blank" rel="noreferrer noopener"><img src="https://opencollective.com/darkreader/sponsor/10/avatar.svg"></a>
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
# Security Policy
|
||||
|
||||
Any security vulnerability discovered in Dark Reader will be fixed as soon as possible with as minimal impact as possible when reported.
|
||||
|
||||
Please ensure you are always running the [latest version available](https://github.com/darkreader/darkreader/releases).
|
||||
|
||||
Some web browser extension stores may have an older version currently published.
|
||||
|
||||
## Security Vulnerability Report
|
||||
|
||||
If you have discovered a security vulnerability, please email us at <darkreaderapp@gmail.com> immediately.
|
||||
@@ -0,0 +1,51 @@
|
||||
This _small_ document to outline the specification of the src/config/color-schemes.drconf
|
||||
which doesn't really follow the standard for other files.
|
||||
|
||||
Spec:
|
||||
- A section is a unique defined colorscheme following the syntax rules.
|
||||
- The file must begin with a section, with the name of "Default" which has both a light and dark variant.
|
||||
- A separator must be placed between new sections, the separator is `'='.repeat(32)`.
|
||||
- A new line must be placed before and after the separator.
|
||||
- All but not the first section should start with a new line(this is the same new line after the separator).
|
||||
- The first keyword in the section(after the possible new line) should be a unique colorscheme name.
|
||||
- After 2 new lines of the first keyword should either be "DARK" or "LIGHT", at least 1 variant should be defined.
|
||||
- If a color scheme has both variants the order should start with "DARK" and then "LIGHT" for consistency.
|
||||
- Within the variants a background color and text color can be defined, both are required.
|
||||
- The syntax of defining background-color and text color should be `{background,text}: #6-or-3-length-hex-color` each on a new line.
|
||||
- The order should start with background-color and then text color for consistency.
|
||||
- The parser will, if found, return the first error, not all of them.
|
||||
- The file always ends with a new line.
|
||||
|
||||
|
||||
Example:
|
||||
```
|
||||
Default
|
||||
|
||||
DARK
|
||||
background: #181a1b
|
||||
text: #e8e6e3
|
||||
|
||||
LIGHT
|
||||
background: #181a1b
|
||||
text: #e8e6e3
|
||||
|
||||
================================
|
||||
|
||||
Dracula
|
||||
|
||||
DARK
|
||||
background: #282b36
|
||||
|
||||
================================
|
||||
|
||||
Nord
|
||||
|
||||
DARK
|
||||
background: #2e3440
|
||||
text: #eceff4
|
||||
|
||||
LIGHT
|
||||
background: #eceff4
|
||||
text: 3b4252
|
||||
|
||||
```
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @type {{[ruleName: string]: import('eslint').Rule.RuleModule}}
|
||||
*/
|
||||
export const localRules = {
|
||||
'jsx-uses-m-pragma': {
|
||||
create(context) {
|
||||
const pragma = 'm';
|
||||
const usePragma = () => context.markVariableAsUsed(pragma);
|
||||
return {
|
||||
JSXOpeningElement: usePragma,
|
||||
JSXOpeningFragment: usePragma,
|
||||
};
|
||||
},
|
||||
},
|
||||
'jsx-uses-vars': {
|
||||
create(context) {
|
||||
return {
|
||||
/**
|
||||
* @param {{ name: any; }} node
|
||||
*/
|
||||
JSXOpeningElement(node) {
|
||||
let variable;
|
||||
const jsxTag = node.name;
|
||||
if (jsxTag.type === 'JSXIdentifier') {
|
||||
variable = jsxTag.name;
|
||||
} else if (jsxTag.type === 'JSXMemberExpression') {
|
||||
variable = jsxTag.object.name;
|
||||
} else {
|
||||
console.warn('Unsupported JSX identifier', jsxTag);
|
||||
}
|
||||
context.markVariableAsUsed(variable);
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
+265
@@ -0,0 +1,265 @@
|
||||
// @ts-check
|
||||
|
||||
import {fixupPluginRules} from '@eslint/compat';
|
||||
import eslint from '@eslint/js';
|
||||
import stylistic from '@stylistic/eslint-plugin';
|
||||
import * as eslintPluginCompat from 'eslint-plugin-compat';
|
||||
import * as eslintPluginImport from 'eslint-plugin-import';
|
||||
import globals from 'globals';
|
||||
import tslint from 'typescript-eslint';
|
||||
import {localRules} from './eslint-plugin-local.js';
|
||||
|
||||
export default tslint.config({
|
||||
files: [
|
||||
'**/*.js',
|
||||
'**/*.ts',
|
||||
'**/*.tsx',
|
||||
],
|
||||
ignores: [
|
||||
'build/**',
|
||||
'darkreader.js',
|
||||
'darkreader.mjs',
|
||||
'node_modules/**',
|
||||
'tests/coverage/**',
|
||||
'**/compatibility.js',
|
||||
],
|
||||
extends: [
|
||||
eslint.configs.recommended,
|
||||
tslint.configs.recommended,
|
||||
eslintPluginImport.flatConfigs?.recommended,
|
||||
eslintPluginImport.flatConfigs?.typescript,
|
||||
],
|
||||
plugins: {
|
||||
'@stylistic': stylistic,
|
||||
local: fixupPluginRules({
|
||||
rules: localRules,
|
||||
}),
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
},
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'array-bracket-spacing': ['error', 'never'],
|
||||
'arrow-parens': ['error', 'always'],
|
||||
'block-spacing': ['error', 'always'],
|
||||
'brace-style': 'error',
|
||||
'comma-spacing': 'error',
|
||||
curly: 'error',
|
||||
'eol-last': ['error', 'always'],
|
||||
eqeqeq: ['error', 'smart'],
|
||||
|
||||
indent: ['error', 4, {
|
||||
SwitchCase: 1,
|
||||
}],
|
||||
|
||||
'jsx-quotes': ['error', 'prefer-double'],
|
||||
'keyword-spacing': 'error',
|
||||
'object-curly-spacing': ['error', 'never'],
|
||||
'operator-assignment': ['error', 'always'],
|
||||
'prefer-template': 'error',
|
||||
'no-debugger': 'error',
|
||||
'no-else-return': 'error',
|
||||
'no-empty': ['error', {allowEmptyCatch: true}],
|
||||
'no-empty-pattern': 'off',
|
||||
'no-cond-assign': 'error',
|
||||
'no-lonely-if': 'error',
|
||||
'no-multiple-empty-lines': 'error',
|
||||
'no-multi-spaces': 'error',
|
||||
'no-implicit-coercion': 'error',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-redeclare': 'error',
|
||||
'no-useless-concat': 'error',
|
||||
'no-useless-escape': 'off',
|
||||
'no-useless-return': 'error',
|
||||
'no-trailing-spaces': 'error',
|
||||
'no-whitespace-before-property': 'error',
|
||||
'padded-blocks': ['error', 'never'],
|
||||
|
||||
'padding-line-between-statements': ['error', {
|
||||
blankLine: 'always',
|
||||
prev: 'function',
|
||||
next: 'function',
|
||||
}],
|
||||
|
||||
'prefer-exponentiation-operator': 'error',
|
||||
'prefer-regex-literals': 'error',
|
||||
semi: 'error',
|
||||
|
||||
'space-before-function-paren': ['error', {
|
||||
anonymous: 'always',
|
||||
asyncArrow: 'always',
|
||||
named: 'never',
|
||||
}],
|
||||
|
||||
'space-in-parens': ['error', 'never'],
|
||||
'space-infix-ops': 'error',
|
||||
|
||||
'spaced-comment': ['error', 'always', {
|
||||
exceptions: ['-'],
|
||||
}],
|
||||
|
||||
'@typescript-eslint/array-type': ['error', {
|
||||
default: 'array-simple',
|
||||
}],
|
||||
|
||||
yoda: ['error', 'never'],
|
||||
'@stylistic/brace-style': 'error',
|
||||
|
||||
'@stylistic/comma-dangle': ['error', {
|
||||
arrays: 'always-multiline',
|
||||
objects: 'always-multiline',
|
||||
imports: 'always-multiline',
|
||||
exports: 'always-multiline',
|
||||
functions: 'only-multiline',
|
||||
}],
|
||||
|
||||
'@stylistic/comma-spacing': ['error', {
|
||||
before: false,
|
||||
after: true,
|
||||
}],
|
||||
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@stylistic/function-call-spacing': ['error', 'never'],
|
||||
'@stylistic/keyword-spacing': ['error', {
|
||||
after: true,
|
||||
before: true,
|
||||
}],
|
||||
|
||||
'@stylistic/member-delimiter-style': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-vars': ['error', {caughtErrors: 'none', argsIgnorePattern: '^_'}],
|
||||
'@stylistic/semi': ['error', 'always'],
|
||||
|
||||
'@stylistic/quotes': ['error', 'single', {
|
||||
allowTemplateLiterals: 'always',
|
||||
avoidEscape: true,
|
||||
}],
|
||||
|
||||
'import/no-duplicates': 'error',
|
||||
|
||||
/*
|
||||
'import/no-unresolved': ['error', {
|
||||
ignore: [
|
||||
'^generators\/',
|
||||
'^malevic\/',
|
||||
'^plus\/',
|
||||
'^ui\/',
|
||||
'^utils\/',
|
||||
],
|
||||
}],
|
||||
*/
|
||||
'import/no-unresolved': 'off',
|
||||
|
||||
'import/no-restricted-paths': ['error', {
|
||||
zones: [{
|
||||
target: './src/inject/',
|
||||
from: './src/background/',
|
||||
}, {
|
||||
target: './src/inject/',
|
||||
from: './src/ui/',
|
||||
}, {
|
||||
target: './src/inject/',
|
||||
from: './src/api/',
|
||||
}, {
|
||||
target: './src/inject/',
|
||||
from: './tests/',
|
||||
}, {
|
||||
target: './src/background/',
|
||||
from: './src/ui/',
|
||||
}, {
|
||||
target: './src/background/',
|
||||
from: './tests/',
|
||||
}, {
|
||||
target: './src/ui/',
|
||||
from: './src/inject/',
|
||||
}, {
|
||||
target: './src/ui/',
|
||||
from: './src/background/',
|
||||
}, {
|
||||
target: './src/ui/',
|
||||
from: './tests/',
|
||||
}, {
|
||||
target: './src/generators/',
|
||||
from: './src/inject/',
|
||||
}, {
|
||||
target: './src/generators/',
|
||||
from: './src/background/',
|
||||
}, {
|
||||
target: './src/generators/',
|
||||
from: './src/ui/',
|
||||
}],
|
||||
}],
|
||||
|
||||
'local/jsx-uses-m-pragma': 'error',
|
||||
'local/jsx-uses-vars': 'error',
|
||||
},
|
||||
}, {
|
||||
files: [
|
||||
'**/darkreader.js',
|
||||
'**/darkreader.mjs',
|
||||
],
|
||||
extends: [
|
||||
eslintPluginCompat.config['flat/recommended'],
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
'navigator.deviceMemory',
|
||||
'navigator.userAgentData',
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
'compat/compat': ['error', [
|
||||
'>0.5% and supports es5 and supports promises and supports url',
|
||||
'not Explorer > 0',
|
||||
].join(', ')],
|
||||
},
|
||||
}, {
|
||||
files: [
|
||||
'build/debug/chrome/**/*.js',
|
||||
],
|
||||
extends: [
|
||||
eslintPluginCompat.config['flat/recommended'],
|
||||
],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module',
|
||||
},
|
||||
settings: {
|
||||
polyfills: [
|
||||
'navigator.deviceMemory',
|
||||
'navigator.userAgentData',
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
'compat/compat': ['error', [
|
||||
'> 0.5% and supports es5',
|
||||
'Firefox ESR',
|
||||
'last 2 FirefoxAndroid versions',
|
||||
'not Explorer > 0',
|
||||
'not Safari > 0',
|
||||
'not iOS > 0',
|
||||
'not ChromeAndroid > 0',
|
||||
'not OperaMini all',
|
||||
].join(', ')],
|
||||
},
|
||||
});
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
# Digital signature files
|
||||
|
||||
This directory contains digital signature files provided by Firefox Add-ons store and bits of metadata necessary for creating a valid signed release file. Currently only Firefox files are provided.
|
||||
|
||||
This information is sufficient for creating release files which are accepted by Firefox, but these files may differ from the ones published on Firefox Add-ons store. Specifically the following information is omitted because it is not checked during installation:
|
||||
- Files which we pack are always valid. Older official releases may fail to be unpacked by streaming zip readers, since archives can contain contradictory metadata about file contents (the index at the end of archive is considered authoritative in this case). Apparently Mozilla used to create slightly broken bundles, but no longer does.
|
||||
- Archives contain a timestamp field and permission flags for each file. These are not checked, make no sense in the context of released extension, and therefore omitted.
|
||||
- Archives can have different levels of compression. Firefox validates the decompressed contents, so this information is also omitted. In practice, users may want to pick different levels of compression (e.g., almost no compression for building locally, and loading a single file into Firefox on the same machine, or highly compressed file for uploading to file hosting).
|
||||
|
||||
Only Firefox archives are supported right now.
|
||||
@@ -0,0 +1,3 @@
|
||||
cose.sig binary
|
||||
mozilla.rsa binary
|
||||
mozilla-recommendation.json binary
|
||||
@@ -0,0 +1 @@
|
||||
{"type":0,"manifest":{"indent":4},"order":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,23,24,17,18,19,20,21,22,25,26,27,28,29,30,31,32,33]}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":0,"manifest":{"indent":4},"order":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,23,24,17,18,19,20,21,22,25,26,27,28,29,30,31,32,33]}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"type":1,"manifest":{"indent":4}}
|
||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user