mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-22 21:04:07 +08:00
feat!: unity iframe preview
This commit is contained in:
parent
e9927806d4
commit
d9ee174dd3
@ -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
|
||||
|
@ -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
|
||||
|
@ -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, ",")
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user