🎨 桌面端内核进程使用随机端口 https://github.com/siyuan-note/siyuan/issues/4952

This commit is contained in:
Liang Ding 2022-10-25 11:55:42 +08:00
parent 1ffdde034c
commit efb6a2801d
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 5 additions and 3 deletions

View file

@ -275,7 +275,7 @@ func InitConf() {
Conf.System.FixedPort = true Conf.System.FixedPort = true
} }
if Conf.System.FixedPort { if Conf.System.FixedPort {
util.ServerPort = "6806" util.ServerPort = util.FixedPort
} }
Conf.LocalIPs = util.GetLocalIPs() Conf.LocalIPs = util.GetLocalIPs()

View file

@ -79,7 +79,7 @@ func Boot() {
Resident, _ = strconv.ParseBool(*resident) Resident, _ = strconv.ParseBool(*resident)
ServerPort = *port ServerPort = *port
if isRunningInDockerContainer() || "dev" == Mode { if isRunningInDockerContainer() || "dev" == Mode {
ServerPort = "6806" ServerPort = FixedPort
} }
ReadOnly, _ = strconv.ParseBool(*readOnly) ReadOnly, _ = strconv.ParseBool(*readOnly)
AccessAuthCode = *accessAuthCode AccessAuthCode = *accessAuthCode
@ -291,6 +291,8 @@ const (
ContainerDocker = "docker" // Docker 容器端 ContainerDocker = "docker" // Docker 容器端
ContainerAndroid = "android" // Android 端 ContainerAndroid = "android" // Android 端
ContainerIOS = "ios" // iOS 端 ContainerIOS = "ios" // iOS 端
FixedPort = "6806" // 固定端口
) )
func initPathDir() { func initPathDir() {

View file

@ -61,7 +61,7 @@ func BootMobile(container, appDir, workspaceDir, nativeLibDir, privateDataDir, l
ThemesPath = filepath.Join(AppearancePath, "themes") ThemesPath = filepath.Join(AppearancePath, "themes")
IconsPath = filepath.Join(AppearancePath, "icons") IconsPath = filepath.Join(AppearancePath, "icons")
Resident = true Resident = true
ServerPort = "6806" ServerPort = FixedPort
Container = container Container = container
UserAgent = UserAgent + " " + Container UserAgent = UserAgent + " " + Container
httpclient.SetUserAgent(UserAgent) httpclient.SetUserAgent(UserAgent)