Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions plugins/v2ex-browser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependencies
node_modules/

# Build and release artifacts
src-ztools/dist/
*.zip

# Project documentation
docs/

# Local Vite state
.vite/

# Logs
*.log
npm-debug.log*

# Environment files
.env
.env.*
!.env.example

# macOS and editor files
.DS_Store
.idea/
.vscode/
32 changes: 32 additions & 0 deletions plugins/v2ex-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog

## 0.1.6 - 2026-10-17

- 修复 macOS 和 Windows 系统代理开关读取,关闭代理时正确直连,并在每次请求时使用最新配置。
- 明确提示不支持的自动代理配置,避免沿用已关闭或不适用的代理地址。

## 0.1.5 - 2026-09-30

- 将最新帖子列表缓存时长调整为 2 分钟;热门帖子继续缓存 10 分钟。

## 0.1.4 - 2026-09-30

- 热门和最新列表分别缓存 10 分钟,手动刷新立即更新当前列表缓存。
- 启动指令精简为 `v2ex` 和 `v2`,默认打开热门列表。
- 修复用户头像通过系统代理加载,以及原帖跳转按钮的显示样式。

## 0.1.3 - 2026-09-30

- 通过 Node 系统代理下载并缓存用户头像,修复 ZTools 页面无法直连头像 CDN 的问题。

## 0.1.2 - 2026-09-30

- 使用 Node HTTPS 代理 Agent 通过 macOS 系统代理请求 V2EX,修复 ZTools 未继承代理导致的连接失败。

## 0.1.1 - 2026-09-30

- 通过 ZTools Preload 请求 V2EX,避开浏览器跨域限制。

## 0.0.1 - 2026-09-30

- 初次发布,将插件提交至 ZTools 插件仓库。
64 changes: 64 additions & 0 deletions plugins/v2ex-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# V2EX 帖子浏览

一个运行在 [ZTools](https://github.com/ZToolsCenter/ZTools) 中的 V2EX 阅读插件。输入 `v2ex` 或 `v2`,即可快速查看热门与最新帖子、筛选内容、阅读详情和回复。

## 演示

### 最新帖子

![最新帖子列表](assets/screenshots/latest-posts.png)

### 最热帖子

![最热帖子列表](assets/screenshots/hot-posts.png)

### 帖子详情与回复

![帖子详情与回复](assets/screenshots/topic-detail.png)

## 功能

- 查看 V2EX 最热与最新帖子。
- 按标题、节点或作者过滤当前列表。
- 在插件内阅读帖子正文和回复。
- 一键在系统浏览器打开 V2EX 原帖。
- 热门列表缓存 10 分钟,最新列表缓存 2 分钟;刷新按钮立即重新拉取并更新当前缓存。
- 在网络异常、超时或服务不可用时显示可重试提示,并保留已加载内容。
- 通过 Node 请求 V2EX 和用户头像;每次请求读取 macOS 或 Windows 当前启用的 HTTPS 系统代理,未启用时直连。当前只支持手动配置的 HTTP 代理,不支持 PAC/WPAD 或 SOCKS 代理。

## ZTools 指令

| 指令 | 初始列表 |
| --- | --- |
| `v2ex` | 最热 |
| `v2` | 最热 |

## 开发

需要 Node.js 18 或更高版本。本项目在 Node `v26.10.0` 下验证:

```bash
nvm exec 26 npm install
nvm exec 26 npm run dev
```

开发服务默认运行在 `http://localhost:5173`。ZTools 会根据 `src-ztools/plugin.json` 中的 `development.main` 加载开发版本。
使用 ZTools 开发者工具打开插件前,请保持 `npm run dev` 运行;如果插件窗口已打开,再刷新或重新打开插件。

## 验证与构建

```bash
nvm exec 26 npm test
nvm exec 26 npm run build
```

构建产物位于 `src-ztools/dist/`。插件发布包由 `src-ztools/` 下的 `plugin.json`、`logo.png`、`preload/` 和 `dist/` 组成。

## 使用的公开接口

- `https://www.v2ex.com/api/topics/hot.json`
- `https://www.v2ex.com/api/topics/latest.json`
- `https://www.v2ex.com/api/topics/show.json?id=<帖子ID>`
- `https://www.v2ex.com/api/replies/show.json?topic_id=<帖子ID>`

这些接口不需要 Token。插件不收集、不保存 V2EX 账号或访问凭据。
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions plugins/v2ex-browser/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading
Loading