update at 2026-02-10 13:47:16
This commit is contained in:
@@ -87,7 +87,7 @@ location /api/ {
|
||||
sudo nginx -t && sudo systemctl reload nginx
|
||||
```
|
||||
|
||||
## 4. systemd(可选)
|
||||
## 4. systemd(Linux,可选)
|
||||
|
||||
仓库内提供示例:`apiserver/font2svg-api.service.example`,可复制到:
|
||||
|
||||
@@ -98,7 +98,38 @@ sudo systemctl enable --now font2svg-api
|
||||
sudo systemctl status font2svg-api
|
||||
```
|
||||
|
||||
## 5. 约束
|
||||
## 5. launchd(macOS,可选)
|
||||
|
||||
仓库内提供示例:`apiserver/font2svg-api.launchd.plist.example`。
|
||||
|
||||
1. 复制并按本机路径修改(重点改 Python 路径和项目路径):
|
||||
|
||||
```bash
|
||||
cp apiserver/font2svg-api.launchd.plist.example ~/Library/LaunchAgents/cn.biboer.font2svg-api.plist
|
||||
```
|
||||
|
||||
2. 加载并启动:
|
||||
|
||||
```bash
|
||||
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/cn.biboer.font2svg-api.plist
|
||||
launchctl enable gui/$(id -u)/cn.biboer.font2svg-api
|
||||
launchctl kickstart -k gui/$(id -u)/cn.biboer.font2svg-api
|
||||
```
|
||||
|
||||
3. 查看状态与日志:
|
||||
|
||||
```bash
|
||||
launchctl print gui/$(id -u)/cn.biboer.font2svg-api
|
||||
tail -f /tmp/font2svg-api.log
|
||||
```
|
||||
|
||||
4. 停止并卸载:
|
||||
|
||||
```bash
|
||||
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/cn.biboer.font2svg-api.plist
|
||||
```
|
||||
|
||||
## 6. 约束
|
||||
|
||||
- 字体解析完全基于字体清单(默认 `miniprogram/assets/fonts.json`),字体文件统一从 `<static-root>/fonts/` 读取,`fontId` 必须存在。
|
||||
- 服务端启用 CORS,允许小程序访问。
|
||||
|
||||
41
apiserver/font2svg-api.launchd.plist.example
Normal file
41
apiserver/font2svg-api.launchd.plist.example
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>cn.biboer.font2svg-api</string>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/Users/gavin/font2svg/.venv/bin/python</string>
|
||||
<string>/Users/gavin/font2svg/apiserver/server.py</string>
|
||||
<string>--host</string>
|
||||
<string>127.0.0.1</string>
|
||||
<string>--port</string>
|
||||
<string>9300</string>
|
||||
<string>--static-root</string>
|
||||
<string>/Users/gavin/font2svg</string>
|
||||
</array>
|
||||
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Users/gavin/font2svg</string>
|
||||
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
|
||||
<key>StandardOutPath</key>
|
||||
<string>/tmp/font2svg-api.log</string>
|
||||
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/tmp/font2svg-api.log</string>
|
||||
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PYTHONUNBUFFERED</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user