1- /**
2- *
3- * [MITM]
4- * *.v2ex.com
5- *
6- * [Script]
7- * http-request ^https://www.v2ex.com/ script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/v2ex/v2ex.cookie.js
8- * cron "10 0 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/v2ex/v2ex.js
9- *
10- */
11-
121const cookieName = 'V2EX'
132const cookieKey = 'chavy_cookie_v2ex'
143const cookieVal = $persistentStore . read ( cookieKey )
@@ -20,11 +9,13 @@ function sign() {
209 Cookie : cookieVal
2110 }
2211 }
23-
2412 $httpClient . get ( url , ( error , response , data ) => {
2513 if ( data . indexOf ( '每日登录奖励已领取' ) ) {
26- console . log ( `签到跳过: ${ cookieName } , 原因: 今天已经签过了` )
27- $notification . post ( '签到跳过' , cookieName , `原因: 今天已经签过了` )
14+ let title = `签到结果: ${ cookieName } `
15+ let subTitle = `签到跳过`
16+ let detail = `今天已经签过了`
17+ console . log ( `${ title } , ${ subTitle } , ${ detail } ` )
18+ $notification . post ( title , subTitle , detail )
2819 } else {
2920 let regex = / < i n p u t [ ^ > ] * \/ m i s s i o n \/ d a i l y \/ r e d e e m \? o n c e = ( \d + ) [ ^ > ] * > / g
3021 for ( const code of data . matchAll ( regex ) ) {
@@ -42,11 +33,17 @@ function signMission(code) {
4233 }
4334 $httpClient . get ( url , ( error , response , data ) => {
4435 if ( data . indexOf ( '每日登录奖励已领取' ) > 0 ) {
45- console . log ( `签到成功: ${ cookieName } ` )
46- $notification . post ( '签到成功' , cookieName , '' )
36+ let title = `签到结果: ${ cookieName } `
37+ let subTitle = `签到成功`
38+ let detail = ``
39+ console . log ( `${ title } , ${ subTitle } , ${ detail } ` )
40+ $notification . post ( title , subTitle , detail )
4741 } else {
42+ let title = `签到结果: ${ cookieName } `
43+ let subTitle = `签到失败`
44+ let detail = `详见日志`
4845 console . log ( `签到失败: ${ cookieName } , error: ${ error } , response: ${ response } , data: ${ data } ` )
49- $notification . post ( '签到失败' , cookieName , '详见日志' )
46+ $notification . post ( title , subTitle , detail )
5047 }
5148 } )
5249}
0 commit comments