mirror of https://github.com/Xhofe/alist
feat: static files for embed viewers (#2739)
parent
4568af9542
commit
e2bcca2fbd
|
@ -105,6 +105,9 @@ func InitialSettings() []model.SettingItem {
|
||||||
},
|
},
|
||||||
"pdf": {
|
"pdf": {
|
||||||
"PDF.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$e_url"
|
"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},
|
}`, Type: conf.TypeText, Group: model.PREVIEW},
|
||||||
// {Key: conf.OfficeViewers, Value: `{
|
// {Key: conf.OfficeViewers, Value: `{
|
||||||
|
|
|
@ -17,7 +17,7 @@ func StoragesLoaded(c *gin.Context) {
|
||||||
c.Next()
|
c.Next()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
paths := []string{"/assets", "/images", "/streamer"}
|
paths := []string{"/assets", "/images", "/streamer", "/static"}
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
if strings.HasPrefix(c.Request.URL.Path, path) {
|
if strings.HasPrefix(c.Request.URL.Path, path) {
|
||||||
c.Next()
|
c.Next()
|
||||||
|
|
|
@ -64,7 +64,7 @@ func UpdateIndex() {
|
||||||
|
|
||||||
func Static(r *gin.Engine) {
|
func Static(r *gin.Engine) {
|
||||||
InitIndex()
|
InitIndex()
|
||||||
folders := []string{"assets", "images", "streamer"}
|
folders := []string{"assets", "images", "streamer", "static"}
|
||||||
r.Use(func(c *gin.Context) {
|
r.Use(func(c *gin.Context) {
|
||||||
for i := range folders {
|
for i := range folders {
|
||||||
if strings.HasPrefix(c.Request.RequestURI, fmt.Sprintf("/%s/", folders[i])) {
|
if strings.HasPrefix(c.Request.RequestURI, fmt.Sprintf("/%s/", folders[i])) {
|
||||||
|
|
Loading…
Reference in New Issue