Skip to content

jiangkunoa/simple-alist

Repository files navigation

Simple AList

一个简化版本的 AList 文件管理器,支持阿里云盘和夸克网盘。

功能特性

  • ✅ 支持阿里云盘和夸克网盘
  • ✅ Web 界面文件浏览
  • ✅ 存储管理(添加、列表显示)
  • ✅ 文件下载链接生成
  • ✅ 响应式设计
  • ✅ Docker 支持

快速开始

方式一:直接运行

  1. 确保已安装 Go 1.19+
  2. 克隆项目并运行:
git clone <repository-url>
cd simple-alist
go mod tidy
go run main.go
  1. 访问 http://localhost:12000

方式二:Docker 运行

# 构建镜像
docker build -t simple-alist .

# 运行容器
docker run -p 12000:12000 simple-alist

方式三:Docker Compose

docker-compose up -d

配置说明

环境变量

  • PORT: 服务端口,默认 12000
  • CONFIG_FILE: 配置文件路径,默认 config.json

配置文件

可以通过配置文件预设存储,创建 config.json

{
  "storages": [
    {
      "name": "我的阿里云盘",
      "type": "aliyun",
      "mount_path": "/aliyun",
      "config": {
        "refresh_token": "your_aliyun_refresh_token"
      }
    },
    {
      "name": "我的夸克网盘", 
      "type": "quark",
      "mount_path": "/quark",
      "config": {
        "cookie": "your_quark_cookie"
      }
    }
  ]
}

获取认证信息

阿里云盘 Refresh Token

  1. 登录阿里云盘网页版
  2. 打开浏览器开发者工具
  3. 在 Application/Storage -> Local Storage 中找到 refresh_token

夸克网盘 Cookie

  1. 登录夸克网盘网页版
  2. 打开浏览器开发者工具
  3. 在 Network 标签页中找到任意请求的 Cookie 头部
  4. 复制完整的 Cookie 字符串

API 接口

存储管理

  • GET /api/storages - 获取存储列表
  • POST /api/storages - 添加存储

文件操作

  • GET /api/files?path=<path> - 获取文件列表
  • GET /api/download?path=<path> - 获取下载链接

项目结构

simple-alist/
├── main.go              # 主程序入口
├── server/
│   └── router.go        # HTTP 路由和处理器
├── drivers/
│   ├── aliyun.go        # 阿里云盘驱动
│   └── quark.go         # 夸克网盘驱动
├── internal/
│   ├── model.go         # 数据模型
│   ├── storage.go       # 存储管理
│   └── config.go        # 配置管理
├── public/
│   ├── index.html       # 主页面
│   └── demo.html        # 演示页面
├── config.example.json  # 配置文件示例
├── Dockerfile           # Docker 构建文件
├── docker-compose.yml   # Docker Compose 配置
└── test_api.sh         # API 测试脚本

开发说明

添加新的云盘驱动

  1. drivers/ 目录下创建新的驱动文件
  2. 实现 Driver 接口:
    type Driver interface {
        Init(config map[string]interface{}) error
        List(path string) ([]File, error)
        GetDownloadURL(path string) (string, error)
    }
  3. internal/storage.go 中注册新驱动

测试 API

使用提供的测试脚本:

chmod +x test_api.sh
./test_api.sh

注意事项

  1. 安全性: 请妥善保管你的 refresh_token 和 cookie,不要泄露给他人
  2. token 有效期: 阿里云盘的 refresh_token 和夸克网盘的 cookie 都有有效期,需要定期更新
  3. 网络环境: 确保服务器能够访问对应的云盘 API
  4. 存储限制: 不同云盘可能有 API 调用频率限制

故障排除

常见错误

  1. "require login" - token/cookie 已过期,需要重新获取
  2. "failed to get drive_id" - 阿里云盘 refresh_token 无效
  3. 网络超时 - 检查网络连接和防火墙设置

日志查看

服务运行时会输出详细日志,可以通过日志排查问题:

# 查看实时日志
tail -f server.log

# 查看错误日志
grep ERROR server.log

许可证

MIT License

贡献

欢迎提交 Issue 和 Pull Request!

相关链接

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published