Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4e8e38c
feat(privileged): 新增特权层基础模块
zcf0508 Oct 22, 2026
8fa0629
feat(privileged): 新增 root helper 进程与客户端
zcf0508 Oct 22, 2026
66a6727
refactor(caddy): 通过 helper 启停 Caddy,移除整进程 sudo
zcf0508 Oct 22, 2026
fa9f452
test(privileged): 覆盖特权层与 Caddy 集成,清理无用依赖
zcf0508 Oct 22, 2026
6eedce4
feat(privileged): Windows 通过 UAC 启动 helper
zcf0508 Oct 22, 2026
e903a55
docs: 更新用法,不再要求 sudo 启动
zcf0508 Oct 22, 2026
22914d7
chore: release v4.1.0-beta.1
zcf0508 Oct 23, 2026
e090a08
fix(ci): release beta version fail
zcf0508 Oct 23, 2026
5462f7d
chore: release v4.1.0-beta.2
zcf0508 Oct 23, 2026
36c9e9d
fix(privileged): 向上查找 helper 入口与 tsx
zcf0508 Oct 23, 2026
b04ffb7
feat: 密码提示前说明原因,拒绝后保留 dev server
zcf0508 Oct 23, 2026
13eacf6
test: 覆盖拒绝状态与密码引导文案
zcf0508 Oct 23, 2026
e6b1bc4
chore: release v4.1.0-beta.3
zcf0508 Oct 23, 2026
c93c9f8
feat(privileged): 多项目共享同一个 Caddy
zcf0508 Oct 23, 2026
95e893a
feat(caddy): 共享路由配置加锁,退出不再停掉共用 Caddy
zcf0508 Oct 23, 2026
90db6be
feat(privileged): 冷启动串行化,避免各起一个 helper
zcf0508 Oct 23, 2026
d970f3d
feat(privileged): helper 空闲后自动退出
zcf0508 Oct 23, 2026
88ab967
chore: release v4.1.0-beta.4
zcf0508 Oct 23, 2026
ec80eb4
fix: 密码提示期间 Ctrl+C 不再杀死 dev server
zcf0508 Oct 23, 2026
5f3cbad
chore: release v4.1.0-beta.5
zcf0508 Oct 23, 2026
69e96ae
fix: 第二个项目复用已有 Caddy 时不再挂起
zcf0508 Oct 23, 2026
25d83c7
chore: release v4.1.0-beta.6
zcf0508 Oct 23, 2026
6470a25
fix: 密码提示期间恢复终端为规范模式
zcf0508 Oct 23, 2026
072c46c
fix(privileged): 空闲退出只在独立进程里结束进程
zcf0508 Oct 23, 2026
2128ccd
test(caddy): 无 sudo 权限时跳过需要真实 Caddy 的用例
zcf0508 Oct 23, 2026
2974cd1
chore: release v4.1.0-beta.7
zcf0508 Oct 23, 2026
70fb67f
fix: 密码提示期间暂停 stdin,避免 Vite 抢走输入
zcf0508 Oct 23, 2026
3a50d9e
chore: release v4.1.0-beta.8
zcf0508 Oct 23, 2026
d9c7b65
fix(privileged): Caddy 脱离启动者进程组,避免被 Ctrl+C 带走
zcf0508 Oct 23, 2026
1efc31d
fix(privileged): helper 不响应终端信号,SIGTERM 也不踢存活会话
zcf0508 Oct 23, 2026
092e756
fix(caddy): 路由变更后在锁内重新生成 Caddyfile
zcf0508 Oct 23, 2026
67d2157
chore: release v4.1.0-beta.9
zcf0508 Oct 23, 2026
db3dafe
fix(caddy): 锁内渲染补完整,写入改成原子替换
zcf0508 Oct 23, 2026
93fee09
fix(privileged): 收回 admin API,并在启动时校验特权路径
zcf0508 Oct 23, 2026
5696b05
chore: release v4.1.0-beta.10
zcf0508 Oct 23, 2026
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
15 changes: 14 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,17 @@ jobs:
run: |
pnpm run build
TARBALL=$(pnpm pack --pack-destination "$RUNNER_TEMP" | tail -n 1)
npm publish "$TARBALL" --access public
VERSION=$(node -p "require('./package.json').version")

# A prerelease must name its dist-tag explicitly; without one npm 11
# refuses to publish. Using `beta` also keeps `latest` on the stable
# line so a plain install does not pick up a beta.
if [[ "$VERSION" == *-* ]]; then
DIST_TAG="${VERSION#*-}"
DIST_TAG="${DIST_TAG%%.*}"
echo "publishing $VERSION under dist-tag $DIST_TAG"
npm publish "$TARBALL" --access public --tag "$DIST_TAG"
else
echo "publishing $VERSION as latest"
npm publish "$TARBALL" --access public
fi
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,39 @@ Please check [caddy path](https://github.com/zcf0508/unplugin-https-reverse-prox
## Usage

```bash
# macOS
sudo -E npm run dev # your dev script
# ^ `-E` is important

# windows
# use powershell as administrator
# macOS / Linux / Windows
npm run dev # your dev script
```

Run it as your normal user. The plugin starts a small privileged helper that
runs as administrator, and only that helper touches `/etc/hosts` and ports
80/443. Your dev server, its caches and `node_modules` stay owned by you.

On macOS and Linux the plugin asks for your password once when the dev server
starts, then reuses the sudo credential for the rest of the session. If you
already ran `sudo -v` in the same terminal, no prompt is shown.

The helper restores the hosts entries by itself when the dev server exits,
including when it is killed or crashes.

### Granting the permission once (optional)

To skip the password prompt entirely, allow the plugin's helper in
`/etc/sudoers.d/` (edit with `sudo visudo -f /etc/sudoers.d/uhrp`):

```
yourname ALL=(root) NOPASSWD: /usr/bin/killall -HUP mDNSResponder
yourname ALL=(root) NOPASSWD: /usr/bin/install -m 644 -o root -g wheel /tmp/uhrp-hosts.* /etc/hosts
```

The second rule only matters when the helper rewrites `/etc/hosts` through
`install`; adjust the paths to your platform.

### Windows

Run `npm run dev` normally. Windows raises a UAC prompt once, when the helper
is started through `Start-Process -Verb RunAs`.

If your broswer shows a not trusted certificate warning, please check the keychain.

![keychain](https://github.com/zcf0508/unplugin-https-reverse-proxy/blob/main/images/Snipaste_2023-11-16_16-59-55.png)
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unplugin-https-reverse-proxy",
"type": "module",
"version": "4.0.4",
"version": "4.1.0-beta.10",
"description": "",
"license": "MIT",
"homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme",
Expand Down Expand Up @@ -135,7 +135,6 @@
"console-table-printer": "^2.12.1",
"dotenv-flow": "^4.1.0",
"got-cjs": "^12.5.4",
"hostile": "^1.4.0",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6",
"ora": "5",
Expand All @@ -149,8 +148,6 @@
"@nuxt/schema": "^3.16.1",
"@rsbuild/core": "^0.4.15",
"@rspack/core": "^0.5.9",
"@types/hostile": "^1.3.5",
"@types/kill-port": "^2.0.3",
"@types/node": "^20.11.19",
"@types/proper-lockfile": "^4.1.4",
"@types/qrcode-terminal": "^0.12.2",
Expand Down
Loading
Loading