Alist最新安装教程
侧边栏壁纸
  • 累计撰写 8 篇文章
  • 累计收到 1 条评论

Alist最新安装教程

优创
2022-04-22 / 1 评论 / 1,993 阅读 / 正在检测是否收录...

简介

AList是一款阿里云盘的目录文件列表程序


项目地址:

一键脚本

仅支持Linux-x86_64/aarch64平台。

安装

curl -fsSL "https://ios98.com/alist.sh" | bash -s install
DANGER

已经安装过再次执行安装会删除之前的数据,更新请使用更新命令。

更新

curl -fsSL "https://ios98.com/alist.sh" | bash -s update

卸载

curl -fsSL "https://ios98.com/alist.sh" | bash -s uninstall

自定义路径

默认安装在/opt/alist,要自定义安装路径,添加安装路径为第二个参数,必须是绝对路径(路径以alist结尾时直接安装到给定路径,否则会安装在给定路径alist目录下),如安装到/root

# 安装
curl -fsSL "https://ios98.com/alist.sh" | bash -s install /root
# 更新
curl -fsSL "https://ios98.com/alist.sh" | bash -s update /root
# 卸载
curl -fsSL "https://ios98.com/alist.sh" | bash -s uninstall /root

配置文件

config.json

address

监听地址

port

监听端口

assets

使用的静态资源位置。这是动态可变化的,现有的静态资源在 npm 和 GitHub 上都有托管,它们的位置分别是:

所以你可以使用任何 npm 或者 github 的 cdn 来作为路径。默认使用饿了么反代的 unpkg 的 cdn(阿里云 cdn):https://npm.elemecdn.com/alist-web@$version/dist/$version在程序中会自动替换为前端的发行版本。在这里列举一些其他的可用的 assets:

NPM

GitHub

本地

  • 本地: /

自定义

两种方法:

  • 反代jsdelivr,然后将jsdelivr的npm或者github的cdn中的host换成自己的
  • https://github.com/alist-org/alist-web/releases 下载编译好的文件放到你的空间上,然后此处的assets填写你存放的位置的链接(到dist/这一级)

database

数据库相关设置

type

数据库类型,可选sqlite3mysqlpostgres

user

数据库用户名

password

数据库密码

host

数据库地址

port

数据库端口

name

数据库名称

table_prefix

数据库表前缀(针对多个应用程序使用一个数据库)

db_file

数据库文件,对于 sqlite3

ssl_mode

scheme

协议

https

是否开启 https

cert_file

证书文件

key_file

密钥文件

cache

缓存相关

expiration

缓存失效时间(单位:分钟)

cleanup_interval

清理失效缓存间隔

前端设置

标题

网页显示的标题

logo

左上角的LOGO,可填两个使用,分开,分别表示light和dark的两个logo。

favicon

浏览器标签页显示的小图标

图标颜色

前端显示的图标与Loding的颜色

文本类型

预览的时候以文本模式打开的后缀,以,分隔

隐藏文件

匹配正则表达式隐藏的文件,如果你不懂不要乱填,错误的正则表达式会导致前端页面崩溃,每行一个,默认有一个隐藏所有目录下的README.md的示例表达式

音乐封面

播放音乐的时候没有缩略图显示的封面

站点备案

如果是备案的站点,可以填写备案号

home readme url

当有多个账号时,首页显示的readme的url,可以使用某个账号中的readme,操作如下:

自动播放视频

预览视频时,无需手动点击播放,自动开始

自动播放音频

预览音频时,无需手动点击播放,自动开始

自定义头部

任意内容需要自己包含标签,自动放置在网页的head开始处

自定义body

任意内容需要自己包含标签,自动放置在网页的body结束处

home emoji

导航栏Home前面显示的emoji,可以不填

动画

文件列表弹出的动画,当文件数量居多时,显示动画会导致卡顿

artplayer whitelist

refer to https://artplayer.org/document/options#whitelist

artplayer autoSize

refer to https://artplayer.org/document/options#autosize

load type

加载方式,可选四种:

  • all: 加载全部
  • load more: 显示一个加载更多按钮
  • auto load more: 滑动到底部自动加载更多
  • pagination: 显示分页

default page size

当load type不为all时的每页数量

后端设置

密码

后台登陆密码

检查父文件夹密码

启用后,如果当前文件夹未设置密码,会递归检查父文件夹是否有密码,直至检查到第一个密码或到根目录停止。

check down link

用于加密直链,开启后直链会携带一个名为pw或sign(管理员)的query参数

d_proxy types)

单独的文件类型只走代理

ocr api

用于识别验证码

账号基本配置

所有账号的通用项

虚拟路径

必填,唯一标识符,即你要挂载到的位置,如果你要挂载到根目录,即为/

index(索引)

当有多个账号时,用于排序,越小越靠前

proxy(代理相关)

一个有三个相关选项:

  • proxy:网页端和直链走不走中转
  • webdav_proxy:webdav文件下载走不走中转
  • webdav_direct:webdav是否直接由本机中转

如果没有proxy和webdav_proxy选项,则说明只能走中转

存储分可以直接请求(有proxy开关)和不可以直接请求的(无proxy开关) 不可以直接请求的会直接走程序所在服务器(如果你没有填down_proxy_url) 可以直接请求的:

  • proxy关、webdav_proxy关:文件下载请求完全不走服务器
  • proxy开、webdav_proxy关:网页上的预览、直链下载都走服务器,但webdav下载不走服务器
  • proxy关、webdav_proxy开:网页上的预览、直链下载不走服务器,但webdav下载走服务器
  • proxy开、webdav_proxy开:网页预览、直链下载和webdav下载都走服务器。
  • webdav_direct: 如果打开此开关,则webdav文件直接由本机中转,且不经过302跳转。如果此项关闭且打开webdav_proxy,webdav客户端在get文件时可能会经过多次302跳转。因为部分客户端可能不支持302跳转get文件,所以打开此开关可能会提示部分客户端的兼容性。

down_proxy_url(下载代理地址)

不填此字段开启代理时,默认使用本机进行中转。提供两种代理方法:

cloudflare workers

可以使用cloudflare workers进行代理,此处填写cloudflare workers地址即可。 workers代码可以在https://github.com/alist-org/alist-proxy/blob/main/alist-proxy.js 找到。其中:

  • HOST: 你的Alist地址,必须添加协议头,且后面不能添加/。如https://alist.nn.ci
  • TOKEN:参见Alist部分的Token。

通用二进制

你也可以使用另外一台机器进行代理,在https://github.com/alist-org/alist-proxy/releases 下载程序

./alist-proxy -help查看使用方法。

你也可以自己开发代理程序,一般的步骤为:

  • 下载时会请求PROXY_URL/path?sign=sign_value
  • 在代理程序中验证sign,sign的计算方式为:
const name = path.split('/').pop();
const sign = md5(`alist-${TOKEN}-${name}`).slice(8, 24)
  • 验证sign无误后,请求HOST/api/admin/link,可以得到文件的URL与需要携带的请求头
  • 使用得到的信息请求并返回

api_proxy_url(API代理地址)

同down_proxy_url,请求API使用的代理,专门为GoogleDrive和PikPak等国内无法直接访问的存储准备。

extract_folder

  • front: 排序时将文件夹全部放到最前面
  • back: 排序时将文件夹全部放到最后面

示例样式

自定义主体宽度

<style>
  @media screen and (min-width: 62em) {
    .root-box {
      width: 1300px !important;
    }
  }
</style>

无边框阴影

<style>
.chakra-ui-light{
  background-color: #edddfd;
}
.main-box {
  border-radius: 15px !important;
  box-shadow: unset !important;
}
.chakra-ui-light .main-box {
  background-color: rgba(255,255,255,0.9) !important;
}
.chakra-ui-light .readme-box {
  background-color: rgba(255,255,255,0.9) !important;
}
.readme-box {
  border-radius: 15px !important;
  box-shadow: unset !important;
}
</style>

仿大白样式

<style>
.chakra-ui-light{
  background-image: linear-gradient(120deg,#e0c3fc 0%,#8ec5fc 100%) !important;
  background-attachment: fixed;
}
.main-box {
  border-radius: 15px !important;
}
.chakra-ui-light .main-box {
  background-color: white !important;
}
.chakra-ui-light .readme-box {
  background-color: white !important;
}
.readme-box {
  border-radius: 15px !important;
}
</style>

随机二次元背景图样式

<style>
.chakra-ui-light{
  background-image: url("https://www.dmoe.cc/random.php") !important;
  background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position-x:center;
}
.main-box {
  border-radius: 15px !important;
}
.chakra-ui-light .main-box {
  background-color: #ffffff70 !important;
}
.chakra-ui-light .readme-box {
  background-color: white !important;
}
.readme-box {
  border-radius: 15px !important;
}
</style>

<script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>

<script>
    L2Dwidget.init({
        "model": {
            jsonPath: "https://blog.imlete.cn/live2d/assets/weier.model.json",<!--这里改模型,前面后面都要改-->
            "scale": 0.8
        },
        "display": {
            "position": "right",<!--设置看板娘的上下左右位置-->
            "width": 50,
            "height": 100,
            "hOffset": 50,
            "vOffset": -10
        },
        "mobile": {
            "show": true,
            "scale": 0.5
        },
        "react": {
            "opacityDefault": 1,<!--设置透明度-->
            "opacityOnHover": 0.2
        }
    });
</script>

猛男风格

<!--head-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=ZCOOL+XiaoWei&display=swap" rel="stylesheet">
<style>
*{font-family:'ZCOOL XiaoWei',serif}div.footer.css-3m0ceo{display:none!important}#root,.App,body,html{min-height:70vh;margin:0;padding:0;margin-top:1%!important}.chakra-ui-light{background-color:#fff}.main-box{border-radius:15px!important;box-shadow:unset!important}.chakra-ui-light .main-box,.chakra-ui-light .readme-box{background-color:rgba(255,255,255,.8)!important}.readme-box{border-radius:15px!important;box-shadow:unset!important}body{background-size:cover!important;background-position:center top!important;background-attachment:fixed!important}.chakra-breadcrumb__list li,.chakra-breadcrumb__list li a{color:#000!important}.css-neion{color:#ffb6c1!important}.chakra-stack button{color:#fff!important}.chakra-stack .list-title p,.overlay button{color:#ffb6c1!important}a:hover{color:#f9cfec!important}.css-g9cw6v a,.footer span{display:none!important}.foot{line-height:40px;position:fixed;bottom:0;width:100%;text-align:center;letter-spacing:1px}dibu{border-top:0;position:absolute;bottom:0;width:100%;margin:0;padding:0}#bg{-moz-transform:scale(1);-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);-webkit-backface-visibility:hidden;position:fixed;top:0;left:0;width:100%;height:100vh;z-index:-1}#bg:after,#bg:before{content:'';display:block;position:absolute;top:0;left:0;width:100%;height:100%}#bg:before{-moz-transition:background-color 2.5s ease-in-out .75s;-webkit-transition:background-color 2.5s ease-in-out .75s;-ms-transition:background-color 2.5s ease-in-out;transition:background-color 2.5s ease-in-out .75s;-ms-transition-delay:.75s;background-image:linear-gradient(to top,rgba(255,255,255,.7),rgba(255,255,255,.7)),url(https://jitsu.oss-cn-beijing.aliyuncs.com/home/img/overlay.png);background-size:auto,256px 256px;background-position:center,center;background-repeat:no-repeat,repeat;z-index:2}#bg:after{-moz-transform:scale(1.125);-webkit-transform:scale(1.125);-ms-transform:scale(1.125);transform:scale(1.125);-moz-transition:-moz-transform 325ms ease-in-out,-moz-filter 325ms ease-in-out;-webkit-transition:-webkit-transform 325ms ease-in-out,-webkit-filter 325ms ease-in-out;-ms-transition:-ms-transform 325ms ease-in-out,-ms-filter 325ms ease-in-out;transition:transform 325ms ease-in-out,filter 325ms ease-in-out;background-image:url(https://iw233.cn/API/pc.php);background-position:center;background-size:cover;background-repeat:no-repeat;z-index:1}@media screen and (max-width:960px){#bg:after{-moz-transform:scale(1.125);-webkit-transform:scale(1.125);-ms-transform:scale(1.125);transform:scale(1.125);-moz-transition:-moz-transform 325ms ease-in-out,-moz-filter 325ms ease-in-out;-webkit-transition:-webkit-transform 325ms ease-in-out,-webkit-filter 325ms ease-in-out;-ms-transition:-ms-transform 325ms ease-in-out,-ms-filter 325ms ease-in-out;transition:transform 325ms ease-in-out,filter 325ms ease-in-out;background-image:url(https://iw233.cn/API/mp.php);background-position:center;background-size:cover;background-repeat:no-repeat;z-index:1}}
</style>

<!--body-->
<div id="bg">

<!--如需修改请自行将代码格式化-->

或者

<!--head-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/anosu/anosu.github.io@main/cdn/css/alist/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

<!--body-->
<div id="bg">

示例脚本

默认暗色

<script async id="default-theme" src="https://api.xhofe.top/js/alist-theme.js" theme="dark"></script>

默认亮色

<script async id="default-theme" src="https://api.xhofe.top/js/alist-theme.js" theme="light"></script>

本教程来自https://alist-doc.nn.ci/,如有侵权,请联系我删除

2

评论 (1)

取消
  1. 头像
    往哪跑
    iPhone · Google Chrome

    大佬 求你Alist网盘页脚代码!

    回复