mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-21 19:41:05 +08:00
* 🐛 fix #5857 * 🎨 #5990 桌面端 `SiYuan` 可执行程序支持使用参数连接非本机内核服务 * 🎨 style * 🎨 style * 🎨 style * 🎨 改进伺服代码片段 `/snippets/` #6356
This commit is contained in:
parent
fe60b22d53
commit
1809c27f60
@ -32,9 +32,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func serveSnippets(c *gin.Context) {
|
func serveSnippets(c *gin.Context) {
|
||||||
name := strings.TrimPrefix(c.Request.URL.Path, "/snippets/")
|
filePath := strings.TrimPrefix(c.Request.URL.Path, "/snippets/")
|
||||||
ext := filepath.Ext(name)
|
ext := filepath.Ext(filePath)
|
||||||
name = strings.TrimSuffix(name, ext)
|
name := strings.TrimSuffix(filePath, ext)
|
||||||
confSnippets, err := model.LoadSnippets()
|
confSnippets, err := model.LoadSnippets()
|
||||||
if nil != err {
|
if nil != err {
|
||||||
logging.LogErrorf("load snippets failed: %s", name, err)
|
logging.LogErrorf("load snippets failed: %s", name, err)
|
||||||
@ -49,7 +49,8 @@ func serveSnippets(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.Status(404)
|
filePath = filepath.Join(util.SnippetsPath, filePath)
|
||||||
|
c.File(filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSnippet(c *gin.Context) {
|
func getSnippet(c *gin.Context) {
|
||||||
|
@ -172,6 +172,7 @@ var (
|
|||||||
AppearancePath string // 配置目录下的外观目录 appearance/ 路径
|
AppearancePath string // 配置目录下的外观目录 appearance/ 路径
|
||||||
ThemesPath string // 配置目录下的外观目录下的 themes/ 路径
|
ThemesPath string // 配置目录下的外观目录下的 themes/ 路径
|
||||||
IconsPath string // 配置目录下的外观目录下的 icons/ 路径
|
IconsPath string // 配置目录下的外观目录下的 icons/ 路径
|
||||||
|
SnippetsPath string // 数据目录下的 snippets/ 路径
|
||||||
|
|
||||||
AndroidNativeLibDir string // Android 库路径
|
AndroidNativeLibDir string // Android 库路径
|
||||||
AndroidPrivateDataDir string // Android 私有数据路径
|
AndroidPrivateDataDir string // Android 私有数据路径
|
||||||
@ -274,6 +275,7 @@ func initWorkspaceDir(workspaceArg string) {
|
|||||||
DBPath = filepath.Join(TempDir, DBName)
|
DBPath = filepath.Join(TempDir, DBName)
|
||||||
HistoryDBPath = filepath.Join(TempDir, "history.db")
|
HistoryDBPath = filepath.Join(TempDir, "history.db")
|
||||||
BlockTreePath = filepath.Join(TempDir, "blocktree.msgpack")
|
BlockTreePath = filepath.Join(TempDir, "blocktree.msgpack")
|
||||||
|
SnippetsPath = filepath.Join(DataDir, "snippets")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -60,6 +60,7 @@ func BootMobile(container, appDir, workspaceDir, nativeLibDir, privateDataDir, l
|
|||||||
AppearancePath = filepath.Join(ConfDir, "appearance")
|
AppearancePath = filepath.Join(ConfDir, "appearance")
|
||||||
ThemesPath = filepath.Join(AppearancePath, "themes")
|
ThemesPath = filepath.Join(AppearancePath, "themes")
|
||||||
IconsPath = filepath.Join(AppearancePath, "icons")
|
IconsPath = filepath.Join(AppearancePath, "icons")
|
||||||
|
SnippetsPath = filepath.Join(DataDir, "snippets")
|
||||||
Resident = true
|
Resident = true
|
||||||
ServerPort = FixedPort
|
ServerPort = FixedPort
|
||||||
Container = container
|
Container = container
|
||||||
|
Loading…
Reference in New Issue
Block a user