Files
PortRelay/Makefile
T
DeepFal 3272e66247 docs: README 跟上授权延长与通道组,截图和动图改为一条命令重新生成
README
- 申请延长写清规则:授权有效期间也可申请,有效的从原到期时间顺延、已结束的从批准时起算,
  被撤销的不能延长;批准延长时通道会开到授权结束(与最长开启时长的关系)
- 修正通道组「一起开关」与「可以单独开关」的矛盾:闲置按整组计算,每个地址仍可单独开关
- 时长选项用界面上的「通道开启期间」;快速开始按实际流程写(保存后自动弹出邀请设置)
- 新增同事端申请延长的三张截图;流程图补上 30 分钟、自定义与 2 小时内可申请延长

截图与动图
- 授权管理、编辑通道、邀请文案、授权成功页、网页面板(含通道组)更新为当前界面
- 离屏渲染时控件按激活状态绘制,开关不再显示成灰色
- 新增 make readme-images:App 离屏渲染、动图合成、授权页与网页面板的无头 Chrome 截图一次完成,
  写入 docs/images;授权页 HTML 由服务端测试用模拟状态生成,网页面板用本机模拟 API

界面
- 计时文字第二个单位补零(27分05秒),卡片上的徽标不再随秒数左右跳动;App 与网页面板一致
- 待审批与延长申请的时间格式统一为不带秒;App 预览的分享文案补上延长提示
2026-10-14 14:51:07 +08:00

89 lines
4.1 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PortRelay —— 常用命令
# make test 运行 gofmt 检查、go vet 与全部测试(-race)
# make server 交叉编译 Linux 服务端到 dist/
# make agent 编译当前平台的 Agent 到 bin/
# make app 构建 macOS 应用 PortRelay.app(需要 Xcode 命令行工具)
# make install-app 构建并替换 /Applications/PortRelay.app(正在运行的会先退出,装好后重新打开)
# make dmg 打包 macOS 安装镜像 dist/PortRelay-<版本>.dmg(UNIVERSAL=1 构建通用版本)
# make release 打包服务端(Linux)与命令行 Agent(Linux / Windows)到 dist/
# make snapshots 离屏渲染 App 界面截图(tools/ui-snapshots/out)
# make readme-images 重新生成 README 的全部截图和动图到 docs/images(需要 Google Chrome)
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null | sed 's/^v//' || echo dev)
LDFLAGS := -s -w -X main.version=$(VERSION)
GOBUILD := CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)"
# 服务端只发布 Linux 版本;macOS 用户用 App,其余平台用命令行 Agent
SERVER_PLATFORMS := linux/amd64 linux/arm64
AGENT_PLATFORMS := linux/amd64 linux/arm64 windows/amd64
.PHONY: all test fmt server agent app install-app dmg release snapshots readme-images clean
all: test agent
test:
@test -z "$$(gofmt -l .)" || (echo "需要 gofmt:" && gofmt -l . && exit 1)
go vet ./...
go test -race -count=1 ./...
fmt:
gofmt -w .
server:
GOOS=linux GOARCH=amd64 $(GOBUILD) -o dist/portrelay-server-linux-amd64 ./cmd/portrelay-server
GOOS=linux GOARCH=arm64 $(GOBUILD) -o dist/portrelay-server-linux-arm64 ./cmd/portrelay-server
agent:
$(GOBUILD) -o bin/portrelay-agent ./cmd/portrelay-agent
app:
VERSION=$(VERSION) ./build-app.sh
# 正常退出正在运行的 App(会一并停止后台引擎)后替换,装好后按原状态重新打开
install-app: app
@running=; \
if pgrep -f /Applications/PortRelay.app/ >/dev/null; then \
running=1; osascript -e 'quit app "PortRelay"' >/dev/null; \
for i in $$(seq 1 30); do pgrep -f /Applications/PortRelay.app/ >/dev/null || break; sleep 0.5; done; \
if pgrep -f /Applications/PortRelay.app/ >/dev/null; then echo "PortRelay 未能退出,已放弃替换"; exit 1; fi; \
fi; \
rm -rf /Applications/PortRelay.app && ditto PortRelay.app /Applications/PortRelay.app && rm -rf PortRelay.app; \
echo "✓ 已安装 /Applications/PortRelay.app ($(VERSION))"; \
if [ -n "$$running" ]; then open /Applications/PortRelay.app; fi
# 安装镜像:PortRelay.app 和「应用程序」的快捷方式,打开后拖进去即可
dmg: app
@rm -rf build/dmg && mkdir -p build/dmg dist
ditto PortRelay.app build/dmg/PortRelay.app && rm -rf PortRelay.app
ln -s /Applications build/dmg/Applications
hdiutil create -volname PortRelay -srcfolder build/dmg -fs HFS+ -format UDZO -ov dist/PortRelay-$(VERSION).dmg
@rm -rf build/dmg
# 服务端:portrelay-server-<版本>-linux-<架构>.tar.gz(含 deploy/ 安装脚本)
# 客户端:portrelay-agent-<版本>-<系统>-<架构>.tar.gz / .zip
release:
@rm -rf dist/portrelay-* dist/SHA256SUMS && mkdir -p dist
@pack() { \
cmd=$$1; os=$$2; arch=$$3; ext=; [ $$os = windows ] && ext=.exe; \
name=$$cmd-$(VERSION)-$$os-$$arch; mkdir -p dist/$$name; \
echo "==> $$name"; \
GOOS=$$os GOARCH=$$arch $(GOBUILD) -o dist/$$name/$$cmd$$ext ./cmd/$$cmd || return 1; \
cp LICENSE README.md README_EN.md dist/$$name/; \
if [ $$cmd = portrelay-server ]; then cp -R deploy dist/$$name/; fi; \
if [ $$os = windows ]; then (cd dist && zip -qr $$name.zip $$name); \
else tar -C dist -czf dist/$$name.tar.gz $$name; fi; \
rm -rf dist/$$name; \
}; \
for p in $(SERVER_PLATFORMS); do pack portrelay-server $${p%/*} $${p#*/} || exit 1; done; \
for p in $(AGENT_PLATFORMS); do pack portrelay-agent $${p%/*} $${p#*/} || exit 1; done
@cd dist && shasum -a 256 * > SHA256SUMS && cat SHA256SUMS
snapshots:
tools/ui-snapshots/render.sh
readme-images:
tools/ui-snapshots/readme.sh
clean:
rm -rf bin build dist PortRelay.app mac-native/PortRelay tools/ui-snapshots/.build tools/ui-snapshots/out