引言
由于腾讯云函数从六月开始收费,于是便弃用改在自己的服务器上搭建
既然六月收费为什么现在才写文章呢?因为(可能还有三个月的免费试用)我米游社的 Cookie 过期更换,故记录
工具 & 原教程
由于原文介绍了多种使用方法,自己的阅读体验不是太好,故写此文
腾讯云函数处理
请将腾讯云函数冻结已确保不会收取费用
当然,如果没什么其他需求可直接注销账号,但注销账号需要手持身份证照片,请注意
前提
服务器可以连接上米忽悠的服务器 https://mihoyo.com
可在 SSH 命令行窗口输入 ping mihoyo.com
测试是否可以连接
我的一个服务器就连接不上,只好换一个,唉
Docker 安装
可以直接使用一键脚本进行安装,实测 Debian10 和 CentOS7 正常安装 (请使用 root 账户)
安装命令如下:
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
也可以使用国内 daocloud 一键安装命令:
curl -sSL https://get.daocloud.io/docker | sh
脚本安装
使用以下命令即可
docker pull yindan/genshinhelper
CentOS 错误
我使用 CentOS 安装时出现错误 Can't Connect to Docker Daemon
请确保使用 root 账户,然后输入以下命令
systemctl start docker
简易使用
Cookie 获取
获取米游社 Cookie 请参考:原神树脂查看 / 推送 – yexca|Hiyoung’Blog
注意:Cookie 应包含 account_id
和 cookie_token
两个字段
多账号在不同 Cookie 中间加#
即可,例如 Cookie1#Cookie2#Cookie3
简易配置
docker run -d --name=genshinhelper \
-e COOKIE_MIHOYOBBS="<COOKIE_MIHOYOBBS>" \
--restart always \
yindan/genshinhelper:latest
将自己的 Cookie
替换上述命令的 <COOKIE_MIHOYOBBS>
即可
重新配置 / 更新 Cookie
重新配置好像需要卸载再重装,然后再进行配置
或者使用配置文件只需替换 Cookie 就可以了吧 (没用过,Cookie 有效期很长的)
常用命令
# 查看Docker所有的容器
docker ps -a
# 查看日志
docker logs -f genshinhelper --tail 100
# 重启
docker restart genshinhelper
# 更新
docker pull yindan/genshinhelper
docker rm -f genshinhelper
# 之后依据基本使用或高级使用重新部署
# 卸载
docker rm -f genshinhelper
docker image rm genshinhelper
配置文件
示例配置文件
- Github: config.json
- Telegram: https://t.me/genshinhelperupdates/5
可下载示例文件修改
安装
假设配置文件位于服务器的 /etc/genshin/config.json
,使用以下命令已映射配置
docker run -d --name=genshinhelper \
-v /etc/genshin:/app/genshincheckinhelper/config \
--restart always \
yindan/genshinhelper:latest
配置
配置文件可以只留下需要的参数,把非必须的参数删除,例如只需要 Cookie
则配置文件除了保持完整也可以写成:
{
"COOKIE_MIHOYOBBS": "<COOKIE_MIHOYOBBS>",
}
配置文件新增
RANDOM_SLEEP_SECS_RANGE:随机延迟休眠秒数范围,单位:秒。设置成”0-0″为取消延迟。 CHECK_IN_TIME:每日签到时间。该时间和运行环境的时间有关,和时区无关。如果是 docker,可以用 TZ=Asia/Shanghai 设置时区。 CHECK_RESIN_SECS:原神原粹树脂检测间隔时间,单位:秒。 COOKIE_RESIN_TIMER:需要开启原粹树脂检测账号的 cookie。 SHOPTOKEN:微信积分商城的 token,通过抓包获取。 ONEPUSH:推送配置。notifier 为推送名字,params 为所需参数。详见后文。
OnePush 推送参数一览
推送名称 /notifier: bark 参数大全 /params: {‘required’: [‘key’], ‘optional’: [‘title’, ‘content’, ‘sound’, ‘isarchive’, ‘icon’, ‘group’, ‘url’, ‘copy’, ‘autocopy’]}
推送名称 /notifier: custom 参数大全 /params: {‘required’: [‘url’], ‘optional’: [‘method’, ‘datatype’, ‘data’]}
推送名称 /notifier: dingtalk 参数大全 /params: {‘required’: [‘token’], ‘optional’: [‘title’, ‘content’, ‘secret’, ‘markdown’]}
推送名称 /notifier: discord 参数大全 /params: {‘required’: [‘webhook’], ‘optional’: [‘title’, ‘content’, ‘username’, ‘avatar_url’, ‘color’]}
推送名称 /notifier: pushplus 参数大全 /params: {‘required’: [‘token’, ‘content’], ‘optional’: [‘title’, ‘topic’, ‘markdown’]}
推送名称 /notifier: qmsg 参数大全 /params: {‘required’: [‘key’], ‘optional’: [‘title’, ‘content’, ‘mode’, ‘qq’]}
推送名称 /notifier: serverchan 参数大全 /params: {‘required’: [‘sckey’, ‘title’], ‘optional’: [‘content’]}
推送名称 /notifier: serverchanturbo 参数大全 /params: {‘required’: [‘sctkey’, ‘title’], ‘optional’: [‘content’, ‘channel’, ‘openid’]}
推送名称 /notifier: telegram 参数大全 /params: {‘required’: [‘token’, ‘userid’], ‘optional’: [‘title’, ‘content’, ‘api_url’]}
推送名称 /notifier: wechatworkapp 参数大全 /params: {‘required’: [‘corpid’, ‘corpsecret’, ‘agentid’], ‘optional’: [‘title’, ‘content’, ‘touser’, ‘markdown’]}
推送名称 /notifier: wechatworkbot 参数大全 /params: {‘required’: [‘key’], ‘optional’: [‘title’, ‘content’, ‘markdown’]}
例子 telegram ONEPUSH={“notifier”:”telegram”,”params”:{“markdown”:false,”token”:”xxxx”,”userid”:”xxx”}}
discord ONEPUSH={“notifier”:”discord”,”params”:{“markdown”:true,”webhook”:”https://discord.com/api/webhooks/xxxxxx“}}
docker 配置文件映射目录为:/etc/genshin:/app/genshincheckinhelper/config
所有变量
Variable Name | Required | Default | Description |
---|---|---|---|
LANGUAGE | ❌ | en | 项目语言。目前支持中文 (zh) 和英文 (en)。 |
MAX_SLEEP_SECS | ❌ | 300 | 最大休眠秒数。自 v1.5.0 添加了运行前随机延迟,设置此参数可自定义延迟,秒数应该>10 |
RUN_ENV | ❌ | prod | 运行环境。设置为任意非默认值即可跳过随机延迟。 |
COOKIE_MIHOYOBBS | ❌ | Cookie from miHoYo bbs. https://bbs.mihoyo.com/ys/ | |
COOKIE_BH3 | ❌ | 和 COOKIE_MIHOYOBBS 一样 | |
COOKIE_MIYOUBI | ❌ | Cookie from miHoYo bbs. https://bbs.mihoyo.com/ys/ | |
COOKIE_HOYOLAB | ❌ | Cookie from HoYoLAB community. https://webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html?act_id=e202102251931481&lang=en-us | |
COOKIE_WEIBO | ❌ | Parameters from Sina Weibo intl. app. aid=xxx; gsid=xxx; s=xxx; from=xxx | |
COOKIE_KA | ❌ | Cookie from https://m.weibo.cn | |
BARK_KEY | ❌ | iOS Bark app’s IP or device code. For example: https://api.day.app/xxxxxx | |
BARK_SOUND | ❌ | healthnotification | iOS Bark app’s notification sound. Default: healthnotification |
COOL_PUSH_SKEY | ❌ | SKEY for Cool Push. https://cp.xuthus.cc/ | |
COOL_PUSH_MODE | ❌ | send | Push method for Cool Push. Choose from send (私聊),group (群组),wx (微信). Default: send |
CRON_SIGNIN | ❌ | 0 6 * | Docker custom runtime |
CUSTOM_NOTIFIER | ❌ | Custom notifier configuration | |
DD_BOT_TOKEN | ❌ | 钉钉机器人 WebHook 地址中 access_token 后的字段. | |
DD_BOT_SECRET | ❌ | 钉钉加签密钥。在机器人安全设置页面,加签一栏下面显示的以 SEC 开头的字符串. | |
DISCORD_WEBHOOK | ❌ | Webhook of Discord. | |
IGOT_KEY | ❌ | KEY for iGot. For example: https://push.hellyw.com/xxxxxx | |
PUSH_PLUS_TOKEN | ❌ | 一对一推送 | pushplus 一对一推送或一对多推送的 token. 不配置 push_plus_user 则默认为一对一推送. https://www.pushplus.plus/doc/ |
PUSH_PLUS_USER | ❌ | pushplus 一对多推送的群组编码。在’一对多推送’->’您的群组 '(如无则新建)->’群组编码’里查看,如果是创建群组人,也需点击’查看二维码’扫描绑定,否则不能接收群组消息. | |
SCKEY | ❌ | SCKEY for ServerChan. https://sc.ftqq.com/3.version/ | |
SCTKEY | ❌ | SENDKEY for ServerChanTurbo. https://sct.ftqq.com/ | |
TG_BOT_API | ❌ | api.telegram.org | Telegram robot api address. Default: api.telegram.org |
TG_BOT_TOKEN | ❌ | Telegram robot token. Generated when requesting a bot from @botfather | |
TG_USER_ID | ❌ | User ID of the Telegram push target. | |
WW_ID | ❌ | 企业微信的企业 ID (corpid). 在’管理后台’->’我的企业’->’企业信息’里查看. https://work.weixin.qq.com/api/doc/90000/90135/90236 | |
WW_APP_SECRET | ❌ | 企业微信应用的 secret. 在’管理后台’->’应用与小程序’->’应用’->’自建’, 点进某应用里查看. | |
WW_APP_USERID | ❌ | @all | 企业微信应用推送对象的用户 ID. 在’管理后台’->’ 通讯录’, 点进某用户的详情页里查看。默认: @all |
WW_APP_AGENTID | ❌ | 企业微信应用的 agentid. 在’管理后台’->’应用与小程序’->’应用’, 点进某应用里查看. | |
WW_BOT_KEY | ❌ | 企业微信机器人 WebHook 地址中 key 后的字段. https://work.weixin.qq.com/api/doc/90000/90136/91770 |