Preview settings
Preview settings
Text types
The extensions of the files you want to preview as text, split by ,
, such as txt,md,go,tsx
.
Audio types
The extensions of the files you want to preview as audio, split by ,
, such as mp3,wav,m4a
.
Video types
The extensions of the files you want to preview as video, split by ,
, such as mp4,webm,ogg
.
Image types
The extensions of the files you want to preview as image, split by ,
, such as jpg,jpeg,png,gif,webp
.
Proxy types
The extensions of the files you want to separately set to download through proxy
External previews
A json object that contains the external preview settings, It is defined as
interface {
[extensions: string]: {
[name: string]: string //(url)
}
}
the first key extensions
is the file extensions that split by ,
(if it's startsWith /
, it will be considered a regular expression), and the value is also a key-value
object, the key is the preview name, and the value is the external url.
For the external url, we provide some variables for you to use:
Basic variable:
$url
: the file url$durl
: the file of alist URL$name
: the file name
Extended variables:
Add [eb_] before the basic variable, where e means encodeURIComponent
, b means base64
, such as
$e_url
: encodeURIComponent($url)$b_url
: btoa($url)$eb_url
: encodeURIComponent(btoa($url))
Finally, the External previews
will displayed a Open with
menu while current file matched the extensions
.
For example, set External previews
to
{
"txt": {
"Notepad": "notepad://$url"
},
"/.*/": {
"VSCode": "vscode://$url"
}
}
when we enter a file with the extension txt
, it will show:
Iframe previews
Similar to External previews
, but it will embed an iframe in current page directly.
Tips
If you want to use self-deployed onlyoffice to preview office files, you can add the configuration like this here:
{
"doc,docx,xls,xlsx,ppt,pptx": {
"OnlyOffice": "you_only_office_url"
}
}
Audio cover
The default audio cover.
Audio autoplay
Whether to automatically play audio files.
Video autoplay
Whether to automatically play video files.
Proxy ignore headers
For details, please check: https://github.com/alist-org/alist/issues/2763
Force preview
We can force the preview type through the type
query parameter.
Available values:
UNKNOWN
FOLDER
VIDEO
AUDIO
TEXT
IMAGE
Example: http://yourdomain/test-file.ahk?type=text