diff --git a/internal/bootstrap/data/setting.go b/internal/bootstrap/data/setting.go index 6235a26a217..9982dc50feb 100644 --- a/internal/bootstrap/data/setting.go +++ b/internal/bootstrap/data/setting.go @@ -82,16 +82,25 @@ func initialSettings() { {Key: conf.AudioTypes, Value: "mp3,flac,ogg,m4a,wav,opus", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, {Key: conf.VideoTypes, Value: "mp4,mkv,avi,mov,rmvb,webm,flv", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, {Key: conf.ImageTypes, Value: "jpg,tiff,jpeg,png,gif,bmp,svg,ico,swf,webp", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, - {Key: conf.OfficeTypes, Value: "doc,docx,xls,xlsx,ppt,pptx", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, + //{Key: conf.OfficeTypes, Value: "doc,docx,xls,xlsx,ppt,pptx", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, {Key: conf.ProxyTypes, Value: "m3u8", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE}, {Key: "external_previews", Value: `{}`, Type: conf.TypeText, Group: model.PREVIEW}, - {Key: conf.OfficeViewers, Value: `{ - "Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url", - "Google":"https://docs.google.com/gview?url=$url&embedded=true", -}`, Type: conf.TypeText, Group: model.PREVIEW}, - {Key: conf.PdfViewers, Value: `{ - "pdf.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$url" + {Key: "iframe_previews", Value: `{ + "doc,docx,xls,xlsx,ppt,pptx": { + "Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url", + "Google":"https://docs.google.com/gview?url=$url&embedded=true" + }, + "pdf": { + "PDF.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$url" + } }`, Type: conf.TypeText, Group: model.PREVIEW}, + // {Key: conf.OfficeViewers, Value: `{ + // "Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url", + // "Google":"https://docs.google.com/gview?url=$url&embedded=true", + //}`, Type: conf.TypeText, Group: model.PREVIEW}, + // {Key: conf.PdfViewers, Value: `{ + // "pdf.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$url" + //}`, Type: conf.TypeText, Group: model.PREVIEW}, {Key: conf.AudioAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW}, {Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW}, // global settings diff --git a/internal/conf/const.go b/internal/conf/const.go index 1e1b3aa7898..fe66388c46f 100644 --- a/internal/conf/const.go +++ b/internal/conf/const.go @@ -21,11 +21,11 @@ const ( MainColor = "main_color" // preview - TextTypes = "text_types" - AudioTypes = "audio_types" - VideoTypes = "video_types" - ImageTypes = "image_types" - OfficeTypes = "office_types" + TextTypes = "text_types" + AudioTypes = "audio_types" + VideoTypes = "video_types" + ImageTypes = "image_types" + //OfficeTypes = "office_types" ProxyTypes = "proxy_types" OfficeViewers = "office_viewers" PdfViewers = "pdf_viewers" @@ -51,7 +51,7 @@ const ( const ( UNKNOWN = iota FOLDER - OFFICE + //OFFICE VIDEO AUDIO TEXT diff --git a/internal/db/settinghooks.go b/internal/db/settinghooks.go index 6d51c6e855b..a49019ea267 100644 --- a/internal/db/settinghooks.go +++ b/internal/db/settinghooks.go @@ -38,12 +38,12 @@ var SettingItemHooks = map[string]SettingItemHook{ return nil }, }, - conf.OfficeTypes: { - Hook: func(item *model.SettingItem) error { - conf.TypesMap[conf.OfficeTypes] = strings.Split(item.Value, ",") - return nil - }, - }, + //conf.OfficeTypes: { + // Hook: func(item *model.SettingItem) error { + // conf.TypesMap[conf.OfficeTypes] = strings.Split(item.Value, ",") + // return nil + // }, + //}, conf.ProxyTypes: { func(item *model.SettingItem) error { conf.TypesMap[conf.ProxyTypes] = strings.Split(item.Value, ",") diff --git a/pkg/utils/file.go b/pkg/utils/file.go index 867ed4c8661..d053173e031 100644 --- a/pkg/utils/file.go +++ b/pkg/utils/file.go @@ -53,9 +53,9 @@ func CreateTempFile(r io.ReadCloser) (*os.File, error) { // GetFileType get file type func GetFileType(filename string) int { ext := Ext(filename) - if SliceContains(conf.TypesMap[conf.OfficeTypes], ext) { - return conf.OFFICE - } + //if SliceContains(conf.TypesMap[conf.OfficeTypes], ext) { + // return conf.OFFICE + //} if SliceContains(conf.TypesMap[conf.AudioTypes], ext) { return conf.AUDIO }