Skip to content

Commit 99f662d

Browse files
committed
添加[时光相册]签到
1 parent 688435b commit 99f662d

6 files changed

Lines changed: 269 additions & 5 deletions

‎QuantumultX_AppStore_Local_Cookie.conf‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 本配置适用于: QuanX 商店版 v1.0.6-build194 及之前版本
22
# 如果你是TF版, 请使用: QuantumultX_Local_Cookie.conf
33

4-
hostname = promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
4+
hostname = api.everphoto.cn, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, gdws.nsenz.com, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
55

66
# 电信营业厅
77
^https:\/\/wapside.189.cn:9001\/api\/home\/homeInfo url script-request-header chavyleung/10000/10000.cookie.js
@@ -89,4 +89,7 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
8989

9090
# 美团外卖
9191
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/entry url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js
92-
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js
92+
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-header chavyleung/wmmeituan/wmmeituan.cookie.js
93+
94+
# 时光相册
95+
^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 url script-request-header chavyleung/everphoto/everphoto.cookie.js

‎QuantumultX_Local_Cookie.conf‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# 本配置适用于: QuanX TestFlight v1.0.6-build195 及以后版本
22
# 如果你是商店版, 请使用: QuantumultX_AppStore_Local_Cookie.conf
33

4-
hostname = i.meituan.com, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, m.gdoil.cn, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
4+
hostname = api.everphoto.cn, i.meituan.com, promotion.waimai.meituan.com, wx.10086.cn, www.maomicd.com, act.10010.com, api-takumi.mihoyo.com, m.gdoil.cn, credits.bz.mgtv.com, *.csdn.net, wapside.189.cn, *.acfun.cn, apk.tw, *.bilibili.com, api.dongqiudi.com, *.feng.com, www.flyertea.com, music.163.com, *.m.163.com, user.qunar.com, *.rr.tv, *.weixinjia.net, *.smzdm.com, tieba.baidu.com, *.v2ex.com, *.video.qq.com, v.qq.com, mobwsa.ximalaya.com, *.you.163.com, *.rrys2019.com, ios.zmzapi.com
55

66
# 电信营业厅
77
^https:\/\/wapside.189.cn:9001\/api\/home\/homeInfo url script-request-header chavyleung/10000/10000.cookie.js
@@ -92,4 +92,7 @@ https:\/\/www.maomicd.com\/plugin.php\?id=k_misign:sign&operation=qiandao url sc
9292
^https:\/\/promotion.waimai.meituan.com\/playcenter\/signIn\/doaction url script-request-body chavyleung/wmmeituan/wmmeituan.cookie.js
9393

9494
# 美团
95-
^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body chavyleung/meituan/meituan.cookie.js
95+
^https:\/\/i.meituan.com\/evolve\/signin\/signpost\/ url script-request-body chavyleung/meituan/meituan.cookie.js
96+
97+
# 时光相册
98+
^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 url script-request-header chavyleung/everphoto/everphoto.cookie.js

‎QuantumultX_Local_Task.conf‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,6 @@
5555
# 美团外卖
5656
8 0 * * * chavyleung/wmmeituan/wmmeituan.js
5757
# 美团
58-
7 0 * * * chavyleung/meituan/meituan.js
58+
7 0 * * * chavyleung/meituan/meituan.js
59+
# 时光相册
60+
7 0 * * * chavyleung/everphoto/everphoto.js

‎everphoto/README.md‎

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# 时光相册
2+
3+
> 代码已同时兼容 Surge & QuanX, 使用同一份签到脚本即可
4+
5+
## 配置 (Surge)
6+
7+
```properties
8+
[MITM]
9+
api.everphoto.cn
10+
11+
[Script]
12+
http-request ^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/everphoto/everphoto.cookie.js
13+
cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/everphoto/everphoto.js
14+
```
15+
16+
## 配置 (QuanX)
17+
18+
```properties
19+
[MITM]
20+
api.everphoto.cn
21+
22+
[rewrite_local]
23+
^https:\/\/api.everphoto.cn\/users\/self\/checkin\/v2 url script-request-header everphoto.cookie.js
24+
25+
[task_local]
26+
1 0 * * * everphoto.js
27+
```
28+
29+
## 说明
30+
31+
1. 先把`api.everphoto.cn`加到`[MITM]`
32+
2. 再配置重写规则:
33+
- Surge: 把两条远程脚本放到`[Script]`
34+
- QuanX: 把`everphoto.cookie.js`和`everphoto.js`传到`On My iPhone - Quantumult X - Scripts` (传到 iCloud 相同目录也可, 注意要打开 quanx 的 iCloud 开关)
35+
3. 打开 APP 然后手动签到 1 次, 系统提示: `获取Cookie: 成功`
36+
4. 最后就可以把第 1 条脚本注释掉了
37+
5. 运行一次脚本, 如果提示重复签到, 那就算成功了!
38+
39+
> 第 1 条脚本是用来获取 cookie 的, 用浏览器访问一次获取 cookie 成功后就可以删掉或注释掉了, 但请确保在`登录成功`后再获取 cookie.
40+
41+
> 第 2 条脚本是签到脚本, 每天`00:00:10`执行一次.
42+
43+
## 常见问题
44+
45+
1. 无法写入 Cookie
46+
47+
- 检查 Surge 系统通知权限放开了没
48+
- 如果你用的是 Safari, 请尝试在浏览地址栏`手动输入网址`(不要用复制粘贴)
49+
50+
2. 写入 Cookie 成功, 但签到不成功
51+
52+
- 看看是不是在登录前就写入 Cookie 了
53+
- 如果是,请确保在登录成功后,再尝试写入 Cookie
54+
55+
3. 为什么有时成功有时失败
56+
57+
- 很正常,网络问题,哪怕你是手工签到也可能失败(凌晨签到容易拥堵就容易失败)
58+
- 暂时不考虑代码级的重试机制,但咱有配置级的(暴力美学):
59+
60+
- `Surge`配置:
61+
62+
```properties
63+
# 没有什么是一顿饭解决不了的:
64+
cron "10 0 0 * * *" script-path=xxx.js # 每天00:00:10执行一次
65+
# 如果有,那就两顿:
66+
cron "20 0 0 * * *" script-path=xxx.js # 每天00:00:20执行一次
67+
# 实在不行,三顿也能接受:
68+
cron "30 0 0 * * *" script-path=xxx.js # 每天00:00:30执行一次
69+
70+
# 再粗暴点,直接:
71+
cron "* */60 * * * *" script-path=xxx.js # 每60分执行一次
72+
```
73+
74+
- `QuanX`配置:
75+
76+
```properties
77+
[task_local]
78+
1 0 * * * xxx.js # 每天00:01执行一次
79+
2 0 * * * xxx.js # 每天00:02执行一次
80+
3 0 * * * xxx.js # 每天00:03执行一次
81+
82+
*/60 * * * * xxx.js # 每60分执行一次
83+
```
84+
85+
## 感谢
86+
87+
[@NobyDa](https://github.com/NobyDa)
88+
89+
[@lhie1](https://github.com/lhie1)
90+
91+
[@ConnersHua](https://github.com/ConnersHua)

‎everphoto/everphoto.cookie.js‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
const chavy = init()
2+
const cookieName = '时光相册'
3+
const KEY_signurl = 'chavy_sign_url_everphoto'
4+
const KEY_signheader = 'chavy_sign_header_everphoto'
5+
6+
if ($request && $request.method != 'OPTIONS') {
7+
try {
8+
chavy.log(`🔔 ${cookieName} 开始获取: Cookies`)
9+
const VAL_signurl = $request.url
10+
const VAL_signheader = JSON.stringify($request.headers)
11+
if (VAL_signurl) {
12+
chavy.setdata(VAL_signurl, KEY_signurl)
13+
chavy.log(`❕ ${cookieName} VAL_signurl: ${VAL_signurl}`)
14+
}
15+
if (VAL_signheader) {
16+
chavy.setdata(VAL_signheader, KEY_signheader)
17+
chavy.log(`❕ ${cookieName} VAL_signheader: ${VAL_signheader}`)
18+
}
19+
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
20+
} catch (e) {
21+
chavy.msg(cookieName, `获取Cookie: 失败`, e)
22+
chavy.log(`❌ ${cookieName} 获取Cookie: 失败: ${e}`)
23+
}
24+
}
25+
26+
function init() {
27+
isSurge = () => {
28+
return undefined === this.$httpClient ? false : true
29+
}
30+
isQuanX = () => {
31+
return undefined === this.$task ? false : true
32+
}
33+
getdata = (key) => {
34+
if (isSurge()) return $persistentStore.read(key)
35+
if (isQuanX()) return $prefs.valueForKey(key)
36+
}
37+
setdata = (key, val) => {
38+
if (isSurge()) return $persistentStore.write(key, val)
39+
if (isQuanX()) return $prefs.setValueForKey(key, val)
40+
}
41+
msg = (title, subtitle, body) => {
42+
if (isSurge()) $notification.post(title, subtitle, body)
43+
if (isQuanX()) $notify(title, subtitle, body)
44+
}
45+
log = (message) => console.log(message)
46+
get = (url, cb) => {
47+
if (isSurge()) {
48+
$httpClient.get(url, cb)
49+
}
50+
if (isQuanX()) {
51+
url.method = 'GET'
52+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
53+
}
54+
}
55+
post = (url, cb) => {
56+
if (isSurge()) {
57+
$httpClient.post(url, cb)
58+
}
59+
if (isQuanX()) {
60+
url.method = 'POST'
61+
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
62+
}
63+
}
64+
done = (value = {}) => {
65+
$done(value)
66+
}
67+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
68+
}
69+
chavy.done()

‎everphoto/everphoto.js‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
const chavy = init()
2+
const cookieName = '时光相册'
3+
const KEY_signurl = 'chavy_sign_url_everphoto'
4+
const KEY_signheader = 'chavy_sign_header_everphoto'
5+
6+
const signinfo = {}
7+
let VAL_signurl = chavy.getdata(KEY_signurl)
8+
let VAL_signheader = chavy.getdata(KEY_signheader)
9+
10+
;(exec = async () => {
11+
chavy.log(`🔔 ${cookieName} 开始签到`)
12+
await signapp()
13+
await showmsg()
14+
})().catch((e) => chavy.log(`❌ ${cookieName} 签到失败: ${e}`))
15+
16+
function signapp() {
17+
return new Promise((resolve, reject) => {
18+
const url = { url: VAL_signurl, headers: JSON.parse(VAL_signheader) }
19+
chavy.post(url, (error, response, data) => {
20+
try {
21+
signinfo.signapp = JSON.parse(data)
22+
resolve()
23+
} catch (e) {
24+
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
25+
chavy.log(`❌ ${cookieName} sign - 签到失败: ${e}`)
26+
chavy.log(`❌ ${cookieName} sign - response: ${JSON.stringify(response)}`)
27+
resolve()
28+
}
29+
})
30+
})
31+
}
32+
33+
function showmsg() {
34+
let subTitle, detail
35+
if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == true) {
36+
const reward = signinfo.signapp.data.reward / 1024 / 1024
37+
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
38+
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
39+
subTitle = '签到结果: 成功'
40+
detail = `总共获得: ${total_reward}MB (+${reward}MB), 明天获得: ${tomorrow_reward}MB`
41+
} else if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == false) {
42+
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
43+
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
44+
subTitle = '签到结果: 成功 (重复签到)'
45+
detail = `总共获得: ${total_reward}MB, 明天获得: ${tomorrow_reward}MB`
46+
} else {
47+
subTitle = '签到结果: 失败'
48+
detail = `编码: ${signinfo.signapp.code}, 说明: 未知`
49+
chavy.log(`❌ ${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`)
50+
}
51+
chavy.msg(cookieName, subTitle, detail)
52+
}
53+
54+
function init() {
55+
isSurge = () => {
56+
return undefined === this.$httpClient ? false : true
57+
}
58+
isQuanX = () => {
59+
return undefined === this.$task ? false : true
60+
}
61+
getdata = (key) => {
62+
if (isSurge()) return $persistentStore.read(key)
63+
if (isQuanX()) return $prefs.valueForKey(key)
64+
}
65+
setdata = (key, val) => {
66+
if (isSurge()) return $persistentStore.write(key, val)
67+
if (isQuanX()) return $prefs.setValueForKey(key, val)
68+
}
69+
msg = (title, subtitle, body) => {
70+
if (isSurge()) $notification.post(title, subtitle, body)
71+
if (isQuanX()) $notify(title, subtitle, body)
72+
}
73+
log = (message) => console.log(message)
74+
get = (url, cb) => {
75+
if (isSurge()) {
76+
$httpClient.get(url, cb)
77+
}
78+
if (isQuanX()) {
79+
url.method = 'GET'
80+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
81+
}
82+
}
83+
post = (url, cb) => {
84+
if (isSurge()) {
85+
$httpClient.post(url, cb)
86+
}
87+
if (isQuanX()) {
88+
url.method = 'POST'
89+
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
90+
}
91+
}
92+
done = (value = {}) => {
93+
$done(value)
94+
}
95+
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
96+
}

0 commit comments

Comments
 (0)