Preview Configuration
Text types
文本类型
The extensions of the files you want to preview as text, split by ,
, such as txt,md,go,tsx
.
要作为文本预览的文件扩展名,用 ,
分隔,例如 txt,md,go,tsx
。
Audio types
音频类型
The extensions of the files you want to preview as audio, split by ,
, such as mp3,wav,m4a
.
要作为音频预览的文件扩展名,以 ,
分隔,例如 mp3,wav,m4a
。
Video types
视频类型
The extensions of the files you want to preview as video, split by ,
, such as mp4,webm,ogg
.
要作为视频预览的文件扩展名,以 ,
分隔,例如 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
.
要作为图像预览的文件扩展名,以 ,
分隔,例如 jpg,jpeg,png,gif,webp
。
Proxy types
代理类型
The extensions of the files you want to separately set to download through proxy
要通过程序代理下载的文件扩展名
Proxy ignore headers
代理忽略头部
For details, please check: https://github.com/alist-org/alist/issues/2763
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 openlist URL$name
: the file name Extended variables: Add [eb_] before the basic variable, where e meansencodeURIComponent
, b meansbase64
, such as$e_url
: encodeURIComponent($url)$b_url
: btoa($url)$eb_url
: encodeURIComponent(btoa($url)) Finally, theExternal previews
will displayed aOpen with
menu while current file matched theextensions
. For example, setExternal previews
to
{
"txt": {
"Notepad": "notepad://$url"
},
"/.*/": {
"VSCode": "vscode://$url"
}
}
when we enter a file with the extension txt
, it will show:
一个包含外部预览设置的 json 对象,定义为
interface {
[extensions: string]: {
[name: string]: string //(url)
}
}
第一个key extensions
是用 ,
分割的文件扩展名(如果是 startsWith/
会被认为是正则表达式),value 也是一个 key-value
对象,key 是 预览名称,值为外部网址。 对于外部 url,我们提供了一些变量供您使用: 基础变量:
$url
: the file url$durl
: the file of alist URL$name
: the file name 拓展变量: 在基础变量前添加[eb_],其中e表示encodeURIComponent
,b表示base64
, 如$e_url
: encodeURIComponent($url)$b_url
: btoa($url)$eb_url
: encodeURIComponent(btoa($url)) 最后,当当前文件与“扩展”匹配时,“外部预览”将显示“打开方式”菜单。 例如,将“外部预览”设置为
{
"txt": {
"Notepad": "notepad://$url"
},
"/.*/": {
"VSCode": "vscode://$url"
}
}
当我们输入一个扩展名为 txt
的文件时,它会显示:
Iframe previews
iframe 预览
Similar to External previews
, but it will embed an iframe in current page directly.
TIP提示
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"
}
}
Deploying and using OnlyOffice
Reference:
类似于 External previews
,但它会直接在当前页面中嵌入 iframe。
TIP提示
如果你想使用自部署的onlyoffice预览office文件,可以在这里添加如下配置:
{
"doc,docx,xls,xlsx,ppt,pptx": {
"OnlyOffice": "you_only_office_url"
}
}
部署和使用 OnlyOffice
参考:
Audio cover
音频封面
The default audio cover.
歌曲无播放封面时显示的默认封面。
Audio autoplay
自动播放音频
Whether to automatically play audio files.
是否自动播放音频文件。
Video autoplay
自动播放视频
Whether to automatically play video files.
是否自动播放视频文件。
Preview by default when opening archives
打开压缩包文件时默认预览
After turning on this option, compressed package format files will be previewed by default (as shown in the figure below), which will consume some server traffic, but will not download them all, If you want to turn off the preferred preview of the compressed format, this option is turned off, and the preference is the download mode
打开此选项后,默认会对压缩包格式文件进行预览(如下图所示),会消耗一些服务器流量,但不会全部下载,如果要关闭压缩包格式首选预览,此选项关闭,首选项就是下载模式
Readme autorender
Readme 自动渲染
After closing, the content of the readme.md
file will not be automatically rendered at the bottom of the file.
关闭后 readme.md
文件的内容将不会自动渲染在文件最底部
Filter readme scripts
过滤 Readme 文件中的脚本
Prevent virus script attacks. After turning it on, the contents of readme.md
will be displayed in text form. The specific effects are as follows
- Including but not limited to strikethrough, tables, task lists, etc. displayed in text form
防止病毒脚本攻击,开启后会以文本形式显示 readme.md
内容,具体效果如下内容
- 包含但不限于 删除线、表格、任务列表等以文本形式展示
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
可以通过 type
请求参数来强制设置预览类型。 可选值:
UNKNOWN
FOLDER
VIDEO
AUDIO
TEXT
IMAGE
示例: http://yourdomain/test-file.ahk?type=text