Skip to content

Commit

Permalink
🔖 Release v3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuoqiu-Yingyi committed Jul 10, 2024
1 parent be91054 commit f96a303
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 30 deletions.
13 changes: 8 additions & 5 deletions app/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ const getServer = (port = kernelPort) => {
return localhost
? `${kernelProtocol}://${kernelHostname}:${port}`
: baseURL;
}
};

const kernelExit = (origin = getServer()) => {
return net.fetch(`${origin}/api/system/exit`, {method: "POST"})
}
return net.fetch(`${origin}/api/system/exit`, {method: "POST"});
};

const windowNavigate = (currentWindow) => {
currentWindow.webContents.on("will-navigate", (event) => {
Expand Down Expand Up @@ -465,7 +465,7 @@ const showWindow = (wnd) => {
wnd.show();
};

const initKernel = (workspace, port, lang, tlsKernel, tlsCertFile, tlsKeyFile) => {
const initKernel = (workspace, port, lang, hostname, tlsKernel, tlsCertFile, tlsKeyFile) => {
return new Promise(async (resolve) => {
bootWindow = new BrowserWindow({
show: false,
Expand Down Expand Up @@ -537,6 +537,9 @@ const initKernel = (workspace, port, lang, tlsKernel, tlsCertFile, tlsKeyFile) =
if (lang) {
cmds.push("--lang", lang);
}
if (hostname) {
cmds.push("--hostname", hostname);
}
if (tlsKernel) {
cmds.push("--tls-kernel", true);
}
Expand Down Expand Up @@ -1270,7 +1273,7 @@ app.whenReady().then(() => {
if (tlsKeyFile) {
writeLog(`got arg [--tls-key-file="${tlsKeyFile}"]`);
}
initKernel(workspace, port, "", tlsKernel, tlsCertFile, tlsKeyFile).then((isSucc) => {
initKernel(workspace, port, "", hostname, tlsKernel, tlsCertFile, tlsKeyFile).then((isSucc) => {
if (isSucc) {
initMainWindow();
}
Expand Down
6 changes: 2 additions & 4 deletions kernel/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ require (
golang.org/x/image v0.18.0
golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b
golang.org/x/mod v0.18.0
golang.org/x/net v0.25.0
golang.org/x/net v0.26.0
golang.org/x/text v0.16.0
golang.org/x/time v0.5.0
)

require (
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-querystring v1.1.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
Expand All @@ -100,7 +100,6 @@ require (
github.com/bytedance/sonic v1.11.9 // indirect
github.com/bytedance/sonic/loader v0.1.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
Expand Down Expand Up @@ -176,7 +175,6 @@ require (
golang.org/x/arch v0.8.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/tools v0.22.0 // indirect
Expand Down
23 changes: 23 additions & 0 deletions kernel/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0
github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 h1:wPbRQzjjwFc0ih8puEVAOFGELsn1zoIIYdxvML7mDxA=
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8/go.mod h1:I0gYDMZ6Z5GRU7l58bNFSkPTFN6Yl12dsUlAZ8xy98g=
github.com/PuerkitoBio/goquery v1.4.1/go.mod h1:T9ezsOHcCrDCgA8aF1Cqr3sSYbO/xgdy8/R/XiIMAhA=
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
Expand All @@ -57,13 +59,15 @@ github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII=
github.com/aws/aws-sdk-go v1.54.11 h1:Zxuv/R+IVS0B66yz4uezhxH9FN9/G2nbxejYqAMFjxk=
github.com/aws/aws-sdk-go v1.54.11/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/bytedance/sonic v1.11.9 h1:LFHENlIY/SLzDWverzdOvgMztTxcfcF+cqNsz9pK5zg=
github.com/bytedance/sonic v1.11.9/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
github.com/cloudflare/circl v1.3.9 h1:QFrlgFYf2Qpi8bSpVPK1HBvWpx16v/1TZivyo7pGuBE=
github.com/cloudflare/circl v1.3.9/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
Expand Down Expand Up @@ -162,8 +166,18 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGw
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4=
github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v53 v53.2.0 h1:wvz3FyF53v4BK+AsnvCmeNhf8AkTaeh2SoYu/XUvTtI=
github.com/google/go-github/v53 v53.2.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down Expand Up @@ -457,6 +471,7 @@ golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand All @@ -472,6 +487,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/oauth2 v0.8.0 h1:6dkIjl3j3LtZ/O3sTgZTMsLKSftL/B8Zgq4huOIIUu8=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -484,6 +501,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -538,6 +556,11 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion kernel/model/emojis_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"github.com/88250/gulu"
"github.com/fsnotify/fsnotify"
"github.com/siyuan-community/siyuan/kernel/util"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
)

var emojisWatcher *fsnotify.Watcher
Expand Down
2 changes: 1 addition & 1 deletion kernel/model/emojis_watcher_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"time"

"github.com/radovskyb/watcher"
"github.com/siyuan-community/siyuan/kernel/util"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
)

var emojisWatcher *watcher.Watcher
Expand Down
12 changes: 9 additions & 3 deletions kernel/server/proxy/fixedport.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"net/http"
"net/http/httputil"

"github.com/siyuan-community/siyuan/kernel/util"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
)

func InitFixedPortService(host string) {
Expand All @@ -33,8 +33,14 @@ func InitFixedPortService(host string) {
// 启动一个固定 6806 端口的反向代理服务器,这样浏览器扩展才能直接使用 127.0.0.1:6806,不用配置端口
proxy := httputil.NewSingleHostReverseProxy(util.ServerURL)
logging.LogInfof("fixed port service [%s:%s] is running", host, util.FixedPort)
if proxyErr := http.ListenAndServe(host+":"+util.FixedPort, proxy); nil != proxyErr {
logging.LogWarnf("boot fixed port service [%s] failed: %s", util.ServerURL, proxyErr)
if util.TLSKernel {
if proxyErr := http.ListenAndServeTLS(host+":"+util.FixedPort, util.TLSCertFile, util.TLSKeyFile, proxy); nil != proxyErr {
logging.LogWarnf("boot fixed port service [%s] with SSL/TLS failed: %s", util.ServerURL, proxyErr)
}
} else {
if proxyErr := http.ListenAndServe(host+":"+util.FixedPort, proxy); nil != proxyErr {
logging.LogWarnf("boot fixed port service [%s] failed: %s", util.ServerURL, proxyErr)
}
}
logging.LogInfof("fixed port service [%s:%s] is stopped", host, util.FixedPort)
}
Expand Down
34 changes: 25 additions & 9 deletions kernel/server/proxy/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
package proxy

import (
"crypto/tls"
"fmt"
"net"
"net/http"
"net/http/httputil"
"strconv"

"github.com/siyuan-community/siyuan/kernel/model"
"github.com/siyuan-community/siyuan/kernel/util"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/model"
"github.com/siyuan-note/siyuan/kernel/util"
)

type PublishServiceTransport struct{}
Expand All @@ -35,10 +36,13 @@ var (
Port = "0"

listener net.Listener
transport = PublishServiceTransport{}
proxy = &httputil.ReverseProxy{
transport = &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
publishServiceTransport = PublishServiceTransport{}
proxy = &httputil.ReverseProxy{
Rewrite: rewrite,
Transport: transport,
Transport: publishServiceTransport,
}
)

Expand Down Expand Up @@ -110,9 +114,17 @@ func closePublishListener() (err error) {
func startPublishReverseProxyService() {
logging.LogInfof("publish service [%s:%s] is running", Host, Port)
// 服务进行时一直阻塞
if err := http.Serve(listener, proxy); nil != err {
if listener != nil {
logging.LogErrorf("boot publish service failed: %s", err)
if util.TLSKernel {
if err := http.ServeTLS(listener, proxy, util.TLSCertFile, util.TLSKeyFile); nil != err {
if listener != nil {
logging.LogErrorf("boot publish service with SSL/TLS failed: %s", err)
}
}
} else {
if err := http.Serve(listener, proxy); nil != err {
if listener != nil {
logging.LogErrorf("boot publish service failed: %s", err)
}
}
}
logging.LogInfof("publish service [%s:%s] is stopped", Host, Port)
Expand Down Expand Up @@ -156,6 +168,10 @@ func (PublishServiceTransport) RoundTrip(request *http.Request) (response *http.
request.Header.Set(model.XAuthTokenKey, model.GetBasicAuthAccount("").Token)
}

response, err = http.DefaultTransport.RoundTrip(request)
// response, err = http.DefaultTransport.RoundTrip(request)
response, err = transport.RoundTrip(request)
if err != nil {
logging.LogWarnf("reverse proxy request failed: %s", err)
}
return
}
4 changes: 1 addition & 3 deletions kernel/server/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func Serve(fastMode bool) {
}
util.ServerPort = port

util.ServerURL, err = url.Parse("http://127.0.0.1:" + port)
util.ServerURL, err = url.Parse(util.Protocol + "://" + util.Hostname + ":" + util.ServerPort)
if err != nil {
logging.LogErrorf("parse server url failed: %s", err)
}
Expand All @@ -138,8 +138,6 @@ func Serve(fastMode bool) {
// 反代服务器启动失败不影响核心服务器启动
}()

go util.HookUILoaded()

if util.TLSKernel {
if err = http.ServeTLS(ln, ginServer.Handler(), util.TLSCertFile, util.TLSKeyFile); nil != err {
if !fastMode {
Expand Down
1 change: 1 addition & 0 deletions kernel/util/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ var (
TLSCertFile = ""
TLSKeyFile = ""
Protocol = "http"
Hostname = "localhost"
UserAgent = "SiYuan/" + Ver
)

Expand Down
12 changes: 8 additions & 4 deletions kernel/util/working.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ func Boot() {
lang := flag.String("lang", "", "zh_CN/zh_CHT/en_US/fr_FR/es_ES/ja_JP")
mode := flag.String("mode", "prod", "dev/prod")

tlsKernel := flag.Bool("tls-kernel", false, "enable SSL/TLS for kernel service")
tlsCertFile := flag.String("tls-cert-file", "", "SSL/TLS fullchain certificate file path, default to workspace/conf/tls/siyuan.pem.cer")
tlsKeyFile := flag.String("tls-key-file", "", "SSL/TLS private key file path, default to workspace/conf/tls/siyuan.pem.key")
hostname := flag.String("hostname", "localhost", "Hostname used for the reverse proxy (publishing services, etc), default to \"localhost\"")

tlsKernel := flag.Bool("tls-kernel", false, "enable SSL/TLS for kernel service, default to false")
tlsCertFile := flag.String("tls-cert-file", "", "SSL/TLS full-chain certificate file path, default to \"workspace/conf/tls/siyuan.pem.cer\"")
tlsKeyFile := flag.String("tls-key-file", "", "SSL/TLS private key file path, default to \"workspace/conf/tls/siyuan.pem.key\"")

flag.Parse()

Expand Down Expand Up @@ -130,6 +132,8 @@ func Boot() {

SSL = *ssl

Hostname = *hostname

TLSKernel = *tlsKernel
TLSCertFile = *tlsCertFile
TLSKeyFile = *tlsKeyFile
Expand All @@ -142,7 +146,7 @@ func Boot() {
TLSKeyFile = filepath.Join(ConfDir, "tls", "siyuan.pem.key")
}
if _, err := tls.LoadX509KeyPair(TLSCertFile, TLSKeyFile); nil != err {
logging.LogWarnf("load SSL/TLS certificate file failed: %s", err)
logging.LogErrorf("load SSL/TLS certificate file failed: %s", err)
TLSKernel = false
} else {
SSL = true
Expand Down

0 comments on commit f96a303

Please sign in to comment.