mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-05 07:01:48 +01:00
✨ Support read-only publish service
* 🎨 kernel supports read-only publishing services * 🐛 Fix authentication vulnerabilities * 🎨 Protect secret information * 🎨 Adjust the permission control * 🎨 Adjust the permission control * 🎨 Fixed the vulnerability that `getFile` gets file `conf.json` * 🎨 Add API `/api/setting/setPublish` * 🎨 Add API `/api/setting/getPublish` * 🐛 Fixed the issue that PWA-related files could not pass BasicAuth * 🎨 Add a settings panel for publishing features * 📝 Add guide for `Publish Service` * 📝 Update Japanese user guide * 🎨 Merge fixed static file services
This commit is contained in:
parent
536879cb84
commit
ba2193403d
47 changed files with 3690 additions and 375 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -90,6 +91,19 @@ func IsOnline(checkURL string, skipTlsVerify bool) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func IsPortOpen(port string) bool {
|
||||
timeout := time.Second
|
||||
conn, err := net.DialTimeout("tcp", net.JoinHostPort("127.0.0.1", port), timeout)
|
||||
if nil != err {
|
||||
return false
|
||||
}
|
||||
if nil != conn {
|
||||
conn.Close()
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {
|
||||
c := req.C().SetTimeout(3 * time.Second)
|
||||
if skipTlsVerify {
|
||||
|
|
@ -168,3 +182,12 @@ func initHttpClient() {
|
|||
http.DefaultClient = httpclient.GetCloudFileClient2Min()
|
||||
http.DefaultTransport = httpclient.NewTransport(false)
|
||||
}
|
||||
|
||||
func ParsePort(portString string) (uint16, error) {
|
||||
if port, err := strconv.ParseUint(portString, 10, 16); err != nil {
|
||||
logging.LogErrorf("parse port [%s] failed: %s", portString, err)
|
||||
return 0, err
|
||||
} else {
|
||||
return uint16(port), nil
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ func IsDisplayableAsset(p string) bool {
|
|||
|
||||
func GetAbsPathInWorkspace(relPath string) (string, error) {
|
||||
absPath := filepath.Join(WorkspaceDir, relPath)
|
||||
absPath = filepath.Clean(absPath)
|
||||
if WorkspaceDir == absPath {
|
||||
return absPath, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"fmt"
|
||||
"math/rand"
|
||||
"mime"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
|
@ -341,7 +342,9 @@ func WriteWorkspacePaths(workspacePaths []string) (err error) {
|
|||
}
|
||||
|
||||
var (
|
||||
ServerPort = "0" // HTTP/WebSocket 端口,0 为使用随机端口
|
||||
ServerURL *url.URL // 内核服务 URL
|
||||
ServerPort = "0" // HTTP/WebSocket 端口,0 为使用随机端口
|
||||
|
||||
ReadOnly bool
|
||||
AccessAuthCode string
|
||||
Lang = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue