修复 daemon 启动问题,分离 GUI 和 daemon 二进制
- 分离二进制: cmd/lmvpn (GUI+Fyne) 和 cmd/lmvpnd (daemon, 无 Fyne)
消除 daemon 启动时的 Fyne locale 初始化错误
- 新增 daemon-launch 子命令: 用 syscall.SysProcAttr{Setsid: true}
替代 nohup, 解决 osascript 无 TTY 时的 'Inappropriate ioctl' 错误
- daemon 日志写到用户家目录: paths.SetUserHome() 覆盖 root 默认路径
- IPC socket chown 给用户: 解决 root:wheel 0660 导致 GUI 无法连接
- 修复 JWT→密码认证回退: 捕获 ServerError{auth_err} 而非仅 AuthError
- 修复 token URL 编码: 用 url.QueryEscape 替代裸拼接
- 日志去重: LMVPN_DAEMON=1 时 daemon 不再 stderr 镜像到文件
- Makefile 构建双二进制并打包到 .app bundle
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -255,13 +256,14 @@ func (e *ServerError) Error() string {
|
||||
return fmt.Sprintf("server %s: %s", e.Type, e.Message)
|
||||
}
|
||||
|
||||
// appendQuery appends a key=value parameter to a URL.
|
||||
func appendQuery(url, key, value string) string {
|
||||
// appendQuery appends a key=value parameter to a URL, with the value
|
||||
// properly URL-escaped.
|
||||
func appendQuery(rawURL, key, value string) string {
|
||||
sep := "?"
|
||||
if contains(url, "?") {
|
||||
if contains(rawURL, "?") {
|
||||
sep = "&"
|
||||
}
|
||||
return url + sep + key + "=" + value
|
||||
return rawURL + sep + key + "=" + url.QueryEscape(value)
|
||||
}
|
||||
|
||||
func contains(s, sub string) bool {
|
||||
|
||||
Reference in New Issue
Block a user