mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-04 20:00:17 +01:00
🎨 Fix network serving TLS on mobile devices (#17119)
* Until now, the TLS would only work via the fixed port proxy, which isn't used on mobile devices. * Move the logic for the multiplexer out of the fixed port logic * Use the newly moved multiplexer logic for the regular server as well, whenever the fixed port and the server port match.
This commit is contained in:
parent
7912100136
commit
0cc061dec8
3 changed files with 71 additions and 32 deletions
|
|
@ -47,6 +47,7 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/model"
|
||||
"github.com/siyuan-note/siyuan/kernel/server/proxy"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
"github.com/soheilhy/cmux"
|
||||
"golang.org/x/net/webdav"
|
||||
)
|
||||
|
||||
|
|
@ -244,6 +245,20 @@ func Serve(fastMode bool, cookieKey string) {
|
|||
Handler: ginServer,
|
||||
}
|
||||
|
||||
if useTLS && (util.FixedPort == util.ServerPort || util.IsPortOpen(util.FixedPort)) {
|
||||
if err = util.ServeMultiplexed(ln, ginServer, certPath, keyPath, util.HttpServer); err != nil {
|
||||
if errors.Is(err, http.ErrServerClosed) || err == cmux.ErrListenerClosed {
|
||||
return
|
||||
}
|
||||
|
||||
if !fastMode {
|
||||
logging.LogErrorf("boot kernel failed: %s", err)
|
||||
os.Exit(logging.ExitCodeUnavailablePort)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err = util.HttpServer.Serve(ln); err != nil {
|
||||
if errors.Is(err, http.ErrServerClosed) {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue