# \> termcourse：在终端中阅读和发布 Discourse 实例的内容

**URL:** https://meta.discourse.org/t/termcourse-read-post-on-discourse-instances-from-the-terminal/395285
**Category:** Extras
**Tags:** experimental
**Created:** [2026年二月5日 13:50 UTC](https://meta.discourse.org/t/termcourse-read-post-on-discourse-instances-from-the-terminal/395285 "2026-02-05T13:50:49Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [2026年二月5日 13:50 UTC](https://meta.discourse.org/t/termcourse-read-post-on-discourse-instances-from-the-terminal/395285/1 "2026-02-05T13:50:49Z")

</div>

这是一个终端应用（TUI），目前还带点趣味性……在这个阶段也还有些实验性质！

| | | |
| --- | --- | --- |
| ℹ | 简介 | 一个用于浏览和发布 Discourse 论坛内容的终端 UI，支持主题列表、完整主题视图、回复、点赞、搜索以及内置的编辑器。 |
| 🛠 | 仓库链接 | [GitHub - merefield/termcourse: A terminal based client to access Discourse instances, supporting API keys, username/password (and with MFA token) · GitHub](https://github.com/merefield/termcourse) |
| 📖 | 安装指南 | 仓库中的 README.md（快速开始部分） |
| ❤ | 赞助 | 请考虑以适合您或您所在组织资源和需求的级别，持续赞助我的开源工作（[https://github.com/sponsors/merefield），以确保该项目获得应有的维护，并能在未来继续为您的站点提供服务。](https://github.com/sponsors/merefield%EF%BC%89%EF%BC%8C%E4%BB%A5%E7%A1%AE%E4%BF%9D%E8%AF%A5%E9%A1%B9%E7%9B%AE%E8%8E%B7%E5%BE%97%E5%BA%94%E6%9C%89%E7%9A%84%E7%BB%B4%E6%8A%A4%EF%BC%8C%E5%B9%B6%E8%83%BD%E5%9C%A8%E6%9C%AA%E6%9D%A5%E7%BB%A7%E7%BB%AD%E4%B8%BA%E6%82%A8%E7%9A%84%E7%AB%99%E7%82%B9%E6%8F%90%E4%BE%9B%E6%9C%8D%E5%8A%A1%E3%80%82) |

喜欢 termcourse？请在 [GitHub](https://github.com/merefield/termcourse) 上给它一个 ⭐ 吧

## 概述

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/8/6/2864d986fc152c793d39abd7e2668b727c03d9a1.png)

`termcourse` 是一个基于终端的 Discourse 客户端，重构为单个 Go 可执行文件。它可以使用权重较轻的浏览器风格 Cookie 会话，通过用户名/电子邮件和密码进行登录，支持 TOTP 和备用代码 MFA。对于不适合交互式登录的站点，可以使用 API 密钥进行身份验证。

该界面使用当前的 Charm 技术栈，支持键盘和鼠标操作。其文件夹式导航、上下文过滤器、响应式面板、主题控件、Markdown 渲染和内联图像旨在让用户无需离开终端即可舒适地浏览论坛。

## 功能

- 浏览最新（Latest）、热门（Hot）、新帖（New）、未读（Unread）、热门（Top）和私信（Private Message）主题列表，支持切换 Top 的时间周期。
- 导航持久化的主题（Topics）、搜索（Search）、通知（Notifications）和撰写（Compose）文件夹，支持上下文二级过滤器。
- 全程使用键盘操作，或点击选项卡、主题行、底部控件和悬停高亮的按钮。
- 使用 Enter 键或数字键 `1`–`0` 打开可见的主题。
- 阅读完整主题，支持帖子懒加载、紧凑摘要、展开选中的帖子以及响应式滚动。
- 点击主题的进度条可直接跳转到帖子流中的相应位置。
- 创建主题、选择分类、回复主题或单个帖子，以及对帖子进行点赞或取消点赞。
- 搜索帖子并直接跳转到其主题上下文中的匹配帖子。
- 浏览和过滤通知，包括未读和私信徽章。
- 撰写多行内容，支持光标移动、插入、换行、粘贴支持和实时验证。
- 渲染 GFM Markdown，包括链接、列表、引用、代码、任务列表和表格。
- 使用 Kitty 图形协议显示高质量的内联和全屏图像，并使用带颜色的 `chafa` 符号或 `viu` 作为可移植的回退方案。
- 在使用 Cookie 会话时，接收主题列表、主题、通知和私信的实时更新。
- 从环境变量或 `credentials.yml` 中获取每个站点的凭据，并提示输入缺失的登录字段。
- 从 `default`、`slate`、`fairground`、`rust` 和 `hacker` 主题中选择，添加 YAML 主题，并在应用运行时切换主题。
- 使用真彩色、256 色或 16 色输出，并自动检测终端能力。
- 以英语、法语、德语或西班牙语运行界面。
- 自由调整终端大小：布局、颜色、主题列表和 Kitty 图像会根据可用空间做出响应。
- 当 Discourse 对操作进行速率限制时，查看服务器提供的重试时间，并可选择启用 HTTP、UI 和图像诊断。

## 安装和运行

在 Linux 或 macOS 上，推荐的安装程序会下载当前操作系统和架构的预构建版本，验证其 SHA-256 校验和和报告的版本，然后进行安装：

```sh
curl -fsSL https://raw.githubusercontent.com/merefield/termcourse/master/install-release.sh | sh
termcourse your.discourse.host

```

如果尚未配置凭据，Termcourse 会提示输入用户名和密码。密码输入将被隐藏。

使用 `termcourse --version` 显示已安装的语义化版本；相同的版本也会显示在宽终端的报头中。

对于不需要 `sudo` 的用户本地安装：

```sh
curl -fsSL https://raw.githubusercontent.com/merefield/termcourse/master/install-release.sh |
  TERMCOURSE_BIN_DIR="$HOME/.local/bin" sh

```

每个 [GitHub Release](https://github.com/merefield/termcourse/releases) 都提供 SHA-256 校验和以及适用于 AMD64 和 ARM64 的 Linux、macOS 和 Windows 的预构建存档。Linux/macOS 使用 `.tar.gz`；Windows 使用 `.zip`。预构建版本不需要 Go。

在 Windows 上，下载并检查安装程序，然后在更改机器范围的执行策略之前运行它：

```powershell
Invoke-WebRequest https://raw.githubusercontent.com/merefield/termcourse/master/install-release.ps1 -OutFile install-release.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File .\install-release.ps1

```

默认情况下，它安装到 `%LOCALAPPDATA%\Programs\termcourse\bin`，并执行相同的校验和版本验证。安装程序也可以使用 `--version` 或 `-Version` 固定特定版本。只有从源代码安装时才需要 Go 1.26.6 或更高版本。

若要改为从检出构建本地可执行文件：

```sh
git clone https://github.com/merefield/termcourse.git
cd termcourse
make build
./termcourse your.discourse.host

```

为了重复使用，请将登录详细信息放在本地 `.env` 中，或使用 [README](https://github.com/merefield/termcourse#configuration) 中描述的按主机配置的 `credentials.yml`。

### 用户名/密码登录（推荐）

用户名/密码登录支持实时更新：

```sh
DISCOURSE_USERNAME="you@example.com" \
DISCOURSE_PASSWORD="your_password" \
termcourse your.discourse.host

```

### API 密钥回退

```sh
DISCOURSE_API_KEY="your_key" \
DISCOURSE_API_USERNAME="your_username" \
termcourse your.discourse.host

```

有关配置、主题、控件、图像后端和故障排除的最新信息，请参阅最新的 [README](https://github.com/merefield/termcourse/blob/master/README.md)。

## 身份验证说明

- 用户名/密码登录遵循 Discourse 的 CSRF 和 Cookie 流程，并支持实时 MessageBus 更新。
- 支持 TOTP 和备用代码 MFA。
- API 密钥身份验证保留 HTTP 功能，但不建立实时浏览器会话。
- 某些站点会禁用或限制脚本化的用户名/密码登录；API 凭据是这些站点的回退方案。

## 安全性

- Termcourse 不会将提示输入的凭据或会话 Cookie 写入磁盘；会话 Cookie 保留在内存中。
- 密码提示可防止密码出现在 shell 历史记录中。
- 持久化凭据是可选的，并保留在用户的环境变量或 YAML 文件中，由用户控制。
- 诊断日志记录是可选的，默认禁用，并且不会记录凭据或响应主体。

## 局限性

- 禁止远程登录流程的站点可能需要 API 密钥身份验证。
- 实时更新需要用户名/密码 Cookie 身份验证。
- 原生内联图像质量取决于终端支持情况；首选 Kitty，其他地方可使用符号渲染。
- 它存在于终端中。🙂

## 致谢

部分灵感来自 [Dumbcourse: old browser friendly UI at dumb/d-pad/small screens](https://meta.discourse.org/t/dumbcourse-old-browser-friendly-ui-at-dumb-d-pad-small-screens/395104)。👏

---

_[View the full topic](https://meta.discourse.org/t/termcourse-read-post-on-discourse-instances-from-the-terminal/395285)._
