Skip to content

Commit fa79d31

Browse files
committed
docs(README): 简化 README 文档
1 parent ec9c7ab commit fa79d31

4 files changed

Lines changed: 221 additions & 229 deletions

File tree

.claude/CLAUDE.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
LinuxDo Scripts is a browser extension built with WXT framework and Vue 3 that enhances the LinuxDo forum experience. It provides features like AI assistance, bookmark management, content filtering, theme customization, and various UI improvements.
8+
9+
## Development Commands
10+
11+
```bash
12+
# Development (Chrome)
13+
npm run dev
14+
15+
# Development (Firefox)
16+
npm run dev:firefox
17+
18+
# Build for production
19+
npm run build
20+
21+
# Build for Firefox
22+
npm run build:firefox
23+
24+
# Create distribution zip files
25+
npm run zip
26+
npm run zip:firefox
27+
28+
# Full publish workflow (build + zip + python script)
29+
npm run publish
30+
31+
# TypeScript type checking
32+
npm run compile
33+
34+
# Clean install
35+
npm run rf && npm install
36+
```
37+
38+
## Project Architecture
39+
40+
### Core Technologies
41+
- **Framework**: WXT (Web Extension Framework) v0.19.13
42+
- **UI Framework**: Vue 3 with TypeScript
43+
- **Component Library**: Arco Design Vue + Element Plus
44+
- **Styling**: Less + Sass
45+
- **Build Tool**: Vite (via WXT)
46+
47+
### Entry Points Structure
48+
49+
```
50+
entrypoints/
51+
├── background.ts # Background service worker - handles messaging, API proxies, click behavior
52+
├── content.js # Content script - injects Vue app into LinuxDo pages via shadow DOM
53+
├── App.vue # Main content script UI (floating settings button + menu)
54+
├── popup/ # Browser action popup
55+
│ ├── App.vue
56+
│ └── main.js
57+
├── sidepanel/ # Side panel UI (reuses PopupViews)
58+
│ ├── App.vue
59+
│ └── main.js
60+
├── PopupViews/ # Shared UI components for popup/sidepanel
61+
│ ├── index.vue # Main view router
62+
│ └── components/ # Feature components (Bookmark, HotPosts, NewsPosts, LDC, etc.)
63+
├── SettingComponents/ # Settings menu components
64+
│ ├── AIConfig/ # AI API configuration (GPTconfig.vue)
65+
│ ├── BasicSettings/ # Toggle switches for features
66+
│ ├── CustomCSS/ # Custom CSS editor
67+
│ ├── DataBackup/ # Import/export settings
68+
│ ├── ThemeStyle/ # Theme customization
69+
│ └── UserTags/ # User tagging system
70+
├── bookmark/ # Bookmark management interface
71+
│ ├── App.vue
72+
│ └── components/
73+
├── share/ # Share/post export functionality
74+
└── utilities/ # Shared utilities
75+
├── indexedDBStorage.js # IndexedDB wrapper for settings/bookmarks
76+
├── settingsManager.js # Settings management with caching
77+
├── storageCompat.js # Storage migration/compatibility
78+
├── connectApi.js # Connect.linux.do API wrapper
79+
├── componentUpdateExample.js
80+
├── post.ts # Post utilities
81+
├── storageDebugger.js # Storage debugging
82+
└── url.ts # URL utilities
83+
```
84+
85+
### Key Architecture Patterns
86+
87+
1. **Shadow DOM Injection**: Content script uses WXT's `createShadowRootUi` to inject Vue app without conflicting with page styles
88+
2. **Background Message Routing**: Background script acts as central hub for:
89+
- AI API proxy (CORS bypass)
90+
- WebDAV requests
91+
- Connect.linux.do API calls
92+
- Tab-to-tab messaging
93+
- Click behavior management (popup vs sidepanel)
94+
3. **Storage Strategy**:
95+
- Primary: IndexedDB via `indexedDBStorage.js` for large data (bookmarks, history)
96+
- Secondary: chrome.storage.local for settings
97+
4. **Shared Components**: Popup and sidepanel share the same `PopupViews` components
98+
5. **Settings Management**: Centralized settings with caching and migration support
99+
100+
### Feature Modules
101+
102+
- **AI Features**: GPT integration, topic summarization, smart replies
103+
- **Bookmark System**: Category-based bookmarking with IndexedDB
104+
- **Content Filtering**: User blocking, keyword filtering, time-based filtering
105+
- **UI Enhancements**: Themes, custom CSS, display optimizations
106+
- **Utilities**: Export to image/PDF, quick actions, level lookup
107+
108+
## Configuration Files
109+
110+
- **wxt.config.ts**: WXT framework configuration, manifest settings, Vite CSS options
111+
- **package.json**: Dependencies, scripts, version management
112+
- **tsconfig.json**: TypeScript config extending WXT's base config
113+
- **.prettierrc**: Code formatting rules (120 char width, tabs, single quotes)
114+
115+
## Build Output
116+
117+
- Development: `.output/chrome-mv3/` (or `firefox-mv2/`)
118+
- Production zips: Created via `npm run zip` commands
119+
- Python script (`scripts/build.py`) auto-updates `version-log.md` based on `package.json` version
120+
121+
## Common Development Tasks
122+
123+
### Adding a New Feature
124+
1. Create component in appropriate `entrypoints/` subdirectory
125+
2. Import and register in `App.vue` or `PopupViews/index.vue`
126+
3. Add settings toggle in `SettingComponents/BasicSettings/`
127+
4. Update storage schema if needed in `indexedDBStorage.js`
128+
129+
### Debugging Content Script
130+
- Content script runs in shadow DOM, inspect via DevTools Elements panel
131+
- Look for `#linuxdoscripts` shadow root
132+
- Background script logs visible in extension service worker panel
133+
134+
### Testing AI Features
135+
- Configure API endpoint in settings (AIConfig/GPTconfig.vue)
136+
- Background script provides proxy endpoints: `ai_api_proxy`, `ai_api_stream_proxy`
137+
138+
### Storage Migration
139+
- Check `storageCompat.js` for version handling
140+
- `indexedDBStorage.js` has `getSettingsWithMigration()` for safe upgrades
141+
142+
## Important Notes
143+
144+
- **Node Version**: Requires Node.js v22.12.0 (see `.nvmrc`)
145+
- **Browser Compatibility**: Chrome (Manifest V3), Firefox (Manifest V2)
146+
- **Permissions**: storage, sidePanel, tabs, host_permissions for http/https
147+
- **Side Panel**: Default entry point, can be switched to popup via settings
148+
- **IDCflare Support**: Also compatible with idcflare.com domain
149+
150+
## Testing Checklist
151+
152+
When making changes, verify:
153+
- [ ] Content script injection works on linux.do pages
154+
- [ ] Background message handlers respond correctly
155+
- [ ] Settings persist across sessions
156+
- [ ] Bookmarks save/load from IndexedDB
157+
- [ ] AI API proxy handles both regular and streaming responses
158+
- [ ] Popup/sidepanel UI renders correctly
159+
- [ ] Theme changes apply without conflicts

.claude/settings.local.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cat:*)"
5+
]
6+
}
7+
}

README.md

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
[简体中文](README.md) | [English](README_EN.md)
22

3-
```
4-
_ _ ____ ____ _ _
5-
| | (_)_ __ _ ___ _| _ \ ___ / ___| ___ _ __(_)_ __ | |_ ___
6-
| | | | '_ \| | | \ \/ / | | |/ _ \ \___ \ / __| '__| | '_ \| __/ __|
7-
| |___| | | | | |_| |> <| |_| | (_) | ___) | (__| | | | |_) | |_\__ \
8-
|_____|_|_| |_|\__,_/_/\_\____/ \___/ |____/ \___|_| |_| .__/ \__|___/
9-
|_|
10-
```
11-
123
<div align="center">
134
<a href="https://github.com/anghunk/linuxdo-scripts">
145
<img src="https://github.com/anghunk/linuxdo-scripts/blob/main/public/icon/128.png?raw=true" alt="Logo" width="80" height="80">
@@ -35,7 +26,7 @@
3526
</p>
3627
</div>
3728

38-
## 📖 一、项目简介
29+
## 一、项目简介
3930

4031
LinuxDo Scripts 是一个功能丰富的浏览器扩展,专为提升 LinuxDo 论坛的使用体验而设计。它集成了从基础界面优化到高级 AI 辅助的多项实用功能,让您的论坛浏览和互动体验更加流畅高效。
4132

@@ -44,13 +35,7 @@ LinuxDo Scripts 是一个功能丰富的浏览器扩展,专为提升 LinuxDo
4435
>
4536
> 已同步兼容 [idcflare.com](https://idcflare.com) 网站。
4637
47-
### 1. 核心亮点
48-
49-
- 🎨 **界面美化** - 多种主题皮肤,个性化定制
50-
- 🤖 **AI 智能** - 话题总结、智能回复生成
51-
- 📚 **内容管理** - 收藏夹、用户标签、内容过滤
52-
-**体验优化** - 快捷操作、自动化功能
53-
- 🔧 **高度可定制** - 支持自定义 CSS、快捷回复等
38+
更多功能功能查看前往 [LinuxDo Scripts 文档](https://linuxdo-scripts.zishu.me)
5439

5540
![主图](https://github.com/user-attachments/assets/1b0039de-3f3e-420b-9a91-6bc651e8c8e5)
5641

@@ -63,7 +48,7 @@ LinuxDo Scripts 是一个功能丰富的浏览器扩展,专为提升 LinuxDo
6348

6449
</details>
6550

66-
## 📥 二、快速安装
51+
## 二、快速安装
6752

6853
### 1. 支持的浏览器
6954

@@ -80,79 +65,7 @@ LinuxDo Scripts 是一个功能丰富的浏览器扩展,专为提升 LinuxDo
8065
3. 确认安装权限
8166
4. 访问 [LinuxDo 论坛](https://linux.do) 开始使用
8267

83-
## ✨ 三、功能特性
84-
85-
<details>
86-
<summary>🔍 浏览体验优化</summary>
87-
88-
- ⏰ 话题列表显示创建时间
89-
- 🏢 显示楼层数和楼主标识
90-
- 🆕 新标签页打开话题
91-
- 👀 话题列表直接预览详情及评论
92-
- 📝 中英文混排优化显示
93-
- 🖼️ 优化签名图显示,防止图片损坏
94-
- 🌙 自动切换黑夜模式
95-
- 📱 超长显示器宽度优化
96-
97-
</details>
98-
99-
<details>
100-
<summary>📚 内容管理</summary>
101-
102-
- ⭐ 完善的收藏夹功能
103-
- 🏷️ 用户标签系统
104-
- 🚫 强制屏蔽指定用户话题
105-
- 👑 只看楼主切换功能
106-
- 🔍 关键词和标签过滤
107-
- 📅 按时间屏蔽旧帖子
108-
109-
</details>
110-
111-
<details>
112-
<summary>💬 互动增强</summary>
113-
114-
- ⚡ 话题快捷回复(支持自定义模板)
115-
- 😊 评论框表情优化
116-
- 📊 等级信息查询
117-
- 👍 快捷点赞按钮
118-
- 🔄 自动展开回复
119-
120-
</details>
121-
122-
<details>
123-
<summary>🤖 AI 智能助手</summary>
124-
125-
- 📋 AI 话题总结
126-
- 💡 智能生成回复
127-
- 🤝 AI 辅助回帖
128-
- 🎯 内容智能分析
129-
130-
</details>
131-
132-
<details>
133-
<summary>🎨 个性化定制</summary>
134-
135-
- 🎭 多种论坛主题皮肤
136-
- 😀 论坛表情风格切换
137-
- 🎨 自定义 CSS 样式支持
138-
- ☁️ 设置数据云端同步
139-
- 🖼️ 自定义论坛 Logo
140-
- 📑 自定义标签页图标和标题
141-
142-
</details>
143-
144-
<details>
145-
<summary>🔧 实用工具</summary>
146-
147-
- 📸 话题转图片分享
148-
- 📄 论坛文章导出
149-
- ⬆️ 返回顶部/直达一楼
150-
- 🔕 快速免打扰帖子
151-
- 🎯 查看自己的回复楼层
152-
153-
</details>
154-
155-
## 🛠️ 四、开发指南
68+
## 四、开发指南
15669

15770
### 1. 环境要求
15871

@@ -187,7 +100,7 @@ npm run dev
187100
- 🔄 **提交流程**: PR → 代码审核 → 合并
188101
- 📚 **文档更新**: 新功能需同步更新文档
189102

190-
## 🤝 五、参与贡献
103+
## 五、参与贡献
191104

192105
### 1. 贡献方式
193106

@@ -204,7 +117,7 @@ npm run dev
204117

205118
- https://linux.do/t/topic/850824 - 始皇酱表情包功能
206119

207-
## 📄 六、其他信息
120+
## 六、其他信息
208121

209122
### 1. Star History
210123

0 commit comments

Comments
 (0)