mirror of https://github.com/Xhofe/alist
feat!: unity iframe preview
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.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.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.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: conf.ProxyTypes, Value: "m3u8", Type: conf.TypeText, Group: model.PREVIEW, Flag: model.PRIVATE},
|
||||||
{Key: "external_previews", Value: `{}`, Type: conf.TypeText, Group: model.PREVIEW},
|
{Key: "external_previews", Value: `{}`, Type: conf.TypeText, Group: model.PREVIEW},
|
||||||
{Key: conf.OfficeViewers, Value: `{
|
{Key: "iframe_previews", Value: `{
|
||||||
"Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url",
|
"doc,docx,xls,xlsx,ppt,pptx": {
|
||||||
"Google":"https://docs.google.com/gview?url=$url&embedded=true",
|
"Microsoft":"https://view.officeapps.live.com/op/view.aspx?src=$url",
|
||||||
}`, Type: conf.TypeText, Group: model.PREVIEW},
|
"Google":"https://docs.google.com/gview?url=$url&embedded=true"
|
||||||
{Key: conf.PdfViewers, Value: `{
|
},
|
||||||
"pdf.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$url"
|
"pdf": {
|
||||||
|
"PDF.js":"https://alist-org.github.io/pdf.js/web/viewer.html?file=$url"
|
||||||
|
}
|
||||||
}`, Type: conf.TypeText, Group: model.PREVIEW},
|
}`, 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.AudioAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
|
||||||
{Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
|
{Key: conf.VideoAutoplay, Value: "true", Type: conf.TypeBool, Group: model.PREVIEW},
|
||||||
// global settings
|
// global settings
|
||||||
|
|
|
@ -21,11 +21,11 @@ const (
|
||||||
MainColor = "main_color"
|
MainColor = "main_color"
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
TextTypes = "text_types"
|
TextTypes = "text_types"
|
||||||
AudioTypes = "audio_types"
|
AudioTypes = "audio_types"
|
||||||
VideoTypes = "video_types"
|
VideoTypes = "video_types"
|
||||||
ImageTypes = "image_types"
|
ImageTypes = "image_types"
|
||||||
OfficeTypes = "office_types"
|
//OfficeTypes = "office_types"
|
||||||
ProxyTypes = "proxy_types"
|
ProxyTypes = "proxy_types"
|
||||||
OfficeViewers = "office_viewers"
|
OfficeViewers = "office_viewers"
|
||||||
PdfViewers = "pdf_viewers"
|
PdfViewers = "pdf_viewers"
|
||||||
|
@ -51,7 +51,7 @@ const (
|
||||||
const (
|
const (
|
||||||
UNKNOWN = iota
|
UNKNOWN = iota
|
||||||
FOLDER
|
FOLDER
|
||||||
OFFICE
|
//OFFICE
|
||||||
VIDEO
|
VIDEO
|
||||||
AUDIO
|
AUDIO
|
||||||
TEXT
|
TEXT
|
||||||
|
|
|
@ -38,12 +38,12 @@ var SettingItemHooks = map[string]SettingItemHook{
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
conf.OfficeTypes: {
|
//conf.OfficeTypes: {
|
||||||
Hook: func(item *model.SettingItem) error {
|
// Hook: func(item *model.SettingItem) error {
|
||||||
conf.TypesMap[conf.OfficeTypes] = strings.Split(item.Value, ",")
|
// conf.TypesMap[conf.OfficeTypes] = strings.Split(item.Value, ",")
|
||||||
return nil
|
// return nil
|
||||||
},
|
// },
|
||||||
},
|
//},
|
||||||
conf.ProxyTypes: {
|
conf.ProxyTypes: {
|
||||||
func(item *model.SettingItem) error {
|
func(item *model.SettingItem) error {
|
||||||
conf.TypesMap[conf.ProxyTypes] = strings.Split(item.Value, ",")
|
conf.TypesMap[conf.ProxyTypes] = strings.Split(item.Value, ",")
|
||||||
|
|
|
@ -53,9 +53,9 @@ func CreateTempFile(r io.ReadCloser) (*os.File, error) {
|
||||||
// GetFileType get file type
|
// GetFileType get file type
|
||||||
func GetFileType(filename string) int {
|
func GetFileType(filename string) int {
|
||||||
ext := Ext(filename)
|
ext := Ext(filename)
|
||||||
if SliceContains(conf.TypesMap[conf.OfficeTypes], ext) {
|
//if SliceContains(conf.TypesMap[conf.OfficeTypes], ext) {
|
||||||
return conf.OFFICE
|
// return conf.OFFICE
|
||||||
}
|
//}
|
||||||
if SliceContains(conf.TypesMap[conf.AudioTypes], ext) {
|
if SliceContains(conf.TypesMap[conf.AudioTypes], ext) {
|
||||||
return conf.AUDIO
|
return conf.AUDIO
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue