🎨 Support directly access data/public/*
contents via URL link https://github.com/siyuan-note/siyuan/issues/8593
This commit is contained in:
parent
bf5caa23f8
commit
c540046b8e
2 changed files with 12 additions and 0 deletions
|
@ -75,6 +75,7 @@ func Serve(fastMode bool) {
|
|||
servePlugins(ginServer)
|
||||
serveEmojis(ginServer)
|
||||
serveTemplates(ginServer)
|
||||
servePublic(ginServer)
|
||||
serveRepoDiff(ginServer)
|
||||
api.ServeAPI(ginServer)
|
||||
|
||||
|
@ -188,6 +189,11 @@ func serveTemplates(ginServer *gin.Engine) {
|
|||
ginServer.Static("/templates/", filepath.Join(util.DataDir, "templates"))
|
||||
}
|
||||
|
||||
func servePublic(ginServer *gin.Engine) {
|
||||
// Support directly access `data/public/*` contents via URL link https://github.com/siyuan-note/siyuan/issues/8593
|
||||
ginServer.Static("/public/", filepath.Join(util.DataDir, "public"))
|
||||
}
|
||||
|
||||
func serveAppearance(ginServer *gin.Engine) {
|
||||
ginServer.StaticFile("favicon.ico", filepath.Join(util.WorkingDir, "stage", "icon.png"))
|
||||
ginServer.StaticFile("manifest.json", filepath.Join(util.WorkingDir, "stage", "manifest.webmanifest"))
|
||||
|
|
|
@ -355,6 +355,12 @@ func initPathDir() {
|
|||
if err := os.MkdirAll(emojis, 0755); nil != err && !os.IsExist(err) {
|
||||
logging.LogFatalf(logging.ExitCodeInitWorkspaceErr, "create data emojis folder [%s] failed: %s", widgets, err)
|
||||
}
|
||||
|
||||
// Support directly access `data/public/*` contents via URL link https://github.com/siyuan-note/siyuan/issues/8593
|
||||
public := filepath.Join(DataDir, "public")
|
||||
if err := os.MkdirAll(public, 0755); nil != err && !os.IsExist(err) {
|
||||
logging.LogFatalf(logging.ExitCodeInitWorkspaceErr, "create data public folder [%s] failed: %s", widgets, err)
|
||||
}
|
||||
}
|
||||
|
||||
func initMime() {
|
||||
|
|
Loading…
Add table
Reference in a new issue