diff --git a/internal/bootstrap/data/setting.go b/internal/bootstrap/data/setting.go index 3a136631..b0892a0f 100644 --- a/internal/bootstrap/data/setting.go +++ b/internal/bootstrap/data/setting.go @@ -105,6 +105,9 @@ func InitialSettings() []model.SettingItem { }, "pdf": { "PDF.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$e_url" + }, + "epub": { + "EPUB.js":"/static/epub.js/viewer.html?url=$e_url" } }`, Type: conf.TypeText, Group: model.PREVIEW}, // {Key: conf.OfficeViewers, Value: `{ diff --git a/server/middlewares/check.go b/server/middlewares/check.go index 056c52b7..aa3878e5 100644 --- a/server/middlewares/check.go +++ b/server/middlewares/check.go @@ -17,7 +17,7 @@ func StoragesLoaded(c *gin.Context) { c.Next() return } - paths := []string{"/assets", "/images", "/streamer"} + paths := []string{"/assets", "/images", "/streamer", "/static"} for _, path := range paths { if strings.HasPrefix(c.Request.URL.Path, path) { c.Next() diff --git a/server/static/static.go b/server/static/static.go index 82a461ae..b31d7858 100644 --- a/server/static/static.go +++ b/server/static/static.go @@ -64,7 +64,7 @@ func UpdateIndex() { func Static(r *gin.Engine) { InitIndex() - folders := []string{"assets", "images", "streamer"} + folders := []string{"assets", "images", "streamer", "static"} r.Use(func(c *gin.Context) { for i := range folders { if strings.HasPrefix(c.Request.RequestURI, fmt.Sprintf("/%s/", folders[i])) {