Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 12 additions & 42 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
# NewAPI 账号配置示例
# 复制此文件为 .env 并填入实际值(仅用于本地测试)
# NewAPI Runner 环境变量示例
# 账号在 Worker 控制台统一管理,GitHub Actions 只需要以下两个必填值。

# ========== 云端配置(推荐)==========
# 优先级高于 NEWAPI_ACCOUNTS,配置文件存放在云盘/NAS,改配置无需推代码
# CONFIG_URL=https://dav.jianguoyun.com/dav/your@email.com/newapi-config.json
# CONFIG_AUTH=your@email.com:your_app_password
# 部署后的 Worker 根地址,不带末尾斜杠
CHECKIN_WORKER_URL=https://newapi-checkin.your-subdomain.workers.dev

# ========== 认证格式说明 ==========
# 坚果云: CONFIG_AUTH=邮箱:应用专用密码(账户设置 → 安全选项 → 第三方应用密码)
# 群晖 NAS: CONFIG_AUTH=用户名:密码(需启用 WebDAV 服务)
# NextCloud: CONFIG_AUTH=用户名:密码 或 CONFIG_AUTH=token:访问令牌
# 直接链接: CONFIG_AUTH=(如果链接无需认证则留空)
# 自行生成,并与 Cloudflare Worker 的 RUNNER_TOKEN 完全一致
# 生成命令:openssl rand -hex 32
CHECKIN_RUNNER_TOKEN=replace-with-a-64-character-hex-token

# ========== 单账号格式 ==========
NEWAPI_ACCOUNTS=https://your-domain.com#your_session_cookie

# ========== 多网站格式(逗号分隔)==========
# 支持多个不同的 NewAPI 站点
# NEWAPI_ACCOUNTS=https://site1.com#session1,https://site2.com#session2,https://site3.com#session3

# ========== JSON 格式(推荐)==========
# 支持多网站、用户ID、备注名称、更好的可读性
# NEWAPI_ACCOUNTS=[{"url":"https://api.example.com","session":"sess1","user_id":"123","name":"主力站"},{"url":"https://api2.example.com","session":"sess2","user_id":"456","name":"备用站"}]

# ========== JSON 格式 + CF 绕过 ==========
# cf_clearance 可手动提供(可选,Playwright 自动绕过时不需要)
# NEWAPI_ACCOUNTS=[{"url":"https://cf-protected-site.com","session":"sess1","cf_clearance":"cf_clearance_value","name":"CF站点"}]

# ========== 完整示例 ==========
# 替换下面的值为你自己的真实配置
# NEWAPI_ACCOUNTS=[{"url":"https://api.example.com","session":"MTc2NzQxMzYzM3xEWDhFQVFMX2dBQUJFQUVRQUFE...","user_id":"123","name":"主力站"},{"url":"https://api2.example.com","session":"QVFMXzJhYWJFRUFRQUFEX3dfLUFBQVlHYzNSeWFXNW5EQTBBQzI...","user_id":"456","name":"备用站"}]

# ========== 钉钉通知配置 ==========

# 钉钉机器人 Webhook URL(可选,配置后启用通知)
# 可选:钉钉通知
# DINGTALK_WEBHOOK=https://oapi.dingtalk.com/robot/send?access_token=xxxxx

# 钉钉机器人签名密钥(可选,如果开启了加签安全设置)
# DINGTALK_SECRET=SECxxxxx

# ========== Cloudflare 绕过说明 ==========
# 本项目支持自动绕过 Cloudflare 防护:
# - 默认使用 requests 直连(快速模式)
# - 检测到 CF 拦截时自动切换 Playwright 无头浏览器
# - GitHub Actions 已配置 Playwright 安装步骤
# - 本地运行需手动安装: pip install playwright && playwright install chromium
# - cf_clearance 字段仍可手动配置作为备用
# 可选:兼容模式回退配置
# NEWAPI_ACCOUNTS=[{"url":"https://api.example.com","session":"session-value","name":"主力站"}]
# CONFIG_URL=https://example.com/newapi-config.json
# CONFIG_AUTH=username:password
5 changes: 2 additions & 3 deletions .github/workflows/checkin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ jobs:

- name: 执行签到
env:
CONFIG_URL: ${{ secrets.CONFIG_URL }}
CONFIG_AUTH: ${{ secrets.CONFIG_AUTH }}
NEWAPI_ACCOUNTS: ${{ secrets.NEWAPI_ACCOUNTS }}
CHECKIN_WORKER_URL: ${{ secrets.CHECKIN_WORKER_URL }}
CHECKIN_RUNNER_TOKEN: ${{ secrets.CHECKIN_RUNNER_TOKEN }}
DINGTALK_WEBHOOK: ${{ secrets.DINGTALK_WEBHOOK }}
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }}
run: python checkin.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Thumbs.db

# 配置文件(包含敏感信息)
.env
worker/.dev.vars
config.json
accounts.json
newapi_accounts.json
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2026 NewAPI-Checkin Contributors
Copyright (c) 2026 zhikanyeye

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading