Change Directory.

This commit is contained in:
sve1r 2020-07-02 11:52:57 +08:00
parent d2cbfe94f3
commit 2e0356b994
103 changed files with 11190 additions and 8026 deletions

View File

@ -3,52 +3,54 @@ const cookieKey = 'chavy_cookie_bilibili'
const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -6,103 +6,105 @@ const cookieVal = chavy.getdata(cookieKey)
sign()
function sign() {
let url = {
url: `https://api.live.bilibili.com/sign/doSign`,
headers: {
Cookie: cookieVal
let url = {
url: `https://api.live.bilibili.com/sign/doSign`,
headers: {
Cookie: cookieVal
}
}
}
url.headers['Origin'] = 'api.live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
url.headers['Origin'] = 'api.live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.code == 0) {
let subTitle = `签到结果: 成功`
let detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}`
chavy.msg(title, subTitle, detail)
}
// 签到重复
else if (result && result.code == 1011040) {
getsigninfo()
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `说明: ${result.message}`
chavy.msg(title, subTitle, detail)
}
chavy.log(`${cookieName}, data: ${data}`)
})
chavy.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.code == 0) {
let subTitle = `签到结果: 成功`
let detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}`
chavy.msg(title, subTitle, detail)
}
// 签到重复
else if (result && result.code == 1011040) {
getsigninfo()
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `说明: ${result.message}`
chavy.msg(title, subTitle, detail)
}
chavy.log(`${cookieName}, data: ${data}`)
})
chavy.done()
chavy.done()
}
function getsigninfo() {
let url = {
url: `https://api.live.bilibili.com/sign/GetSignInfo`,
headers: {
Cookie: cookieVal
let url = {
url: `https://api.live.bilibili.com/sign/GetSignInfo`,
headers: {
Cookie: cookieVal
}
}
}
url.headers['Host'] = 'api.live.bilibili.com'
url.headers['Origin'] = 'http://live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
url.headers['Host'] = 'api.live.bilibili.com'
url.headers['Origin'] = 'http://live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
let title = `${cookieName}`
let subTitle = `签到结果: 成功 (重复签到)`
let detail = ``
let result = JSON.parse(data)
if (result && result.code == 0) detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}`
chavy.msg(title, subTitle, detail)
})
chavy.get(url, (error, response, data) => {
let title = `${cookieName}`
let subTitle = `签到结果: 成功 (重复签到)`
let detail = ``
let result = JSON.parse(data)
if (result && result.code == 0) detail = `本月累计: ${result.data.hadSignDays}/${result.data.allDays}次, 说明: ${result.data.text}`
chavy.msg(title, subTitle, detail)
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,83 +6,84 @@ const cookieVal = chavy.getdata(cookieKey)
sign()
function sign() {
let url = {
url: `https://api.live.bilibili.com/pay/v1/Exchange/silver2coin`,
headers: {
Cookie: cookieVal
let url = {
url: `https://api.live.bilibili.com/pay/v1/Exchange/silver2coin`,
headers: {
Cookie: cookieVal
}
}
}
url.headers['Origin'] = 'api.live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
url.headers['Origin'] = 'api.live.bilibili.com'
url.headers['Referer'] = 'http://live.bilibili.com/'
url.headers['Accept'] = 'application/json, text/javascript, */*; q=0.01'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName} 银瓜子转硬币`
// 兑换成功
if (result && result.code == 0) {
let subTitle = `${result.message}`
let detail = `成功兑换: ${result.data.coin} 个硬币\n当前银瓜子: ${result.data.silver} , 当前金瓜子: ${result.data.gold}`
chavy.msg(title, subTitle, detail)
}
// 兑换中止(重复兑换&银瓜子不足)
else if (result && result.code == 403) {
let subTitle = `未成功兑换`
let detail = `${result.message}`
chavy.msg(title, subTitle, detail)
}
// 兑换失败
else {
let subTitle = `兑换失败`
let detail = `说明: ${result.message}`
chavy.msg(title, subTitle, detail)
}
chavy.log(`${cookieName}, data: ${data}`)
})
chavy.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName} 银瓜子转硬币`
// 兑换成功
if (result && result.code == 0) {
let subTitle = `${result.message}`
let detail = `成功兑换: ${result.data.coin} 个硬币\n当前银瓜子: ${result.data.silver} , 当前金瓜子: ${result.data.gold}`
chavy.msg(title, subTitle, detail)
}
// 兑换中止(重复兑换&银瓜子不足)
else if (result && result.code == 403) {
let subTitle = `未成功兑换`
let detail = `${result.message}`
chavy.msg(title, subTitle, detail)
}
// 兑换失败
else {
let subTitle = `兑换失败`
let detail = `说明: ${result.message}`
chavy.msg(title, subTitle, detail)
}
chavy.log(`${cookieName}, data: ${data}`)
})
chavy.done()
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -9,131 +9,267 @@
"id": "10000",
"name": "10000",
"keys": [],
"settings": [{ "id": "chavy_mobile_10000", "name": "手机号码", "val": "", "type": "textarea", "placeholder": "18918920000,\n18918920000", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔多个号码, 可加回车" }],
"settings": [
{
"id": "chavy_mobile_10000",
"name": "手机号码",
"val": "",
"type": "textarea",
"placeholder": "18918920000,\n18918920000",
"autoGrow": true,
"rows": 5,
"desc": "以英文逗号分隔多个号码, 可加回车"
}
],
"author": "@wangfei021325, @chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/10000/10000.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10000.png", "https://raw.githubusercontent.com/Orz-3/task/master/10000.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/10000.png",
"https://raw.githubusercontent.com/Orz-3/task/master/10000.png"
]
},
{
"id": "chavyleung.10086",
"name": "10086",
"keys": ["chavy_autologin_cmcc", "chavy_getfee_cmcc", "chavy_tokenurl_10086", "chavy_tokenheader_10086", "chavy_signurl_10086", "chavy_signheader_10086"],
"keys": [
"chavy_autologin_cmcc",
"chavy_getfee_cmcc",
"chavy_tokenurl_10086",
"chavy_tokenheader_10086",
"chavy_signurl_10086",
"chavy_signheader_10086"
],
"author": "@wangfei021325, @chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/10086/10086.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/10086.png", "https://raw.githubusercontent.com/Orz-3/task/master/10086.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/10086.png",
"https://raw.githubusercontent.com/Orz-3/task/master/10086.png"
]
},
{
"id": "chavyleung.suning",
"name": "苏宁易购",
"keys": ["chavy_login_url_suning", "chavy_login_body_suning", "chavy_login_header_suning", "chavy_sign_url_suning", "chavy_sign_header_suning", "chavy_signweb_url_suning", "snyg_userTokenKey", "chavy_signweb_header_suning", "chavy_signgame_url_suning", "chavy_signgame_header_suning", "chavy_signgetgame_url_suning", "chavy_signgetgame_header_suning"],
"keys": [
"chavy_login_url_suning",
"chavy_login_body_suning",
"chavy_login_header_suning",
"chavy_sign_url_suning",
"chavy_sign_header_suning",
"chavy_signweb_url_suning",
"snyg_userTokenKey",
"chavy_signweb_header_suning",
"chavy_signgame_url_suning",
"chavy_signgame_header_suning",
"chavy_signgetgame_url_suning",
"chavy_signgetgame_header_suning"
],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/suning/suning.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/suning.png", "https://raw.githubusercontent.com/Orz-3/task/master/suning.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/suning.png",
"https://raw.githubusercontent.com/Orz-3/task/master/suning.png"
]
},
{
"id": "chavyleung.bilibili.live",
"name": "bilibili直播",
"keys": ["chavy_cookie_bilibili"],
"keys": [
"chavy_cookie_bilibili"
],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/bilibili/bilibili.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/bilibili.png", "https://raw.githubusercontent.com/Orz-3/task/master/bilibili.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/bilibili.png",
"https://raw.githubusercontent.com/Orz-3/task/master/bilibili.png"
]
},
{
"id": "chavyleung.meituan",
"name": "美团",
"keys": ["chavy_tokenurl_meituan", "chavy_tokenheader_meituan", "chavy_signurl_meituan", "chavy_signheader_meituan", "chavy_signbody_meituan"],
"keys": [
"chavy_tokenurl_meituan",
"chavy_tokenheader_meituan",
"chavy_signurl_meituan",
"chavy_signheader_meituan",
"chavy_signbody_meituan"
],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/meituan/meituan.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/meituan.png", "https://raw.githubusercontent.com/Orz-3/task/master/meituan.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/meituan.png",
"https://raw.githubusercontent.com/Orz-3/task/master/meituan.png"
]
},
{
"id": "chavyleung.mgtv",
"name": "芒果TV",
"keys": ["chavy_signurl_mgtv", "chavy_signheader_mgtv"],
"keys": [
"chavy_signurl_mgtv",
"chavy_signheader_mgtv"
],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/blob/master/mgtv/mgtv.js",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/mgtv.png", "https://raw.githubusercontent.com/Orz-3/task/master/mgtv.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/mgtv.png",
"https://raw.githubusercontent.com/Orz-3/task/master/mgtv.png"
]
},
{
"id": "gdoil",
"name": "加油广东",
"keys": ["chavy_signurl_gdoil", "chavy_signheader_gdoil"],
"keys": [
"chavy_signurl_gdoil",
"chavy_signheader_gdoil"
],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/tree/master/gdoil",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/gdoil.png", "https://raw.githubusercontent.com/Orz-3/task/master/gdoil.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/gdoil.png",
"https://raw.githubusercontent.com/Orz-3/task/master/gdoil.png"
]
},
{
"id": "feng",
"name": "威锋网",
"settings": [{ "id": "chavy_accounts_feng", "name": "威锋账号", "val": "", "type": "textarea", "placeholder": "账号,密码 (回车) 账号,密码", "autoGrow": true, "rows": 5, "desc": "以英文逗号分隔账号与密码, 回车添加多个账号" }],
"settings": [
{
"id": "chavy_accounts_feng",
"name": "威锋账号",
"val": "",
"type": "textarea",
"placeholder": "账号,密码 (回车) 账号,密码",
"autoGrow": true,
"rows": 5,
"desc": "以英文逗号分隔账号与密码, 回车添加多个账号"
}
],
"keys": [],
"author": "@chavyleung",
"repo": "https://github.com/chavyleung/scripts/tree/master/feng",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/feng.png", "https://raw.githubusercontent.com/Orz-3/task/master/feng.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/feng.png",
"https://raw.githubusercontent.com/Orz-3/task/master/feng.png"
]
},
{
"id": "wanda",
"name": "万达电影",
"keys": ["senku_wanda_mi_"],
"keys": [
"senku_wanda_mi_"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/wanda",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/wanda.png", "https://raw.githubusercontent.com/Orz-3/task/master/wanda.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/wanda.png",
"https://raw.githubusercontent.com/Orz-3/task/master/wanda.png"
]
},
{
"id": "qtt",
"name": "趣头条",
"keys": ["senku_signKey_qtt", "senku_signXTK_qtt", "senku_readKey_qtt", "senku_navCoinKey_qtt"],
"keys": [
"senku_signKey_qtt",
"senku_signXTK_qtt",
"senku_readKey_qtt",
"senku_navCoinKey_qtt"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/qtt",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/qtt.png", "https://raw.githubusercontent.com/Orz-3/task/master/qtt.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/qtt.png",
"https://raw.githubusercontent.com/Orz-3/task/master/qtt.png"
]
},
{
"id": "qmkg",
"name": "全民K歌",
"keys": ["senku_signurl_qmkg", "senku_signheader_qmkg", "senku_signbody_qmkg"],
"keys": [
"senku_signurl_qmkg",
"senku_signheader_qmkg",
"senku_signbody_qmkg"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/qmkg",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/qmkg.png", "https://raw.githubusercontent.com/Orz-3/task/master/qmkg.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/qmkg.png",
"https://raw.githubusercontent.com/Orz-3/task/master/qmkg.png"
]
},
{
"id": "bcz",
"name": "百词斩",
"keys": ["senku_cookie_bcz", "senku_key_bcz"],
"keys": [
"senku_cookie_bcz",
"senku_key_bcz"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/bcz",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/bcz.png", "https://raw.githubusercontent.com/Orz-3/task/master/bcz.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/bcz.png",
"https://raw.githubusercontent.com/Orz-3/task/master/bcz.png"
]
},
{
"id": "zxhc",
"name": "智行火车票",
"keys": ["senku_signurl_zxhc", "senku_signheader_zxhc", "senku_signbody_zxhc"],
"keys": [
"senku_signurl_zxhc",
"senku_signheader_zxhc",
"senku_signbody_zxhc"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/zxhc",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/zxhc.png", "https://raw.githubusercontent.com/Orz-3/task/master/zxhc.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/zxhc.png",
"https://raw.githubusercontent.com/Orz-3/task/master/zxhc.png"
]
},
{
"id": "fenqile",
"name": "分期乐",
"keys": ["senku_signurl_fenqile", "senku_signheader_fenqile", "senku_signbody_fenqile", "senku_signDailyKey_fenqile", "senku_signDailyUrlKey_fenqile"],
"keys": [
"senku_signurl_fenqile",
"senku_signheader_fenqile",
"senku_signbody_fenqile",
"senku_signDailyKey_fenqile",
"senku_signDailyUrlKey_fenqile"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/fenqile",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/fenqile.png", "https://raw.githubusercontent.com/Orz-3/task/master/fenqile.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/fenqile.png",
"https://raw.githubusercontent.com/Orz-3/task/master/fenqile.png"
]
},
{
"id": "fandeng",
"name": "樊登读书",
"keys": ["senku_signurl_pandeng", "senku_signheader_pandeng", "senku_signbody_pandeng"],
"keys": [
"senku_signurl_pandeng",
"senku_signheader_pandeng",
"senku_signbody_pandeng"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/fandeng",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/fandeng.png", "https://raw.githubusercontent.com/Orz-3/task/master/fandeng.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/fandeng.png",
"https://raw.githubusercontent.com/Orz-3/task/master/fandeng.png"
]
},
{
"id": "dbsj",
"name": "豆瓣时间",
"keys": ["senku_signurl_dbsj", "senku_signheader_dbsj", "senku_signbody_dbsj"],
"keys": [
"senku_signurl_dbsj",
"senku_signheader_dbsj",
"senku_signbody_dbsj"
],
"author": "@GideonSenku",
"repo": "https://github.com/chavyleung/scripts/tree/master/dbsj",
"icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/dbsj.png", "https://raw.githubusercontent.com/Orz-3/task/master/dbsj.png"]
"icons": [
"https://raw.githubusercontent.com/Orz-3/mini/master/dbsj.png",
"https://raw.githubusercontent.com/Orz-3/task/master/dbsj.png"
]
}
]
}

View File

@ -2,92 +2,124 @@
"releases": [
{
"version": "0.3.1",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "修复",
"descs": ["手动切换会话会导致自动切换顺序错误问题"]
"descs": [
"手动切换会话会导致自动切换顺序错误问题"
]
}
]
},
{
"version": "0.3.0",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "新增",
"descs": ["全局搜索"]
"descs": [
"全局搜索"
]
}
]
},
{
"version": "0.2.4",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "优化",
"descs": ["帮助页面样式", "订阅链接多余空格&换行等字符"]
"descs": [
"帮助页面样式",
"订阅链接多余空格&换行等字符"
]
}
]
},
{
"version": "0.2.2",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "优化",
"descs": ["悬浮按钮刷新不用确认", "侧栏可以隐藏帮助按钮"]
"descs": [
"悬浮按钮刷新不用确认",
"侧栏可以隐藏帮助按钮"
]
}
]
},
{
"version": "0.2.1",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "新增",
"descs": ["可以设置悬浮按钮的位置"]
"descs": [
"可以设置悬浮按钮的位置"
]
}
]
},
{
"version": "0.2.0",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "新增",
"descs": ["版本更新提醒", "BoxJs升级教程"]
"descs": [
"版本更新提醒",
"BoxJs升级教程"
]
}
]
},
{
"version": "0.1.3",
"tags": ["beta"],
"tags": [
"beta"
],
"author": "@chavyleung",
"icon": "https://avatars3.githubusercontent.com/u/29748519",
"repo": "https://github.com/chavyleung",
"notes": [
{
"name": "新增",
"descs": ["长文本控件", "读写表达式"]
"descs": [
"长文本控件",
"读写表达式"
]
}
]
}

File diff suppressed because one or more lines are too long

View File

@ -6,137 +6,137 @@ var KEY = bubei.getdata("CookieBB")
let isGetCookie = typeof $request !== 'undefined'
if (isGetCookie) {
getcookie()
getcookie()
} else {
sign()
sign()
}
function getcookie() {
var url = $request.url;
if (url) {
var UrlKeyBB = "UrlBB";
var UrlValueBB = url;
if (bubei.getdata(UrlKeyBB) != (undefined || null)) {
if (bubei.getdata(UrlKeyBB) != UrlValueBB) {
var url = bubei.setdata(UrlValueBB, UrlKeyBB);
if (!url) {
bubei.msg("更新" + appName + "Url失败‼", "", "");
} else {
bubei.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
bubei.msg(appName + "Url未变化❗", "", "");
}
var url = $request.url;
if (url) {
var UrlKeyBB = "UrlBB";
var UrlValueBB = url;
if (bubei.getdata(UrlKeyBB) != (undefined || null)) {
if (bubei.getdata(UrlKeyBB) != UrlValueBB) {
var url = bubei.setdata(UrlValueBB, UrlKeyBB);
if (!url) {
bubei.msg("更新" + appName + "Url失败‼", "", "");
} else {
bubei.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
bubei.msg(appName + "Url未变化❗", "", "");
}
} else {
var url = bubei.setdata(UrlValueBB, UrlKeyBB);
if (!url) {
bubei.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
bubei.msg("首次写入" + appName + "Url成功🎉", "", "");
}
var url = bubei.setdata(UrlValueBB, UrlKeyBB);
if (!url) {
bubei.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
bubei.msg("首次写入" + appName + "Url成功🎉", "", "");
}
}
} else {
bubei.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyBB = "CookieBB";
var CookieValueBB = JSON.stringify($request.headers);
if (bubei.getdata(CookieKeyBB) != (undefined || null)) {
if (bubei.getdata(CookieKeyBB) != CookieValueBB) {
var cookie = bubei.setdata(CookieValueBB, CookieKeyBB);
if (!cookie) {
bubei.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
bubei.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
bubei.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = bubei.setdata(CookieValueBB, CookieKeyBB);
if (!cookie) {
bubei.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
bubei.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
bubei.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
bubei.done()
}
function sign() {
var t1 = new Date().getTime()
var t2 = t1 + 1
URL = URL.replace(/by-sign-in\/\d*/g,"by-sign-in/" + t1).replace(/timestamp=\d*/g,"timestamp=" + t2)
const url = { url: URL, headers: JSON.parse(KEY) }
bubei.get(url, (error, response, data) => {
bubei.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.result_code == 200) {
subTitle = `签到结果: 成功`
} else {
subTitle = `签到结果: 未知`
detail = `说明: ${result.error_body.user_msg}`
bubei.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyBB = "CookieBB";
var CookieValueBB = JSON.stringify($request.headers);
if (bubei.getdata(CookieKeyBB) != (undefined || null)) {
if (bubei.getdata(CookieKeyBB) != CookieValueBB) {
var cookie = bubei.setdata(CookieValueBB, CookieKeyBB);
if (!cookie) {
bubei.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
bubei.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
bubei.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = bubei.setdata(CookieValueBB, CookieKeyBB);
if (!cookie) {
bubei.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
bubei.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
bubei.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
bubei.msg(title, subTitle, detail)
bubei.done()
})
}
function sign() {
var t1 = new Date().getTime()
var t2 = t1 + 1
URL = URL.replace(/by-sign-in\/\d*/g, "by-sign-in/" + t1).replace(/timestamp=\d*/g, "timestamp=" + t2)
const url = {url: URL, headers: JSON.parse(KEY)}
bubei.get(url, (error, response, data) => {
bubei.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.result_code == 200) {
subTitle = `签到结果: 成功`
} else {
subTitle = `签到结果: 未知`
detail = `说明: ${result.error_body.user_msg}`
}
bubei.msg(title, subTitle, detail)
bubei.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -8,63 +8,64 @@ const chavy = init()
let title = ``
let detail = ``
if ($request && $request.method != 'OPTIONS' && $request.headers.Host == 'passport.csdn.net') {
const tokenurlVal = $request.url
const tokenheaderVal = JSON.stringify($request.headers)
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
title = `获取刷新链接: 成功`
detail = `请进入 "我的>签到" 并手动签到1次`
chavy.msg(`${cookieName}`, title, detail)
const tokenurlVal = $request.url
const tokenheaderVal = JSON.stringify($request.headers)
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
title = `获取刷新链接: 成功`
detail = `请进入 "我的>签到" 并手动签到1次`
chavy.msg(`${cookieName}`, title, detail)
} else if ($request && $request.method != 'OPTIONS' && $request.headers.Host == 'gw.csdn.net') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
title = `获取Cookie: 成功 (手动签到)`
chavy.msg(`${cookieName}`, title, detail)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
title = `获取Cookie: 成功 (手动签到)`
chavy.msg(`${cookieName}`, title, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -12,195 +12,195 @@ let VAL_signurl = chavy.getdata(KEY_signurl)
let VAL_signheader = chavy.getdata(KEY_signheader)
;(sign = async () => {
chavy.log(`🔔 ${cookieName}`)
await loginapp()
await signapp()
await getlucky()
for (let i = 0; i < signinfo.lucky.data.drawTimes; i++) {
await luckyapp()
}
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName}`)
await loginapp()
await signapp()
await getlucky()
for (let i = 0; i < signinfo.lucky.data.drawTimes; i++) {
await luckyapp()
}
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function loginapp() {
return new Promise((resolve, reject) => {
const url = { url: VAL_loginurl, headers: JSON.parse(VAL_loginheader) }
chavy.get(url, (error, response, data) => {
try {
signinfo.loginapp = JSON.parse(data)
updateSignAppCookies()
resolve()
} catch (e) {
chavy.msg(cookieName, `登录结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} loginapp - 登录失败: ${e}`)
chavy.log(`${cookieName} loginapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_loginurl, headers: JSON.parse(VAL_loginheader)}
chavy.get(url, (error, response, data) => {
try {
signinfo.loginapp = JSON.parse(data)
updateSignAppCookies()
resolve()
} catch (e) {
chavy.msg(cookieName, `登录结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} loginapp - 登录失败: ${e}`)
chavy.log(`${cookieName} loginapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function updateSignAppCookies() {
if (signinfo.loginapp) {
const signheaderObj = JSON.parse(VAL_signheader)
signheaderObj['JWT-TOKEN'] = signinfo.loginapp.data.token
signheaderObj['Cookie'] = signheaderObj['Cookie'].replace(/JWT-TOKEN=[^;]*/, `JWT-TOKEN=${signinfo.loginapp.data.token}`)
VAL_signheader = JSON.stringify(signheaderObj)
} else {
chavy.log(`${cookieName} updateSignAppCookies: 请先获取 Cookies`)
}
if (signinfo.loginapp) {
const signheaderObj = JSON.parse(VAL_signheader)
signheaderObj['JWT-TOKEN'] = signinfo.loginapp.data.token
signheaderObj['Cookie'] = signheaderObj['Cookie'].replace(/JWT-TOKEN=[^;]*/, `JWT-TOKEN=${signinfo.loginapp.data.token}`)
VAL_signheader = JSON.stringify(signheaderObj)
} else {
chavy.log(`${cookieName} updateSignAppCookies: 请先获取 Cookies`)
}
}
function signapp() {
return new Promise((resolve, reject) => {
const url = { url: VAL_signurl, body: '{}', headers: JSON.parse(VAL_signheader) }
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_signurl, body: '{}', headers: JSON.parse(VAL_signheader)}
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getlucky() {
return new Promise((resolve, reject) => {
const VAL_getluckyurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/sign_info?projectVersion=1.0.0`
const url = { url: VAL_getluckyurl, headers: JSON.parse(VAL_signheader) }
delete url.headers['Content-Length']
url.headers['Connection'] = 'keep-alive'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['X-OS'] = 'iOS'
url.headers['Content-Type'] = 'application/json'
url.headers['X-App-ID'] = 'CSDN-APP'
url.headers['Origin'] = 'https://webapp.csdn.net'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid'
url.headers['Referer'] = 'https://webapp.csdn.net/'
url.headers['Host'] = 'gw.csdn.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept'] = '*/*'
return new Promise((resolve, reject) => {
const VAL_getluckyurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/sign_info?projectVersion=1.0.0`
const url = {url: VAL_getluckyurl, headers: JSON.parse(VAL_signheader)}
delete url.headers['Content-Length']
url.headers['Connection'] = 'keep-alive'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['X-OS'] = 'iOS'
url.headers['Content-Type'] = 'application/json'
url.headers['X-App-ID'] = 'CSDN-APP'
url.headers['Origin'] = 'https://webapp.csdn.net'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid'
url.headers['Referer'] = 'https://webapp.csdn.net/'
url.headers['Host'] = 'gw.csdn.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept'] = '*/*'
chavy.get(url, (error, response, data) => {
try {
signinfo.lucky = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖次数: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getlucky - 获取抽奖次数失败: ${e}`)
chavy.log(`${cookieName} getlucky - response: ${JSON.stringify(response)}`)
resolve()
}
chavy.get(url, (error, response, data) => {
try {
signinfo.lucky = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖次数: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getlucky - 获取抽奖次数失败: ${e}`)
chavy.log(`${cookieName} getlucky - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function luckyapp() {
return new Promise((resolve, reject) => {
const VAL_luckyappurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/good_luck?projectVersion=1.0.0`
const url = { url: VAL_luckyappurl, body: '{}', headers: JSON.parse(VAL_signheader) }
url.headers['Connection'] = 'keep-alive'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['X-OS'] = 'iOS'
url.headers['Content-Type'] = 'application/json'
url.headers['X-App-ID'] = 'CSDN-APP'
url.headers['Origin'] = 'https://webapp.csdn.net'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid'
url.headers['Referer'] = 'https://webapp.csdn.net/'
url.headers['Host'] = 'gw.csdn.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept'] = '*/*'
chavy.post(url, (error, response, data) => {
try {
chavy.log(`${cookieName} luckyapp - response: ${JSON.stringify(response)}`)
signinfo.luckylist = signinfo.luckylist ? signinfo.luckylist : []
signinfo.luckylist.push(JSON.parse(data))
resolve()
} catch (e) {
chavy.msg(cookieName, `抽奖结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} luckyapp - 抽奖失败: ${e}`)
chavy.log(`${cookieName} luckyapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const VAL_luckyappurl = `https://gw.csdn.net/mini-app/v2/lucky_draw/login/good_luck?projectVersion=1.0.0`
const url = {url: VAL_luckyappurl, body: '{}', headers: JSON.parse(VAL_signheader)}
url.headers['Connection'] = 'keep-alive'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['X-OS'] = 'iOS'
url.headers['Content-Type'] = 'application/json'
url.headers['X-App-ID'] = 'CSDN-APP'
url.headers['Origin'] = 'https://webapp.csdn.net'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 CSDNApp/4.1.5(iOS) AnalysysAgent/Hybrid'
url.headers['Referer'] = 'https://webapp.csdn.net/'
url.headers['Host'] = 'gw.csdn.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept'] = '*/*'
chavy.post(url, (error, response, data) => {
try {
chavy.log(`${cookieName} luckyapp - response: ${JSON.stringify(response)}`)
signinfo.luckylist = signinfo.luckylist ? signinfo.luckylist : []
signinfo.luckylist.push(JSON.parse(data))
resolve()
} catch (e) {
chavy.msg(cookieName, `抽奖结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} luckyapp - 抽奖失败: ${e}`)
chavy.log(`${cookieName} luckyapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle = ''
let detail = ''
if (signinfo.signapp.code == 200) {
if (signinfo.signapp.data.isSigned === false) {
subTitle = `签到结果: 成功`
detail = `共签: ${signinfo.signapp.data.totalCount}天, 连签: ${signinfo.signapp.data.keepCount}`
} else if (signinfo.signapp.data.isSigned === true) {
subTitle = `签到结果: 重复`
let subTitle = ''
let detail = ''
if (signinfo.signapp.code == 200) {
if (signinfo.signapp.data.isSigned === false) {
subTitle = `签到结果: 成功`
detail = `共签: ${signinfo.signapp.data.totalCount}天, 连签: ${signinfo.signapp.data.keepCount}`
} else if (signinfo.signapp.data.isSigned === true) {
subTitle = `签到结果: 重复`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.msg}`
}
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.msg}`
subTitle = `签到结果: 失败`
detail = `说明: 详见日志`
}
} else {
subTitle = `签到结果: 失败`
detail = `说明: 详见日志`
}
if (signinfo.lucky && signinfo.lucky.data && signinfo.lucky.data.drawTimes && signinfo.lucky.data.drawTimes > 0) {
subTitle += `; 抽奖次数: ${signinfo.lucky.data.drawTimes}`
detail += `\n查看抽奖详情\n`
for (let i = 0; i < signinfo.luckylist.length; i++) {
const can_draw = signinfo.luckylist[i].data.can_draw
if (can_draw) detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.title}`
else detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.msg}`
if (signinfo.lucky && signinfo.lucky.data && signinfo.lucky.data.drawTimes && signinfo.lucky.data.drawTimes > 0) {
subTitle += `; 抽奖次数: ${signinfo.lucky.data.drawTimes}`
detail += `\n查看抽奖详情\n`
for (let i = 0; i < signinfo.luckylist.length; i++) {
const can_draw = signinfo.luckylist[i].data.can_draw
if (can_draw) detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.title}`
else detail += `\n抽奖 ${i + 1}: ${signinfo.luckylist[i].data.msg}`
}
}
}
chavy.msg(cookieName, subTitle, detail)
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,55 +6,56 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS') {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

View File

@ -10,69 +10,68 @@ sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal)}
senku.get(url, (error, response, data) => {
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
const has_checked = result.today_status.has_checked
const continuous_check_in_count = result.continuous_check_in_count
const status = result.auto_check.status
if (status == "success") {
subTitle = `签到结果: 成功`
detail = `连续签到天数${continuous_check_in_count}`
} else if (has_checked == false) {
subTitle = `签到结果: 重复`
}
else if (has_checked == false) {
subTitle = `签到结果: 失败`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
senku.get(url, (error, response, data) => {
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
const has_checked = result.today_status.has_checked
const continuous_check_in_count = result.continuous_check_in_count
const status = result.auto_check.status
if (status == "success") {
subTitle = `签到结果: 成功`
detail = `连续签到天数${continuous_check_in_count}`
} else if (has_checked == false) {
subTitle = `签到结果: 重复`
} else if (has_checked == false) {
subTitle = `签到结果: 失败`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -2,54 +2,56 @@ const cookieName = '懂球帝'
const cookieKey = 'chavy_cookie_dongqiudi'
const chavy = init()
const cookieVal = JSON.stringify({
UUID: $request.headers['UUID'],
Authorization: $request.headers['Authorization']
UUID: $request.headers['UUID'],
Authorization: $request.headers['Authorization']
})
if (cookieVal && chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -6,77 +6,77 @@ const cookieVal = JSON.parse(chavy.getdata(cookieKey))
sign()
function sign() {
let url = { url: `https://api.dongqiudi.com/v3/useract/sign/tasknew/index`, headers: {} }
url.headers['UUID'] = `${cookieVal.UUID}`
url.headers['Authorization'] = `${cookieVal.Authorization}`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Origin'] = `https://n.dongqiudi.com`
url.headers['Connection'] = `keep-alive`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Referer'] = `https://n.dongqiudi.com/webapp/signIn.html`
url.headers['Host'] = `api.dongqiudi.com`
url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 NewsApp/7.3.3 NetType/NA Technology/Wifi (iPhone; iOS 13.3; Scale/2.00) dongqiudiClientApp (modelIdentifier/iPhone10,1 )`
url.headers['Accept-Language'] = `zh-cn`
let url = {url: `https://api.dongqiudi.com/v3/useract/sign/tasknew/index`, headers: {}}
url.headers['UUID'] = `${cookieVal.UUID}`
url.headers['Authorization'] = `${cookieVal.Authorization}`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Origin'] = `https://n.dongqiudi.com`
url.headers['Connection'] = `keep-alive`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Referer'] = `https://n.dongqiudi.com/webapp/signIn.html`
url.headers['Host'] = `api.dongqiudi.com`
url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 NewsApp/7.3.3 NetType/NA Technology/Wifi (iPhone; iOS 13.3; Scale/2.00) dongqiudiClientApp (modelIdentifier/iPhone10,1 )`
url.headers['Accept-Language'] = `zh-cn`
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == 0) {
if (result.data.sign_gold != 0) subTitle = '签到结果: 成功'
else subTitle = '签到结果: 成功 (重复签到)'
detail = `连签: ${result.data.continue_sign_days}天, 金币: ${result.data.gold_num} (+${result.data.sign_gold}), 价值: ${result.data.convertible_money}`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.code}, 说明: ${result.message}`
}
chavy.msg(title, subTitle, detail)
})
chavy.done()
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == 0) {
if (result.data.sign_gold != 0) subTitle = '签到结果: 成功'
else subTitle = '签到结果: 成功 (重复签到)'
detail = `连签: ${result.data.continue_sign_days}天, 金币: ${result.data.gold_num} (+${result.data.sign_gold}), 价值: ${result.data.convertible_money}`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.code}, 说明: ${result.message}`
}
chavy.msg(title, subTitle, detail)
})
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,78 +4,78 @@ const DUOKAN_DEVICE_ID_KEY = 'duokan_device_id'
let $util = init()
if (typeof $request !== 'undefined') {
getCookie()
getCookie()
}
$util.done({})
function getCookie() {
let cookieVal = $request.headers['Cookie']
$util.log(`cookie: ${cookieVal}`)
if (cookieVal.indexOf('token=') !== -1 && cookieVal.indexOf('device_id=') !== -1) {
let regexp = /device_id=(.*?);/g
let matched = regexp.exec(cookieVal)
if (matched) {
let deviceId = matched[1]
$util.log(`deviceId: ${deviceId}`)
if ($util.setdata(cookieVal, DUOKAN_COOKIE_KEY) && $util.setdata(deviceId, DUOKAN_DEVICE_ID_KEY)) {
$util.msg(`获取多看阅读 Cookie 成功 🎉`)
}
let cookieVal = $request.headers['Cookie']
$util.log(`cookie: ${cookieVal}`)
if (cookieVal.indexOf('token=') !== -1 && cookieVal.indexOf('device_id=') !== -1) {
let regexp = /device_id=(.*?);/g
let matched = regexp.exec(cookieVal)
if (matched) {
let deviceId = matched[1]
$util.log(`deviceId: ${deviceId}`)
if ($util.setdata(cookieVal, DUOKAN_COOKIE_KEY) && $util.setdata(deviceId, DUOKAN_DEVICE_ID_KEY)) {
$util.msg(`获取多看阅读 Cookie 成功 🎉`)
}
}
}
}
}
function init() {
isSurge = () => {
return undefined !== this.$httpClient
}
isQuanX = () => {
return undefined !== this.$task
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (msg) => {
console.log(`${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'GET'
return $task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
isSurge = () => {
return undefined !== this.$httpClient
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'POST'
$task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
isQuanX = () => {
return undefined !== this.$task
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (msg) => {
console.log(`${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'GET'
return $task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'POST'
$task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,118 +6,118 @@ const TASK_NAME = '多看阅读'
let $util = init()
;(async () => {
let cookieVal = $util.getdata(DUOKAN_COOKIE_KEY)
let deviceId = $util.getdata(DUOKAN_DEVICE_ID_KEY)
if (!cookieVal || !deviceId) {
$util.msg(TASK_NAME, '⚠️ 请先获取 Cookie')
$util.done({})
return
}
await checkin(cookieVal, deviceId).then(() => {
$util.done({})
})
let cookieVal = $util.getdata(DUOKAN_COOKIE_KEY)
let deviceId = $util.getdata(DUOKAN_DEVICE_ID_KEY)
if (!cookieVal || !deviceId) {
$util.msg(TASK_NAME, '⚠️ 请先获取 Cookie')
$util.done({})
return
}
await checkin(cookieVal, deviceId).then(() => {
$util.done({})
})
})()
function checkin(cookieVal, deviceId) {
return new Promise((resolve, reject) => {
let options = {
url: `${API_HOST}/checkin/v0/checkin`,
headers: {
'User-Agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
Cookie: cookieVal
},
body: signature(deviceId)
}
$util.post(options, (error, response, data) => {
if (error) {
$util.log(`签到失败error${error}`)
$util.msg(TASK_NAME, '⚠️ 签到失败,详情请查看日志')
resolve()
return
}
let result = JSON.parse(data)
if (result && result.result === 0 && result.data) {
$util.log(`签到成功response: ${data}`)
let subtitle = `签到成功,已连续签到 ${result.data.today}`
let body = ''
if (result.data.gift && Array.isArray(result.data.gift) && result.data.gift.length > 0) {
body = result.data.gift.reduce((prev, cur) => {
return (prev += `获得 ${cur.value}${cur.name} \n`)
}, '')
return new Promise((resolve, reject) => {
let options = {
url: `${API_HOST}/checkin/v0/checkin`,
headers: {
'User-Agent':
'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
Cookie: cookieVal
},
body: signature(deviceId)
}
$util.msg(TASK_NAME, subtitle, body)
resolve()
} else {
$util.log(`签到失败response: ${data}`)
$util.msg(TASK_NAME, `⚠️ 签到失败,${result.msg}`)
resolve()
}
$util.post(options, (error, response, data) => {
if (error) {
$util.log(`签到失败error${error}`)
$util.msg(TASK_NAME, '⚠️ 签到失败,详情请查看日志')
resolve()
return
}
let result = JSON.parse(data)
if (result && result.result === 0 && result.data) {
$util.log(`签到成功response: ${data}`)
let subtitle = `签到成功,已连续签到 ${result.data.today}`
let body = ''
if (result.data.gift && Array.isArray(result.data.gift) && result.data.gift.length > 0) {
body = result.data.gift.reduce((prev, cur) => {
return (prev += `获得 ${cur.value}${cur.name} \n`)
}, '')
}
$util.msg(TASK_NAME, subtitle, body)
resolve()
} else {
$util.log(`签到失败response: ${data}`)
$util.msg(TASK_NAME, `⚠️ 签到失败,${result.msg}`)
resolve()
}
})
})
})
}
function signature(deviceId) {
let t = parseInt(new Date().getTime() / 1000)
let c = 0
for (char of `${deviceId}&${t}`) {
c = (c * 131 + char.charCodeAt(0)) % 65536
}
return `_t=${t}&_c=${c}`
let t = parseInt(new Date().getTime() / 1000)
let c = 0
for (char of `${deviceId}&${t}`) {
c = (c * 131 + char.charCodeAt(0)) % 65536
}
return `_t=${t}&_c=${c}`
}
function init() {
isSurge = () => {
return undefined !== this.$httpClient
}
isQuanX = () => {
return undefined !== this.$task
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (msg) => {
console.log(`${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'GET'
return $task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
isSurge = () => {
return undefined !== this.$httpClient
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'POST'
$task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
isQuanX = () => {
return undefined !== this.$task
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (msg) => {
console.log(`${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'GET'
return $task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'POST'
$task.fetch(options).then(
(response) => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
(reason) => callback(reason.error, null, null)
)
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,66 +4,67 @@ const KEY_signurl = 'chavy_sign_url_everphoto'
const KEY_signheader = 'chavy_sign_header_everphoto'
if ($request && $request.method != 'OPTIONS') {
try {
chavy.log(`🔔 ${cookieName} 开始获取: Cookies`)
const VAL_signurl = $request.url
const VAL_signheader = JSON.stringify($request.headers)
if (VAL_signurl) {
chavy.setdata(VAL_signurl, KEY_signurl)
chavy.log(`${cookieName} VAL_signurl: ${VAL_signurl}`)
try {
chavy.log(`🔔 ${cookieName} 开始获取: Cookies`)
const VAL_signurl = $request.url
const VAL_signheader = JSON.stringify($request.headers)
if (VAL_signurl) {
chavy.setdata(VAL_signurl, KEY_signurl)
chavy.log(`${cookieName} VAL_signurl: ${VAL_signurl}`)
}
if (VAL_signheader) {
chavy.setdata(VAL_signheader, KEY_signheader)
chavy.log(`${cookieName} VAL_signheader: ${VAL_signheader}`)
}
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
} catch (e) {
chavy.msg(cookieName, `获取Cookie: 失败`, e)
chavy.log(`${cookieName} 获取Cookie: 失败: ${e}`)
}
if (VAL_signheader) {
chavy.setdata(VAL_signheader, KEY_signheader)
chavy.log(`${cookieName} VAL_signheader: ${VAL_signheader}`)
}
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
} catch (e) {
chavy.msg(cookieName, `获取Cookie: 失败`, e)
chavy.log(`${cookieName} 获取Cookie: 失败: ${e}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,90 +8,90 @@ let VAL_signurl = chavy.getdata(KEY_signurl)
let VAL_signheader = chavy.getdata(KEY_signheader)
;(exec = async () => {
chavy.log(`🔔 ${cookieName} 开始签到`)
await signapp()
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName} 开始签到`)
await signapp()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function signapp() {
return new Promise((resolve, reject) => {
const url = { url: VAL_signurl, headers: JSON.parse(VAL_signheader) }
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} sign - 签到失败: ${e}`)
chavy.log(`${cookieName} sign - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_signurl, headers: JSON.parse(VAL_signheader)}
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} sign - 签到失败: ${e}`)
chavy.log(`${cookieName} sign - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle, detail
if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == true) {
const reward = signinfo.signapp.data.reward / 1024 / 1024
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
subTitle = '签到结果: 成功'
detail = `总共获得: ${total_reward}MB (+${reward}MB), 明天获得: ${tomorrow_reward}MB`
} else if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == false) {
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
subTitle = '签到结果: 成功 (重复签到)'
detail = `总共获得: ${total_reward}MB, 明天获得: ${tomorrow_reward}MB`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${signinfo.signapp.code}, 说明: 未知`
chavy.log(`${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`)
}
chavy.msg(cookieName, subTitle, detail)
let subTitle, detail
if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == true) {
const reward = signinfo.signapp.data.reward / 1024 / 1024
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
subTitle = '签到结果: 成功'
detail = `总共获得: ${total_reward}MB (+${reward}MB), 明天获得: ${tomorrow_reward}MB`
} else if (signinfo.signapp.code == 0 && signinfo.signapp.data.checkin_result == false) {
const total_reward = signinfo.signapp.data.total_reward / 1024 / 1024
const tomorrow_reward = signinfo.signapp.data.tomorrow_reward / 1024 / 1024
subTitle = '签到结果: 成功 (重复签到)'
detail = `总共获得: ${total_reward}MB, 明天获得: ${tomorrow_reward}MB`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${signinfo.signapp.code}, 说明: 未知`
chavy.log(`${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`)
}
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -3,59 +3,61 @@ const cookieKey = 'chavy_cookie_feng'
const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal.indexOf('userInfo') >= 0) {
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
}
} else {
let subTitle = '获取Cookie: 失败'
let detail = `请确保在已登录状态下获取Cookie`
chavy.msg(`${cookieName}`, subTitle, detail)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
let subTitle = '获取Cookie: 失败'
let detail = `请确保在已登录状态下获取Cookie`
chavy.msg(`${cookieName}`, subTitle, detail)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

File diff suppressed because one or more lines are too long

View File

@ -8,63 +8,64 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/route0014\/star\/sign\//)) {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, `签到领乐星`)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, `签到领乐星`)
} else {
const signDailyUrlVal = $request.url
const signDailyVal = $request.body;
if (signDailyUrlVal) senku.setdata(signDailyUrlVal,signDailyUrlKey)
if (signDailyVal) senku.setdata(signDailyVal,signDailyKey)
senku.msg(cookieName, `获取Cookie: 成功`, `天天领乐星`)
senku.log()
const signDailyUrlVal = $request.url
const signDailyVal = $request.body;
if (signDailyUrlVal) senku.setdata(signDailyUrlVal, signDailyUrlKey)
if (signDailyVal) senku.setdata(signDailyVal, signDailyKey)
senku.msg(cookieName, `获取Cookie: 成功`, `天天领乐星`)
senku.log()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

View File

@ -17,116 +17,112 @@ const signinfo = {}
check()
function check(){
signDaily()
sign()
checkin()
function check() {
signDaily()
sign()
checkin()
}
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, 🔔sign--data: ${data}`)
signinfo.sign = JSON.parse(data)
})
}
function signDaily(){
const url = { url: signDailyUrlVal, headers: JSON.parse(signheaderVal), body: signDailyVal }
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, 🔔signDaily--data: ${data}`)
signinfo.signDaily = JSON.parse(data)
})
senku.log(`${cookieName}, 🔔sign--data: ${data}`)
signinfo.sign = JSON.parse(data)
})
}
function signDaily() {
const url = {url: signDailyUrlVal, headers: JSON.parse(signheaderVal), body: signDailyVal}
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, 🔔signDaily--data: ${data}`)
signinfo.signDaily = JSON.parse(data)
})
}
function getinfo(){
const title = `${cookieName}`
let subTitle = `天天领乐星:`
let detail = ``
function getinfo() {
const title = `${cookieName}`
let subTitle = `天天领乐星:`
let detail = ``
//signDaily
if (signinfo.signDaily.data.result == 0) {
subTitle += `成功`
}
else if (signinfo.signDaily.data.result == 11650011) {
subTitle += `重复签到`
}
else {
subTitle += `失败`
detail += `编码: ${signinfo.signDaily.data.result}, 说明: ${signinfo.signDaily.data.res_info}`
}
//signDaily
if (signinfo.signDaily.data.result == 0) {
subTitle += `成功`
} else if (signinfo.signDaily.data.result == 11650011) {
subTitle += `重复签到`
} else {
subTitle += `失败`
detail += `编码: ${signinfo.signDaily.data.result}, 说明: ${signinfo.signDaily.data.res_info}`
}
//sign
subTitle += ` 签到领乐星:`
if (signinfo.sign.data.result == 0) {
subTitle += `成功`
detail += `账户乐星总数: ${signinfo.sign.data.result_rows.postStar}`
}
else if (signinfo.sign.data.result == 12130022) {
subTitle += `重复签到`
}
else {
subTitle += `失败`
detail += `编码: ${signinfo.sign.data.result}, 说明: ${signinfo.sign.data.res_info}`
}
senku.msg(title, subTitle, detail)
senku.done()
//sign
subTitle += ` 签到领乐星:`
if (signinfo.sign.data.result == 0) {
subTitle += `成功`
detail += `账户乐星总数: ${signinfo.sign.data.result_rows.postStar}`
} else if (signinfo.sign.data.result == 12130022) {
subTitle += `重复签到`
} else {
subTitle += `失败`
detail += `编码: ${signinfo.sign.data.result}, 说明: ${signinfo.sign.data.res_info}`
}
senku.msg(title, subTitle, detail)
senku.done()
}
function checkin(checkms = 0) {
if (signinfo.sign && signinfo.signDaily) {
getinfo()
} else {
if (checkms > 5000) {
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
chavy.done()
if (signinfo.sign && signinfo.signDaily) {
getinfo()
} else {
setTimeout(() => check(checkms + 100), 100)
if (checkms > 5000) {
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
chavy.done()
} else {
setTimeout(() => check(checkms + 100), 100)
}
}
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,66 +4,67 @@ const tokenKey = 'chavy_token_flyertea'
const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
const queryparam = $request.url.split('?')[1]
if (queryparam) {
const params = {}
for (param of $request.url.split('?')[1].split('&')) {
params[param.split('=')[0]] = param.split('=')[1]
}
const token = JSON.stringify(params)
if (chavy.setdata(token, tokenKey)) {
chavy.msg(`${cookieName}`, '获取Token: 成功', '')
chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`)
}
const params = {}
for (param of $request.url.split('?')[1].split('&')) {
params[param.split('=')[0]] = param.split('=')[1]
}
const token = JSON.stringify(params)
if (chavy.setdata(token, tokenKey)) {
chavy.msg(`${cookieName}`, '获取Token: 成功', '')
chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,78 +8,81 @@ let tokenVal = chavy.getdata(tokenKey)
sign()
function sign() {
const token = JSON.parse(tokenVal)
let url = { url: `https://www.flyertea.com/plugin.php?id=k_misign:sign&operation=qiandao&from=insign&version=${token.version}&appcan=appcan&appkey=${token.appkey}&appversion=${token.appversion}&formhash=${token.formhash}&token=${token.token}`, headers: { Cookie: cookieVal } }
url.headers['Accept'] = `*/*`
url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9`
url.headers['Host'] = `www.flyertea.com`
url.headers['User-Agent'] = `FKForum/7.14.0 (iPhone10,1; iOS 13.3; Scale/2.00)`
url.headers['Referer'] = `https://www.flyertea.com/home.php`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.Variables && result.Variables.Message.messageval == 'success') {
subTitle = `签到结果: 成功`
detail = `说明: ${result.Variables.Message.messagestr}`
chavy.msg(title, subTitle, detail)
} else {
if (result.Message.messageval == 'error' && result.Message.messagestr.indexOf('只能签到一次') >= 0) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
}
detail = `说明: ${result.Message.messagestr}`
chavy.msg(title, subTitle, detail)
const token = JSON.parse(tokenVal)
let url = {
url: `https://www.flyertea.com/plugin.php?id=k_misign:sign&operation=qiandao&from=insign&version=${token.version}&appcan=appcan&appkey=${token.appkey}&appversion=${token.appversion}&formhash=${token.formhash}&token=${token.token}`,
headers: {Cookie: cookieVal}
}
})
chavy.done()
url.headers['Accept'] = `*/*`
url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9`
url.headers['Host'] = `www.flyertea.com`
url.headers['User-Agent'] = `FKForum/7.14.0 (iPhone10,1; iOS 13.3; Scale/2.00)`
url.headers['Referer'] = `https://www.flyertea.com/home.php`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.Variables && result.Variables.Message.messageval == 'success') {
subTitle = `签到结果: 成功`
detail = `说明: ${result.Variables.Message.messagestr}`
chavy.msg(title, subTitle, detail)
} else {
if (result.Message.messageval == 'error' && result.Message.messagestr.indexOf('只能签到一次') >= 0) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
}
detail = `说明: ${result.Message.messagestr}`
chavy.msg(title, subTitle, detail)
}
})
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,54 +4,55 @@ const signheaderKey = 'chavy_signheader_gdoil'
const chavy = init()
if ($request && $request.method != 'OPTIONS') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,66 +8,66 @@ const signheaderVal = chavy.getdata(signheaderKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
url.body = '{}'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
if (result.result == true) {
subTitle = `签到结果: 成功`
} else {
if (result.msg.indexOf('已经签到') >= 0) subTitle = `签到结果: 成功 (重复签到)`
else subTitle = `签到结果: 失败`
detail = `说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
url.body = '{}'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
if (result.result == true) {
subTitle = `签到结果: 成功`
} else {
if (result.msg.indexOf('已经签到') >= 0) subTitle = `签到结果: 成功 (重复签到)`
else subTitle = `签到结果: 失败`
detail = `说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -7,100 +7,100 @@ const hdl = init()
let isGetCookie = typeof $request !== 'undefined'
if (isGetCookie) {
getcookie()
getcookie()
} else {
sign()
sign()
}
function getcookie() {
if ($request && $request.method == 'POST') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) hdl.setdata(signurlVal, signurlKey)
if (signheaderVal) hdl.setdata(signheaderVal, signheaderKey)
if (signbodyVal) hdl.setdata(signbodyVal, signbodyKey)
hdl.msg(cookieName, `获取Cookie: 成功, 请禁用该脚本`, ``)
}
hdl.done()
}
function sign() {
const signurlVal = hdl.getdata(signurlKey)
const signheaderVal = hdl.getdata(signheaderKey)
const signbodyVal = hdl.getdata(signbodyKey)
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal }
hdl.post(url, (error, response, data) => {
hdl.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.success == true && result.signInfoVO.todaySigned == true) {
subTitle = `签到结果: 成功`
detail = `签到奖励: ${result.customInfo.foodNum}火柴, 连签: ${result.signInfoVO.continueDay}`
} else if (result.success == false && result.signInfoVO.todaySigned == true) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `连签: ${result.signInfoVO.continueDay}`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${result.message}, 请重新获取`
if ($request && $request.method == 'POST') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) hdl.setdata(signurlVal, signurlKey)
if (signheaderVal) hdl.setdata(signheaderVal, signheaderKey)
if (signbodyVal) hdl.setdata(signbodyVal, signbodyKey)
hdl.msg(cookieName, `获取Cookie: 成功, 请禁用该脚本`, ``)
}
hdl.msg(title, subTitle, detail)
hdl.done()
})
}
function sign() {
const signurlVal = hdl.getdata(signurlKey)
const signheaderVal = hdl.getdata(signheaderKey)
const signbodyVal = hdl.getdata(signbodyKey)
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal}
hdl.post(url, (error, response, data) => {
hdl.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.success == true && result.signInfoVO.todaySigned == true) {
subTitle = `签到结果: 成功`
detail = `签到奖励: ${result.customInfo.foodNum}火柴, 连签: ${result.signInfoVO.continueDay}`
} else if (result.success == false && result.signInfoVO.todaySigned == true) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `连签: ${result.signInfoVO.continueDay}`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${result.message}, 请重新获取`
}
hdl.msg(title, subTitle, detail)
hdl.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -5,299 +5,299 @@ const API_URL = 'https://gameapi.hellobike.com/api'
const UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148; app=easybike; version=5.35.0'
if (typeof $request !== 'undefined') {
getToken()
HELLO_BIKE.done()
getToken()
HELLO_BIKE.done()
} else {
;(async () => {
let token = HELLO_BIKE.getdata(TOKEN_KEY)
if (!token) {
HELLO_BIKE.msg(TASK_NAME, '请先获取 Token')
HELLO_BIKE.done()
return
}
await checkin(token).then(data => {
if (data && data.isSuccess) {
HELLO_BIKE.msg(TASK_NAME, `签到成功,获取 ${data.energy}c 能量`)
} else if (data && !data.isSuccess) {
HELLO_BIKE.msg(TASK_NAME, `重复签到`)
}
}).catch(error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
}
})
await share(token).then(data => {
HELLO_BIKE.log(TASK_NAME, `分享成功, ${JSON.stringify(data)}`)
}).catch(error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
}
})
await getEnergyList(token).then(
data => {
HELLO_BIKE.log(TASK_NAME, `获取能量:${JSON.stringify(data)}`)
return mergePromise(data.map(energy => collectEnergy(token, energy.guid)))
},
error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
;(async () => {
let token = HELLO_BIKE.getdata(TOKEN_KEY)
if (!token) {
HELLO_BIKE.msg(TASK_NAME, '请先获取 Token')
HELLO_BIKE.done()
return
}
},
).then(
data => {
if (Array.isArray(data) && data.length > 0) {
HELLO_BIKE.log(TASK_NAME, `收取能量: ${JSON.stringify(data)}`)
let collected = data.filter(energy => {
return energy != null
}).reduce((total, currentValue) => {
return total + currentValue.energy
}, 0)
HELLO_BIKE.msg(TASK_NAME, `收取能量成功,总共收取 ${collected}c 能量`)
}
HELLO_BIKE.done()
},
error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
HELLO_BIKE.done()
},
)
})()
await checkin(token).then(data => {
if (data && data.isSuccess) {
HELLO_BIKE.msg(TASK_NAME, `签到成功,获取 ${data.energy}c 能量`)
} else if (data && !data.isSuccess) {
HELLO_BIKE.msg(TASK_NAME, `重复签到`)
}
}).catch(error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
}
})
await share(token).then(data => {
HELLO_BIKE.log(TASK_NAME, `分享成功, ${JSON.stringify(data)}`)
}).catch(error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
}
})
await getEnergyList(token).then(
data => {
HELLO_BIKE.log(TASK_NAME, `获取能量:${JSON.stringify(data)}`)
return mergePromise(data.map(energy => collectEnergy(token, energy.guid)))
},
error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
if (error.isInvalidToken) {
token = null
}
},
).then(
data => {
if (Array.isArray(data) && data.length > 0) {
HELLO_BIKE.log(TASK_NAME, `收取能量: ${JSON.stringify(data)}`)
let collected = data.filter(energy => {
return energy != null
}).reduce((total, currentValue) => {
return total + currentValue.energy
}, 0)
HELLO_BIKE.msg(TASK_NAME, `收取能量成功,总共收取 ${collected}c 能量`)
}
HELLO_BIKE.done()
},
error => {
HELLO_BIKE.msg(TASK_NAME, error.reason)
HELLO_BIKE.done()
},
)
})()
}
function getToken() {
if ($request.body) {
let body = JSON.parse($request.body)
if (body && body.token) {
let token = HELLO_BIKE.getdata(TOKEN_KEY)
if (token != null) {
if (token !== body.token) {
if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) {
HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 失败‼️`)
} else {
HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 成功 🎉`)
}
if ($request.body) {
let body = JSON.parse($request.body)
if (body && body.token) {
let token = HELLO_BIKE.getdata(TOKEN_KEY)
if (token != null) {
if (token !== body.token) {
if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) {
HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 失败‼️`)
} else {
HELLO_BIKE.msg(`更新 ${TASK_NAME} Token 成功 🎉`)
}
}
} else {
if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) {
HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 失败‼️`)
} else {
HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 成功 🎉`)
}
}
}
} else {
if (!HELLO_BIKE.setdata(body.token, TOKEN_KEY)) {
HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 失败‼️`)
} else {
HELLO_BIKE.msg(`首次写入 ${TASK_NAME} Token 成功 🎉`)
}
}
}
}
}
function checkin(token) {
if (!token) {
return Promise.resolve({})
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.dailyCheck.v2'
let options = {
url: API_URL,
headers: { 'User-Agent': UA },
body: JSON.stringify({
action,
token,
ticket: '',
}),
if (!token) {
return Promise.resolve({})
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `签到失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `签到失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.dailyCheck.v2'
let options = {
url: API_URL,
headers: {'User-Agent': UA},
body: JSON.stringify({
action,
token,
ticket: '',
}),
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `签到失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `签到失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
})
})
})
}
function share(token) {
if (!token) {
return Promise.resolve({})
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.dailyShare'
let options = {
url: API_URL,
headers: { 'User-Agent': UA },
body: JSON.stringify({
token,
action,
ticket: '',
}),
if (!token) {
return Promise.resolve({})
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `分享失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0) {
resolve(result)
} else {
HELLO_BIKE.log(TASK_NAME, `分享失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.dailyShare'
let options = {
url: API_URL,
headers: {'User-Agent': UA},
body: JSON.stringify({
token,
action,
ticket: '',
}),
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `分享失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0) {
resolve(result)
} else {
HELLO_BIKE.log(TASK_NAME, `分享失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
})
})
})
}
function getEnergyList(token) {
if (!token) {
return Promise.resolve([])
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.getEnergyList'
let options = {
url: API_URL,
headers: { 'User-Agent': UA },
body: JSON.stringify({
token,
action,
ticket: '',
limit: 6,
}),
if (!token) {
return Promise.resolve([])
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `获取能量失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `获取能量失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.getEnergyList'
let options = {
url: API_URL,
headers: {'User-Agent': UA},
body: JSON.stringify({
token,
action,
ticket: '',
limit: 6,
}),
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `获取能量失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `获取能量失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
})
})
})
}
function collectEnergy(token, energyGuid) {
if (!token) {
return Promise.resolve({})
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.collectEnergy'
let options = {
url: API_URL,
headers: { 'User-Agent': UA },
body: JSON.stringify({
token,
action,
ticket: '',
energyGuid,
}),
if (!token) {
return Promise.resolve({})
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `收取能量失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `收取能量失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
return new Promise((resolve, reject) => {
let action = 'happy.energy.collectEnergy'
let options = {
url: API_URL,
headers: {'User-Agent': UA},
body: JSON.stringify({
token,
action,
ticket: '',
energyGuid,
}),
}
HELLO_BIKE.post(options, (error, response, data) => {
if (error) {
HELLO_BIKE.log(TASK_NAME, `收取能量失败error${error}`)
reject(new RequestFailed(action, error))
return
}
let result = JSON.parse(data)
if (result && result.code === 0 && result.data) {
resolve(result.data)
} else {
HELLO_BIKE.log(TASK_NAME, `收取能量失败response${data}`)
reject(new RequestFailed(action, result.msg, result.code === 103))
}
})
})
})
}
function mergePromise(promises = []) {
let array = []
let sequence = Promise.resolve([])
promises.forEach(promise => {
sequence = sequence.then(() => promise).then(data => {
array.push(data)
return array
let array = []
let sequence = Promise.resolve([])
promises.forEach(promise => {
sequence = sequence.then(() => promise).then(data => {
array.push(data)
return array
})
})
})
return sequence
return sequence
}
function init() {
isSurge = () => {
return undefined !== this.$httpClient
}
isQuanX = () => {
return undefined !== this.$task
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (title, msg) => {
console.log(`${title}:\n${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'GET'
return $task.fetch(options).then(
response => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
reason => callback(reason.error, null, null),
)
isSurge = () => {
return undefined !== this.$httpClient
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = { url: options }
options['method'] = 'POST'
$task.fetch(options).then(
response => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
reason => callback(reason.error, null, null),
)
isQuanX = () => {
return undefined !== this.$task
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle = '', body = '') => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (title, msg) => {
console.log(`${title}:\n${msg}\n`)
}
get = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'GET'
return $task.fetch(options).then(
response => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
reason => callback(reason.error, null, null),
)
}
if (isSurge()) return $httpClient.get(options, callback)
}
post = (options, callback) => {
if (isQuanX()) {
if (typeof options == 'string') options = {url: options}
options['method'] = 'POST'
$task.fetch(options).then(
response => {
response['status'] = response.statusCode
callback(null, response, response.body)
},
reason => callback(reason.error, null, null),
)
}
if (isSurge()) $httpClient.post(options, callback)
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
function RequestFailed(action = '', reason = '', isInvalidToken = false) {
this.action = action
this.reason = reason
this.isInvalidToken = isInvalidToken
this.action = action
this.reason = reason
this.isInvalidToken = isInvalidToken
}
RequestFailed.prototype = {
constructor: RequestFailed,
constructor: RequestFailed,
}

View File

@ -4,64 +4,65 @@ const signheaderKey = 'signheader_hycan'
const hycan = init()
if ($request && $request.method == 'POST') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) hycan.setdata(signurlVal, signurlKey)
if (signheaderVal) hycan.setdata(signheaderVal, signheaderKey)
hycan.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) hycan.setdata(signurlVal, signurlKey)
if (signheaderVal) hycan.setdata(signheaderVal, signheaderKey)
hycan.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}
hycan.done()

View File

@ -8,76 +8,76 @@ const signheaderVal = hycan.getdata(signheaderKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
hycan.post(url, (error, response, data) => {
hycan.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.data.addScore == true) {
subTitle = `签到结果: 成功`
detail = `签到积分: ${result.data.score}, 签到详情: ${result.data.msg}`
} else if (result.data.addScore == false) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `说明: token失效, ${result.msg}`
}
hycan.msg(title, subTitle, detail)
hycan.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
hycan.post(url, (error, response, data) => {
hycan.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.data.addScore == true) {
subTitle = `签到结果: 成功`
detail = `签到积分: ${result.data.score}, 签到详情: ${result.data.msg}`
} else if (result.data.addScore == false) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `说明: token失效, ${result.msg}`
}
hycan.msg(title, subTitle, detail)
hycan.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -8,370 +8,398 @@ $.VAL_radommsMin = $.getdata('CFG_618_radomms_min') || '2000'
$.VAL_radommsMax = $.getdata('CFG_618_radomms_max') || '5000'
!(async () => {
$.log('', `🔔 ${$.name}, 开始!`, '')
await getData()
await getActs()
await getShops()
await execActs()
showmsg()
$.log('', `🔔 ${$.name}, 开始!`, '')
await getData()
await getActs()
await getShops()
await execActs()
showmsg()
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
function getData() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_getHomeData'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _info = JSON.parse(data).data.result.cakeBakerInfo
$.secretp = _info.secretp
if (!$.secretp) throw new Error('获取 secretp 失败!')
$.log(`${$.name}, 获取密钥!`)
$.log(` 密钥 = ${$.secretp.slice(0, 10)}...`)
$.log(` 等级 = ${_info.raiseInfo.scoreLevel}`)
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`)
$.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
return new Promise((resove) => {
$.post(taskurl('cakebaker_getHomeData'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _info = JSON.parse(data).data.result.cakeBakerInfo
$.secretp = _info.secretp
if (!$.secretp) throw new Error('获取 secretp 失败!')
$.log(`${$.name}, 获取密钥!`)
$.log(` 密钥 = ${$.secretp.slice(0, 10)}...`)
$.log(` 等级 = ${_info.raiseInfo.scoreLevel}`)
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`)
$.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
})
}
function getShops() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => {
try {
$.log(`${$.name}, 获取商店!`)
if (error) throw new Error(error)
$.shopActs = []
JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => {
const _shopact = {
_raw: _shopa,
id: _shopa.venderId,
name: _shopa.name
}
$.shopActs.push(_shopact)
return new Promise((resove) => {
$.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => {
try {
$.log(`${$.name}, 获取商店!`)
if (error) throw new Error(error)
$.shopActs = []
JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => {
const _shopact = {
_raw: _shopa,
id: _shopa.venderId,
name: _shopa.name
}
$.shopActs.push(_shopact)
})
$.log(` 商店数量 = ${$.shopActs.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
$.log(` 商店数量 = ${$.shopActs.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
function getActs() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => {
try {
$.log(`${$.name}, 获取活动!`)
if (error) throw new Error(error)
$.acts = []
JSON.parse(data).data.result.taskVos.forEach((_a) => {
const _act = {
_raw: _a,
id: _a.taskId,
name: _a.taskName,
times: _a.times,
maxTimes: _a.maxTimes,
waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration,
isProd: _a.productInfoVos ? true : false,
isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false,
tasks: []
}
const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))]
if (Array.isArray(_vo)) {
_vo.forEach((_task) => _act.tasks.push({ _raw: _task, id: _task.itemId, name: _task.title || _task.shopName || _task.taskName || '未知名称' }))
} else {
_act.tasks = Array(_act.maxTimes - _act.times).fill({ _raw: _vo, id: _vo.itemId, name: _act.name })
}
$.acts.push(_act)
return new Promise((resove) => {
$.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => {
try {
$.log(`${$.name}, 获取活动!`)
if (error) throw new Error(error)
$.acts = []
JSON.parse(data).data.result.taskVos.forEach((_a) => {
const _act = {
_raw: _a,
id: _a.taskId,
name: _a.taskName,
times: _a.times,
maxTimes: _a.maxTimes,
waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration,
isProd: _a.productInfoVos ? true : false,
isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false,
tasks: []
}
const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))]
if (Array.isArray(_vo)) {
_vo.forEach((_task) => _act.tasks.push({
_raw: _task,
id: _task.itemId,
name: _task.title || _task.shopName || _task.taskName || '未知名称'
}))
} else {
_act.tasks = Array(_act.maxTimes - _act.times).fill({
_raw: _vo,
id: _vo.itemId,
name: _act.name
})
}
$.acts.push(_act)
})
if (!$.acts) throw new Error('获取活动失败!')
$.log(` 活动数量 = ${$.acts.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
if (!$.acts) throw new Error('获取活动失败!')
$.log(` 活动数量 = ${$.acts.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
async function execActs() {
$.log(`${$.name}, 执行活动!`)
for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) {
const _act = $.acts[_actIdx]
$.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`)
if (_act.times === _act.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
// 跳过:邀请好友、加入战队
if ([2, 12].includes(_act.id)) {
$.log(' 跳过!', '')
continue
}
// 甄选优品
else if (_act.isProd) {
await getProdAct(_act)
for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) {
const subact = _act.subacts[subactIdx]
$.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`)
if (subact.times === subact.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) {
const subatask = subact.tasks[subataskIdx]
$.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`)
if (subatask._raw.status && subatask._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
$.log(`${$.name}, 执行活动!`)
for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) {
const _act = $.acts[_actIdx]
$.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`)
if (_act.times === _act.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
await sendtask(subact, subatask, true)
$.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`)
if (subatask.isskip) {
$.log(` @跳过: ${subatask.msg}`)
}
// 跳过:邀请好友、加入战队
if ([2, 12].includes(_act.id)) {
$.log(' 跳过!', '')
continue
}
// 甄选优品
else if (_act.isProd) {
await getProdAct(_act)
for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) {
const subact = _act.subacts[subactIdx]
$.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`)
if (subact.times === subact.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) {
const subatask = subact.tasks[subataskIdx]
$.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`)
if (subatask._raw.status && subatask._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(subact, subatask, true)
$.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`)
if (subatask.isskip) {
$.log(` @跳过: ${subatask.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(subact.waitDuration * 1000 + randomms))
await sendtask(subact, subatask)
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 开通会员
else if (_act.isBrand) {
if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
await joinBrand(task)
$.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`)
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await brandAward(task)
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '')
}
}
// 普通任务
else {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
if (task._raw.status && task._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(_act, task, true)
$.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`)
if (task.isskip || task.ishot) {
$.log(` @跳过: ${task.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await sendtask(_act, task)
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 商店签到
$.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`)
if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) {
for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) {
const shop = $.shopActs[_shopIdx]
$.log(` ${_shopIdx + 1}. ${shop.name}`)
await signshop(shop)
shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg
$.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(subact.waitDuration * 1000 + randomms))
await sendtask(subact, subatask)
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '')
}
// 开通会员
else if (_act.isBrand) {
if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
await joinBrand(task)
$.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`)
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await brandAward(task)
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '')
}
}
// 普通任务
else {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
if (task._raw.status && task._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(_act, task, true)
$.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`)
if (task.isskip || task.ishot) {
$.log(` @跳过: ${task.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await sendtask(_act, task)
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 商店签到
$.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`)
if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) {
for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) {
const shop = $.shopActs[_shopIdx]
$.log(` ${_shopIdx + 1}. ${shop.name}`)
await signshop(shop)
shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg
$.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '')
}
}
// 商品类活动
function getProdAct(act) {
return new Promise((resove) => {
const body = { taskIds: act.tasks.map((task) => task.id).toString() }
$.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => {
try {
const _result = JSON.parse(data).data.result
const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))]
act.subacts = []
_vo.forEach((_suba) => {
const _subact = {
_raw: _suba,
id: _suba.taskId,
name: _suba.taskName,
times: _suba.times,
maxTimes: _suba.maxTimes,
waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration,
isProd: _suba.productInfoVos ? true : false,
tasks: []
}
_suba.productInfoVos.slice(0, 5).forEach((_prodvo) => {
const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称'
_subact.tasks.push({
_raw: _prodvo,
id: _prodvo.itemId,
name: _taskname
})
})
act.subacts.push(_subact)
return new Promise((resove) => {
const body = {taskIds: act.tasks.map((task) => task.id).toString()}
$.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => {
try {
const _result = JSON.parse(data).data.result
const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))]
act.subacts = []
_vo.forEach((_suba) => {
const _subact = {
_raw: _suba,
id: _suba.taskId,
name: _suba.taskName,
times: _suba.times,
maxTimes: _suba.maxTimes,
waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration,
isProd: _suba.productInfoVos ? true : false,
tasks: []
}
_suba.productInfoVos.slice(0, 5).forEach((_prodvo) => {
const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称'
_subact.tasks.push({
_raw: _prodvo,
id: _prodvo.itemId,
name: _taskname
})
})
act.subacts.push(_subact)
})
} catch (e) {
$.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
} catch (e) {
$.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
function sendtask(act, task, isClaim = false) {
return new Promise((resove) => {
const body = {
taskId: act.id,
itemId: task.id,
actionType: isClaim ? 1 : undefined,
safeStr: JSON.stringify({ secretp: $.secretp })
}
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
if (isClaim) task.isClaimSuc = _issuc
else task.isExecSuc = _issuc
task.isskip = _data.data.bizCode === -5
task.ishot = _data.data.bizCode === -15
task.msg = _data.data.bizMsg || '无'
} catch (e) {
if (isClaim) task.isClaimSuc = false
else task.isExecSuc = false
task.isskip = false
task.ishot = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {
taskId: act.id,
itemId: task.id,
actionType: isClaim ? 1 : undefined,
safeStr: JSON.stringify({secretp: $.secretp})
}
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
if (isClaim) task.isClaimSuc = _issuc
else task.isExecSuc = _issuc
task.isskip = _data.data.bizCode === -5
task.ishot = _data.data.bizCode === -15
task.msg = _data.data.bizMsg || '无'
} catch (e) {
if (isClaim) task.isClaimSuc = false
else task.isExecSuc = false
task.isskip = false
task.ishot = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function signshop(shop) {
return new Promise((resove) => {
const body = { channel: 2, venderId: shop.id }
$.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false
shop.code = _data.code
shop.msg = _data.msg
} catch (e) {
shop.isSuc = false
shop.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {channel: 2, venderId: shop.id}
$.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false
shop.code = _data.code
shop.msg = _data.msg
} catch (e) {
shop.isSuc = false
shop.msg = error || e
} finally {
resove()
}
})
})
})
}
function joinBrand(task) {
return new Promise((resove) => {
const body = {
venderId: task._raw.copy1,
shopId: task._raw.copy1,
bindByVerifyCodeFlag: 1,
registerExtend: {},
writeChildFlag: 0,
channel: 4032
}
const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888`
const url = { url: joinurl, headers: JSON.parse($.VAL_headers) }
delete url.headers['Content-Length']
$.get(url, (error, response, data) => {
try {
const _data = JSON.parse(data)
task.isJoinSuc = _data.busiCode === '0'
task.msg = _data.message || '无'
} catch (e) {
task.isJoinSuc = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {
venderId: task._raw.copy1,
shopId: task._raw.copy1,
bindByVerifyCodeFlag: 1,
registerExtend: {},
writeChildFlag: 0,
channel: 4032
}
const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888`
const url = {url: joinurl, headers: JSON.parse($.VAL_headers)}
delete url.headers['Content-Length']
$.get(url, (error, response, data) => {
try {
const _data = JSON.parse(data)
task.isJoinSuc = _data.busiCode === '0'
task.msg = _data.message || '无'
} catch (e) {
task.isJoinSuc = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function brandAward(task) {
return new Promise((resove) => {
const body = { venderId: task._raw.copy1, itemId: task.id }
$.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
task.isAwardSuc = _issuc
task.msg = _data.data.bizMsg || '无'
} catch (e) {
task.isAwardSuc = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {venderId: task._raw.copy1, itemId: task.id}
$.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
task.isAwardSuc = _issuc
task.msg = _data.data.bizMsg || '无'
} catch (e) {
task.isAwardSuc = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function taskurl(fid, body = '{}') {
const url = { url: `https://api.m.jd.com/client.action` }
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
const url = {url: `https://api.m.jd.com/client.action`}
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
}
function genRadomms() {
const max = $.VAL_radommsMax * 1
const min = $.VAL_radommsMin * 1
return parseInt(Math.random() * (max - min + 1) + min, 10)
const max = $.VAL_radommsMax * 1
const min = $.VAL_radommsMin * 1
return parseInt(Math.random() * (max - min + 1) + min, 10)
}
function showmsg() {}
function showmsg() {
}
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -6,83 +6,101 @@ $.VAL_boomtimes = $.getdata('CFG_BOOM_times_JD618') || 1
$.VAL_boominterval = $.getdata('CFG_BOOM_interval_JD618') || 100
!(async () => {
$.log('', `🔔 ${$.name}, 开始!`, '')
await boom()
await showmsg()
$.log('', `🔔 ${$.name}, 开始!`, '')
await boom()
await showmsg()
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
async function boom() {
$.boomacts = []
$.boomdesc = []
for (let boomIdx = 0; boomIdx < $.VAL_boomtimes; boomIdx++) {
const isLastBoom = boomIdx === $.VAL_boomtimes - 1
$.boomdesc.push(`💣 [${moment('mm:ss')}] 发送第 ${boomIdx + 1} 个炸弹 ${isLastBoom ? '(最后一个)' : ''}`)
const boomAct = new Promise((resove) => {
$.post(taskurl('cakebaker_pk_getCakeBomb'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _data = JSON.parse(data)
const _issuc = _data.code === 0 && _data.data && _data.data.bizCode === 0
$.boom = { isSuc: _issuc, boomIdx, ..._data.data.result }
if (isLastBoom) $.boomdesc.push(`❕ [${moment('mm:ss')}] 第 ${boomIdx + 1} 炸: ${$.boom.tip}`)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
$.boomacts.push(boomAct)
if (isLastBoom) await boomAct
await new Promise($.wait($.VAL_boominterval * 1))
$.boomdesc.push(`❕ [${moment('mm:ss')}] 等待: ${$.VAL_boominterval} 毫秒!`)
}
$.boomacts = []
$.boomdesc = []
for (let boomIdx = 0; boomIdx < $.VAL_boomtimes; boomIdx++) {
const isLastBoom = boomIdx === $.VAL_boomtimes - 1
$.boomdesc.push(`💣 [${moment('mm:ss')}] 发送第 ${boomIdx + 1} 个炸弹 ${isLastBoom ? '(最后一个)' : ''}`)
const boomAct = new Promise((resove) => {
$.post(taskurl('cakebaker_pk_getCakeBomb'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _data = JSON.parse(data)
const _issuc = _data.code === 0 && _data.data && _data.data.bizCode === 0
$.boom = {isSuc: _issuc, boomIdx, ..._data.data.result}
if (isLastBoom) $.boomdesc.push(`❕ [${moment('mm:ss')}] 第 ${boomIdx + 1} 炸: ${$.boom.tip}`)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
$.boomacts.push(boomAct)
if (isLastBoom) await boomAct
await new Promise($.wait($.VAL_boominterval * 1))
$.boomdesc.push(`❕ [${moment('mm:ss')}] 等待: ${$.VAL_boominterval} 毫秒!`)
}
}
function moment(fmt) {
const now = new Date()
const o = {
'M+': now.getMonth() + 1,
'd+': now.getDate(),
'h+': now.getHours(),
'm+': now.getMinutes(),
's+': now.getSeconds(),
'q+': Math.floor((now.getMonth() + 3) / 3),
S: now.getMilliseconds()
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (now.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
const now = new Date()
const o = {
'M+': now.getMonth() + 1,
'd+': now.getDate(),
'h+': now.getHours(),
'm+': now.getMinutes(),
's+': now.getSeconds(),
'q+': Math.floor((now.getMonth() + 3) / 3),
S: now.getMilliseconds()
}
}
return fmt
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (now.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (var k in o) {
if (new RegExp('(' + k + ')').test(fmt)) {
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
}
}
return fmt
}
function taskurl(fid, body = '{}') {
const url = { url: `https://api.m.jd.com/client.action` }
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
const url = {url: `https://api.m.jd.com/client.action`}
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
}
async function showmsg() {
await Promise.all($.boomacts)
$.subt = `我方: ${$.boom.groupLevel || '❓'}层, 对方: ${$.boom.opponentLevel || 0}层, 炸掉: ${$.boom.destroyLevel || 0}`
$.desc = [$.boom.tip || '提示: 无!', '点击查看详情', ...$.boomdesc]
$.msg(`${$.name} (第 ${$.boom.boomIdx + 1} 炸)`, $.subt, $.desc.join('\n'))
// return new Promise((resove) => {
// resove()
// })
await Promise.all($.boomacts)
$.subt = `我方: ${$.boom.groupLevel || '❓'}层, 对方: ${$.boom.opponentLevel || 0}层, 炸掉: ${$.boom.destroyLevel || 0}`
$.desc = [$.boom.tip || '提示: 无!', '点击查看详情', ...$.boomdesc]
$.msg(`${$.name} (第 ${$.boom.boomIdx + 1} 炸)`, $.subt, $.desc.join('\n'))
// return new Promise((resove) => {
// resove()
// })
}
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -30,25 +30,43 @@
const $ = new Env('京东618')
!(async () => {
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const VAL_url = $request.url
const VAL_body = $request.body
const VAL_headers = JSON.stringify($request.headers)
if (VAL_url && VAL_body && VAL_headers) {
$.setdata($request.url, 'chavy_url_jd816')
$.setdata($request.body, 'chavy_body_jd816')
$.setdata(JSON.stringify($request.headers), 'chavy_headers_jd816')
$.subt = '获取会话: 成功!'
}
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const VAL_url = $request.url
const VAL_body = $request.body
const VAL_headers = JSON.stringify($request.headers)
if (VAL_url && VAL_body && VAL_headers) {
$.setdata($request.url, 'chavy_url_jd816')
$.setdata($request.body, 'chavy_body_jd816')
$.setdata(JSON.stringify($request.headers), 'chavy_headers_jd816')
$.subt = '获取会话: 成功!'
}
})()
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -8,370 +8,398 @@ $.VAL_radommsMin = $.getdata('CFG_618_radomms_min') || '2000'
$.VAL_radommsMax = $.getdata('CFG_618_radomms_max') || '5000'
!(async () => {
$.log('', `🔔 ${$.name}, 开始!`, '')
await getData()
await getActs()
await getShops()
await execActs()
showmsg()
$.log('', `🔔 ${$.name}, 开始!`, '')
await getData()
await getActs()
await getShops()
await execActs()
showmsg()
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
function getData() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_getHomeData'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _info = JSON.parse(data).data.result.cakeBakerInfo
$.secretp = _info.secretp
if (!$.secretp) throw new Error('获取 secretp 失败!')
$.log(`${$.name}, 获取密钥!`)
$.log(` 密钥 = ${$.secretp.slice(0, 10)}...`)
$.log(` 等级 = ${_info.raiseInfo.scoreLevel}`)
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`)
$.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
return new Promise((resove) => {
$.post(taskurl('cakebaker_getHomeData'), (error, response, data) => {
try {
if (error) throw new Error(error)
const _info = JSON.parse(data).data.result.cakeBakerInfo
$.secretp = _info.secretp
if (!$.secretp) throw new Error('获取 secretp 失败!')
$.log(`${$.name}, 获取密钥!`)
$.log(` 密钥 = ${$.secretp.slice(0, 10)}...`)
$.log(` 等级 = ${_info.raiseInfo.scoreLevel}`)
$.log(` 分数 = ${_info.raiseInfo.totalScore} => ${_info.raiseInfo.nextLevelScore}`)
$.log(` 延时 = ${$.VAL_radommsMin} => ${$.VAL_radommsMax} 毫秒`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取密钥!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
})
}
function getShops() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => {
try {
$.log(`${$.name}, 获取商店!`)
if (error) throw new Error(error)
$.shopActs = []
JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => {
const _shopact = {
_raw: _shopa,
id: _shopa.venderId,
name: _shopa.name
}
$.shopActs.push(_shopact)
return new Promise((resove) => {
$.post(taskurl('cakebaker_bigBrandHomeData'), (error, response, data) => {
try {
$.log(`${$.name}, 获取商店!`)
if (error) throw new Error(error)
$.shopActs = []
JSON.parse(data).data.result.bigBrandList.forEach((_shopa) => {
const _shopact = {
_raw: _shopa,
id: _shopa.venderId,
name: _shopa.name
}
$.shopActs.push(_shopact)
})
$.log(` 商店数量 = ${$.shopActs.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
$.log(` 商店数量 = ${$.shopActs.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取商店!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
function getActs() {
return new Promise((resove) => {
$.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => {
try {
$.log(`${$.name}, 获取活动!`)
if (error) throw new Error(error)
$.acts = []
JSON.parse(data).data.result.taskVos.forEach((_a) => {
const _act = {
_raw: _a,
id: _a.taskId,
name: _a.taskName,
times: _a.times,
maxTimes: _a.maxTimes,
waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration,
isProd: _a.productInfoVos ? true : false,
isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false,
tasks: []
}
const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))]
if (Array.isArray(_vo)) {
_vo.forEach((_task) => _act.tasks.push({ _raw: _task, id: _task.itemId, name: _task.title || _task.shopName || _task.taskName || '未知名称' }))
} else {
_act.tasks = Array(_act.maxTimes - _act.times).fill({ _raw: _vo, id: _vo.itemId, name: _act.name })
}
$.acts.push(_act)
return new Promise((resove) => {
$.post(taskurl('cakebaker_getTaskDetail'), (error, response, data) => {
try {
$.log(`${$.name}, 获取活动!`)
if (error) throw new Error(error)
$.acts = []
JSON.parse(data).data.result.taskVos.forEach((_a) => {
const _act = {
_raw: _a,
id: _a.taskId,
name: _a.taskName,
times: _a.times,
maxTimes: _a.maxTimes,
waitDuration: _a.waitDuration === 0 ? 1 : _a.waitDuration,
isProd: _a.productInfoVos ? true : false,
isBrand: _a.shoppingActivityVos && _a.taskId === 42 ? true : false,
tasks: []
}
const _vo = _a[Object.keys(_a).find((key) => (_a[key] && _a[key].itemId) || (_a[key] && _a[key][0] && _a[key][0].itemId))]
if (Array.isArray(_vo)) {
_vo.forEach((_task) => _act.tasks.push({
_raw: _task,
id: _task.itemId,
name: _task.title || _task.shopName || _task.taskName || '未知名称'
}))
} else {
_act.tasks = Array(_act.maxTimes - _act.times).fill({
_raw: _vo,
id: _vo.itemId,
name: _act.name
})
}
$.acts.push(_act)
})
if (!$.acts) throw new Error('获取活动失败!')
$.log(` 活动数量 = ${$.acts.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
if (!$.acts) throw new Error('获取活动失败!')
$.log(` 活动数量 = ${$.acts.length}`, '')
} catch (e) {
$.log(`❗️ ${$.name}, 获取活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
async function execActs() {
$.log(`${$.name}, 执行活动!`)
for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) {
const _act = $.acts[_actIdx]
$.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`)
if (_act.times === _act.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
// 跳过:邀请好友、加入战队
if ([2, 12].includes(_act.id)) {
$.log(' 跳过!', '')
continue
}
// 甄选优品
else if (_act.isProd) {
await getProdAct(_act)
for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) {
const subact = _act.subacts[subactIdx]
$.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`)
if (subact.times === subact.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) {
const subatask = subact.tasks[subataskIdx]
$.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`)
if (subatask._raw.status && subatask._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
$.log(`${$.name}, 执行活动!`)
for (let _actIdx = 0; _actIdx < $.acts.length; _actIdx++) {
const _act = $.acts[_actIdx]
$.log(` ${_actIdx + 1}. ${_act.name} (${_act.times}/${_act.maxTimes})`)
if (_act.times === _act.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
await sendtask(subact, subatask, true)
$.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`)
if (subatask.isskip) {
$.log(` @跳过: ${subatask.msg}`)
}
// 跳过:邀请好友、加入战队
if ([2, 12].includes(_act.id)) {
$.log(' 跳过!', '')
continue
}
// 甄选优品
else if (_act.isProd) {
await getProdAct(_act)
for (let subactIdx = 0; subactIdx < _act.subacts.length; subactIdx++) {
const subact = _act.subacts[subactIdx]
$.log(` ${subactIdx + 1}. ${subact.name} (${subact.times}/${subact.maxTimes})`)
if (subact.times === subact.maxTimes) {
$.log(` @跳过: 全部完成!`, '')
continue
}
for (let subataskIdx = 0; subataskIdx < subact.tasks.length; subataskIdx++) {
const subatask = subact.tasks[subataskIdx]
$.log(` ${subataskIdx + 1}. ${subatask.name.slice(0, 15)}...`)
if (subatask._raw.status && subatask._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(subact, subatask, true)
$.log(` @认领任务: ${subatask.isClaimSuc ? '🟢' : '🔴'}`)
if (subatask.isskip) {
$.log(` @跳过: ${subatask.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(subact.waitDuration * 1000 + randomms))
await sendtask(subact, subatask)
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 开通会员
else if (_act.isBrand) {
if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
await joinBrand(task)
$.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`)
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await brandAward(task)
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '')
}
}
// 普通任务
else {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
if (task._raw.status && task._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(_act, task, true)
$.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`)
if (task.isskip || task.ishot) {
$.log(` @跳过: ${task.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await sendtask(_act, task)
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 商店签到
$.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`)
if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) {
for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) {
const shop = $.shopActs[_shopIdx]
$.log(` ${_shopIdx + 1}. ${shop.name}`)
await signshop(shop)
shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg
$.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${subact.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(subact.waitDuration * 1000 + randomms))
await sendtask(subact, subatask)
$.log(` @完成任务: ${subatask.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '')
}
// 开通会员
else if (_act.isBrand) {
if ($.VAL_isJoinBrand === 'true' || $.VAL_isJoinBrand === true) {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
await joinBrand(task)
$.log(` @加入会员: ${task.isJoinSuc ? '🟢' : '🔴'}`)
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await brandAward(task)
$.log(` @完成任务: ${task.isAwardSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 品牌会员!`, '')
}
}
// 普通任务
else {
for (let taskIdx = 0; taskIdx < _act.tasks.length; taskIdx++) {
const task = _act.tasks[taskIdx]
$.log(` ${taskIdx + 1}. ${task.name}`)
if (task._raw.status && task._raw.status === 2) {
$.log(` @跳过: 已经做过!`, '')
continue
}
await sendtask(_act, task, true)
$.log(` @认领任务: ${task.isClaimSuc ? '🟢' : '🔴'}`)
if (task.isskip || task.ishot) {
$.log(` @跳过: ${task.msg}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
} else {
const randomms = genRadomms()
$.log(` @等待: ${_act.waitDuration} 秒 + ${randomms} 毫秒`)
await new Promise($.wait(_act.waitDuration * 1000 + randomms))
await sendtask(_act, task)
$.log(` @完成任务: ${task.isExecSuc ? '🟢' : '🔴'}`)
$.log(` @等待: 5 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(5000 + randomms))
}
}
}
}
// 商店签到
$.log(` ${$.acts.length + 1}. 商店签到 (${$.shopActs.length})`)
if ($.VAL_isSignShop === 'true' || $.VAL_isSignShop === true) {
for (let _shopIdx = 0; _shopIdx < $.shopActs.length; _shopIdx++) {
const shop = $.shopActs[_shopIdx]
$.log(` ${_shopIdx + 1}. ${shop.name}`)
await signshop(shop)
shop.msg = /,/.test(shop.msg) ? shop.msg.split(',')[1] : shop.msg
$.log(` @签到: ${shop.isSuc ? '🟢 已领取!' : shop.code === 402 ? '⚪️ 无效活动!' : `🔴 ${shop.msg}`}`)
const randomms = genRadomms()
$.log(` @等待: 8 秒 + ${randomms} 毫秒`, '')
await new Promise($.wait(8000 + randomms))
}
} else {
$.log(` @跳过: BoxJs 设置为 关闭 商店签到!`, '')
}
}
// 商品类活动
function getProdAct(act) {
return new Promise((resove) => {
const body = { taskIds: act.tasks.map((task) => task.id).toString() }
$.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => {
try {
const _result = JSON.parse(data).data.result
const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))]
act.subacts = []
_vo.forEach((_suba) => {
const _subact = {
_raw: _suba,
id: _suba.taskId,
name: _suba.taskName,
times: _suba.times,
maxTimes: _suba.maxTimes,
waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration,
isProd: _suba.productInfoVos ? true : false,
tasks: []
}
_suba.productInfoVos.slice(0, 5).forEach((_prodvo) => {
const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称'
_subact.tasks.push({
_raw: _prodvo,
id: _prodvo.itemId,
name: _taskname
})
})
act.subacts.push(_subact)
return new Promise((resove) => {
const body = {taskIds: act.tasks.map((task) => task.id).toString()}
$.post(taskurl('cakebaker_getFeedDetail', JSON.stringify(body)), (error, response, data) => {
try {
const _result = JSON.parse(data).data.result
const _vo = _result[Object.keys(_result).find((key) => Array.isArray(_result[key] && _result[key][0] && _result[key][0].productInfoVos))]
act.subacts = []
_vo.forEach((_suba) => {
const _subact = {
_raw: _suba,
id: _suba.taskId,
name: _suba.taskName,
times: _suba.times,
maxTimes: _suba.maxTimes,
waitDuration: _suba.waitDuration === 0 ? 1 : _suba.waitDuration,
isProd: _suba.productInfoVos ? true : false,
tasks: []
}
_suba.productInfoVos.slice(0, 5).forEach((_prodvo) => {
const _taskname = _prodvo.skuName || _prodvo.title || _prodvo.shopName || _prodvo.taskName || '未知名称'
_subact.tasks.push({
_raw: _prodvo,
id: _prodvo.itemId,
name: _taskname
})
})
act.subacts.push(_subact)
})
} catch (e) {
$.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
} catch (e) {
$.log(`❗️ ${$.name}, 执行商品类活动!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
}
function sendtask(act, task, isClaim = false) {
return new Promise((resove) => {
const body = {
taskId: act.id,
itemId: task.id,
actionType: isClaim ? 1 : undefined,
safeStr: JSON.stringify({ secretp: $.secretp })
}
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
if (isClaim) task.isClaimSuc = _issuc
else task.isExecSuc = _issuc
task.isskip = _data.data.bizCode === -5
task.ishot = _data.data.bizCode === -15
task.msg = _data.data.bizMsg || '无'
} catch (e) {
if (isClaim) task.isClaimSuc = false
else task.isExecSuc = false
task.isskip = false
task.ishot = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {
taskId: act.id,
itemId: task.id,
actionType: isClaim ? 1 : undefined,
safeStr: JSON.stringify({secretp: $.secretp})
}
$.post(taskurl('cakebaker_ckCollectScore', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
if (isClaim) task.isClaimSuc = _issuc
else task.isExecSuc = _issuc
task.isskip = _data.data.bizCode === -5
task.ishot = _data.data.bizCode === -15
task.msg = _data.data.bizMsg || '无'
} catch (e) {
if (isClaim) task.isClaimSuc = false
else task.isExecSuc = false
task.isskip = false
task.ishot = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function signshop(shop) {
return new Promise((resove) => {
const body = { channel: 2, venderId: shop.id }
$.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false
shop.code = _data.code
shop.msg = _data.msg
} catch (e) {
shop.isSuc = false
shop.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {channel: 2, venderId: shop.id}
$.post(taskurl('interact_center_sign_collectGift', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
shop.isSuc = _data.code === 407000005 || _data.code === 200 ? true : false
shop.code = _data.code
shop.msg = _data.msg
} catch (e) {
shop.isSuc = false
shop.msg = error || e
} finally {
resove()
}
})
})
})
}
function joinBrand(task) {
return new Promise((resove) => {
const body = {
venderId: task._raw.copy1,
shopId: task._raw.copy1,
bindByVerifyCodeFlag: 1,
registerExtend: {},
writeChildFlag: 0,
channel: 4032
}
const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888`
const url = { url: joinurl, headers: JSON.parse($.VAL_headers) }
delete url.headers['Content-Length']
$.get(url, (error, response, data) => {
try {
const _data = JSON.parse(data)
task.isJoinSuc = _data.busiCode === '0'
task.msg = _data.message || '无'
} catch (e) {
task.isJoinSuc = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {
venderId: task._raw.copy1,
shopId: task._raw.copy1,
bindByVerifyCodeFlag: 1,
registerExtend: {},
writeChildFlag: 0,
channel: 4032
}
const joinurl = `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body=${encodeURIComponent(JSON.stringify(body))}&client=H5&clientVersion=8.5.6&uuid=88888`
const url = {url: joinurl, headers: JSON.parse($.VAL_headers)}
delete url.headers['Content-Length']
$.get(url, (error, response, data) => {
try {
const _data = JSON.parse(data)
task.isJoinSuc = _data.busiCode === '0'
task.msg = _data.message || '无'
} catch (e) {
task.isJoinSuc = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function brandAward(task) {
return new Promise((resove) => {
const body = { venderId: task._raw.copy1, itemId: task.id }
$.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
task.isAwardSuc = _issuc
task.msg = _data.data.bizMsg || '无'
} catch (e) {
task.isAwardSuc = false
task.msg = error || e
} finally {
resove()
}
return new Promise((resove) => {
const body = {venderId: task._raw.copy1, itemId: task.id}
$.post(taskurl('cakebaker_taskBigBrandAward', JSON.stringify(body)), (error, response, data) => {
try {
const _data = JSON.parse(data)
const _issuc = _data.data.bizCode === 0 || _data.data.bizCode === -5 || _data.data.bizCode === -15
task.isAwardSuc = _issuc
task.msg = _data.data.bizMsg || '无'
} catch (e) {
task.isAwardSuc = false
task.msg = error || e
} finally {
resove()
}
})
})
})
}
function taskurl(fid, body = '{}') {
const url = { url: `https://api.m.jd.com/client.action` }
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
const url = {url: `https://api.m.jd.com/client.action`}
url.headers = JSON.parse($.VAL_headers)
url.body = `functionId=${fid}&body=${body}&client=wh5&clientVersion=1.0.0`
return url
}
function genRadomms() {
const max = $.VAL_radommsMax * 1
const min = $.VAL_radommsMin * 1
return parseInt(Math.random() * (max - min + 1) + min, 10)
const max = $.VAL_radommsMax * 1
const min = $.VAL_radommsMin * 1
return parseInt(Math.random() * (max - min + 1) + min, 10)
}
function showmsg() {}
function showmsg() {
}
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -1,54 +1,56 @@
const cookieName = '京东到家'
const signheaderKey = 'chen_signheader_jddj'
const chen = init()
if (this.$request) {
if (this.$request) {
const signheaderVal = JSON.stringify($request.headers)
if (signheaderVal) {
chen.setdata(signheaderVal, signheaderKey)
chen.msg(cookieName, `获取Cookie: 成功`, ``)
chen.setdata(signheaderVal, signheaderKey)
chen.msg(cookieName, `获取Cookie: 成功`, ``)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chen.done()

View File

@ -1,73 +1,75 @@
const cookieName ='京东到家'
const cookieName = '京东到家'
const signheaderKey = 'chen_signheader_jddj'
const chen = init()
const signheaderVal = chen.getdata(signheaderKey)
sign()
function sign() {
let url = {url: `https://daojia.jd.com/client?functionId=signin%2FuserSigninNew&body=%7B%7D`,headers: JSON.parse(signheaderVal)}
chen.get(url, (error, response, data) => {
chen.log(`${cookieName}, data: ${data}`)
let res = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (res.success&&res.result.points!='undefined') {
subTitle = `签到结果:成功`
detail = `获取鲜豆:${res.result.points}`
} else if(!res.success&&res.code==202){
subTitle = `签到结果: 失败`
detail = `说明: ${res.msg}`
}
else if (!res.success&&res.code==-1){
subTitle = `签到成功,请勿重复操作`
}
else{
subTitle = `未知错误,截图日志`
}
chen.msg(title, subTitle, detail)
})
}
function init() {
function sign() {
let url = {
url: `https://daojia.jd.com/client?functionId=signin%2FuserSigninNew&body=%7B%7D`,
headers: JSON.parse(signheaderVal)
}
chen.get(url, (error, response, data) => {
chen.log(`${cookieName}, data: ${data}`)
let res = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (res.success && res.result.points != 'undefined') {
subTitle = `签到结果:成功`
detail = `获取鲜豆:${res.result.points}`
} else if (!res.success && res.code == 202) {
subTitle = `签到结果: 失败`
detail = `说明: ${res.msg}`
} else if (!res.success && res.code == -1) {
subTitle = `签到成功,请勿重复操作`
} else {
subTitle = `未知错误,截图日志`
}
chen.msg(title, subTitle, detail)
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,54 +4,55 @@ const signheaderKey = 'chavy_signheader_mgtv'
const chavy = init()
if ($request && $request.method != 'OPTIONS') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,68 +8,68 @@ const signheaderVal = chavy.getdata(signheaderKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
url.body = '{}'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data.match(/\(([^\)]*)\)/)[1])
if (result.code == 200) {
subTitle = `签到结果: 成功`
detail = `共签: ${result.data.curDay}天, 连签: ${result.data.curDayTotal}天, 积分: ${result.data.balance} +${result.data.credits}`
} else if (result.code == 1002) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
url.body = '{}'
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data.match(/\(([^\)]*)\)/)[1])
if (result.code == 200) {
subTitle = `签到结果: 成功`
detail = `共签: ${result.data.curDay}天, 连签: ${result.data.curDayTotal}天, 积分: ${result.data.balance} +${result.data.credits}`
} else if (result.code == 1002) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,54 +4,55 @@ const signheaderKey = 'chavy_signheader_maomicd'
const chavy = init()
if ($request && $request.method != 'OPTIONS') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,65 +8,65 @@ const signheaderVal = chavy.getdata(signheaderKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let subTitle = ``
let detail = ``
let result = data.match(/<root>(<!\[CDATA\[(.*?)\]\]>)<\/root>/)
if (result) {
result = result[2]
if (result == '') subTitle = `签到结果: 成功`
else if (result.indexOf('今日已签') >= 0) subTitle = `签到结果: 成功 (重复签到)`
else (subTitle = `签到结果: 未知`), (detail = `说明: ${result}`)
} else {
subTitle = `签到结果: 失败`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
chavy.get(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let subTitle = ``
let detail = ``
let result = data.match(/<root>(<!\[CDATA\[(.*?)\]\]>)<\/root>/)
if (result) {
result = result[2]
if (result == '') subTitle = `签到结果: 成功`
else if (result.indexOf('今日已签') >= 0) subTitle = `签到结果: 成功 (重复签到)`
else (subTitle = `签到结果: 未知`), (detail = `说明: ${result}`)
} else {
subTitle = `签到结果: 失败`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,66 +4,67 @@ const KEY_homeurl = 'chavy_home_url_mcdd'
const KEY_homeheader = 'chavy_home_header_mcdd'
if ($request && $request.method != 'OPTIONS') {
try {
chavy.log(`🔔 ${cookieName} 开始获取: Cookies`)
const VAL_homeurl = $request.url
const VAL_homeheader = JSON.stringify($request.headers)
if (VAL_homeurl) {
chavy.setdata(VAL_homeurl, KEY_homeurl)
chavy.log(`${cookieName} VAL_homeurl: ${VAL_homeurl}`)
try {
chavy.log(`🔔 ${cookieName} 开始获取: Cookies`)
const VAL_homeurl = $request.url
const VAL_homeheader = JSON.stringify($request.headers)
if (VAL_homeurl) {
chavy.setdata(VAL_homeurl, KEY_homeurl)
chavy.log(`${cookieName} VAL_homeurl: ${VAL_homeurl}`)
}
if (VAL_homeheader) {
chavy.setdata(VAL_homeheader, KEY_homeheader)
chavy.log(`${cookieName} VAL_homeheader: ${VAL_homeheader}`)
}
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
} catch (e) {
chavy.msg(cookieName, `获取Cookie: 失败`, e)
chavy.log(`${cookieName} 获取Cookie: 失败: ${e}`)
}
if (VAL_homeheader) {
chavy.setdata(VAL_homeheader, KEY_homeheader)
chavy.log(`${cookieName} VAL_homeheader: ${VAL_homeheader}`)
}
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
} catch (e) {
chavy.msg(cookieName, `获取Cookie: 失败`, e)
chavy.log(`${cookieName} 获取Cookie: 失败: ${e}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,226 +8,226 @@ let VAL_homeurl = chavy.getdata(KEY_homeurl)
let VAL_homeheader = chavy.getdata(KEY_homeheader)
;(exec = async () => {
chavy.log(`🔔 ${cookieName} 开始签到`)
await signapp()
await getlottery()
if (signinfo.draw_num > 0) for (let i = 0; i < signinfo.draw_num; i++) await lotteryapp(i)
await browseapp()
await getinfo()
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName} 开始签到`)
await signapp()
await getlottery()
if (signinfo.draw_num > 0) for (let i = 0; i < signinfo.draw_num; i++) await lotteryapp(i)
await browseapp()
await getinfo()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function getinfo() {
return new Promise((resolve, reject) => {
const url = { url: VAL_homeurl, headers: JSON.parse(VAL_homeheader) }
chavy.get(url, (error, response, data) => {
try {
signinfo.info = JSON.parse(data)
if (typeof signinfo.is_today_sign === 'undefined') signinfo.is_today_sign = signinfo.info.data.user_sign.is_today_sign
resolve()
} catch (e) {
chavy.msg(cookieName, `获取信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_homeurl, headers: JSON.parse(VAL_homeheader)}
chavy.get(url, (error, response, data) => {
try {
signinfo.info = JSON.parse(data)
if (typeof signinfo.is_today_sign === 'undefined') signinfo.is_today_sign = signinfo.info.data.user_sign.is_today_sign
resolve()
} catch (e) {
chavy.msg(cookieName, `获取信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function signapp() {
return new Promise((resolve, reject) => {
const url = { url: `https://ddxq.mobi/api/v2/user/signin/`, headers: JSON.parse(VAL_homeheader) }
url.headers['Accept'] = '*/*'
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Host'] = 'ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Content-Length'] = '129'
url.headers['Accept-Language'] = 'zh-cn'
url.body = VAL_homeurl.split('?')[1]
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: `https://ddxq.mobi/api/v2/user/signin/`, headers: JSON.parse(VAL_homeheader)}
url.headers['Accept'] = '*/*'
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Host'] = 'ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Content-Length'] = '129'
url.headers['Accept-Language'] = 'zh-cn'
url.body = VAL_homeurl.split('?')[1]
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getlottery() {
return new Promise((resolve, reject) => {
const getlotteryurl = `https://maicai.api.ddxq.mobi/lottery/index?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721`
const url = { url: getlotteryurl, headers: JSON.parse(VAL_homeheader) }
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Accept'] = '*/*'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
chavy.get(url, (error, response, data) => {
try {
signinfo.lotteryinfo = JSON.parse(data)
if (typeof signinfo.draw_num === 'undefined') signinfo.draw_num = signinfo.lotteryinfo.data.draw_num
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getlottery - 获取抽奖失败: ${e}`)
chavy.log(`${cookieName} getlottery - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const getlotteryurl = `https://maicai.api.ddxq.mobi/lottery/index?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721`
const url = {url: getlotteryurl, headers: JSON.parse(VAL_homeheader)}
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Accept'] = '*/*'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
chavy.get(url, (error, response, data) => {
try {
signinfo.lotteryinfo = JSON.parse(data)
if (typeof signinfo.draw_num === 'undefined') signinfo.draw_num = signinfo.lotteryinfo.data.draw_num
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getlottery - 获取抽奖失败: ${e}`)
chavy.log(`${cookieName} getlottery - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function lotteryapp(cnt) {
return new Promise((resolve, reject) => {
setTimeout(() => {
const lotteryappurl = `https://maicai.api.ddxq.mobi/lottery/draw?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721`
const url = { url: lotteryappurl, headers: JSON.parse(VAL_homeheader) }
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Accept'] = '*/*'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
chavy.get(url, (error, response, data) => {
try {
if (!signinfo.lottery) signinfo.lottery = []
signinfo.lottery.push(JSON.parse(data))
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} lotteryapp - 获取抽奖失败: ${e}`)
chavy.log(`${cookieName} lotteryapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
}, cnt * 5000)
})
return new Promise((resolve, reject) => {
setTimeout(() => {
const lotteryappurl = `https://maicai.api.ddxq.mobi/lottery/draw?${VAL_homeurl.split('?')[1]}&event_id=5dbacee44df3e3ed628ce721`
const url = {url: lotteryappurl, headers: JSON.parse(VAL_homeheader)}
url.headers['Origin'] = 'https://activity.m.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['Accept'] = '*/*'
url.headers['Referer'] = 'https://activity.m.ddxq.mobi/'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
chavy.get(url, (error, response, data) => {
try {
if (!signinfo.lottery) signinfo.lottery = []
signinfo.lottery.push(JSON.parse(data))
resolve()
} catch (e) {
chavy.msg(cookieName, `获取抽奖: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} lotteryapp - 获取抽奖失败: ${e}`)
chavy.log(`${cookieName} lotteryapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
}, cnt * 5000)
})
}
function browseapp() {
return new Promise((resolve, reject) => {
const browseappurl = `https://maicai.api.ddxq.mobi/point/completeTask`
const url = { url: browseappurl, headers: JSON.parse(VAL_homeheader) }
url.body = `${VAL_homeurl.split('?')[1]}&station_id=5500fe01916edfe0738b4e43&task_type=21`
url.headers['Accept'] = '*/*'
url.headers['Origin'] = 'https://maicai.m.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.7.5 station_id/5500fe01916edfe0738b4e43'
url.headers['Referer'] = 'https://maicai.m.ddxq.mobi/?v=1.30.0'
url.headers['Content-Length'] = '152'
url.headers['Accept-Language'] = 'zh-cn'
chavy.post(url, (error, response, data) => {
try {
signinfo.browseapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `浏览商品: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} browseapp - 浏览商品失败: ${e}`)
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const browseappurl = `https://maicai.api.ddxq.mobi/point/completeTask`
const url = {url: browseappurl, headers: JSON.parse(VAL_homeheader)}
url.body = `${VAL_homeurl.split('?')[1]}&station_id=5500fe01916edfe0738b4e43&task_type=21`
url.headers['Accept'] = '*/*'
url.headers['Origin'] = 'https://maicai.m.ddxq.mobi'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Host'] = 'maicai.api.ddxq.mobi'
url.headers['Connection'] = 'keep-alive'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 xzone/9.7.5 station_id/5500fe01916edfe0738b4e43'
url.headers['Referer'] = 'https://maicai.m.ddxq.mobi/?v=1.30.0'
url.headers['Content-Length'] = '152'
url.headers['Accept-Language'] = 'zh-cn'
chavy.post(url, (error, response, data) => {
try {
signinfo.browseapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `浏览商品: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} browseapp - 浏览商品失败: ${e}`)
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle, detail
if (signinfo.signapp.code == 0) {
if (signinfo.is_today_sign === false) subTitle = '签到: 成功'
else subTitle = '签到: 重复'
detail = `积分: ${signinfo.info.data.point_num} (+${signinfo.signapp.data.point}), 价值: ${signinfo.info.data.point_money}`
} else {
subTitle = '签到: 失败'
detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.message}`
chavy.log(`${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`)
}
if (signinfo.lotteryinfo.code == 0) {
if (signinfo.draw_num == 0) subTitle += '; 抽奖: 已转'
else subTitle += `; 抽奖: ${signinfo.draw_num}`
} else {
subTitle = '抽奖: 失败'
detail = `编码: ${signinfo.lotteryinfo.code}, 说明: ${signinfo.lotteryinfo.message}`
chavy.log(`${cookieName} showmsg - 抽奖失败: ${JSON.stringify(signinfo.lotteryinfo)}`)
}
if (signinfo.browseapp.code == 0) {
subTitle += '; 浏览任务: 成功'
} else if (signinfo.browseapp.code == -1) {
subTitle += '; 浏览任务: 重复'
} else {
subTitle = '浏览任务: 失败'
detail = `编码: ${signinfo.browseapp.code}, 说明: ${signinfo.browseapp.msg}`
chavy.log(`${cookieName} showmsg - 浏览任务失败: ${JSON.stringify(signinfo.browseapp)}`)
}
if (signinfo.lottery) {
detail += '\n查看抽奖详情\n'
for (let i = 0; i < signinfo.lottery.length; i++) {
if (signinfo.lottery[i].code == 0) detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].data.prize.title}`
else detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].msg}`
let subTitle, detail
if (signinfo.signapp.code == 0) {
if (signinfo.is_today_sign === false) subTitle = '签到: 成功'
else subTitle = '签到: 重复'
detail = `积分: ${signinfo.info.data.point_num} (+${signinfo.signapp.data.point}), 价值: ${signinfo.info.data.point_money}`
} else {
subTitle = '签到: 失败'
detail = `编码: ${signinfo.signapp.code}, 说明: ${signinfo.signapp.message}`
chavy.log(`${cookieName} showmsg - 签到失败: ${JSON.stringify(signinfo.signapp)}`)
}
}
chavy.msg(cookieName, subTitle, detail)
if (signinfo.lotteryinfo.code == 0) {
if (signinfo.draw_num == 0) subTitle += '; 抽奖: 已转'
else subTitle += `; 抽奖: ${signinfo.draw_num}`
} else {
subTitle = '抽奖: 失败'
detail = `编码: ${signinfo.lotteryinfo.code}, 说明: ${signinfo.lotteryinfo.message}`
chavy.log(`${cookieName} showmsg - 抽奖失败: ${JSON.stringify(signinfo.lotteryinfo)}`)
}
if (signinfo.browseapp.code == 0) {
subTitle += '; 浏览任务: 成功'
} else if (signinfo.browseapp.code == -1) {
subTitle += '; 浏览任务: 重复'
} else {
subTitle = '浏览任务: 失败'
detail = `编码: ${signinfo.browseapp.code}, 说明: ${signinfo.browseapp.msg}`
chavy.log(`${cookieName} showmsg - 浏览任务失败: ${JSON.stringify(signinfo.browseapp)}`)
}
if (signinfo.lottery) {
detail += '\n查看抽奖详情\n'
for (let i = 0; i < signinfo.lottery.length; i++) {
if (signinfo.lottery[i].code == 0) detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].data.prize.title}`
else detail += `\n抽奖 (${i + 1}): ${signinfo.lottery[i].msg}`
}
}
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -8,56 +8,57 @@ const chavy = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/evolve\/signin\/signpost\//)) {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -14,73 +14,73 @@ const signBodyVal = chavy.getdata(signbodyKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
if (result.code == 0) {
subTitle = `签到结果: 成功`
detail = `本周连签: ${result.data[0].circleSignTimes}`
for (r of result.data[0].signInAwardRecords) {
const rinfo = JSON.parse(r.info)
if (rinfo.type == `cash`) detail += `, 奖励金: ${rinfo.amount / 100}`
else if (rinfo.type == `coupon`) detail += `\n优惠券: ${rinfo.name}: ${rinfo.amount}元 (${rinfo.condition})`
else detail += `\n未知奖励!`
}
} else if (result.code == 2002) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.msg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
if (result.code == 0) {
subTitle = `签到结果: 成功`
detail = `本周连签: ${result.data[0].circleSignTimes}`
for (r of result.data[0].signInAwardRecords) {
const rinfo = JSON.parse(r.info)
if (rinfo.type == `cash`) detail += `, 奖励金: ${rinfo.amount / 100}`
else if (rinfo.type == `coupon`) detail += `\n优惠券: ${rinfo.name}: ${rinfo.amount}元 (${rinfo.condition})`
else detail += `\n未知奖励!`
}
} else if (result.code == 2002) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.msg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -168,4 +168,5 @@ function init() {
done
}
}
senku.done()

View File

@ -137,6 +137,7 @@ function double() {
all()
}
}
// 抽奖
function drawPrize(bodyVal) {
return new Promise((resolve, reject) => {
@ -220,6 +221,7 @@ function prizeInfo(bodyVal) {
})
})
}
// 阅读时长
function readTime(header, token, urlVal) {
return new Promise((resolve, reject) => {

View File

@ -397,7 +397,6 @@ function showmsg() {
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true

View File

@ -4,54 +4,55 @@ const signheaderKey = 'chavy_signheader_mihoyo'
const chavy = init()
if ($request && $request.method != 'OPTIONS') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -10,92 +10,95 @@ let bbslist = []
sign()
function sign() {
const url = { url: `https://api-takumi.mihoyo.com/apihub/api/getGameList`, headers: JSON.parse(signheaderVal) }
chavy.get(url, (error, response, data) => {
const result = JSON.parse(data)
bbslist = result.data.list
for (bbs of bbslist) signbbs(bbs)
check()
})
const url = {url: `https://api-takumi.mihoyo.com/apihub/api/getGameList`, headers: JSON.parse(signheaderVal)}
chavy.get(url, (error, response, data) => {
const result = JSON.parse(data)
bbslist = result.data.list
for (bbs of bbslist) signbbs(bbs)
check()
})
}
function signbbs(bbs) {
const url = { url: `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${bbs.id}`, headers: JSON.parse(signheaderVal) }
chavy.post(url, (error, response, data) => signinfo.push(data))
const url = {
url: `https://api-takumi.mihoyo.com/apihub/sapi/signIn?gids=${bbs.id}`,
headers: JSON.parse(signheaderVal)
}
chavy.post(url, (error, response, data) => signinfo.push(data))
}
function check(checkms = 0) {
if (bbslist.length == signinfo.length) {
showmsg()
} else {
if (checkms > 5000) {
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
chavy.done()
if (bbslist.length == signinfo.length) {
showmsg()
} else {
setTimeout(() => check(checkms + 100), 100)
if (checkms > 5000) {
chavy.msg(`${cookieName}`, `签到失败: 超时退出`, ``)
chavy.done()
} else {
setTimeout(() => check(checkms + 100), 100)
}
}
}
}
function showmsg() {
const totalcnt = bbslist.length
let signed = 0
let skiped = 0
let succnt = 0
let failcnt = 0
for (info of signinfo) {
const i = JSON.parse(info)
if (i.retcode == 0) (signed += 1), (succnt += 1)
else if (i.retcode == 1008) (signed += 1), (skiped += 1)
else failcnt += 1
}
let subtitle = totalcnt == signed ? '签到结果: 全部成功' : '签到结果: 部分成功'
subtitle = 0 == signed ? '签到结果: 全部失败' : subtitle
const detail = `共签: ${signed}/${totalcnt}, 本次成功: ${succnt}, 失败: ${failcnt}, 重签: ${skiped}`
chavy.msg(cookieName, subtitle, detail)
chavy.done()
const totalcnt = bbslist.length
let signed = 0
let skiped = 0
let succnt = 0
let failcnt = 0
for (info of signinfo) {
const i = JSON.parse(info)
if (i.retcode == 0) (signed += 1), (succnt += 1)
else if (i.retcode == 1008) (signed += 1), (skiped += 1)
else failcnt += 1
}
let subtitle = totalcnt == signed ? '签到结果: 全部成功' : '签到结果: 部分成功'
subtitle = 0 == signed ? '签到结果: 全部失败' : subtitle
const detail = `共签: ${signed}/${totalcnt}, 本次成功: ${succnt}, 失败: ${failcnt}, 重签: ${skiped}`
chavy.msg(cookieName, subtitle, detail)
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -1,27 +1,61 @@
const $ = new Env('网易云音乐')
!(async () => {
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const session = {}
session.url = $request.url
session.body = $request.body
session.headers = $request.headers
delete session.headers['Content-Length']
$.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`)
if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) {
$.subt = '获取会话: 成功!'
} else {
$.subt = '获取会话: 失败!'
}
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const session = {}
session.url = $request.url
session.body = $request.body
session.headers = $request.headers
delete session.headers['Content-Length']
$.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`)
if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) {
$.subt = '获取会话: 成功!'
} else {
$.subt = '获取会话: 失败!'
}
})()
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
// prettier-ignore
function Env(s){this.name=s,this.data=null,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.isNode=(()=>"undefined"!=typeof module&&!!module.exports),this.log=((...s)=>{this.logs=[...this.logs,...s],s?console.log(s.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((s=this.name,t="",i="")=>{this.isSurge()&&$notification.post(s,t,i),this.isQuanX()&&$notify(s,t,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];s&&e.push(s),t&&e.push(t),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(s=>{if(this.isSurge())return $persistentStore.read(s);if(this.isQuanX())return $prefs.valueForKey(s);if(this.isNode()){const t="box.dat";return this.fs=this.fs?this.fs:require("fs"),this.fs.existsSync(t)?(this.data=JSON.parse(this.fs.readFileSync(t)),this.data[s]):null}}),this.setdata=((s,t)=>{if(this.isSurge())return $persistentStore.write(s,t);if(this.isQuanX())return $prefs.setValueForKey(s,t);if(this.isNode()){const i="box.dat";return this.fs=this.fs?this.fs:require("fs"),!!this.fs.existsSync(i)&&(this.data=JSON.parse(this.fs.readFileSync(i)),this.data[t]=s,this.fs.writeFileSync(i,JSON.stringify(this.data)),!0)}}),this.wait=((s,t=s)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(t-s+1)+s))),this.get=((s,t)=>this.send(s,"GET",t)),this.post=((s,t)=>this.send(s,"POST",t)),this.send=((s,t,i)=>{if(this.isSurge()){const e="POST"==t?$httpClient.post:$httpClient.get;e(s,(s,t,e)=>{t&&(t.body=e,t.statusCode=t.status),i(s,t,e)})}this.isQuanX()&&(s.method=t,$task.fetch(s).then(s=>{s.status=s.statusCode,i(null,s,s.body)},s=>i(s.error,s,s))),this.isNode()&&(this.request=this.request?this.request:require("request"),s.method=t,s.gzip=!0,this.request(s,(s,t,e)=>{t&&(t.status=t.statusCode),i(null,t,e)}))}),this.done=((s={})=>this.isNode()?null:$done(s))}
function Env(s) {
this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => {
this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((s = this.name, t = "", i = "") => {
this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (s => {
if (this.isSurge()) return $persistentStore.read(s);
if (this.isQuanX()) return $prefs.valueForKey(s);
if (this.isNode()) {
const t = "box.dat";
return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null
}
}), this.setdata = ((s, t) => {
if (this.isSurge()) return $persistentStore.write(s, t);
if (this.isQuanX()) return $prefs.setValueForKey(s, t);
if (this.isNode()) {
const i = "box.dat";
return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0)
}
}), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => {
if (this.isSurge()) {
const e = "POST" == t ? $httpClient.post : $httpClient.get;
e(s, (s, t, e) => {
t && (t.body = e, t.statusCode = t.status), i(s, t, e)
})
}
this.isQuanX() && (s.method = t, $task.fetch(s).then(s => {
s.status = s.statusCode, i(null, s, s.body)
}, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => {
t && (t.status = t.statusCode), i(null, t, e)
}))
}), this.done = ((s = {}) => this.isNode() ? null : $done(s))
}

View File

@ -4,99 +4,133 @@ $.CFG_retryCnt = ($.getdata('CFG_neteasemusic_retryCnt') || '10') * 1
$.CFG_retryInterval = ($.getdata('CFG_neteasemusic_retryInterval') || '500') * 1
!(async () => {
$.log('', `🔔 ${$.name}, 开始!`, '')
init()
await signweb()
await signapp()
await getInfo()
await showmsg()
$.log('', `🔔 ${$.name}, 开始!`, '')
init()
await signweb()
await signapp()
await getInfo()
await showmsg()
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
function init() {
$.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session)
$.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session
$.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session)
$.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session
}
async function signweb() {
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = { url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {} }
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.get(url, (error, response, data) => {
try {
$.isWebSuc = JSON.parse(data).code === -2
$.log(`[Web] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isWebSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isWebSuc) break
}
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = {url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {}}
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.get(url, (error, response, data) => {
try {
$.isWebSuc = JSON.parse(data).code === -2
$.log(`[Web] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isWebSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isWebSuc) break
}
}
async function signapp() {
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = { url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {} }
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
$.get(url, (error, response, data) => {
try {
$.isAppSuc = JSON.parse(data).code === -2
$.log(`[App] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isAppSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isAppSuc) break
}
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = {url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {}}
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
$.get(url, (error, response, data) => {
try {
$.isAppSuc = JSON.parse(data).code === -2
$.log(`[App] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isAppSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isAppSuc) break
}
}
function getInfo() {
if (!$.isNewCookie) return
return new Promise((resove) => {
$.post(JSON.parse($.VAL_session), (error, response, data) => {
try {
$.userInfo = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
if (!$.isNewCookie) return
return new Promise((resove) => {
$.post(JSON.parse($.VAL_session), (error, response, data) => {
try {
$.userInfo = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
})
}
function showmsg() {
return new Promise((resove) => {
$.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败'
$.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败'
if ($.isNewCookie && $.userInfo) {
$.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)`
$.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.desc
}
resove()
})
return new Promise((resove) => {
$.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败'
$.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败'
if ($.isNewCookie && $.userInfo) {
$.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)`
$.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.desc
}
resove()
})
}
// prettier-ignore
function Env(s){this.name=s,this.data=null,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.isNode=(()=>"undefined"!=typeof module&&!!module.exports),this.log=((...s)=>{this.logs=[...this.logs,...s],s?console.log(s.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((s=this.name,t="",i="")=>{this.isSurge()&&$notification.post(s,t,i),this.isQuanX()&&$notify(s,t,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];s&&e.push(s),t&&e.push(t),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(s=>{if(this.isSurge())return $persistentStore.read(s);if(this.isQuanX())return $prefs.valueForKey(s);if(this.isNode()){const t="box.dat";return this.fs=this.fs?this.fs:require("fs"),this.fs.existsSync(t)?(this.data=JSON.parse(this.fs.readFileSync(t)),this.data[s]):null}}),this.setdata=((s,t)=>{if(this.isSurge())return $persistentStore.write(s,t);if(this.isQuanX())return $prefs.setValueForKey(s,t);if(this.isNode()){const i="box.dat";return this.fs=this.fs?this.fs:require("fs"),!!this.fs.existsSync(i)&&(this.data=JSON.parse(this.fs.readFileSync(i)),this.data[t]=s,this.fs.writeFileSync(i,JSON.stringify(this.data)),!0)}}),this.wait=((s,t=s)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(t-s+1)+s))),this.get=((s,t)=>this.send(s,"GET",t)),this.post=((s,t)=>this.send(s,"POST",t)),this.send=((s,t,i)=>{if(this.isSurge()){const e="POST"==t?$httpClient.post:$httpClient.get;e(s,(s,t,e)=>{t&&(t.body=e,t.statusCode=t.status),i(s,t,e)})}this.isQuanX()&&(s.method=t,$task.fetch(s).then(s=>{s.status=s.statusCode,i(null,s,s.body)},s=>i(s.error,s,s))),this.isNode()&&(this.request=this.request?this.request:require("request"),s.method=t,s.gzip=!0,this.request(s,(s,t,e)=>{t&&(t.status=t.statusCode),i(null,t,e)}))}),this.done=((s={})=>this.isNode()?null:$done(s))}
function Env(s) {
this.name = s, this.data = null, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.isNode = (() => "undefined" != typeof module && !!module.exports), this.log = ((...s) => {
this.logs = [...this.logs, ...s], s ? console.log(s.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((s = this.name, t = "", i = "") => {
this.isSurge() && $notification.post(s, t, i), this.isQuanX() && $notify(s, t, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
s && e.push(s), t && e.push(t), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (s => {
if (this.isSurge()) return $persistentStore.read(s);
if (this.isQuanX()) return $prefs.valueForKey(s);
if (this.isNode()) {
const t = "box.dat";
return this.fs = this.fs ? this.fs : require("fs"), this.fs.existsSync(t) ? (this.data = JSON.parse(this.fs.readFileSync(t)), this.data[s]) : null
}
}), this.setdata = ((s, t) => {
if (this.isSurge()) return $persistentStore.write(s, t);
if (this.isQuanX()) return $prefs.setValueForKey(s, t);
if (this.isNode()) {
const i = "box.dat";
return this.fs = this.fs ? this.fs : require("fs"), !!this.fs.existsSync(i) && (this.data = JSON.parse(this.fs.readFileSync(i)), this.data[t] = s, this.fs.writeFileSync(i, JSON.stringify(this.data)), !0)
}
}), this.wait = ((s, t = s) => i => setTimeout(() => i(), Math.floor(Math.random() * (t - s + 1) + s))), this.get = ((s, t) => this.send(s, "GET", t)), this.post = ((s, t) => this.send(s, "POST", t)), this.send = ((s, t, i) => {
if (this.isSurge()) {
const e = "POST" == t ? $httpClient.post : $httpClient.get;
e(s, (s, t, e) => {
t && (t.body = e, t.statusCode = t.status), i(s, t, e)
})
}
this.isQuanX() && (s.method = t, $task.fetch(s).then(s => {
s.status = s.statusCode, i(null, s, s.body)
}, s => i(s.error, s, s))), this.isNode() && (this.request = this.request ? this.request : require("request"), s.method = t, s.gzip = !0, this.request(s, (s, t, e) => {
t && (t.status = t.statusCode), i(null, t, e)
}))
}), this.done = ((s = {}) => this.isNode() ? null : $done(s))
}

View File

@ -1,27 +1,45 @@
const $ = new Env('网易云音乐')
!(async () => {
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const session = {}
session.url = $request.url
session.body = $request.body
session.headers = $request.headers
delete session.headers['Content-Length']
$.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`)
if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) {
$.subt = '获取会话: 成功!'
} else {
$.subt = '获取会话: 失败!'
}
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const session = {}
session.url = $request.url
session.body = $request.body
session.headers = $request.headers
delete session.headers['Content-Length']
$.log('', `url: ${session.url}`, `body: ${session.body}`, `headers: ${JSON.stringify(session.headers)}`)
if ($.setdata(JSON.stringify(session), 'chavy_cookie_neteasemusic')) {
$.subt = '获取会话: 成功!'
} else {
$.subt = '获取会话: 失败!'
}
})()
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -4,99 +4,117 @@ $.CFG_retryCnt = ($.getdata('CFG_neteasemusic_retryCnt') || '10') * 1
$.CFG_retryInterval = ($.getdata('CFG_neteasemusic_retryInterval') || '500') * 1
!(async () => {
$.log('', `🔔 ${$.name}, 开始!`, '')
init()
await signweb()
await signapp()
await getInfo()
await showmsg()
$.log('', `🔔 ${$.name}, 开始!`, '')
init()
await signweb()
await signapp()
await getInfo()
await showmsg()
})()
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
.catch((e) => {
$.log('', `${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 结束!`, ''), $.done()
})
function init() {
$.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session)
$.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session
$.isNewCookie = /https:\/\/music.163.com\/weapi\/user\/level/.test($.VAL_session)
$.Cookie = $.isNewCookie ? JSON.parse($.VAL_session).headers.Cookie : $.VAL_session
}
async function signweb() {
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = { url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {} }
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.get(url, (error, response, data) => {
try {
$.isWebSuc = JSON.parse(data).code === -2
$.log(`[Web] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isWebSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isWebSuc) break
}
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = {url: `http://music.163.com/api/point/dailyTask?type=1`, headers: {}}
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.get(url, (error, response, data) => {
try {
$.isWebSuc = JSON.parse(data).code === -2
$.log(`[Web] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isWebSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isWebSuc) break
}
}
async function signapp() {
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = { url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {} }
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
$.get(url, (error, response, data) => {
try {
$.isAppSuc = JSON.parse(data).code === -2
$.log(`[App] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isAppSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isAppSuc) break
}
for (let signIdx = 0; signIdx < $.CFG_retryCnt; signIdx++) {
await new Promise((resove) => {
const url = {url: `http://music.163.com/api/point/dailyTask?type=0`, headers: {}}
url.headers['Cookie'] = $.Cookie
url.headers['Host'] = 'music.163.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1'
$.get(url, (error, response, data) => {
try {
$.isAppSuc = JSON.parse(data).code === -2
$.log(`[App] 第 ${signIdx + 1} 次: ${data}`)
} catch (e) {
$.isAppSuc = false
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
await new Promise($.wait($.CFG_retryInterval))
if ($.isAppSuc) break
}
}
function getInfo() {
if (!$.isNewCookie) return
return new Promise((resove) => {
$.post(JSON.parse($.VAL_session), (error, response, data) => {
try {
$.userInfo = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
if (!$.isNewCookie) return
return new Promise((resove) => {
$.post(JSON.parse($.VAL_session), (error, response, data) => {
try {
$.userInfo = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '')
} finally {
resove()
}
})
})
})
}
function showmsg() {
return new Promise((resove) => {
$.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败'
$.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败'
if ($.isNewCookie && $.userInfo) {
$.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)`
$.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.desc
}
resove()
})
return new Promise((resove) => {
$.subt = $.isWebSuc ? 'PC: 成功' : 'PC: 失败'
$.subt += $.isAppSuc ? ', APP: 成功' : ', APP: 失败'
if ($.isNewCookie && $.userInfo) {
$.desc = `等级: ${$.userInfo.data.level}, 听歌: ${$.userInfo.data.nowPlayCount} => ${$.userInfo.data.nextPlayCount} 升级 (首)`
$.desc = $.userInfo.data.level === 10 ? `等级: ${$.userInfo.data.level}, 你的等级已爆表!` : $.desc
}
resove()
})
}
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i);const e=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t&&e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n"))}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i);
const e = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
t && e.push(t), s && e.push(s), i && e.push(i), console.log(e.join("\n"))
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -6,97 +6,98 @@ let cookieVal = null
let bodyVal = ``
if ($request.body) {
cookieVal = JSON.stringify($request.headers)
bodyVal = bodyVal ? bodyVal : $request.body
cookieVal = JSON.stringify($request.headers)
bodyVal = bodyVal ? bodyVal : $request.body
} else {
// ([^:]*):\s(.*)\n?
// cookieObj['$1'] = $request.headers['$1']\n
const cookieObj = {}
cookieObj['Content-Length'] = `699`
cookieObj['isDirectRequest'] = `1`
cookieObj['X-NR-Trace-Id'] = $request.headers['X-NR-Trace-Id']
cookieObj['User-DA'] = $request.headers['User-DA']
cookieObj['Accept-Encoding'] = `gzip, deflate, br`
cookieObj['Connection'] = `keep-alive`
cookieObj['Content-Type'] = `application/x-www-form-urlencoded`
cookieObj['User-D'] = $request.headers['User-D']
cookieObj['User-U'] = $request.headers['User-U']
cookieObj['User-id'] = $request.headers['User-id']
cookieObj['User-C'] = $request.headers['User-C']
cookieObj['User-tk'] = $request.headers['User-tk']
cookieObj['User-N'] = $request.headers['User-N']
cookieObj['User-Agent'] = `NewsApp/64.1 iOS/13.3 (iPhone10,1)`
cookieObj['Host'] = `c.m.163.com`
cookieObj['User-LC'] = $request.headers['User-LC']
cookieObj['Accept-Language'] = `zh-cn`
cookieObj['Accept'] = `*/*`
cookieObj['User-L'] = $request.headers['User-L']
cookieVal = JSON.stringify(cookieObj)
// ([^:]*):\s(.*)\n?
// cookieObj['$1'] = $request.headers['$1']\n
const cookieObj = {}
cookieObj['Content-Length'] = `699`
cookieObj['isDirectRequest'] = `1`
cookieObj['X-NR-Trace-Id'] = $request.headers['X-NR-Trace-Id']
cookieObj['User-DA'] = $request.headers['User-DA']
cookieObj['Accept-Encoding'] = `gzip, deflate, br`
cookieObj['Connection'] = `keep-alive`
cookieObj['Content-Type'] = `application/x-www-form-urlencoded`
cookieObj['User-D'] = $request.headers['User-D']
cookieObj['User-U'] = $request.headers['User-U']
cookieObj['User-id'] = $request.headers['User-id']
cookieObj['User-C'] = $request.headers['User-C']
cookieObj['User-tk'] = $request.headers['User-tk']
cookieObj['User-N'] = $request.headers['User-N']
cookieObj['User-Agent'] = `NewsApp/64.1 iOS/13.3 (iPhone10,1)`
cookieObj['Host'] = `c.m.163.com`
cookieObj['User-LC'] = $request.headers['User-LC']
cookieObj['Accept-Language'] = `zh-cn`
cookieObj['Accept'] = `*/*`
cookieObj['User-L'] = $request.headers['User-L']
cookieVal = JSON.stringify(cookieObj)
}
if (cookieVal) {
chavy.setdata(cookieVal, cookieKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
chavy.setdata(cookieVal, cookieKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
} else {
chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`)
chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`)
}
if (bodyVal) {
chavy.setdata(bodyVal, bodyKey)
chavy.msg(`${cookieName}`, '获取Body: 成功', '')
chavy.log(`[${cookieName}] 获取Body: 成功, body: ${bodyVal}`)
chavy.setdata(bodyVal, bodyKey)
chavy.msg(`${cookieName}`, '获取Body: 成功', '')
chavy.log(`[${cookieName}] 获取Body: 成功, body: ${bodyVal}`)
} else {
if (isQuanX()) {
chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: QuanX用户请手动抓包 body 参数!')
chavy.log(`[${cookieName}] 获取Body: 失败, 说明: QuanX用户请手动抓包 body 参数!`)
} else {
chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Body: 失败, body: ${bodyVal}`)
}
if (isQuanX()) {
chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: QuanX用户请手动抓包 body 参数!')
chavy.log(`[${cookieName}] 获取Body: 失败, 说明: QuanX用户请手动抓包 body 参数!`)
} else {
chavy.msg(`${cookieName}`, '获取Body: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Body: 失败, body: ${bodyVal}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,78 +8,78 @@ const bodyVal = chavy.getdata(bodyKey)
sign()
function sign() {
if (bodyVal) {
let url = { url: `https://c.m.163.com/uc/api/sign/v2/commit`, headers: cookieVal }
url.body = bodyVal
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == 200) {
subTitle = '签到结果: 成功'
detail = `连签: +${result.data.serialDays}, 金币: ${result.data.awardGoldCoin}, 说明: ${result.msg}`
} else if (result.code == 700) {
subTitle = '签到结果: 成功 (重复签到)'
detail = `说明: ${result.msg}`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
})
} else {
const title = `${cookieName}`
let subTitle = `签到结果: 失败`
let detail = `说明: body参数为空`
if (isQuanX()) detail += `, QuanX用户请手动抓包 body 参数!`
chavy.msg(title, subTitle, detail)
}
if (bodyVal) {
let url = {url: `https://c.m.163.com/uc/api/sign/v2/commit`, headers: cookieVal}
url.body = bodyVal
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == 200) {
subTitle = '签到结果: 成功'
detail = `连签: +${result.data.serialDays}, 金币: ${result.data.awardGoldCoin}, 说明: ${result.msg}`
} else if (result.code == 700) {
subTitle = '签到结果: 成功 (重复签到)'
detail = `说明: ${result.msg}`
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.code}, 说明: ${result.msg}`
}
chavy.msg(title, subTitle, detail)
})
} else {
const title = `${cookieName}`
let subTitle = `签到结果: 失败`
let detail = `说明: body参数为空`
if (isQuanX()) detail += `, QuanX用户请手动抓包 body 参数!`
chavy.msg(title, subTitle, detail)
}
chavy.done()
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,64 +4,65 @@ const signheaderKey = 'signheader_nextevcar'
const nextevcar = init()
if ($request && $request.method == 'POST') {
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) nextevcar.setdata(signurlVal, signurlKey)
if (signheaderVal) nextevcar.setdata(signheaderVal, signheaderKey)
nextevcar.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
if (signurlVal) nextevcar.setdata(signurlVal, signurlKey)
if (signheaderVal) nextevcar.setdata(signheaderVal, signheaderKey)
nextevcar.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}
nextevcar.done()

View File

@ -8,76 +8,76 @@ const signheaderVal = nextevcar.getdata(signheaderKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal) }
nextevcar.post(url, (error, response, data) => {
nextevcar.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.result_code == "success") {
subTitle = `签到结果: 成功`
detail = `签到积分: ${result.data.stats.credit_amount}, 连签: ${result.data.stats.continuous_checkin_days}`
} else if (result.result_code == "credit_limit_reached") {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${result.debug_msg}, 请重新获取`
}
nextevcar.msg(title, subTitle, detail)
nextevcar.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal)}
nextevcar.post(url, (error, response, data) => {
nextevcar.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.result_code == "success") {
subTitle = `签到结果: 成功`
detail = `签到积分: ${result.data.stats.credit_amount}, 连签: ${result.data.stats.continuous_checkin_days}`
} else if (result.result_code == "credit_limit_reached") {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${result.debug_msg}, 请重新获取`
}
nextevcar.msg(title, subTitle, detail)
nextevcar.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -1,28 +1,44 @@
const $ = new Env('有道云笔记')
!(async () => {
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const VAL_url = $request.url
const VAL_body = $request.body
const VAL_headers = JSON.stringify($request.headers)
$.log('', `🔔 ${$.name}, 获取会话: 开始!`, '')
const VAL_url = $request.url
const VAL_body = $request.body
const VAL_headers = JSON.stringify($request.headers)
$.log('', `${$.name}`, `url: ${$request.url}`, `body: ${$request.body}`, `headers: ${JSON.stringify($request.headers)}`, '')
$.log('', `${$.name}`, `url: ${$request.url}`, `body: ${$request.body}`, `headers: ${JSON.stringify($request.headers)}`, '')
if (VAL_url && VAL_body && VAL_headers) {
$.setdata(VAL_url, 'chavy_signurl_noteyoudao')
$.setdata(VAL_body, 'chavy_signbody_noteyoudao')
$.setdata(VAL_headers, 'chavy_signheaders_noteyoudao')
$.subt = '获取会话: 成功 (签到)!'
}
if (VAL_url && VAL_body && VAL_headers) {
$.setdata(VAL_url, 'chavy_signurl_noteyoudao')
$.setdata(VAL_body, 'chavy_signbody_noteyoudao')
$.setdata(VAL_headers, 'chavy_signheaders_noteyoudao')
$.subt = '获取会话: 成功 (签到)!'
}
})()
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
.catch((e) => {
$.subt = '获取会话: 失败!'
$.desc = `原因: ${e}`
$.log(`${$.name}, 获取会话: 失败! 原因: ${e}!`)
})
.finally(() => {
$.msg($.name, $.subt, $.desc), $.log('', `🔔 ${$.name}, 获取会话: 结束!`, ''), $.done()
})
// prettier-ignore
function Env(t){this.name=t,this.logs=[],this.isSurge=(()=>"undefined"!=typeof $httpClient),this.isQuanX=(()=>"undefined"!=typeof $task),this.log=((...t)=>{this.logs=[...this.logs,...t],t?console.log(t.join("\n")):console.log(this.logs.join("\n"))}),this.msg=((t=this.name,s="",i="")=>{this.isSurge()&&$notification.post(t,s,i),this.isQuanX()&&$notify(t,s,i),this.log("==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),t&&this.log(t),s&&this.log(s),i&&this.log(i)}),this.getdata=(t=>this.isSurge()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):void 0),this.setdata=((t,s)=>this.isSurge()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):void 0),this.get=((t,s)=>this.send(t,"GET",s)),this.wait=((t,s=t)=>i=>setTimeout(()=>i(),Math.floor(Math.random()*(s-t+1)+t))),this.post=((t,s)=>this.send(t,"POST",s)),this.send=((t,s,i)=>{if(this.isSurge()){const e="POST"==s?$httpClient.post:$httpClient.get;e(t,(t,s,e)=>{s&&(s.body=e,s.statusCode=s.status),i(t,s,e)})}this.isQuanX()&&(t.method=s,$task.fetch(t).then(t=>{t.status=t.statusCode,i(null,t,t.body)},t=>i(t.error,t,t)))}),this.done=((t={})=>$done(t))}
function Env(t) {
this.name = t, this.logs = [], this.isSurge = (() => "undefined" != typeof $httpClient), this.isQuanX = (() => "undefined" != typeof $task), this.log = ((...t) => {
this.logs = [...this.logs, ...t], t ? console.log(t.join("\n")) : console.log(this.logs.join("\n"))
}), this.msg = ((t = this.name, s = "", i = "") => {
this.isSurge() && $notification.post(t, s, i), this.isQuanX() && $notify(t, s, i), this.log("==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), t && this.log(t), s && this.log(s), i && this.log(i)
}), this.getdata = (t => this.isSurge() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : void 0), this.setdata = ((t, s) => this.isSurge() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : void 0), this.get = ((t, s) => this.send(t, "GET", s)), this.wait = ((t, s = t) => i => setTimeout(() => i(), Math.floor(Math.random() * (s - t + 1) + t))), this.post = ((t, s) => this.send(t, "POST", s)), this.send = ((t, s, i) => {
if (this.isSurge()) {
const e = "POST" == s ? $httpClient.post : $httpClient.get;
e(t, (t, s, e) => {
s && (s.body = e, s.statusCode = s.status), i(t, s, e)
})
}
this.isQuanX() && (t.method = s, $task.fetch(t).then(t => {
t.status = t.statusCode, i(null, t, t.body)
}, t => i(t.error, t, t)))
}), this.done = ((t = {}) => $done(t))
}

View File

@ -5,78 +5,201 @@ $.VAL_sign_body = $.getdata('chavy_signbody_noteyoudao')
$.VAL_sign_headers = $.getdata('chavy_signheaders_noteyoudao')
!(async () => {
await loginapp()
await signinapp()
await logindaily()
await showmsg()
await loginapp()
await signinapp()
await logindaily()
await showmsg()
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
.catch((e) => $.logErr(e))
.finally(() => $.done())
function loginapp() {
return new Promise((resove) => {
const { url, body, headers } = JSON.parse($.VAL_login)
$.post({ url, body, headers: JSON.parse(headers) }, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 登录: ${JSON.stringify(response)}`)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
return new Promise((resove) => {
const {url, body, headers} = JSON.parse($.VAL_login)
$.post({url, body, headers: JSON.parse(headers)}, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 登录: ${JSON.stringify(response)}`)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
})
}
function logindaily() {
return new Promise((resove) => {
const url = { url: 'https://note.youdao.com/yws/api/daupromotion?method=sync', headers: JSON.parse($.VAL_sign_headers) }
delete url.headers.Cookie
$.post(url, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 每日登录: ${data}`)
$.daily = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
return new Promise((resove) => {
const url = {
url: 'https://note.youdao.com/yws/api/daupromotion?method=sync',
headers: JSON.parse($.VAL_sign_headers)
}
delete url.headers.Cookie
$.post(url, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 每日登录: ${data}`)
$.daily = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
})
}
function signinapp() {
return new Promise((resove) => {
const url = { url: $.VAL_sign_url, body: $.VAL_sign_body, headers: JSON.parse($.VAL_sign_headers) }
delete url.headers.Cookie
$.post(url, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 每日签到: ${data}`)
$.signin = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
return new Promise((resove) => {
const url = {url: $.VAL_sign_url, body: $.VAL_sign_body, headers: JSON.parse($.VAL_sign_headers)}
delete url.headers.Cookie
$.post(url, (error, response, data) => {
try {
if (error) throw new Error(error)
$.log(`${$.name}, 每日签到: ${data}`)
$.signin = JSON.parse(data)
} catch (e) {
$.log(`❗️ ${$.name}, 每日登录: 失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, `data = ${data}`, '')
} finally {
resove()
}
})
})
})
}
function showmsg() {
return new Promise((resove) => {
const dailyFlag = $.daily.accept === true ? '成功' : '重复'
const signinFlag = $.signin.success === 1 ? '成功' : $.signin.success === 0 ? '重复' : '错误'
$.subt = `每日登录: ${dailyFlag}, 每日签到: ${signinFlag}`
const continuousDays = `连签: ${$.daily.rewardSpace / 1024 / 1024}`
const rewardSpace = `本次获得: ${$.daily.rewardSpace / 1024 / 1024}MB`
const totalReward = `总共获得: ${$.daily.totalRewardSpace / 1024 / 1024}MB`
$.desc = `${continuousDays}, ${rewardSpace}, ${totalReward}`
resove()
})
return new Promise((resove) => {
const dailyFlag = $.daily.accept === true ? '成功' : '重复'
const signinFlag = $.signin.success === 1 ? '成功' : $.signin.success === 0 ? '重复' : '错误'
$.subt = `每日登录: ${dailyFlag}, 每日签到: ${signinFlag}`
const continuousDays = `连签: ${$.daily.rewardSpace / 1024 / 1024}`
const rewardSpace = `本次获得: ${$.daily.rewardSpace / 1024 / 1024}MB`
const totalReward = `总共获得: ${$.daily.totalRewardSpace / 1024 / 1024}MB`
$.desc = `${continuousDays}, ${rewardSpace}, ${totalReward}`
resove()
})
}
// prettier-ignore
function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
function Env(t, s) {
return new class {
constructor(t, s) {
this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
}
isNode() {
return "undefined" != typeof module && !!module.exports
}
isQuanX() {
return "undefined" != typeof $task
}
isSurge() {
return "undefined" != typeof $httpClient
}
isLoon() {
return "undefined" != typeof $loon
}
loaddata() {
if (!this.isNode) return {};
{
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s);
if (!e && !i) return {};
{
const i = e ? t : s;
try {
return JSON.parse(this.fs.readFileSync(i))
} catch {
return {}
}
}
}
}
writedata() {
if (this.isNode) {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), h = JSON.stringify(this.data);
e ? this.fs.writeFileSync(t, h) : i ? this.fs.writeFileSync(s, h) : this.fs.writeFileSync(t, h)
}
}
getdata(t) {
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setdata(t, s) {
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || null
}
initGotEnv(t) {
this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
}
get(t, s = (() => {
})) {
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}) : this.isQuanX() ? $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => {
try {
const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
this.ckjar.setCookieSync(e, null), s.cookieJar = this.ckjar
} catch (t) {
this.logErr(t)
}
}).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)))
}
post(t, s = (() => {
})) {
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)); else if (this.isNode()) {
this.initGotEnv(t);
const {url: e, ...i} = t;
this.got.post(e, i).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t))
}
}
msg(s = t, e = "", i = "", h) {
this.isSurge() || this.isLoon() ? $notification.post(s, e, i) : this.isQuanX() && $notify(s, e, i), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i)
}
log(...t) {
t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator))
}
logErr(t, s) {
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.message)
}
wait(t) {
return new Promise(s => setTimeout(s, t))
}
done(t = null) {
const s = (new Date).getTime(), e = (s - this.startTime) / 1e3;
this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, s)
}

View File

@ -6,62 +6,63 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS') {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
const cmd = JSON.parse($request.body).cmd
senku.log(`signurlVal:${signurlVal}`)
senku.log(`signheaderVal:${signheaderVal}`)
senku.log(`signbodyVal:${signbodyVal}`)
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal && cmd=='task.revisionSignInGetAward') {
senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
}
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
const cmd = JSON.parse($request.body).cmd
senku.log(`signurlVal:${signurlVal}`)
senku.log(`signheaderVal:${signheaderVal}`)
senku.log(`signbodyVal:${signbodyVal}`)
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal && cmd == 'task.revisionSignInGetAward') {
senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

View File

@ -10,67 +10,67 @@ const signBodyVal = senku.getdata(signbodyKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
senku.post(url, (error, response, data) => {
const result = JSON.parse(data)
const total = result.data['task.revisionSignInGetAward'].total
const ret = result.data['task.revisionSignInGetAward'].ret
let subTitle = ``
let detail = ``
if (total != 0) {
const num = result.data['task.revisionSignInGetAward'].awards[0].num
subTitle = `签到结果: 成功`
detail = `获得鲜花: ${num}朵,已连续签到:${total}`
} else if (ret == -11532) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
senku.post(url, (error, response, data) => {
const result = JSON.parse(data)
const total = result.data['task.revisionSignInGetAward'].total
const ret = result.data['task.revisionSignInGetAward'].ret
let subTitle = ``
let detail = ``
if (total != 0) {
const num = result.data['task.revisionSignInGetAward'].awards[0].num
subTitle = `签到结果: 成功`
detail = `获得鲜花: ${num}朵,已连续签到:${total}`
} else if (ret == -11532) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,89 +6,90 @@ const signFlagKey = 'chavy_flag_qqmusic'
const chavy = init()
if ($request && $request.body) {
// 每日签到: UserGrow.UserGrowScore receive_score
// 每月签到: music.activeCenter.MonthLoginSvr MonthScore
// 签到记录: UserGrow.UserGrowScore sign_record
const is_receive_score = $request.body.indexOf(`receive_score`) >= 0
const is_MonthScore = $request.body.indexOf(`MonthScore`) >= 0
const is_sign_record = $request.body.indexOf(`sign_record`) >= 0
if ($request.headers['Cookie'] && is_receive_score) {
let signFlagVal = is_receive_score ? `receive_score` : ``
signFlagVal = is_MonthScore ? `MonthScore` : signFlagVal
signFlagVal = is_sign_record ? `sign_record` : signFlagVal
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
if (signFlagVal) chavy.setdata(signFlagVal, signFlagKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignUrl: ${signurlVal}`)
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignHeader: ${signheaderVal}`)
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignBody: ${signbodyVal}`)
}
// 每日签到: UserGrow.UserGrowScore receive_score
// 每月签到: music.activeCenter.MonthLoginSvr MonthScore
// 签到记录: UserGrow.UserGrowScore sign_record
const is_receive_score = $request.body.indexOf(`receive_score`) >= 0
const is_MonthScore = $request.body.indexOf(`MonthScore`) >= 0
const is_sign_record = $request.body.indexOf(`sign_record`) >= 0
if ($request.headers['Cookie'] && is_receive_score) {
let signFlagVal = is_receive_score ? `receive_score` : ``
signFlagVal = is_MonthScore ? `MonthScore` : signFlagVal
signFlagVal = is_sign_record ? `sign_record` : signFlagVal
const signurlVal = $request.url
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
if (signFlagVal) chavy.setdata(signFlagVal, signFlagKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignUrl: ${signurlVal}`)
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignHeader: ${signheaderVal}`)
// chavy.log(`[${cookieName}] 获取Cookie: 成功, SignBody: ${signbodyVal}`)
}
} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `receive_score` == chavy.getdata(signFlagKey)) {
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '手动签到: 成功 (每日签到)', `共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`)
chavy.log(`[${cookieName}] 手动签到: 成功 (每日签到), 共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`)
}
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '手动签到: 成功 (每日签到)', `共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`)
chavy.log(`[${cookieName}] 手动签到: 成功 (每日签到), 共签: ${respbodyObj.req_0.data.totalDays}天, 今天积分: +${respbodyObj.req_0.data.todayScore}, 明天积分: +${respbodyObj.req_0.data.tomrrowScore}`)
}
} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `MonthScore` == chavy.getdata(signFlagKey)) {
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '手动签到: 成功 (每月首签)', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
chavy.log(`[${cookieName}] 手动签到: 成功 (每月首签), 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
}
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '手动签到: 成功 (每月首签)', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
chavy.log(`[${cookieName}] 手动签到: 成功 (每月首签), 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
}
} else if ($response && $response.body && $request.url == chavy.getdata(signurlKey) && `sign_record` == chavy.getdata(signFlagKey)) {
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '获取签到: 成功', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
chavy.log(`[${cookieName}] 获取签到: 成功, 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
}
const respbodyObj = JSON.parse($response.body)
if (respbodyObj && respbodyObj.req_0 && respbodyObj.req_0.data && respbodyObj.req_0.data.totalDays) {
chavy.msg(`${cookieName}`, '获取签到: 成功', `共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
chavy.log(`[${cookieName}] 获取签到: 成功, 说明: 共签: ${respbodyObj.req_0.data.totalDays}天, 积分: +${respbodyObj.req_0.data.todayScore}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -10,82 +10,82 @@ const signbodyVal = chavy.getdata(signbodyKey)
sign()
function sign() {
if (signurlVal && signheaderVal && signbodyVal) {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal }
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
let result = JSON.parse(data)
if (result.code == 0 && result.req_0 && result.req_0.code == 0) {
if (result.req_0.data.retCode == 0) {
subTitle = `签到结果: 成功`
detail = `共签: ${result.req_0.data.totalDays}天, 今天积分: +${result.req_0.data.todayScore}, 明天积分: +${result.req_0.data.tomrrowScore}`
} else if (result.req_0.data.retCode == 40001) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.req_0.data.errMsg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.req_0.data.retCode}, 说明: ${result.req_0.data.errMsg}`
}
} else {
subTitle = `签到结果: 失败`
detail = `说明: 详见日志`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
} else {
const title = `${cookieName}`
const subTitle = '签到结果: 失败'
const detail = `原因: 请先获取Cookie`
chavy.msg(title, subTitle, detail)
chavy.log(`${cookieName}, ${subTitle}, ${detail}`)
chavy.done()
}
if (signurlVal && signheaderVal && signbodyVal) {
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signbodyVal}
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const title = `${cookieName}`
let subTitle = ''
let detail = ''
let result = JSON.parse(data)
if (result.code == 0 && result.req_0 && result.req_0.code == 0) {
if (result.req_0.data.retCode == 0) {
subTitle = `签到结果: 成功`
detail = `共签: ${result.req_0.data.totalDays}天, 今天积分: +${result.req_0.data.todayScore}, 明天积分: +${result.req_0.data.tomrrowScore}`
} else if (result.req_0.data.retCode == 40001) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.req_0.data.errMsg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.req_0.data.retCode}, 说明: ${result.req_0.data.errMsg}`
}
} else {
subTitle = `签到结果: 失败`
detail = `说明: 详见日志`
}
chavy.msg(title, subTitle, detail)
chavy.done()
})
} else {
const title = `${cookieName}`
const subTitle = '签到结果: 失败'
const detail = `原因: 请先获取Cookie`
chavy.msg(title, subTitle, detail)
chavy.log(`${cookieName}, ${subTitle}, ${detail}`)
chavy.done()
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -8,74 +8,75 @@ const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if ($request.url.indexOf('auth_refresh') > 0) {
const authurl = $request.url
const authHeader = JSON.stringify($request.headers)
if (cookieVal) chavy.setdata(cookieVal, cookieKey)
if (authurl) chavy.setdata(authurl, authUrlKey)
if (authHeader) chavy.setdata(authHeader, authHeaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthUrl: ${authurl}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthHeader: ${authHeader}`)
} else if ($request.url.indexOf('mobile_checkin') > 0) {
const msignurl = $request.url
const msignheader = JSON.stringify($request.headers)
if (msignurl) chavy.setdata(msignurl, msignurlKey)
if (msignheader) chavy.setdata(msignheader, msignheaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, msignurl: ${msignurl}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, msignheader: ${msignheader}`)
} else {
chavy.setdata(cookieVal, cookieKey)
chavy.setdata(``, authUrlKey)
chavy.setdata(``, authHeaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`)
}
if ($request.url.indexOf('auth_refresh') > 0) {
const authurl = $request.url
const authHeader = JSON.stringify($request.headers)
if (cookieVal) chavy.setdata(cookieVal, cookieKey)
if (authurl) chavy.setdata(authurl, authUrlKey)
if (authHeader) chavy.setdata(authHeader, authHeaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthUrl: ${authurl}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, AuthHeader: ${authHeader}`)
} else if ($request.url.indexOf('mobile_checkin') > 0) {
const msignurl = $request.url
const msignheader = JSON.stringify($request.headers)
if (msignurl) chavy.setdata(msignurl, msignurlKey)
if (msignheader) chavy.setdata(msignheader, msignheaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, msignurl: ${msignurl}`)
chavy.log(`[${cookieName}] 获取Cookie: 成功, msignheader: ${msignheader}`)
} else {
chavy.setdata(cookieVal, cookieKey)
chavy.setdata(``, authUrlKey)
chavy.setdata(``, authHeaderKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, Cookie: ${cookieVal}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -14,133 +14,133 @@ let VAL_mh5signurl = chavy.getdata(KEY_mh5signurl)
let VAL_mh5signheader = chavy.getdata(KEY_mh5signheader)
;(sign = async () => {
chavy.log(`🔔 ${cookieName}`)
await login()
await signapp()
await getexp()
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName}`)
await login()
await signapp()
await getexp()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function login() {
return new Promise((resolve, reject) => {
const url = { url: VAL_loginurl, headers: JSON.parse(VAL_loginheader) }
chavy.get(url, (error, response, data) => {
try {
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} login - 登录失败: ${e}`)
chavy.log(`${cookieName} login - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_loginurl, headers: JSON.parse(VAL_loginheader)}
chavy.get(url, (error, response, data) => {
try {
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} login - 登录失败: ${e}`)
chavy.log(`${cookieName} login - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function signapp() {
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const VAL_signurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=${timestamp}`
let url = { url: VAL_signurl, headers: {} }
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data.match(/\((.*)\);/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const VAL_signurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=${timestamp}`
let url = {url: VAL_signurl, headers: {}}
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
try {
signinfo.signapp = JSON.parse(data.match(/\((.*)\);/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getexp() {
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const VAL_getexpurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_PropertyNum&cmd=1&growth_value=1&otype=json&_=${timestamp}`
let url = { url: VAL_getexpurl, headers: {} }
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
try {
signinfo.expinfo = JSON.parse(data.match(/\((.*)\);/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getexp - 签到失败: ${e}`)
chavy.log(`${cookieName} getexp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const VAL_getexpurl = `https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_PropertyNum&cmd=1&growth_value=1&otype=json&_=${timestamp}`
let url = {url: VAL_getexpurl, headers: {}}
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15'
chavy.get(url, (error, response, data) => {
try {
signinfo.expinfo = JSON.parse(data.match(/\((.*)\);/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getexp - 签到失败: ${e}`)
chavy.log(`${cookieName} getexp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
if (signinfo.signapp) {
let subTitle, detail
if (signinfo.signapp.ret == 0) {
subTitle = '签到结果: 成功'
if (signinfo.expinfo) {
subTitle += !signinfo.signapp.checkin_score ? ' (重复签到)' : ''
detail = `V力值: ${signinfo.expinfo.GrowthValue.num} (+${signinfo.signapp.checkin_score}), 观影券: ${signinfo.expinfo.MovieTicket.num}, 赠片资格: ${signinfo.expinfo.GiveMovie.num}`
}
} else if (signinfo.signapp.ret == -10006) {
subTitle = '签到结果: 失败'
detail = `原因: 未登录, 说明: ${signinfo.signapp.msg}`
} else if (signinfo.signapp.ret == -10019) {
subTitle = '签到结果: 失败'
detail = `原因: 非会员, 说明: ${signinfo.signapp.msg}`
} else {
subTitle = '签到结果: 未知'
detail = `编码: ${signinfo.signapp.ret}, 说明: ${signinfo.signapp.msg}`
if (signinfo.signapp) {
let subTitle, detail
if (signinfo.signapp.ret == 0) {
subTitle = '签到结果: 成功'
if (signinfo.expinfo) {
subTitle += !signinfo.signapp.checkin_score ? ' (重复签到)' : ''
detail = `V力值: ${signinfo.expinfo.GrowthValue.num} (+${signinfo.signapp.checkin_score}), 观影券: ${signinfo.expinfo.MovieTicket.num}, 赠片资格: ${signinfo.expinfo.GiveMovie.num}`
}
} else if (signinfo.signapp.ret == -10006) {
subTitle = '签到结果: 失败'
detail = `原因: 未登录, 说明: ${signinfo.signapp.msg}`
} else if (signinfo.signapp.ret == -10019) {
subTitle = '签到结果: 失败'
detail = `原因: 非会员, 说明: ${signinfo.signapp.msg}`
} else {
subTitle = '签到结果: 未知'
detail = `编码: ${signinfo.signapp.ret}, 说明: ${signinfo.signapp.msg}`
}
chavy.msg(cookieName, subTitle, detail)
}
chavy.msg(cookieName, subTitle, detail)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -14,399 +14,407 @@ const time = 0
let isGetCookie = typeof $request !== 'undefined'
if (isGetCookie) {
GetCookie()
qmnovel.done()
GetCookie()
qmnovel.done()
} else {
all()
qmnovel.done()
all()
qmnovel.done()
}
async function all() {
qmnovel.log(`🔔 ${cookieName}签到开始`)
await DailyCheckin(time);
await NoviceCheckin(time);
for (let i = 0; i < 5; i++) {
await LuckyTurn(time);
}
await VideoCoin(time)
Notify();
qmnovel.log(`🔔 ${cookieName}签到开始`)
await DailyCheckin(time);
await NoviceCheckin(time);
for (let i = 0; i < 5; i++) {
await LuckyTurn(time);
}
await VideoCoin(time)
Notify();
}
function GetCookie() {
const dailycheckin = '/api/v1/sign-in/do-sign-in';
const novice = '/api/v1/task/get-novice-reward';
const turn = '/api/v2/lucky-draw/do-extracting';
const video = '/api/v1/sign-in/sign-in-video-coin';
var url = $request.url;
if (url.indexOf(dailycheckin) != -1) {
if (url) {
var UrlKeyDC = "UrlDC";
var UrlNameDC = "七猫小说日常签到";
var UrlValueDC = url;
if (qmnovel.getdata(UrlKeyDC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyDC) != UrlValueDC) {
var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC);
if (!urlDC) {
qmnovel.msg("更新" + UrlNameDC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameDC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameDC + "Url未变化❗", "", "");
}
const dailycheckin = '/api/v1/sign-in/do-sign-in';
const novice = '/api/v1/task/get-novice-reward';
const turn = '/api/v2/lucky-draw/do-extracting';
const video = '/api/v1/sign-in/sign-in-video-coin';
var url = $request.url;
if (url.indexOf(dailycheckin) != -1) {
if (url) {
var UrlKeyDC = "UrlDC";
var UrlNameDC = "七猫小说日常签到";
var UrlValueDC = url;
if (qmnovel.getdata(UrlKeyDC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyDC) != UrlValueDC) {
var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC);
if (!urlDC) {
qmnovel.msg("更新" + UrlNameDC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameDC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameDC + "Url未变化❗", "", "");
}
} else {
var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC);
if (!cookieDC) {
qmnovel.msg("首次写入" + UrlNameDC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameDC + "Url成功🎉", "", "");
}
}
} else {
var urlDC = qmnovel.setdata(UrlValueDC, UrlKeyDC);
if (!cookieDC) {
qmnovel.msg("首次写入" + UrlNameDC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameDC + "Url成功🎉", "", "");
}
qmnovel.msg("写入" + UrlNameDC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
} else {
qmnovel.msg("写入" + UrlNameDC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyDC = "CookieDC";
var CookieNameDC = "七猫小说日常签到及视频奖励";
var CookieValueDC = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyDC) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyDC) != CookieValueDC) {
var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC);
if (!cookieDC) {
qmnovel.msg("更新" + CookieNameDC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameDC + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameDC + "Cookie未变化❗", "", "");
}
if ($request.headers) {
var CookieKeyDC = "CookieDC";
var CookieNameDC = "七猫小说日常签到及视频奖励";
var CookieValueDC = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyDC) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyDC) != CookieValueDC) {
var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC);
if (!cookieDC) {
qmnovel.msg("更新" + CookieNameDC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameDC + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameDC + "Cookie未变化❗", "", "");
}
} else {
var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC);
if (!cookieDC) {
qmnovel.msg("首次写入" + CookieNameDC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameDC + "Cookie成功🎉", "", "");
}
}
} else {
var cookieDC = qmnovel.setdata(CookieValueDC, CookieKeyDC);
if (!cookieDC) {
qmnovel.msg("首次写入" + CookieNameDC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameDC + "Cookie成功🎉", "", "");
}
qmnovel.msg("写入" + CookieNameDC + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else {
qmnovel.msg("写入" + CookieNameDC + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else if (url.indexOf(novice) != -1) {
if (url) {
var UrlKeyNC = "UrlNC";
var UrlNameNC = "七猫小说新人签到";
var UrlValueNC = url;
if (qmnovel.getdata(UrlKeyNC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyNC) != UrlValueNC) {
var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC);
if (!urlNC) {
qmnovel.msg("更新" + UrlNameNC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameNC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameNC + "Url未变化❗", "", "");
}
} else if (url.indexOf(novice) != -1) {
if (url) {
var UrlKeyNC = "UrlNC";
var UrlNameNC = "七猫小说新人签到";
var UrlValueNC = url;
if (qmnovel.getdata(UrlKeyNC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyNC) != UrlValueNC) {
var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC);
if (!urlNC) {
qmnovel.msg("更新" + UrlNameNC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameNC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameNC + "Url未变化❗", "", "");
}
} else {
var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC);
if (!urlNC) {
qmnovel.msg("首次写入" + UrlNameNC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameNC + "Url成功🎉", "", "");
}
}
} else {
var urlNC = qmnovel.setdata(UrlValueNC, UrlKeyNC);
if (!urlNC) {
qmnovel.msg("首次写入" + UrlNameNC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameNC + "Url成功🎉", "", "");
}
qmnovel.msg("写入" + UrlNameNC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
} else {
qmnovel.msg("写入" + UrlNameNC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyNC = "CookieNC";
var CookieNameNC = "七猫小说新人签到";
var CookieValueNC = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyNC) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyNC) != CookieValueNC) {
var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC);
if (!cookieNC) {
qmnovel.msg("更新" + CookieNameNC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameNC + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameNC + "Cookie未变化❗", "", "");
}
if ($request.headers) {
var CookieKeyNC = "CookieNC";
var CookieNameNC = "七猫小说新人签到";
var CookieValueNC = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyNC) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyNC) != CookieValueNC) {
var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC);
if (!cookieNC) {
qmnovel.msg("更新" + CookieNameNC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameNC + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameNC + "Cookie未变化❗", "", "");
}
} else {
var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC);
if (!cookieNC) {
qmnovel.msg("首次写入" + CookieNameNC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameNC + "Cookie成功🎉", "", "");
}
}
} else {
var cookieNC = qmnovel.setdata(CookieValueNC, CookieKeyNC);
if (!cookieNC) {
qmnovel.msg("首次写入" + CookieNameNC + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameNC + "Cookie成功🎉", "", "");
}
qmnovel.msg("写入" + CookieNameNC + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else {
qmnovel.msg("写入" + CookieNameNC + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else if (url.indexOf(turn) != -1) {
if (url) {
var UrlKeyLT = "UrlLT";
var UrlNameLT = "七猫小说幸运大转盘";
var UrlValueLT = url;
if (qmnovel.getdata(UrlKeyLT) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyLT) != UrlValueLT) {
var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT);
if (!urlLT) {
qmnovel.msg("更新" + UrlNameLT + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameLT + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameLT + "Url未变化❗", "", "");
}
} else if (url.indexOf(turn) != -1) {
if (url) {
var UrlKeyLT = "UrlLT";
var UrlNameLT = "七猫小说幸运大转盘";
var UrlValueLT = url;
if (qmnovel.getdata(UrlKeyLT) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyLT) != UrlValueLT) {
var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT);
if (!urlLT) {
qmnovel.msg("更新" + UrlNameLT + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameLT + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameLT + "Url未变化❗", "", "");
}
} else {
var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT);
if (!urlLT) {
qmnovel.msg("首次写入" + UrlNameLT + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameLT + "Url成功🎉", "", "");
}
}
} else {
var urlLT = qmnovel.setdata(UrlValueLT, UrlKeyLT);
if (!urlLT) {
qmnovel.msg("首次写入" + UrlNameLT + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameLT + "Url成功🎉", "", "");
}
qmnovel.msg("写入" + UrlNameLT + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
} else {
qmnovel.msg("写入" + UrlNameLT + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyLT = "CookieLT";
var CookieNameLT = "七猫小说幸运大转盘";
var CookieValueLT = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyLT) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyLT) != CookieValueLT) {
var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT);
if (!cookieLT) {
qmnovel.msg("更新" + CookieNameLT + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameLT + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameLT + "Cookie未变化❗", "", "");
}
if ($request.headers) {
var CookieKeyLT = "CookieLT";
var CookieNameLT = "七猫小说幸运大转盘";
var CookieValueLT = JSON.stringify($request.headers);
if (qmnovel.getdata(CookieKeyLT) != (undefined || null)) {
if (qmnovel.getdata(CookieKeyLT) != CookieValueLT) {
var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT);
if (!cookieLT) {
qmnovel.msg("更新" + CookieNameLT + "Cookie失败‼", "", "");
} else {
qmnovel.msg("更新" + CookieNameLT + "Cookie成功🎉", "", "");
}
} else {
qmnovel.msg(CookieNameLT + "Cookie未变化❗", "", "");
}
} else {
var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT);
if (!cookieLT) {
qmnovel.msg("首次写入" + CookieNameLT + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameLT + "Cookie成功🎉", "", "");
}
}
} else {
var cookieLT = qmnovel.setdata(CookieValueLT, CookieKeyLT);
if (!cookieLT) {
qmnovel.msg("首次写入" + CookieNameLT + "Cookie失败‼", "", "");
} else {
qmnovel.msg("首次写入" + CookieNameLT + "Cookie成功🎉", "", "");
}
qmnovel.msg("写入" + CookieNameLT + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else {
qmnovel.msg("写入" + CookieNameLT + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
} else if (url.indexOf(video) != -1) {
if (url) {
var UrlKeyVC = "UrlVC";
var UrlNameVC = "七猫小说视频奖励";
var UrlValueVC = url;
if (qmnovel.getdata(UrlKeyVC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyVC) != UrlValueVC) {
var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC);
if (!urlVC) {
qmnovel.msg("更新" + UrlNameVC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameVC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameVC + "Url未变化❗", "", "");
}
} else if (url.indexOf(video) != -1) {
if (url) {
var UrlKeyVC = "UrlVC";
var UrlNameVC = "七猫小说视频奖励";
var UrlValueVC = url;
if (qmnovel.getdata(UrlKeyVC) != (undefined || null)) {
if (qmnovel.getdata(UrlKeyVC) != UrlValueVC) {
var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC);
if (!urlVC) {
qmnovel.msg("更新" + UrlNameVC + "Url失败‼", "", "");
} else {
qmnovel.msg("更新" + UrlNameVC + "Url成功🎉", "", "");
}
} else {
qmnovel.msg(UrlNameVC + "Url未变化❗", "", "");
}
} else {
var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC);
if (!urlVC) {
qmnovel.msg("首次写入" + UrlNameVC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameVC + "Url成功🎉", "", "");
}
}
} else {
var urlVC = qmnovel.setdata(UrlValueVC, UrlKeyVC);
if (!urlVC) {
qmnovel.msg("首次写入" + UrlNameVC + "Url失败‼", "", "");
} else {
qmnovel.msg("首次写入" + UrlNameVC + "Url成功🎉", "", "");
}
qmnovel.msg("写入" + UrlNameVC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
} else {
qmnovel.msg("写入" + UrlNameVC + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
}
}
}
function DailyCheckin(t) {
return new Promise(resolve => { setTimeout(() => {
url = { url: DCURL, headers: JSON.parse(DCKEY) }
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.dailycheckin = JSON.parse(data)
qmnovel.log(`${cookieName}日常签到, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '日常签到结果: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})}, t)
})
return new Promise(resolve => {
setTimeout(() => {
url = {url: DCURL, headers: JSON.parse(DCKEY)}
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.dailycheckin = JSON.parse(data)
qmnovel.log(`${cookieName}日常签到, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '日常签到结果: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})
}, t)
})
}
function NoviceCheckin(t) {
return new Promise(resolve => { setTimeout(() => {
url = { url: NCURL, headers: JSON.parse(NCKEY) }
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.novicecheckin = JSON.parse(data)
qmnovel.log(`${cookieName}新人签到, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '新人签到结果: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})}, t)
})
}
return new Promise(resolve => {
setTimeout(() => {
url = {url: NCURL, headers: JSON.parse(NCKEY)}
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.novicecheckin = JSON.parse(data)
qmnovel.log(`${cookieName}新人签到, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '新人签到结果: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})
}, t)
})
}
function VideoCoin(t) {
return new Promise(resolve => { setTimeout(() => {
url = { url: VCURL, headers: JSON.parse(DCKEY) }
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.videocoin = JSON.parse(data)
qmnovel.log(`${cookieName}视频奖励, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '领取视频奖励: 失败‼️', '请查看错误日志‼️')
resolve('done');
}
})}, t)
})
return new Promise(resolve => {
setTimeout(() => {
url = {url: VCURL, headers: JSON.parse(DCKEY)}
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.videocoin = JSON.parse(data)
qmnovel.log(`${cookieName}视频奖励, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '领取视频奖励: 失败‼️', '请查看错误日志‼️')
resolve('done');
}
})
}, t)
})
}
function LuckyTurn(t) {
return new Promise(resolve => { setTimeout(() => {
url = { url: LTURL, headers: JSON.parse(LTKEY) }
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.luckyturnlist = Totalresult.luckyturnlist ? Totalresult.luckyturnlist : []
Totalresult.luckyturnlist.push(JSON.parse(data))
qmnovel.log(`${cookieName}幸运大转盘, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '幸运大转盘: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})}, t)
})
return new Promise(resolve => {
setTimeout(() => {
url = {url: LTURL, headers: JSON.parse(LTKEY)}
qmnovel.get(url, (error, response, data) => {
try {
Totalresult.luckyturnlist = Totalresult.luckyturnlist ? Totalresult.luckyturnlist : []
Totalresult.luckyturnlist.push(JSON.parse(data))
qmnovel.log(`${cookieName}幸运大转盘, data: ${data}`)
resolve('done');
} catch (e) {
qmnovel.log(`Error: ${error}`)
qmnovel.msg(cookieName, '幸运大转盘: 失败‼️', '请查看错误日志‼️')
resolve('done')
}
})
}, t)
})
}
function Notify() {
let subTitle = '';
let detail = '';
if (Totalresult.dailycheckin) {
if (Totalresult.dailycheckin.data) {
subTitle += '日常签到结果: 成功🎉\n'
detail += '日常签到奖励: '+ Totalresult.dailycheckin.data.coin +'金币\n'
} else if (Totalresult.dailycheckin.errors) {
if (Totalresult.dailycheckin.errors.code == 23010103) {
subTitle += '日常签到结果: 成功(重复签到)🎉\n'
} else {
subTitle += '日常签到结果: 失败‼️\n'
detail += '日常签到说明: ' + Totalresult.dailycheckin.errors.details + '\n'
}
}
}
if (Totalresult.videocoin) {
if (Totalresult.videocoin.data) {
subTitle += '领取视频奖励: 成功🎉\n'
detail += '视频奖励: '+ Totalresult.videocoin.data.coin +'金币\n'
} else if (Totalresult.videocoin.errors) {
if (Totalresult.videocoin.errors.code == 23010107) {
subTitle += '领取视频奖励: 成功(重复签到)🎉\n'
detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n'
} else {
subTitle += '领取视频奖励: 失败‼️\n'
detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n'
}
}
}
if (Totalresult.novicecheckin) {
if (Totalresult.novicecheckin.data) {
subTitle += '新人签到结果: 成功🎉\n'
detail += '签到奖励: '+ Totalresult.novicecheckin.data.reward_cash +'金币\n'
} else if (Totalresult.novicecheckin.errors) {
if (Totalresult.novicecheckin.errors.code == 13101002) {
subTitle += '新人签到结果: 成功(重复签到)🎉\n'
detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n'
} else {
subTitle += '新人签到结果: 失败‼️\n'
detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n'
}
}
}
if (Totalresult.luckyturnlist) {
subTitle += '幸运大转盘次数: 5次';
for (let i = 0; i < 5; i++) {
n = i + 1
if (Totalresult.luckyturnlist[i].data) {
detail += '第' + n + '次' + '幸运大转盘: 成功🎉 转盘奖励: ' + Totalresult.luckyturnlist[i].data.prize_title + '\n'
} else if (Totalresult.luckyturnlist[i].errors) {
if (Totalresult.luckyturnlist[i].errors.code == 13101002) {
detail += '幸运大转盘: 次数耗尽🚫 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n'
let subTitle = '';
let detail = '';
if (Totalresult.dailycheckin) {
if (Totalresult.dailycheckin.data) {
subTitle += '日常签到结果: 成功🎉\n'
detail += '日常签到奖励: ' + Totalresult.dailycheckin.data.coin + '金币\n'
} else if (Totalresult.dailycheckin.errors) {
if (Totalresult.dailycheckin.errors.code == 23010103) {
subTitle += '日常签到结果: 成功(重复签到)🎉\n'
} else {
detail += '幸运大转盘: 失败‼️ 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n'
subTitle += '日常签到结果: 失败‼️\n'
detail += '日常签到说明: ' + Totalresult.dailycheckin.errors.details + '\n'
}
}
}
}
qmnovel.msg(cookieName, subTitle, detail)
}
}
if (Totalresult.videocoin) {
if (Totalresult.videocoin.data) {
subTitle += '领取视频奖励: 成功🎉\n'
detail += '视频奖励: ' + Totalresult.videocoin.data.coin + '金币\n'
} else if (Totalresult.videocoin.errors) {
if (Totalresult.videocoin.errors.code == 23010107) {
subTitle += '领取视频奖励: 成功(重复签到)🎉\n'
detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n'
} else {
subTitle += '领取视频奖励: 失败‼️\n'
detail += '视频奖励说明: ' + Totalresult.videocoin.errors.details + '\n'
}
}
}
if (Totalresult.novicecheckin) {
if (Totalresult.novicecheckin.data) {
subTitle += '新人签到结果: 成功🎉\n'
detail += '签到奖励: ' + Totalresult.novicecheckin.data.reward_cash + '金币\n'
} else if (Totalresult.novicecheckin.errors) {
if (Totalresult.novicecheckin.errors.code == 13101002) {
subTitle += '新人签到结果: 成功(重复签到)🎉\n'
detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n'
} else {
subTitle += '新人签到结果: 失败‼️\n'
detail += '新人签到说明: ' + Totalresult.novicecheckin.errors.details + '\n'
}
}
}
if (Totalresult.luckyturnlist) {
subTitle += '幸运大转盘次数: 5次';
for (let i = 0; i < 5; i++) {
n = i + 1
if (Totalresult.luckyturnlist[i].data) {
detail += '第' + n + '次' + '幸运大转盘: 成功🎉 转盘奖励: ' + Totalresult.luckyturnlist[i].data.prize_title + '\n'
} else if (Totalresult.luckyturnlist[i].errors) {
if (Totalresult.luckyturnlist[i].errors.code == 13101002) {
detail += '幸运大转盘: 次数耗尽🚫 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n'
} else {
detail += '幸运大转盘: 失败‼️ 说明: ' + Totalresult.luckyturnlist[i].errors.details + '\n'
}
}
}
}
qmnovel.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -7,87 +7,89 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS') {
try {
const tokenVal = '&' + requrl.match(/token=[a-zA-Z0-9_-]+/)[0]
const uuidVal = '&' + requrl.match(/uuid=[a-zA-Z0-9_-]+/)[0]
const signVal = tokenVal + uuidVal
const XTK = requrl.match(/tk=[a-zA-Z0-9_-]+/)[0]
const signXTKVal = XTK.substring(3, XTK.length)
if (signVal) senku.setdata(signVal, signKey)
if (signXTKVal) senku.setdata(signXTKVal, signXTKKey)
senku.msg(cookieName, `签到,获取Cookie: 成功`, ``)
senku.log(`🔔${signVal},🔔${signXTKVal}`)
} catch (error) {
senku.log(`❌error:${error}`)
}
try {
const tokenVal = '&' + requrl.match(/token=[a-zA-Z0-9_-]+/)[0]
const uuidVal = '&' + requrl.match(/uuid=[a-zA-Z0-9_-]+/)[0]
const signVal = tokenVal + uuidVal
const XTK = requrl.match(/tk=[a-zA-Z0-9_-]+/)[0]
const signXTKVal = XTK.substring(3, XTK.length)
if (signVal) senku.setdata(signVal, signKey)
if (signXTKVal) senku.setdata(signXTKVal, signXTKKey)
senku.msg(cookieName, `签到,获取Cookie: 成功`, ``)
senku.log(`🔔${signVal},🔔${signXTKVal}`)
} catch (error) {
senku.log(`❌error:${error}`)
}
}
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/content\/readV2\?qdata=[a-zA-Z0-9_-]+/)) {
try {
const readVal = requrl
if (readVal) {
if (senku.setdata(readVal, readKey))
senku.msg(cookieName, `阅读,获取Cookie: 成功`, ``)
senku.log(`🔔${readVal}`)
try {
const readVal = requrl
if (readVal) {
if (senku.setdata(readVal, readKey))
senku.msg(cookieName, `阅读,获取Cookie: 成功`, ``)
senku.log(`🔔${readVal}`)
}
} catch (error) {
senku.log(`❌error:${error}`)
}
} catch (error) {
senku.log(`❌error:${error}`)
}
}
if ($request && $request.method != 'OPTIONS' && requrl.match(/\/x\/feed\/getReward\?qdata=[a-zA-Z0-9_-]+/)) {
try {
const navCoinVal = requrl
if (navCoinVal) {
if (senku.setdata(navCoinVal, navCoinKey))
senku.msg(cookieName, `首页金币奖励,获取Cookie: 成功`, ``)
senku.log(`🔔${navCoinVal}`)
try {
const navCoinVal = requrl
if (navCoinVal) {
if (senku.setdata(navCoinVal, navCoinKey))
senku.msg(cookieName, `首页金币奖励,获取Cookie: 成功`, ``)
senku.log(`🔔${navCoinVal}`)
}
} catch (error) {
senku.log(`❌error:${error}`)
}
} catch (error) {
senku.log(`❌error:${error}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

File diff suppressed because it is too large Load Diff

View File

@ -4,55 +4,56 @@ const chavy = init()
const cookieVal = JSON.stringify($request.headers)
if (cookieVal) {
chavy.setdata(cookieVal, cookieKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
chavy.setdata(cookieVal, cookieKey)
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
} else {
chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`)
chavy.msg(`${cookieName}`, '获取Cookie: 失败', '说明: 未知')
chavy.log(`[${cookieName}] 获取Cookie: 失败, cookie: ${cookieVal}`)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -6,72 +6,72 @@ const cookieVal = JSON.parse(chavy.getdata(cookieKey))
sign()
function sign() {
let url = { url: `https://user.qunar.com/webapi/member/signNewIndex.htm`, headers: cookieVal }
url.body = `channel=app&platform=ios`
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.errcode == 200) {
if (result.data.modalInfo.title) {
subTitle = '签到结果: 成功'
detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}天, 说明: ${result.data.modalInfo.title}`
} else {
subTitle = '签到结果: 成功 (重复签到)'
detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}`
}
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.errcode}, 说明: ${result.errmsg}`
}
chavy.msg(title, subTitle, detail)
})
let url = {url: `https://user.qunar.com/webapi/member/signNewIndex.htm`, headers: cookieVal}
url.body = `channel=app&platform=ios`
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
let result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.errcode == 200) {
if (result.data.modalInfo.title) {
subTitle = '签到结果: 成功'
detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}天, 说明: ${result.data.modalInfo.title}`
} else {
subTitle = '签到结果: 成功 (重复签到)'
detail = `${result.data.unit}: ${result.data.preferential.counts}个, 共签: ${result.data.total}天, 连签: ${result.data.continuous}`
}
} else {
subTitle = '签到结果: 失败'
detail = `编码: ${result.errcode}, 说明: ${result.errmsg}`
}
chavy.msg(title, subTitle, detail)
})
chavy.done()
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -3,52 +3,54 @@ const cookieKey = 'chavy_cookie_rrtv'
const chavy = init()
const cookieVal = $request.headers['token']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -6,319 +6,319 @@ const signinfo = {}
let VAL_signcookie = chavy.getdata(KEY_signcookie)
;(exec = async () => {
chavy.log(`🔔 ${cookieName} 开始签到`)
await signdaily()
await signwelfare()
await getquestion()
if (!signinfo.hasAnswered) {
await answerquestion()
chavy.log(`🔔 ${cookieName} 开始签到`)
await signdaily()
await signwelfare()
await getquestion()
}
await openbox('copperbox', '铜宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0A4t2g56kUpDGFsn9z6%2BofyiL5QwfBYZBZOTw9stNt9mc%3D')
await openbox('silverbox', '银宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0ADPPhFllL7eBnJs52RODWxxe9rquyWdYcDcbyirN6KiE%3D')
await openbox('goldenbox', '金宝箱', 'simpleBody=3abxJMn7LwEdH8u1Xpe2qN6AtFpDhBrmviLyoU%2BunKwnS1IGS7DIfS0HiKtt03G0%0D%0A/zVCARFyXUFFrOxLRrgAS4m/u4BiQYWJzTUeUqLAFZk%3D')
await getinfo()
showmsg()
chavy.done()
if (!signinfo.hasAnswered) {
await answerquestion()
await getquestion()
}
await openbox('copperbox', '铜宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0A4t2g56kUpDGFsn9z6%2BofyiL5QwfBYZBZOTw9stNt9mc%3D')
await openbox('silverbox', '银宝箱', 'simpleBody=nUuymDQ/BcC2Q6QH21Tjww23J7qtVaDlUN17k1/KY%2BXGDsRVwDRJ8YfjAMraptIL%0D%0ADPPhFllL7eBnJs52RODWxxe9rquyWdYcDcbyirN6KiE%3D')
await openbox('goldenbox', '金宝箱', 'simpleBody=3abxJMn7LwEdH8u1Xpe2qN6AtFpDhBrmviLyoU%2BunKwnS1IGS7DIfS0HiKtt03G0%0D%0A/zVCARFyXUFFrOxLRrgAS4m/u4BiQYWJzTUeUqLAFZk%3D')
await getinfo()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function signdaily() {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/rrtv-activity/sign/sign`, headers: { token: VAL_signcookie } }
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `12`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.signdaily = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signdaily - 日常签到失败: ${e}`)
chavy.log(`${cookieName} signdaily - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/rrtv-activity/sign/sign`, headers: {token: VAL_signcookie}}
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `12`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.signdaily = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signdaily - 日常签到失败: ${e}`)
chavy.log(`${cookieName} signdaily - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function signwelfare() {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/dailyWelfare/getWelfare`, headers: { token: VAL_signcookie } }
url.headers['clientType'] = `web`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `0.0.1`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/mission/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `45`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.signwelfare = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signwelfare - 日常签到失败: ${e}`)
chavy.log(`${cookieName} signwelfare - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/dailyWelfare/getWelfare`, headers: {token: VAL_signcookie}}
url.headers['clientType'] = `web`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `0.0.1`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/mission/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `45`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.signwelfare = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `日常签到: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signwelfare - 日常签到失败: ${e}`)
chavy.log(`${cookieName} signwelfare - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getinfo() {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/user/profile`, headers: { token: VAL_signcookie } }
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.userinfo = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取会员信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取会员信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/user/profile`, headers: {token: VAL_signcookie}}
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.userinfo = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取会员信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取会员信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getquestion() {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/v3plus/question/getQuestion`, headers: { token: VAL_signcookie } }
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.question = JSON.parse(data)
signinfo.questionopts = {}
for (opt of signinfo.question.data.question.optionViewList) {
signinfo.questionopts[opt.id] = opt
if (!signinfo.answeropt) signinfo.answeropt = opt
else signinfo.answeropt = opt.answererCount > signinfo.answeropt.answererCount ? opt : signinfo.answeropt
}
signinfo.hasAnswered = signinfo.question.data.question.hasAnswered
if (signinfo.hasAnswered) {
signinfo.selectId = signinfo.question.data.question.selectId
signinfo.isRight = signinfo.questionopts[signinfo.selectId].isRight
}
resolve()
} catch (e) {
chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 获取问题失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/v3plus/question/getQuestion`, headers: {token: VAL_signcookie}}
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.question = JSON.parse(data)
signinfo.questionopts = {}
for (opt of signinfo.question.data.question.optionViewList) {
signinfo.questionopts[opt.id] = opt
if (!signinfo.answeropt) signinfo.answeropt = opt
else signinfo.answeropt = opt.answererCount > signinfo.answeropt.answererCount ? opt : signinfo.answeropt
}
signinfo.hasAnswered = signinfo.question.data.question.hasAnswered
if (signinfo.hasAnswered) {
signinfo.selectId = signinfo.question.data.question.selectId
signinfo.isRight = signinfo.questionopts[signinfo.selectId].isRight
}
resolve()
} catch (e) {
chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 获取问题失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function answerquestion() {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/v3plus/question/answerQuestion`, headers: { token: VAL_signcookie } }
url.body = `optionId=${signinfo.answeropt.id}`
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.answerquestion = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 获取问题失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/v3plus/question/answerQuestion`, headers: {token: VAL_signcookie}}
url.body = `optionId=${signinfo.answeropt.id}`
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Connection'] = `keep-alive`
url.headers['clientVersion'] = `4.3.5`
url.headers['Content-Type'] = `application/x-www-form-urlencoded; charset=UTF-8`
url.headers['Origin'] = `https://mobile.rr.tv`
url.headers['Referer'] = `https://mobile.rr.tv/`
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Host'] = `api.rr.tv`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 App/RRSPApp platform/iPhone AppVersion/4.3.5'
chavy.post(url, (error, response, data) => {
try {
signinfo.answerquestion = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取问题: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 获取问题失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function openbox(boxcode, boxname, body) {
return new Promise((resolve, reject) => {
let url = { url: `https://api.rr.tv/v3plus/taskCenter/openBox`, headers: { token: VAL_signcookie } }
url.body = body
url.headers['Accept'] = `*/*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/x-www-form-urlencoded`
url.headers['Host'] = `api.rr.tv`
url.headers['User-Agent'] = `PUClient/4.3.6 (iPhone; iOS 13.3.1; Scale/2.00)`
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['clientVersion'] = `4.3.6`
url.headers['deviceMode'] = `iPhone 8`
url.headers['p'] = `iOS`
chavy.post(url, (error, response, data) => {
try {
signinfo[boxcode] = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `打开${boxname}: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 打开${boxname}失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = {url: `https://api.rr.tv/v3plus/taskCenter/openBox`, headers: {token: VAL_signcookie}}
url.body = body
url.headers['Accept'] = `*/*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-Hans-CN;q=1, en-US;q=0.9`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/x-www-form-urlencoded`
url.headers['Host'] = `api.rr.tv`
url.headers['User-Agent'] = `PUClient/4.3.6 (iPhone; iOS 13.3.1; Scale/2.00)`
url.headers['clientType'] = `ios_rrsp_jzsp`
url.headers['clientVersion'] = `4.3.6`
url.headers['deviceMode'] = `iPhone 8`
url.headers['p'] = `iOS`
chavy.post(url, (error, response, data) => {
try {
signinfo[boxcode] = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `打开${boxname}: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getquestion - 打开${boxname}失败: ${e}`)
chavy.log(`${cookieName} getquestion - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle = ''
let detail = ''
if (signinfo.signdaily) {
subTitle = `签到: `
if (signinfo.signdaily.code == '0000' || signinfo.signdaily.code == '8750') {
subTitle += signinfo.signdaily.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signdaily.code == '8750' ? '重复; ' : ''
} else {
subTitle += '失败; '
let subTitle = ''
let detail = ''
if (signinfo.signdaily) {
subTitle = `签到: `
if (signinfo.signdaily.code == '0000' || signinfo.signdaily.code == '8750') {
subTitle += signinfo.signdaily.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signdaily.code == '8750' ? '重复; ' : ''
} else {
subTitle += '失败; '
}
}
}
if (signinfo.signwelfare) {
subTitle += `福利: `
if (signinfo.signwelfare.code == '0000' || signinfo.signwelfare.code == '8623') {
subTitle += signinfo.signwelfare.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signwelfare.code == '8623' ? '重复; ' : ''
} else {
subTitle += '失败;'
if (signinfo.signwelfare) {
subTitle += `福利: `
if (signinfo.signwelfare.code == '0000' || signinfo.signwelfare.code == '8623') {
subTitle += signinfo.signwelfare.code == '0000' ? '成功; ' : ''
subTitle += signinfo.signwelfare.code == '8623' ? '重复; ' : ''
} else {
subTitle += '失败;'
}
}
if (signinfo.question && signinfo.questionopts) {
subTitle += `答题: ${signinfo.isRight ? '✅' : '❌'}`
}
}
if (signinfo.question && signinfo.questionopts) {
subTitle += `答题: ${signinfo.isRight ? '✅' : '❌'}`
}
if (signinfo.userinfo.code == '0000') {
const levelStr = signinfo.userinfo.data.user.levelStr ? ` (${signinfo.userinfo.data.user.levelStr})` : ``
detail = `等级: ${signinfo.userinfo.data.user.level}${levelStr}, 银币: ${signinfo.userinfo.data.user.silverCount}`
} else {
detail = `编码: ${signinfo.userinfo.code}, 说明: ${signinfo.userinfo.msg}`
}
if (signinfo.question.data.question) {
detail += `\n查看答题详情`
detail += `\n\n问题: ${signinfo.question.data.question.questionStr}`
for (key in signinfo.questionopts) detail += `\n选项: ${signinfo.questionopts[key].optionStr}, 回答人数: ${signinfo.questionopts[key].answererCount} (${signinfo.questionopts[key].percent})`
if (signinfo.selectId) {
detail += `\n最佳回答: ${signinfo.answeropt.optionStr}`
detail += `\n我的回答: ${signinfo.questionopts[signinfo.selectId].optionStr}`
detail += `${signinfo.isRight ? '✅' : '❌'}\n`
if (signinfo.userinfo.code == '0000') {
const levelStr = signinfo.userinfo.data.user.levelStr ? ` (${signinfo.userinfo.data.user.levelStr})` : ``
detail = `等级: ${signinfo.userinfo.data.user.level}${levelStr}, 银币: ${signinfo.userinfo.data.user.silverCount}`
} else {
detail += `\n最佳回答: ${signinfo.answeropt.optionStr}\n`
detail = `编码: ${signinfo.userinfo.code}, 说明: ${signinfo.userinfo.msg}`
}
}
if (signinfo.copperbox) {
if (signinfo.copperbox.code == '0000') {
for (box of signinfo.copperbox.data.boxs) detail += `\n铜宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n铜宝箱: ${signinfo.copperbox.msg}`
if (signinfo.question.data.question) {
detail += `\n查看答题详情`
detail += `\n\n问题: ${signinfo.question.data.question.questionStr}`
for (key in signinfo.questionopts) detail += `\n选项: ${signinfo.questionopts[key].optionStr}, 回答人数: ${signinfo.questionopts[key].answererCount} (${signinfo.questionopts[key].percent})`
if (signinfo.selectId) {
detail += `\n最佳回答: ${signinfo.answeropt.optionStr}`
detail += `\n我的回答: ${signinfo.questionopts[signinfo.selectId].optionStr}`
detail += `${signinfo.isRight ? '✅' : '❌'}\n`
} else {
detail += `\n最佳回答: ${signinfo.answeropt.optionStr}\n`
}
}
}
if (signinfo.silverbox) {
if (signinfo.silverbox.code == '0000') {
for (box of signinfo.silverbox.data.boxs) detail += `\n银宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n银宝箱: ${signinfo.silverbox.msg}`
if (signinfo.copperbox) {
if (signinfo.copperbox.code == '0000') {
for (box of signinfo.copperbox.data.boxs) detail += `\n铜宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n铜宝箱: ${signinfo.copperbox.msg}`
}
}
}
if (signinfo.goldenbox) {
if (signinfo.goldenbox.code == '0000') {
for (box of signinfo.goldenbox.data.boxs) detail += `\n金宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n金宝箱: ${signinfo.goldenbox.msg}`
if (signinfo.silverbox) {
if (signinfo.silverbox.code == '0000') {
for (box of signinfo.silverbox.data.boxs) detail += `\n银宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n银宝箱: ${signinfo.silverbox.msg}`
}
}
}
chavy.msg(cookieName, subTitle, detail)
if (signinfo.goldenbox) {
if (signinfo.goldenbox.code == '0000') {
for (box of signinfo.goldenbox.data.boxs) detail += `\n金宝箱: ${box.rewardName} (+${box.rewardNum})`
} else {
detail += `\n金宝箱: ${signinfo.goldenbox.msg}`
}
}
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -3,13 +3,13 @@ const cookieKey = 'chavy_cookie_smzdm'
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notify(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notify(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
}
$done({})

View File

@ -3,39 +3,39 @@ const cookieKey = 'chavy_cookie_smzdm'
const cookieVal = $prefs.valueForKey(cookieKey)
function sign() {
let url = {
url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`,
headers: {
Cookie: cookieVal
let url = {
url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`,
headers: {
Cookie: cookieVal
}
}
}
url.headers['Referer'] = 'http://www.smzdm.com/'
url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36'
url.headers['Referer'] = 'http://www.smzdm.com/'
url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36'
$task.fetch(url).then((response) => {
let data = response.body
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.data && result.error_code == 0) {
let subTitle = `签到结果: 成功`
let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}`
$notify(title, subTitle, detail)
}
// 登录失效
else if (result && result.data && result.error_code == 99) {
let subTitle = `签到结果: 失败`
let detail = `说明: 登录失效, 请重新获取Cookie`
$notify(title, subTitle, detail)
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}`
$notify(title, subTitle, detail)
}
console.log(`${cookieName}, data: ${data}`)
})
$task.fetch(url).then((response) => {
let data = response.body
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.data && result.error_code == 0) {
let subTitle = `签到结果: 成功`
let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}`
$notify(title, subTitle, detail)
}
// 登录失效
else if (result && result.data && result.error_code == 99) {
let subTitle = `签到结果: 失败`
let detail = `说明: 登录失效, 请重新获取Cookie`
$notify(title, subTitle, detail)
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}`
$notify(title, subTitle, detail)
}
console.log(`${cookieName}, data: ${data}`)
})
}
sign()

View File

@ -3,13 +3,13 @@ const cookieKey = 'chavy_cookie_smzdm'
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
let cookie = $persistentStore.write(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notification.post(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
let cookie = $persistentStore.write(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notification.post(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
}
$done({})

View File

@ -3,40 +3,40 @@ const cookieKey = 'chavy_cookie_smzdm'
const cookieVal = $persistentStore.read(cookieKey)
function sign() {
let url = {
url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`,
headers: {
Cookie: cookieVal
let url = {
url: `https://zhiyou.smzdm.com/user/checkin/jsonp_checkin`,
headers: {
Cookie: cookieVal
}
}
}
url.headers['Referer'] = 'http://www.smzdm.com/'
url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36'
url.headers['Referer'] = 'http://www.smzdm.com/'
url.headers['User-Agent'] = 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36'
$httpClient.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.data && result.error_code == 0) {
let subTitle = `签到结果: 成功`
let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}`
$notification.post(title, subTitle, detail)
}
// 登录失效
else if (result && result.data && result.error_code == 99) {
let subTitle = `签到结果: 失败`
let detail = `说明: 登录失效, 请重新获取Cookie`
$notification.post(title, subTitle, detail)
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}`
$notification.post(title, subTitle, detail)
}
console.log(`${cookieName}, data: ${data}`)
})
$httpClient.get(url, (error, response, data) => {
let result = JSON.parse(data)
let title = `${cookieName}`
// 签到成功
if (result && result.data && result.error_code == 0) {
let subTitle = `签到结果: 成功`
let detail = `累计: ${result.data.checkin_num}次, 经验: ${result.data.exp}, 金币: ${result.data.gold}, 积分: ${result.data.point}`
$notification.post(title, subTitle, detail)
}
// 登录失效
else if (result && result.data && result.error_code == 99) {
let subTitle = `签到结果: 失败`
let detail = `说明: 登录失效, 请重新获取Cookie`
$notification.post(title, subTitle, detail)
}
// 签到失败
else {
let subTitle = `签到结果: 失败`
let detail = `编码: ${result.error_code}, 说明: ${result.error_msg}`
$notification.post(title, subTitle, detail)
}
console.log(`${cookieName}, data: ${data}`)
})
$done({})
$done({})
}
sign()

View File

@ -6,60 +6,61 @@ const KEY_login27url = 'chavy_login27url_sfexpress'
const KEY_login27header = 'chavy_login27header_sfexpress'
if ($request && $request.method != 'OPTIONS' && $request.url.match(/app\/index/)) {
const VAL_loginurl = $request.url
const VAL_loginheader = JSON.stringify($request.headers)
if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl)
if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const VAL_loginurl = $request.url
const VAL_loginheader = JSON.stringify($request.headers)
if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl)
if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader)
chavy.msg(cookieName, `获取Cookie: 成功`, ``)
} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/mcs-mimp\/share\/(.*?)Redirect/)) {
const VAL_login27url = $request.url
const VAL_login27header = JSON.stringify($request.headers)
if (VAL_login27url) chavy.setdata(VAL_login27url, KEY_login27url)
if (VAL_login27header) chavy.setdata(VAL_login27header, KEY_login27header)
chavy.msg(cookieName, `获取Cookie: 成功 (27周年)`, ``)
const VAL_login27url = $request.url
const VAL_login27header = JSON.stringify($request.headers)
if (VAL_login27url) chavy.setdata(VAL_login27url, KEY_login27url)
if (VAL_login27header) chavy.setdata(VAL_login27header, KEY_login27header)
chavy.msg(cookieName, `获取Cookie: 成功 (27周年)`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -3,99 +3,222 @@ $.VAL_loginurl = $.getdata('chavy_loginurl_sfexpress')
$.VAL_loginheader = $.getdata('chavy_loginheader_sfexpress')
!(async () => {
await refresh()
await loginapp()
await signapp()
await getinfo()
await showmsg()
await refresh()
await loginapp()
await signapp()
await getinfo()
await showmsg()
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
.catch((e) => $.logErr(e))
.finally(() => $.done())
function refresh() {
if (!$.isQuanX()) return
return new Promise((resolve) => {
const url = { url: `https://sf-integral-sign-in.weixinjia.net/app/signin`, headers: { Cookie: '' } }
url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}`
$.post(url, () => resolve())
})
if (!$.isQuanX()) return
return new Promise((resolve) => {
const url = {url: `https://sf-integral-sign-in.weixinjia.net/app/signin`, headers: {Cookie: ''}}
url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}`
$.post(url, () => resolve())
})
}
function loginapp() {
return new Promise((resolve) => {
const url = { url: $.VAL_loginurl }
$.get(url, () => resolve())
})
return new Promise((resolve) => {
const url = {url: $.VAL_loginurl}
$.get(url, () => resolve())
})
}
function signapp() {
return new Promise((resolve) => {
const url = { url: `https://sf-integral-sign-in.weixinjia.net/app/signin`, headers: JSON.parse($.VAL_loginheader) }
delete url.headers['Cookie']
url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net'
url.headers['Connection'] = 'keep-alive'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Accept'] = 'application/json, text/plain, */*'
url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}`
$.post(url, (err, resp, data) => {
try {
$.signapp = JSON.parse(data)
} catch (e) {
$.logErr(e, resp)
} finally {
resolve()
}
return new Promise((resolve) => {
const url = {
url: `https://sf-integral-sign-in.weixinjia.net/app/signin`,
headers: JSON.parse($.VAL_loginheader)
}
delete url.headers['Cookie']
url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net'
url.headers['Connection'] = 'keep-alive'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Accept'] = 'application/json, text/plain, */*'
url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net'
url.headers['Accept-Language'] = 'zh-cn'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.body = `date=${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}`
$.post(url, (err, resp, data) => {
try {
$.signapp = JSON.parse(data)
} catch (e) {
$.logErr(e, resp)
} finally {
resolve()
}
})
})
})
}
function getinfo() {
return new Promise((resolve) => {
const url = { url: `https://sf-integral-sign-in.weixinjia.net/app/init`, headers: JSON.parse($.VAL_loginheader) }
delete url.headers['Cookie']
url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net'
url.headers['Connection'] = 'keep-alive'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Accept'] = 'application/json, text/plain, */*'
url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
$.post(url, (err, resp, data) => {
try {
$.info = JSON.parse(data)
} catch (e) {
$.logErr(e, resp)
} finally {
resolve()
}
return new Promise((resolve) => {
const url = {url: `https://sf-integral-sign-in.weixinjia.net/app/init`, headers: JSON.parse($.VAL_loginheader)}
delete url.headers['Cookie']
url.headers['Origin'] = 'https://sf-integral-sign-in.weixinjia.net'
url.headers['Connection'] = 'keep-alive'
url.headers['Content-Type'] = 'application/x-www-form-urlencoded'
url.headers['Accept'] = 'application/json, text/plain, */*'
url.headers['Host'] = 'sf-integral-sign-in.weixinjia.net'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Accept-Language'] = 'zh-cn'
$.post(url, (err, resp, data) => {
try {
$.info = JSON.parse(data)
} catch (e) {
$.logErr(e, resp)
} finally {
resolve()
}
})
})
})
}
function showmsg() {
return new Promise((resolve) => {
if ($.signapp.code == 0 && $.signapp.msg == 'success') {
$.subt = `签到: 成功`
} else if ($.signapp.code == -1) {
if ($.signapp.msg == 'ALREADY_CHECK') {
$.subt = `签到: 重复`
} else {
$.subt = `签到: 失败`
}
} else {
$.subt = `签到: 未知`
$.desc = `说明: ${$.signapp.msg}`
}
if ($.info && $.info.code == 0) {
$.desc = `积分: ${$.info.data.member_info.integral}, 本周连签: ${$.info.data.check_count}`
}
$.msg($.name, $.subt, $.desc)
resolve()
})
return new Promise((resolve) => {
if ($.signapp.code == 0 && $.signapp.msg == 'success') {
$.subt = `签到: 成功`
} else if ($.signapp.code == -1) {
if ($.signapp.msg == 'ALREADY_CHECK') {
$.subt = `签到: 重复`
} else {
$.subt = `签到: 失败`
}
} else {
$.subt = `签到: 未知`
$.desc = `说明: ${$.signapp.msg}`
}
if ($.info && $.info.code == 0) {
$.desc = `积分: ${$.info.data.member_info.integral}, 本周连签: ${$.info.data.check_count}`
}
$.msg($.name, $.subt, $.desc)
resolve()
})
}
// prettier-ignore
function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
function Env(t, s) {
return new class {
constructor(t, s) {
this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
}
isNode() {
return "undefined" != typeof module && !!module.exports
}
isQuanX() {
return "undefined" != typeof $task
}
isSurge() {
return "undefined" != typeof $httpClient
}
isLoon() {
return "undefined" != typeof $loon
}
loaddata() {
if (!this.isNode) return {};
{
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s);
if (!e && !i) return {};
{
const i = e ? t : s;
try {
return JSON.parse(this.fs.readFileSync(i))
} catch {
return {}
}
}
}
}
writedata() {
if (this.isNode) {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), h = JSON.stringify(this.data);
e ? this.fs.writeFileSync(t, h) : i ? this.fs.writeFileSync(s, h) : this.fs.writeFileSync(t, h)
}
}
getdata(t) {
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setdata(t, s) {
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || null
}
initGotEnv(t) {
this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
}
get(t, s = (() => {
})) {
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}) : this.isQuanX() ? $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => {
try {
const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
this.ckjar.setCookieSync(e, null), s.cookieJar = this.ckjar
} catch (t) {
this.logErr(t)
}
}).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)))
}
post(t, s = (() => {
})) {
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)); else if (this.isNode()) {
this.initGotEnv(t);
const {url: e, ...i} = t;
this.got.post(e, i).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t))
}
}
msg(s = t, e = "", i = "", h) {
this.isSurge() || this.isLoon() ? $notification.post(s, e, i) : this.isQuanX() && $notify(s, e, i), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i)
}
log(...t) {
t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator))
}
logErr(t, s) {
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.message)
}
wait(t) {
return new Promise(s => setTimeout(s, t))
}
done(t = null) {
const s = (new Date).getTime(), e = (s - this.startTime) / 1e3;
this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, s)
}

View File

@ -13,91 +13,92 @@ const KEY_signgetgameurl = 'chavy_signgetgame_url_suning'
const KEY_signgetgameheader = 'chavy_signgetgame_header_suning'
if ($request.url.match(/\/ids\/login/)) {
const VAL_loginurl = $request.url
const VAL_loginbody = $request.body
const VAL_loginheader = JSON.stringify($request.headers)
if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl)
if (VAL_loginbody) chavy.setdata(VAL_loginbody, KEY_loginbody)
if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (登录链接)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginurl: ${VAL_loginurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginbody: ${VAL_loginbody}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginheader: ${VAL_loginheader}`)
const VAL_loginurl = $request.url
const VAL_loginbody = $request.body
const VAL_loginheader = JSON.stringify($request.headers)
if (VAL_loginurl) chavy.setdata(VAL_loginurl, KEY_loginurl)
if (VAL_loginbody) chavy.setdata(VAL_loginbody, KEY_loginbody)
if (VAL_loginheader) chavy.setdata(VAL_loginheader, KEY_loginheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (登录链接)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginurl: ${VAL_loginurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginbody: ${VAL_loginbody}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_loginheader: ${VAL_loginheader}`)
} else if ($request.url.match(/\/sign\/doSign.do/)) {
const VAL_signurl = $request.url
const VAL_signheader = JSON.stringify($request.headers)
if (VAL_signurl) chavy.setdata(VAL_signurl, KEY_signurl)
if (VAL_signheader) chavy.setdata(VAL_signheader, KEY_signheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日签到)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signurl: ${VAL_signurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signheader: ${VAL_signheader}`)
const VAL_signurl = $request.url
const VAL_signheader = JSON.stringify($request.headers)
if (VAL_signurl) chavy.setdata(VAL_signurl, KEY_signurl)
if (VAL_signheader) chavy.setdata(VAL_signheader, KEY_signheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日签到)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signurl: ${VAL_signurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signheader: ${VAL_signheader}`)
} else if ($request.url.match(/\/api\/clock_sign.do/)) {
const VAL_signweburl = $request.url
const VAL_signwebheader = JSON.stringify($request.headers)
if (VAL_signweburl) chavy.setdata(VAL_signweburl, KEY_signweburl)
if (VAL_signwebheader) chavy.setdata(VAL_signwebheader, KEY_signwebheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日红包)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signweburl: ${VAL_signweburl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signwebheader: ${VAL_signwebheader}`)
const VAL_signweburl = $request.url
const VAL_signwebheader = JSON.stringify($request.headers)
if (VAL_signweburl) chavy.setdata(VAL_signweburl, KEY_signweburl)
if (VAL_signwebheader) chavy.setdata(VAL_signwebheader, KEY_signwebheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (每日红包)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signweburl: ${VAL_signweburl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signwebheader: ${VAL_signwebheader}`)
} else if ($request.url.match(/customerSignOperation.do/)) {
const VAL_signgameurl = $request.url
const VAL_signgameheader = JSON.stringify($request.headers)
if (VAL_signgameurl) chavy.setdata(VAL_signgameurl, KEY_signgameurl)
if (VAL_signgameheader) chavy.setdata(VAL_signgameheader, KEY_signgameheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (天天低价)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgameurl: ${VAL_signgameurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgameheader: ${VAL_signgameheader}`)
const VAL_signgameurl = $request.url
const VAL_signgameheader = JSON.stringify($request.headers)
if (VAL_signgameurl) chavy.setdata(VAL_signgameurl, KEY_signgameurl)
if (VAL_signgameheader) chavy.setdata(VAL_signgameheader, KEY_signgameheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (天天低价)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgameurl: ${VAL_signgameurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgameheader: ${VAL_signgameheader}`)
} else if ($request.url.match(/queryPrize.do/)) {
const VAL_signgetgameurl = $request.url
const VAL_signgetgameheader = JSON.stringify($request.headers)
if (VAL_signgetgameurl) chavy.setdata(VAL_signgetgameurl, KEY_signgetgameurl)
if (VAL_signgetgameheader) chavy.setdata(VAL_signgetgameheader, KEY_signgetgameheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (查询天天低价)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgetgameurl: ${VAL_signgetgameurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgetgameheader: ${VAL_signgetgameheader}`)
const VAL_signgetgameurl = $request.url
const VAL_signgetgameheader = JSON.stringify($request.headers)
if (VAL_signgetgameurl) chavy.setdata(VAL_signgetgameurl, KEY_signgetgameurl)
if (VAL_signgetgameheader) chavy.setdata(VAL_signgetgameheader, KEY_signgetgameheader)
chavy.msg(`${cookieName}`, '获取Cookie: 成功 (查询天天低价)', '')
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgetgameurl: ${VAL_signgetgameurl}`)
chavy.log(`${cookieName} 获取Cookie: 成功, VAL_signgetgameheader: ${VAL_signgetgameheader}`)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -30,291 +30,294 @@ let VAL_signgetgameheader = chavy.getdata(KEY_signgetgameheader)
let VAL_runflag = chavy.getdata(KEY_runflag)
;(sign = async () => {
chavy.log(`🔔 ${cookieName}`)
await loginapp()
if (VAL_signurl) await signapp()
await getinfo()
if (VAL_signweburl || VAL_signweburlBarry) await signweb(), await getwebinfo()
if (VAL_signgameurl && VAL_signgetgameurl) await signgame(), await getgameinfo()
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName}`)
await loginapp()
if (VAL_signurl) await signapp()
await getinfo()
if (VAL_signweburl || VAL_signweburlBarry) await signweb(), await getwebinfo()
if (VAL_signgameurl && VAL_signgetgameurl) await signgame(), await getgameinfo()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function loginapp() {
return new Promise((resolve, reject) => {
const url = { url: VAL_loginurl, body: VAL_loginbody, headers: JSON.parse(VAL_loginheader) }
// chavy.log(`❕ ${cookieName} loginapp - VAL_runflag: ${VAL_runflag}`)
// if (VAL_runflag) delete url.headers['Cookie']
// else chavy.setdata('true', KEY_runflag)
chavy.post(url, (error, response, data) => {
resolve()
return new Promise((resolve, reject) => {
const url = {url: VAL_loginurl, body: VAL_loginbody, headers: JSON.parse(VAL_loginheader)}
// chavy.log(`❕ ${cookieName} loginapp - VAL_runflag: ${VAL_runflag}`)
// if (VAL_runflag) delete url.headers['Cookie']
// else chavy.setdata('true', KEY_runflag)
chavy.post(url, (error, response, data) => {
resolve()
})
})
})
}
function signapp() {
return new Promise((resolve, reject) => {
const url = { url: VAL_signurl, headers: JSON.parse(VAL_signheader) }
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_signurl, headers: JSON.parse(VAL_signheader)}
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
signinfo.signapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function signgame() {
return new Promise((resolve, reject) => {
const url = { url: VAL_signgameurl, headers: JSON.parse(VAL_signgameheader) }
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signgame - response: ${JSON.stringify(response)}`)
signinfo.signgame = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `天天低价: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signgame - 签到失败: ${e}`)
chavy.log(`${cookieName} signgame - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_signgameurl, headers: JSON.parse(VAL_signgameheader)}
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signgame - response: ${JSON.stringify(response)}`)
signinfo.signgame = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `天天低价: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signgame - 签到失败: ${e}`)
chavy.log(`${cookieName} signgame - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function signweb() {
return new Promise((resolve, reject) => {
let url = null
if (VAL_signweburl) {
url = { url: VAL_signweburl, headers: JSON.parse(VAL_signwebheader) }
delete url.headers['Cookie']
url.headers['Host'] = 'luckman.suning.com'
url.headers['Referer'] = 'https: //luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SNEBUY-APP 8.5.0 SNCLIENT-WAP'
} else if (VAL_signweburlBarry) {
url = { url: VAL_signweburlBarry, headers: {} }
url.headers['Cookie'] = chavy.getdata('snyg_userCookieKey')
url.headers['Accept'] = 'application/json'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Connection'] = 'keep-alive'
url.headers['Referer'] = 'https://luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true'
url.headers['Host'] = 'luckman.suning.com'
url.headers['User-Agent'] = chavy.getdata('snyg_userAgentKey')
url.headers['Accept-Language'] = 'en-us'
url.headers['X-Requested-With'] = 'XMLHttpRequest'
}
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signweb - response: ${JSON.stringify(response)}`)
signinfo.signweb = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `每日红包: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signweb - 每日红包失败: ${e}`)
chavy.log(`${cookieName} signweb - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
let url = null
if (VAL_signweburl) {
url = {url: VAL_signweburl, headers: JSON.parse(VAL_signwebheader)}
delete url.headers['Cookie']
url.headers['Host'] = 'luckman.suning.com'
url.headers['Referer'] = 'https: //luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 SNEBUY-APP 8.5.0 SNCLIENT-WAP'
} else if (VAL_signweburlBarry) {
url = {url: VAL_signweburlBarry, headers: {}}
url.headers['Cookie'] = chavy.getdata('snyg_userCookieKey')
url.headers['Accept'] = 'application/json'
url.headers['Accept-Encoding'] = 'gzip, deflate, br'
url.headers['Connection'] = 'keep-alive'
url.headers['Referer'] = 'https://luckman.suning.com/luck-web/sign/app/index_sign.htm?wx_navbar_transparent=true'
url.headers['Host'] = 'luckman.suning.com'
url.headers['User-Agent'] = chavy.getdata('snyg_userAgentKey')
url.headers['Accept-Language'] = 'en-us'
url.headers['X-Requested-With'] = 'XMLHttpRequest'
}
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} signweb - response: ${JSON.stringify(response)}`)
signinfo.signweb = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `每日红包: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signweb - 每日红包失败: ${e}`)
chavy.log(`${cookieName} signweb - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getwebinfo() {
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime()).toString()
const VAL_webinfourl = `https://luckman.suning.com/luck-web/sign/api/query/detail/record_sign.do?terminal=app&channel=sign&_=${timestamp}`
const url = { url: VAL_webinfourl, headers: JSON.parse(VAL_signheader) }
delete url.headers['Cookie']
url.headers['Host'] = 'luckman.suning.com'
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getwebinfo - response: ${JSON.stringify(response)}`)
signinfo.webinfo = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `领红包结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getwebinfo - 领红包失败: ${e}`)
chavy.log(`${cookieName} getwebinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime()).toString()
const VAL_webinfourl = `https://luckman.suning.com/luck-web/sign/api/query/detail/record_sign.do?terminal=app&channel=sign&_=${timestamp}`
const url = {url: VAL_webinfourl, headers: JSON.parse(VAL_signheader)}
delete url.headers['Cookie']
url.headers['Host'] = 'luckman.suning.com'
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getwebinfo - response: ${JSON.stringify(response)}`)
signinfo.webinfo = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `领红包结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getwebinfo - 领红包失败: ${e}`)
chavy.log(`${cookieName} getwebinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getgameinfo() {
return new Promise((resolve, reject) => {
const url = { url: VAL_signgetgameurl, headers: JSON.parse(VAL_signgetgameheader) }
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getgameinfo - response: ${JSON.stringify(response)}`)
signinfo.gameinfo = JSON.parse(data.match(/\((.*)\)/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `查询天天低价: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getgameinfo - 查询天天低价失败: ${e}`)
chavy.log(`${cookieName} getgameinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: VAL_signgetgameurl, headers: JSON.parse(VAL_signgetgameheader)}
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getgameinfo - response: ${JSON.stringify(response)}`)
signinfo.gameinfo = JSON.parse(data.match(/\((.*)\)/)[1])
resolve()
} catch (e) {
chavy.msg(cookieName, `查询天天低价: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getgameinfo - 查询天天低价失败: ${e}`)
chavy.log(`${cookieName} getgameinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getinfo() {
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime()).toString()
const url = { url: `https://sign.suning.com/sign-web/m/newsign/getDiamondInfo.do?_=${timestamp}`, headers: JSON.parse(VAL_signheader) }
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getinfo - info: ${JSON.stringify(response)}`)
signinfo.info = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取签到信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime()).toString()
const url = {
url: `https://sign.suning.com/sign-web/m/newsign/getDiamondInfo.do?_=${timestamp}`,
headers: JSON.parse(VAL_signheader)
}
delete url.headers['Cookie']
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} getinfo - info: ${JSON.stringify(response)}`)
signinfo.info = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取签到信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle = ''
let detail = ''
let moreDetail = ''
if (signinfo.signapp && signinfo.signapp.code == '1') {
if (signinfo.signapp.data.todayFirstSignFlag == true) subTitle = '签到: 成功'
else subTitle = '签到: 重复'
for (myinfo of signinfo.info.data) {
detail += detail == '' ? '总共: ' : ', '
detail += myinfo.showLabel
}
if (signinfo.signapp.data.prizeLists) {
detail += `, 说明: 还有${signinfo.signapp.data.remainingPoint}云钻待领取`
const prizeLists = signinfo.signapp.data.prizeLists
const customerDays = signinfo.signapp.data.customerDays
const prize = prizeLists[customerDays - 1]
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n💎 每日签到: '
for (res of prize) moreDetail += `\n${res.prizeName}: ${res.prizeContent}`
}
} else {
subTitle = '签到: 失败'
chavy.log(`${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signapp)}`)
}
subTitle += subTitle == '' ? '' : ', '
if (signinfo.signweb) {
if (signinfo.signweb.respCode == '1') {
subTitle += '红包: 成功'
} else if (signinfo.signweb.respCode == '70512') {
subTitle += '红包: 重复'
let subTitle = ''
let detail = ''
let moreDetail = ''
if (signinfo.signapp && signinfo.signapp.code == '1') {
if (signinfo.signapp.data.todayFirstSignFlag == true) subTitle = '签到: 成功'
else subTitle = '签到: 重复'
for (myinfo of signinfo.info.data) {
detail += detail == '' ? '总共: ' : ', '
detail += myinfo.showLabel
}
if (signinfo.signapp.data.prizeLists) {
detail += `, 说明: 还有${signinfo.signapp.data.remainingPoint}云钻待领取`
const prizeLists = signinfo.signapp.data.prizeLists
const customerDays = signinfo.signapp.data.customerDays
const prize = prizeLists[customerDays - 1]
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n💎 每日签到: '
for (res of prize) moreDetail += `\n${res.prizeName}: ${res.prizeContent}`
}
} else {
subTitle += '红包: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`)
subTitle = '签到: 失败'
chavy.log(`${cookieName} showmsg - 每日签到: ${JSON.stringify(signinfo.signapp)}`)
}
} else {
subTitle += '红包: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`)
}
subTitle += subTitle == '' ? '' : ', '
if (signinfo.signgame && signinfo.signgame.code == '1') {
if (signinfo.signgame.data.resultCode == 'SG0000') {
subTitle += '低价: 成功'
} else if (signinfo.signgame.data.resultCode == 'SG0103') {
subTitle += '低价: 重复'
subTitle += subTitle == '' ? '' : ', '
if (signinfo.signweb) {
if (signinfo.signweb.respCode == '1') {
subTitle += '红包: 成功'
} else if (signinfo.signweb.respCode == '70512') {
subTitle += '红包: 重复'
} else {
subTitle += '红包: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`)
}
} else {
subTitle += '低价: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`)
subTitle += '红包: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signweb: ${JSON.stringify(signinfo.signweb)}`)
}
} else {
subTitle += '低价: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`)
}
if (signinfo.webinfo && signinfo.webinfo.respData) {
const currentIndex = signinfo.webinfo.respData.currentIndex
const detailTreeMap = signinfo.webinfo.respData.detailTreeMap
const currentMap = detailTreeMap[currentIndex]
if (currentMap.signMark == true) {
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n🧧 每日红包: '
for (res of currentMap.resList) moreDetail += `\n${res.remark}: ${res.amount}`
subTitle += subTitle == '' ? '' : ', '
if (signinfo.signgame && signinfo.signgame.code == '1') {
if (signinfo.signgame.data.resultCode == 'SG0000') {
subTitle += '低价: 成功'
} else if (signinfo.signgame.data.resultCode == 'SG0103') {
subTitle += '低价: 重复'
} else {
subTitle += '低价: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`)
}
} else {
chavy.log(`${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`)
subTitle += '低价: 失败'
chavy.log(`${cookieName} showmsg - 每日红包 - signgame: ${JSON.stringify(signinfo.signgame)}`)
}
} else {
chavy.log(`${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`)
}
if (signinfo.signgame && signinfo.gameinfo && signinfo.gameinfo.code == 1) {
if (signinfo.gameinfo.data.resultCode == 0000) {
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n💰 天天低价: '
for (d of signinfo.gameinfo.data.result.datas)
if (d.obj) moreDetail += `\n${d.obj.couponRuleName} (${d.obj.remainValue}元)`
else moreDetail += `\n${d.basePrizeEntity.prizeName} (${d.basePrizeEntity.prizeRules})`
if (signinfo.webinfo && signinfo.webinfo.respData) {
const currentIndex = signinfo.webinfo.respData.currentIndex
const detailTreeMap = signinfo.webinfo.respData.detailTreeMap
const currentMap = detailTreeMap[currentIndex]
if (currentMap.signMark == true) {
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n🧧 每日红包: '
for (res of currentMap.resList) moreDetail += `\n${res.remark}: ${res.amount}`
} else {
chavy.log(`${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`)
}
} else {
chavy.log(`${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`)
chavy.log(`${cookieName} showmsg - 每日红包 - webinfo: ${JSON.stringify(signinfo.webinfo)}`)
}
} else {
chavy.log(`${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`)
}
if (moreDetail) detail += `\n查看签到详情\n${moreDetail}`
chavy.msg(cookieName, subTitle, detail)
if (signinfo.signgame && signinfo.gameinfo && signinfo.gameinfo.code == 1) {
if (signinfo.gameinfo.data.resultCode == 0000) {
moreDetail += moreDetail == '' ? '' : '\n'
moreDetail += '\n💰 天天低价: '
for (d of signinfo.gameinfo.data.result.datas)
if (d.obj) moreDetail += `\n${d.obj.couponRuleName} (${d.obj.remainValue}元)`
else moreDetail += `\n${d.basePrizeEntity.prizeName} (${d.basePrizeEntity.prizeRules})`
} else {
chavy.log(`${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`)
}
} else {
chavy.log(`${cookieName} showmsg - 天天低价 - gameinfo: ${JSON.stringify(signinfo.gameinfo)}`)
}
if (moreDetail) detail += `\n查看签到详情\n${moreDetail}`
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,61 +4,61 @@ const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal.indexOf('BDUSS') > 0) {
let cookie = chavy.setdata(cookieVal, cookieKey)
if (cookie) {
let subTitle = '获取Cookie: 成功'
chavy.msg(`${cookieName}`, subTitle, '')
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
}
let cookie = chavy.setdata(cookieVal, cookieKey)
if (cookie) {
let subTitle = '获取Cookie: 成功'
chavy.msg(`${cookieName}`, subTitle, '')
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
}
} else {
let subTitle = '获取Cookie: 失败'
let detail = `请确保在已登录状态下获取Cookie`
chavy.msg(`${cookieName}`, subTitle, detail)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
let subTitle = '获取Cookie: 失败'
let detail = `请确保在已登录状态下获取Cookie`
chavy.msg(`${cookieName}`, subTitle, detail)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -7,225 +7,337 @@ $.CFG_maxSignBars = $.getdata('CFG_tieba_maxSignBars') * 1 || 5 // 每次并发
$.CFG_signWaitTime = $.getdata('CFG_tieba_signWaitTime') * 1 || 2000 // 每次并发间隔时间 (毫秒)
!(async () => {
await tieba()
await zhidao()
await showmsg()
await tieba()
await zhidao()
await showmsg()
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
.catch((e) => $.logErr(e))
.finally(() => $.done())
// 贴吧
function tieba() {
return new Promise((resove) => {
const url = { url: 'https://tieba.baidu.com/mo/q/newmoindex', headers: { Cookie: $.VAL_cookies } }
$.get(url, async (err, resp, data) => {
try {
const _data = JSON.parse(data)
// 处理异常
if (_data.no !== 0) {
throw new Error(`获取清单失败! 原因: ${_data.error}`)
}
// 组装数据
$.bars = []
$.tieba = { tbs: _data.data.tbs }
_data.data.like_forum.forEach((bar) => $.bars.push(barWrapper(bar)))
$.bars = $.bars.sort((a, b) => b.exp - a.exp)
// 开始签到
await signbars($.bars)
await getbars($.bars)
} catch (e) {
$.logErr(e, resp)
} finally {
resove()
}
return new Promise((resove) => {
const url = {url: 'https://tieba.baidu.com/mo/q/newmoindex', headers: {Cookie: $.VAL_cookies}}
$.get(url, async (err, resp, data) => {
try {
const _data = JSON.parse(data)
// 处理异常
if (_data.no !== 0) {
throw new Error(`获取清单失败! 原因: ${_data.error}`)
}
// 组装数据
$.bars = []
$.tieba = {tbs: _data.data.tbs}
_data.data.like_forum.forEach((bar) => $.bars.push(barWrapper(bar)))
$.bars = $.bars.sort((a, b) => b.exp - a.exp)
// 开始签到
await signbars($.bars)
await getbars($.bars)
} catch (e) {
$.logErr(e, resp)
} finally {
resove()
}
})
})
})
}
async function signbars(bars) {
let signbarActs = []
// 处理`已签`数据
bars.filter((bar) => bar.isSign).forEach((bar) => (bar.iscurSign = false))
// 处理`未签`数据
let _curbarIdx = 1
let _signbarCnt = 0
bars.filter((bar) => !bar.isSign).forEach((bar) => _signbarCnt++)
for (let bar of bars.filter((bar) => !bar.isSign)) {
const signbarAct = (resove) => {
const url = { url: 'https://tieba.baidu.com/sign/add', headers: { Cookie: $.VAL_cookies } }
url.body = `ie=utf-8&kw=${encodeURIComponent(bar.name)}&tbs=${$.tieba.tbs}`
url.headers['Host'] = 'tieba.baidu.com'
url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1'
$.post(url, (err, resp, data) => {
try {
const _data = JSON.parse(data)
bar.iscurSign = true
bar.issignSuc = _data.no === 0 || _data.no === 1101
bar.signNo = _data.no
bar.signMsg = _data.no === 1102 ? '签得太快!' : _data.error
bar.signMsg = _data.no === 2150040 ? '需要验证码!' : _data.error
} catch (e) {
bar.iscurSign = true
bar.issignSuc = false
bar.signNo = null
bar.signMsg = error !== null ? error : e
$.logErr(e, resp)
} finally {
$.log(`❕ 贴吧:【${bar.name}】签到完成!`)
resove()
let signbarActs = []
// 处理`已签`数据
bars.filter((bar) => bar.isSign).forEach((bar) => (bar.iscurSign = false))
// 处理`未签`数据
let _curbarIdx = 1
let _signbarCnt = 0
bars.filter((bar) => !bar.isSign).forEach((bar) => _signbarCnt++)
for (let bar of bars.filter((bar) => !bar.isSign)) {
const signbarAct = (resove) => {
const url = {url: 'https://tieba.baidu.com/sign/add', headers: {Cookie: $.VAL_cookies}}
url.body = `ie=utf-8&kw=${encodeURIComponent(bar.name)}&tbs=${$.tieba.tbs}`
url.headers['Host'] = 'tieba.baidu.com'
url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1'
$.post(url, (err, resp, data) => {
try {
const _data = JSON.parse(data)
bar.iscurSign = true
bar.issignSuc = _data.no === 0 || _data.no === 1101
bar.signNo = _data.no
bar.signMsg = _data.no === 1102 ? '签得太快!' : _data.error
bar.signMsg = _data.no === 2150040 ? '需要验证码!' : _data.error
} catch (e) {
bar.iscurSign = true
bar.issignSuc = false
bar.signNo = null
bar.signMsg = error !== null ? error : e
$.logErr(e, resp)
} finally {
$.log(`❕ 贴吧:【${bar.name}】签到完成!`)
resove()
}
})
}
})
signbarActs.push(new Promise(signbarAct))
if (signbarActs.length === $.CFG_maxSignBars || _signbarCnt === _curbarIdx) {
$.log('', `⏳ 正在发起 ${signbarActs.length} 个签到任务!`)
await Promise.all(signbarActs)
await $.wait($.CFG_signWaitTime)
signbarActs = []
}
_curbarIdx++
}
signbarActs.push(new Promise(signbarAct))
if (signbarActs.length === $.CFG_maxSignBars || _signbarCnt === _curbarIdx) {
$.log('', `⏳ 正在发起 ${signbarActs.length} 个签到任务!`)
await Promise.all(signbarActs)
await $.wait($.CFG_signWaitTime)
signbarActs = []
}
_curbarIdx++
}
}
function getbars(bars) {
const getBarActs = []
for (let bar of bars) {
const getBarAct = (resove) => {
const url = { url: `http://tieba.baidu.com/sign/loadmonth?kw=${encodeURIComponent(bar.name)}&ie=utf-8`, headers: { Cookie: $.VAL_cookies } }
url.headers['Host'] = 'tieba.baidu.com'
url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1'
$.get(url, (err, resp, data) => {
try {
const _signinfo = JSON.parse(data).data.sign_user_info
bar.signRank = _signinfo.rank
bar.contsignCnt = _signinfo.sign_keep
bar.totalsignCnt = _signinfo.sign_total
} catch (e) {
bar.contsignCnt = '❓'
$.logErr(e, response)
} finally {
resove()
const getBarActs = []
for (let bar of bars) {
const getBarAct = (resove) => {
const url = {
url: `http://tieba.baidu.com/sign/loadmonth?kw=${encodeURIComponent(bar.name)}&ie=utf-8`,
headers: {Cookie: $.VAL_cookies}
}
url.headers['Host'] = 'tieba.baidu.com'
url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1'
$.get(url, (err, resp, data) => {
try {
const _signinfo = JSON.parse(data).data.sign_user_info
bar.signRank = _signinfo.rank
bar.contsignCnt = _signinfo.sign_keep
bar.totalsignCnt = _signinfo.sign_total
} catch (e) {
bar.contsignCnt = '❓'
$.logErr(e, response)
} finally {
resove()
}
})
}
})
getBarActs.push(new Promise(getBarAct))
}
getBarActs.push(new Promise(getBarAct))
}
return Promise.all(getBarActs)
return Promise.all(getBarActs)
}
async function zhidao() {
await loginZhidao()
await signZhidao()
await loginZhidao()
await signZhidao()
}
function loginZhidao() {
return new Promise((resove) => {
const url = { url: 'https://zhidao.baidu.com/', headers: { Cookie: $.VAL_cookies } }
url.headers['Host'] = 'zhidao.baidu.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.zhidao = {}
$.post(url, (err, resp, data) => {
try {
$.zhidao.stoken = data.match(/"stoken"[^"]*"([^"]*)"/)[1]
if (!$.zhidao.stoken) {
throw new Error(`获取 stoken 失败! stoken: ${$.zhidao.stoken}`)
}
$.zhidao.isloginSuc = true
$.zhidao.loginMsg = '登录成功'
} catch (e) {
$.zhidao.isloginSuc = false
$.zhidao.loginMsg = '登录失败'
$.logErr(e, resp)
} finally {
resove()
}
return new Promise((resove) => {
const url = {url: 'https://zhidao.baidu.com/', headers: {Cookie: $.VAL_cookies}}
url.headers['Host'] = 'zhidao.baidu.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
$.zhidao = {}
$.post(url, (err, resp, data) => {
try {
$.zhidao.stoken = data.match(/"stoken"[^"]*"([^"]*)"/)[1]
if (!$.zhidao.stoken) {
throw new Error(`获取 stoken 失败! stoken: ${$.zhidao.stoken}`)
}
$.zhidao.isloginSuc = true
$.zhidao.loginMsg = '登录成功'
} catch (e) {
$.zhidao.isloginSuc = false
$.zhidao.loginMsg = '登录失败'
$.logErr(e, resp)
} finally {
resove()
}
})
})
})
}
function signZhidao() {
// 登录失败, 直接跳出
if (!$.zhidao.isloginSuc) {
return null
}
return new Promise((resove) => {
const url = { url: 'https://zhidao.baidu.com/submit/user', headers: { Cookie: $.VAL_cookies } }
url.headers['Host'] = 'zhidao.baidu.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
const timestamp = Date.parse(new Date())
const utdata = `61,61,7,0,0,0,12,61,5,2,12,4,24,5,4,1,4,${timestamp}`
url.body = `cm=100509&utdata=${utdata}&stoken=${$.zhidao.stoken}`
$.post(url, (err, resp, data) => {
try {
const _data = JSON.parse(data)
$.zhidao.isSignSuc = true
$.zhidao.signNo = _data.errorNo
$.zhidao.signMsg = _data.errorMsg
} catch (e) {
$.zhidao.isSignSuc = false
$.zhidao.signNo = null
$.zhidao.signMsg = e
$.logErr(e, resp)
} finally {
resove()
}
// 登录失败, 直接跳出
if (!$.zhidao.isloginSuc) {
return null
}
return new Promise((resove) => {
const url = {url: 'https://zhidao.baidu.com/submit/user', headers: {Cookie: $.VAL_cookies}}
url.headers['Host'] = 'zhidao.baidu.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15'
const timestamp = Date.parse(new Date())
const utdata = `61,61,7,0,0,0,12,61,5,2,12,4,24,5,4,1,4,${timestamp}`
url.body = `cm=100509&utdata=${utdata}&stoken=${$.zhidao.stoken}`
$.post(url, (err, resp, data) => {
try {
const _data = JSON.parse(data)
$.zhidao.isSignSuc = true
$.zhidao.signNo = _data.errorNo
$.zhidao.signMsg = _data.errorMsg
} catch (e) {
$.zhidao.isSignSuc = false
$.zhidao.signNo = null
$.zhidao.signMsg = e
$.logErr(e, resp)
} finally {
resove()
}
})
})
})
}
function barWrapper(bar) {
return { id: bar.forum_id, name: bar.forum_name, exp: bar.user_exp, level: bar.user_level, isSign: bar.is_sign === 1 }
return {id: bar.forum_id, name: bar.forum_name, exp: bar.user_exp, level: bar.user_level, isSign: bar.is_sign === 1}
}
function showmsg() {
return new Promise((resolve) => {
// 数据: 签到数量
const allbarCnt = $.bars.length
let allsignCnt = 0
let cursignCnt = 0
let curfailCnt = 0
$.bars.filter((bar) => bar.isSign).forEach((bar) => (allsignCnt += 1))
$.bars.filter((bar) => bar.iscurSign && bar.issignSuc).forEach((bar) => (cursignCnt += 1))
$.bars.filter((bar) => bar.iscurSign && !bar.issignSuc).forEach((bar) => (curfailCnt += 1))
$.bars = [true, 'true'].includes($.CFG_isOrderBars) ? $.bars.sort((a, b) => b.contsignCnt - a.contsignCnt) : $.bars
allsignCnt += cursignCnt
// 通知: 副标题
let tiebasubt = '贴吧: '
if (allbarCnt == allsignCnt) tiebasubt += '成功'
else if (allbarCnt == curfailCnt) tiebasubt += '失败'
else tiebasubt += '部分'
let zhidaosubt = '知道: '
if ($.zhidao.isSignSuc && $.zhidao.signNo === 0) zhidaosubt += '成功'
else if ($.zhidao.isSignSuc && $.zhidao.signNo === 2) zhidaosubt += '重复'
else zhidaosubt += '失败'
// 通知: 详情
let _curPage = 1
const _totalPage = Math.ceil(allbarCnt / $.CFG_maxShowBars)
return new Promise((resolve) => {
// 数据: 签到数量
const allbarCnt = $.bars.length
let allsignCnt = 0
let cursignCnt = 0
let curfailCnt = 0
$.bars.filter((bar) => bar.isSign).forEach((bar) => (allsignCnt += 1))
$.bars.filter((bar) => bar.iscurSign && bar.issignSuc).forEach((bar) => (cursignCnt += 1))
$.bars.filter((bar) => bar.iscurSign && !bar.issignSuc).forEach((bar) => (curfailCnt += 1))
$.bars = [true, 'true'].includes($.CFG_isOrderBars) ? $.bars.sort((a, b) => b.contsignCnt - a.contsignCnt) : $.bars
allsignCnt += cursignCnt
// 通知: 副标题
let tiebasubt = '贴吧: '
if (allbarCnt == allsignCnt) tiebasubt += '成功'
else if (allbarCnt == curfailCnt) tiebasubt += '失败'
else tiebasubt += '部分'
let zhidaosubt = '知道: '
if ($.zhidao.isSignSuc && $.zhidao.signNo === 0) zhidaosubt += '成功'
else if ($.zhidao.isSignSuc && $.zhidao.signNo === 2) zhidaosubt += '重复'
else zhidaosubt += '失败'
// 通知: 详情
let _curPage = 1
const _totalPage = Math.ceil(allbarCnt / $.CFG_maxShowBars)
$.desc = []
$.bars.forEach((bar, index) => {
const barno = index + 1
const signbar = `${bar.isSign || bar.issignSuc ? '🟢' : '🔴'} [${barno}]【${bar.name}】排名: ${bar.signRank}`
const signlevel = `等级: ${bar.level}`
const signexp = `经验: ${bar.exp}`
const signcnt = `连签: ${bar.contsignCnt}/${bar.totalsignCnt}`
const signmsg = `${bar.isSign || bar.issignSuc ? '' : `失败原因: ${bar.signMsg}\n`}`
$.desc.push(`${signbar}`)
$.desc.push(`${signlevel}, ${signexp}, ${signcnt}`)
$.desc.push(`${signmsg}`)
if (barno % $.CFG_maxShowBars === 0 || barno === allbarCnt) {
const _descinfo = []
_descinfo.push(`共签: ${allsignCnt}/${allbarCnt}, 本次成功: ${cursignCnt}, 本次失败: ${curfailCnt}`)
_descinfo.push(`点击查看详情, 第 ${_curPage++}/${_totalPage}`)
$.subt = `${tiebasubt}, ${zhidaosubt}`
$.desc = [..._descinfo, '', ...$.desc].join('\n')
$.msg($.name, $.subt, $.desc)
$.desc = []
}
$.bars.forEach((bar, index) => {
const barno = index + 1
const signbar = `${bar.isSign || bar.issignSuc ? '🟢' : '🔴'} [${barno}]【${bar.name}】排名: ${bar.signRank}`
const signlevel = `等级: ${bar.level}`
const signexp = `经验: ${bar.exp}`
const signcnt = `连签: ${bar.contsignCnt}/${bar.totalsignCnt}`
const signmsg = `${bar.isSign || bar.issignSuc ? '' : `失败原因: ${bar.signMsg}\n`}`
$.desc.push(`${signbar}`)
$.desc.push(`${signlevel}, ${signexp}, ${signcnt}`)
$.desc.push(`${signmsg}`)
if (barno % $.CFG_maxShowBars === 0 || barno === allbarCnt) {
const _descinfo = []
_descinfo.push(`共签: ${allsignCnt}/${allbarCnt}, 本次成功: ${cursignCnt}, 本次失败: ${curfailCnt}`)
_descinfo.push(`点击查看详情, 第 ${_curPage++}/${_totalPage}`)
$.subt = `${tiebasubt}, ${zhidaosubt}`
$.desc = [..._descinfo, '', ...$.desc].join('\n')
$.msg($.name, $.subt, $.desc)
$.desc = []
}
})
resolve()
})
resolve()
})
}
// prettier-ignore
function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
function Env(t, s) {
return new class {
constructor(t, s) {
this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
}
isNode() {
return "undefined" != typeof module && !!module.exports
}
isQuanX() {
return "undefined" != typeof $task
}
isSurge() {
return "undefined" != typeof $httpClient
}
isLoon() {
return "undefined" != typeof $loon
}
loaddata() {
if (!this.isNode) return {};
{
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s);
if (!e && !i) return {};
{
const i = e ? t : s;
try {
return JSON.parse(this.fs.readFileSync(i))
} catch {
return {}
}
}
}
}
writedata() {
if (this.isNode) {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), h = JSON.stringify(this.data);
e ? this.fs.writeFileSync(t, h) : i ? this.fs.writeFileSync(s, h) : this.fs.writeFileSync(t, h)
}
}
getdata(t) {
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setdata(t, s) {
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || null
}
get(t, s = (() => {
})) {
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}) : this.isQuanX() ? $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)) : this.isNode() && (this.got = this.got ? this.got : require("got"), this.got(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)))
}
post(t, s = (() => {
})) {
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)); else if (this.isNode()) {
this.got = this.got ? this.got : require("got");
const {url: e, ...i} = t;
this.got.post(e, i).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t))
}
}
msg(s = t, e = "", i = "", h) {
this.isSurge() || this.isLoon() ? $notification.post(s, e, i) : this.isQuanX() && $notify(s, e, i), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i)
}
log(...t) {
t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator))
}
logErr(t, s) {
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.message)
}
wait(t) {
return new Promise(s => setTimeout(s, t))
}
done(t = null) {
const s = (new Date).getTime(), e = (s - this.startTime) / 1e3;
this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, s)
}

View File

@ -3,13 +3,13 @@ const cookieKey = 'chavy_cookie_v2ex'
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notify(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
let cookie = $prefs.setValueForKey(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notify(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
}
$done({})

View File

@ -3,49 +3,49 @@ const cookieKey = 'chavy_cookie_v2ex'
const cookieVal = $prefs.valueForKey(cookieKey)
function sign() {
let url = {
url: `https://www.v2ex.com/mission/daily`,
method: 'GET',
headers: {
Cookie: cookieVal
let url = {
url: `https://www.v2ex.com/mission/daily`,
method: 'GET',
headers: {
Cookie: cookieVal
}
}
}
$task.fetch(url).then((response) => {
let data = response.body
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到跳过`
let detail = `今天已经签过了`
console.log(`${title}, ${subTitle}, ${detail}`)
$notify(title, subTitle, detail)
} else {
signMission(data.match(/<input[^>]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1])
}
})
$task.fetch(url).then((response) => {
let data = response.body
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到跳过`
let detail = `今天已经签过了`
console.log(`${title}, ${subTitle}, ${detail}`)
$notify(title, subTitle, detail)
} else {
signMission(data.match(/<input[^>]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1])
}
})
}
function signMission(code) {
let url = {
url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`,
method: 'GET',
headers: { Cookie: cookieVal }
}
$task.fetch(url).then((response) => {
let data = response.body
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到成功`
let detail = ``
console.log(`${title}, ${subTitle}, ${detail}`)
$notify(title, subTitle, detail)
} else {
let title = `${cookieName}`
let subTitle = `签到结果: 签到失败`
let detail = `详见日志`
console.log(`签到失败: ${cookieName}, data: ${data}`)
$notify(title, subTitle, detail)
let url = {
url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`,
method: 'GET',
headers: {Cookie: cookieVal}
}
})
$task.fetch(url).then((response) => {
let data = response.body
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到成功`
let detail = ``
console.log(`${title}, ${subTitle}, ${detail}`)
$notify(title, subTitle, detail)
} else {
let title = `${cookieName}`
let subTitle = `签到结果: 签到失败`
let detail = `详见日志`
console.log(`签到失败: ${cookieName}, data: ${data}`)
$notify(title, subTitle, detail)
}
})
}
sign({})

View File

@ -3,13 +3,13 @@ const cookieKey = 'chavy_cookie_v2ex'
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
let cookie = $persistentStore.write(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notification.post(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
let cookie = $persistentStore.write(cookieVal, cookieKey)
if (cookie) {
let msg = `${cookieName}`
$notification.post(msg, 'Cookie写入成功', '详见日志')
console.log(msg)
console.log(cookieVal)
}
}
$done({})

View File

@ -3,46 +3,46 @@ const cookieKey = 'chavy_cookie_v2ex'
const cookieVal = $persistentStore.read(cookieKey)
function sign() {
let url = {
url: `https://www.v2ex.com/mission/daily`,
headers: {
Cookie: cookieVal
let url = {
url: `https://www.v2ex.com/mission/daily`,
headers: {
Cookie: cookieVal
}
}
}
$httpClient.get(url, (error, response, data) => {
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到跳过`
let detail = `今天已经签过了`
console.log(`${title}, ${subTitle}, ${detail}`)
$notification.post(title, subTitle, detail)
} else {
signMission(data.match(/<input[^>]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1])
}
})
$done({})
$httpClient.get(url, (error, response, data) => {
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到跳过`
let detail = `今天已经签过了`
console.log(`${title}, ${subTitle}, ${detail}`)
$notification.post(title, subTitle, detail)
} else {
signMission(data.match(/<input[^>]*\/mission\/daily\/redeem\?once=(\d+)[^>]*>/)[1])
}
})
$done({})
}
function signMission(code) {
let url = {
url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`,
headers: { Cookie: cookieVal }
}
$httpClient.get(url, (error, response, data) => {
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到成功`
let detail = ``
console.log(`${title}, ${subTitle}, ${detail}`)
$notification.post(title, subTitle, detail)
} else {
let title = `${cookieName}`
let subTitle = `签到结果: 签到失败`
let detail = `详见日志`
console.log(`签到失败: ${cookieName}, error: ${error}, response: ${response}, data: ${data}`)
$notification.post(title, subTitle, detail)
let url = {
url: `https://www.v2ex.com/mission/daily/redeem?once=${code}`,
headers: {Cookie: cookieVal}
}
})
$httpClient.get(url, (error, response, data) => {
if (data.indexOf('每日登录奖励已领取') >= 0) {
let title = `${cookieName}`
let subTitle = `签到结果: 签到成功`
let detail = ``
console.log(`${title}, ${subTitle}, ${detail}`)
$notification.post(title, subTitle, detail)
} else {
let title = `${cookieName}`
let subTitle = `签到结果: 签到失败`
let detail = `详见日志`
console.log(`签到失败: ${cookieName}, error: ${error}, response: ${response}, data: ${data}`)
$notification.post(title, subTitle, detail)
}
})
}
sign({})

View File

@ -13,7 +13,7 @@
* # Loon
* http-response ^https:\/\/user-api-prd-mx\.wandafilm\.com script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.cookie.js
* cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/wanda/wanda.js
*
*
* # 获取方式:进入签到页面获取网页端:https://act-m.wandacinemas.com/2005/17621a8caacc4d190dadd/
*/
@ -21,18 +21,127 @@ const $ = new Env('万达影城')
$._mi_ = 'senku_wanda_mi_'
!(async () => {
const session = {}
session.url = $request.url
session.headers = JSON.parse($request.headers['MX-API'])['_mi_']
if (session.headers&&$.setdata(session.headers, $._mi_)) {
$.subt = `获取会话: 成功! (${$._mi_})`
} else {
$.subt = `获取会话: 失败! (${$._mi_})`
}
$.msg($.name, $.subt, $.desc)
const session = {}
session.url = $request.url
session.headers = JSON.parse($request.headers['MX-API'])['_mi_']
if (session.headers && $.setdata(session.headers, $._mi_)) {
$.subt = `获取会话: 成功! (${$._mi_})`
} else {
$.subt = `获取会话: 失败! (${$._mi_})`
}
$.msg($.name, $.subt, $.desc)
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
.catch((e) => $.logErr(e))
.finally(() => $.done())
// prettier-ignore
function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient}isLoon(){return"undefined"!=typeof $loon}loaddata(){if(!this.isNode)return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch{return{}}}}}writedata(){if(this.isNode){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),h=JSON.stringify(this.data);e?this.fs.writeFileSync(t,h):i?this.fs.writeFileSync(s,h):this.fs.writeFileSync(t,h)}}getdata(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setdata(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)):this.isNode()&&(this.got=this.got?this.got:require("got"),this.got(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status,s(t,e,i))});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t));else if(this.isNode()){this.got=this.got?this.got:require("got");const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:h,body:o}=t;s(null,{status:e,statusCode:i,headers:h,body:o},o)},t=>s(t))}}msg(s=t,e="",i="",h){this.isSurge()||this.isLoon()?$notification.post(s,e,i):this.isQuanX()&&$notify(s,e,i),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.message)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t=null){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
function Env(t, s) {
return new class {
constructor(t, s) {
this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
}
isNode() {
return "undefined" != typeof module && !!module.exports
}
isQuanX() {
return "undefined" != typeof $task
}
isSurge() {
return "undefined" != typeof $httpClient
}
isLoon() {
return "undefined" != typeof $loon
}
loaddata() {
if (!this.isNode) return {};
{
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s);
if (!e && !i) return {};
{
const i = e ? t : s;
try {
return JSON.parse(this.fs.readFileSync(i))
} catch {
return {}
}
}
}
}
writedata() {
if (this.isNode) {
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile),
e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), h = JSON.stringify(this.data);
e ? this.fs.writeFileSync(t, h) : i ? this.fs.writeFileSync(s, h) : this.fs.writeFileSync(t, h)
}
}
getdata(t) {
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setdata(t, s) {
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || null
}
get(t, s = (() => {
})) {
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}) : this.isQuanX() ? $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)) : this.isNode() && (this.got = this.got ? this.got : require("got"), this.got(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)))
}
post(t, s = (() => {
})) {
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => {
!t && e && (e.body = i, e.statusCode = e.status, s(t, e, i))
}); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t)); else if (this.isNode()) {
this.got = this.got ? this.got : require("got");
const {url: e, ...i} = t;
this.got.post(e, i).then(t => {
const {statusCode: e, statusCode: i, headers: h, body: o} = t;
s(null, {status: e, statusCode: i, headers: h, body: o}, o)
}, t => s(t))
}
}
msg(s = t, e = "", i = "", h) {
this.isSurge() || this.isLoon() ? $notification.post(s, e, i) : this.isQuanX() && $notify(s, e, i), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i)
}
log(...t) {
t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator))
}
logErr(t, s) {
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.message)
}
wait(t) {
return new Promise(s => setTimeout(s, t))
}
done(t = null) {
const s = (new Date).getTime(), e = (s - this.startTime) / 1e3;
this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, s)
}

File diff suppressed because one or more lines are too long

View File

@ -9,73 +9,74 @@ const chavy = init()
const requrl = $request.url
const reqRef = $request.headers.Referer
if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/entry/)) {
const tokenurlVal = requrl
const tokenheaderVal = JSON.stringify($request.headers)
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``)
const tokenurlVal = requrl
const tokenheaderVal = JSON.stringify($request.headers)
if (tokenurlVal) chavy.setdata(tokenurlVal, tokenurlKey)
if (tokenheaderVal) chavy.setdata(tokenheaderVal, tokenheaderKey)
title = chavy.msg(cookieName, `获取刷新链接: 成功`, ``)
} else if ($request && $request.method != 'OPTIONS' && requrl.match(/playcenter\/signIn\/doaction/)) {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
else {
const tokenurlVal = chavy.getdata(tokenurlKey)
const body = {}
body.activityViewId = tokenurlVal.match(/activityViewId=(.*?)(&|$)/)[1]
body.lat = tokenurlVal.match(/lat=(.*?)(&|$)/)[1]
body.lng = tokenurlVal.match(/lng=(.*?)(&|$)/)[1]
body.checkLogin = true
body.appType = 3
body.deviceType = 2
chavy.setdata(JSON.stringify(body), signbodyKey)
}
title = chavy.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) chavy.setdata(signurlVal, signurlKey)
if (signheaderVal) chavy.setdata(signheaderVal, signheaderKey)
if (signbodyVal) chavy.setdata(signbodyVal, signbodyKey)
else {
const tokenurlVal = chavy.getdata(tokenurlKey)
const body = {}
body.activityViewId = tokenurlVal.match(/activityViewId=(.*?)(&|$)/)[1]
body.lat = tokenurlVal.match(/lat=(.*?)(&|$)/)[1]
body.lng = tokenurlVal.match(/lng=(.*?)(&|$)/)[1]
body.checkLogin = true
body.appType = 3
body.deviceType = 2
chavy.setdata(JSON.stringify(body), signbodyKey)
}
title = chavy.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -14,67 +14,67 @@ const signBodyVal = chavy.getdata(signbodyKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
if (result.code == 0 && result.subcode == 0) {
subTitle = `签到结果: 成功`
detail = `说明: ${result.msg}`
} else if (result.code == 1 && result.subcode == 3) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.msg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}-${result.subcode}, 说明: ${result.msg}`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
let subTitle = ``
let detail = ``
if (result.code == 0 && result.subcode == 0) {
subTitle = `签到结果: 成功`
detail = `说明: ${result.msg}`
} else if (result.code == 1 && result.subcode == 3) {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.msg}`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${result.code}-${result.subcode}, 说明: ${result.msg}`
}
chavy.msg(cookieName, subTitle, detail)
chavy.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,56 +6,57 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS') {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

View File

@ -10,66 +10,66 @@ const signBodyVal = senku.getdata(signbodyKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, data: ${data}`)
const res = JSON.parse(data)
let subTitle = ``
let detail = ``
if (res.retCode == 200) {
subTitle = `签到结果: 成功`
detail = `获得:${res.data.popupWindowInfo.frontRewardName},签到天数:${res.data.signCount}`
} else if (res.retCode==401 || res.retCode==403 || res.code==401) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${res.code}, 说明: ${res.msg}`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, data: ${data}`)
const res = JSON.parse(data)
let subTitle = ``
let detail = ``
if (res.retCode == 200) {
subTitle = `签到结果: 成功`
detail = `获得:${res.data.popupWindowInfo.frontRewardName},签到天数:${res.data.signCount}`
} else if (res.retCode == 401 || res.retCode == 403 || res.code == 401) {
subTitle = `签到结果: 成功 (重复签到)`
} else {
subTitle = `签到结果: 失败`
detail = `编码: ${res.code}, 说明: ${res.msg}`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -3,53 +3,54 @@ const cookieKey = 'chavy_cookie_ximalaya'
const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -6,179 +6,182 @@ const signinfo = {}
let VAL_signcookie = chavy.getdata(KEY_signcookie)
;(exec = async () => {
chavy.log(`🔔 ${cookieName} 开始签到`)
await getinfo()
if (signinfo.info.isTickedToday == false) await signapp()
// await browseapp()
await getacc()
showmsg()
chavy.done()
chavy.log(`🔔 ${cookieName} 开始签到`)
await getinfo()
if (signinfo.info.isTickedToday == false) await signapp()
// await browseapp()
await getacc()
showmsg()
chavy.done()
})().catch((e) => chavy.log(`${cookieName} 签到失败: ${e}`), chavy.done())
function signapp() {
return new Promise((resolve, reject) => {
const url = { url: `https://m.ximalaya.com/starwar/lottery/check-in/check/action`, headers: { Cookie: VAL_signcookie } }
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = data
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {
url: `https://m.ximalaya.com/starwar/lottery/check-in/check/action`,
headers: {Cookie: VAL_signcookie}
}
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.post(url, (error, response, data) => {
try {
signinfo.signapp = data
resolve()
} catch (e) {
chavy.msg(cookieName, `签到结果: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} signapp - 签到失败: ${e}`)
chavy.log(`${cookieName} signapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function browseapp() {
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const browseappurl = `https://mobile.ximalaya.com/daily-label-mobile/v1/task/checkIn/ts-${timestamp}?coinSwitch=true`
const url = { url: browseappurl, headers: { Cookie: VAL_signcookie } }
url.headers['Accept'] = '*/*'
url.headers['Accept-Encoding'] = 'gzip, deflate'
url.headers['Accept-Language'] = 'zh-Hans-CN;q=1, en-US;q=0.9'
url.headers['Connection'] = 'close'
url.headers['Host'] = 'mobile.ximalaya.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
signinfo.browseapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `每日浏览: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} browseapp - 每日浏览: ${e}`)
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const timestamp = Math.round(new Date().getTime() / 1000).toString()
const browseappurl = `https://mobile.ximalaya.com/daily-label-mobile/v1/task/checkIn/ts-${timestamp}?coinSwitch=true`
const url = {url: browseappurl, headers: {Cookie: VAL_signcookie}}
url.headers['Accept'] = '*/*'
url.headers['Accept-Encoding'] = 'gzip, deflate'
url.headers['Accept-Language'] = 'zh-Hans-CN;q=1, en-US;q=0.9'
url.headers['Connection'] = 'close'
url.headers['Host'] = 'mobile.ximalaya.com'
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
signinfo.browseapp = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `每日浏览: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} browseapp - 每日浏览: ${e}`)
chavy.log(`${cookieName} browseapp - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getinfo() {
return new Promise((resolve, reject) => {
const url = { url: `https://m.ximalaya.com/starwar/lottery/check-in/record`, headers: { Cookie: VAL_signcookie } }
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/json;charset=utf-8`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
signinfo.info = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取签到信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: `https://m.ximalaya.com/starwar/lottery/check-in/record`, headers: {Cookie: VAL_signcookie}}
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/json;charset=utf-8`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
signinfo.info = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取签到信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getinfo - 获取签到信息失败: ${e}`)
chavy.log(`${cookieName} getinfo - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function getacc() {
return new Promise((resolve, reject) => {
const url = { url: `https://m.ximalaya.com/starwar/task/listen/account`, headers: { Cookie: VAL_signcookie } }
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/json;charset=utf-8`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
signinfo.acc = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取账号信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getacc - 获取账号信息失败: ${e}`)
chavy.log(`${cookieName} getacc - response: ${JSON.stringify(response)}`)
resolve()
}
return new Promise((resolve, reject) => {
const url = {url: `https://m.ximalaya.com/starwar/task/listen/account`, headers: {Cookie: VAL_signcookie}}
url.headers['Accept'] = `application/json, text/plain, */*`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Accept-Language'] = `zh-cn`
url.headers['Connection'] = `keep-alive`
url.headers['Content-Type'] = `application/json;charset=utf-8`
url.headers['Host'] = `m.ximalaya.com`
url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/6.6.45 kdtunion_iting/1.0 iting(main)/6.6.45/ios_1'
chavy.get(url, (error, response, data) => {
try {
signinfo.acc = JSON.parse(data)
resolve()
} catch (e) {
chavy.msg(cookieName, `获取账号信息: 失败`, `说明: ${e}`)
chavy.log(`${cookieName} getacc - 获取账号信息失败: ${e}`)
chavy.log(`${cookieName} getacc - response: ${JSON.stringify(response)}`)
resolve()
}
})
})
})
}
function showmsg() {
let subTitle = ''
let detail = ''
if (signinfo.info.isTickedToday == false) {
if (signinfo.signapp == 'true') {
subTitle = '签到: 成功'
detail = `共签: ${signinfo.info.totalCheckedCounts + 1}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})`
let subTitle = ''
let detail = ''
if (signinfo.info.isTickedToday == false) {
if (signinfo.signapp == 'true') {
subTitle = '签到: 成功'
detail = `共签: ${signinfo.info.totalCheckedCounts + 1}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})`
} else {
subTitle = '签到: 失败'
detail = `说明: ${signinfo.signapp}`
}
} else {
subTitle = '签到: 失败'
detail = `说明: ${signinfo.signapp}`
subTitle = `签到: 重复`
detail = `共签: ${signinfo.info.totalCheckedCounts}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})`
}
} else {
subTitle = `签到: 重复`
detail = `共签: ${signinfo.info.totalCheckedCounts}天, 积分: ${signinfo.acc.data.score}(+${signinfo.info.awardAmount})`
}
if (signinfo.browseapp) {
if (signinfo.browseapp.ret == 0 && signinfo.browseapp.data && signinfo.browseapp.data.awards) {
if (signinfo.browseapp.data.awards) subTitle += `, 每日浏览: 成功 (${signinfo.browseapp.data.awards})`
else subTitle += ', 每日浏览: 重复'
} else {
subTitle += ', 每日浏览: 失败'
if (signinfo.browseapp) {
if (signinfo.browseapp.ret == 0 && signinfo.browseapp.data && signinfo.browseapp.data.awards) {
if (signinfo.browseapp.data.awards) subTitle += `, 每日浏览: 成功 (${signinfo.browseapp.data.awards})`
else subTitle += ', 每日浏览: 重复'
} else {
subTitle += ', 每日浏览: 失败'
}
}
}
chavy.msg(cookieName, subTitle, detail)
chavy.msg(cookieName, subTitle, detail)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -4,69 +4,70 @@ const tokenKey = 'chavy_token_yanxuan'
const chavy = init()
const cookieVal = $request.headers['Cookie']
if (cookieVal.indexOf('yx_csrf') > 0) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName}`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName}] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
} else {
chavy.msg(`${cookieName}`, '获取Cookie: 失败', `请确保在已登录状态下获取Cookie`)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
chavy.msg(`${cookieName}`, '获取Cookie: 失败', `请确保在已登录状态下获取Cookie`)
chavy.log(`[${cookieName}] ${subTitle}, cookie: ${cookieVal}`)
}
const queryparam = $request.url.split('?')[1]
if (queryparam) {
const params = {}
for (param of $request.url.split('?')[1].split('&')) {
params[param.split('=')[0]] = param.split('=')[1]
}
const token = JSON.stringify(params)
if (params['csrf_token'] && chavy.setdata(token, tokenKey)) {
chavy.msg(`${cookieName}`, '获取Token: 成功', '')
chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`)
}
const params = {}
for (param of $request.url.split('?')[1].split('&')) {
params[param.split('=')[0]] = param.split('=')[1]
}
const token = JSON.stringify(params)
if (params['csrf_token'] && chavy.setdata(token, tokenKey)) {
chavy.msg(`${cookieName}`, '获取Token: 成功', '')
chavy.log(`[${cookieName}] 获取Token: 成功, token: ${token}`)
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

View File

@ -8,87 +8,90 @@ let tokenVal = chavy.getdata(tokenKey)
sign()
function sign() {
const title = `${cookieName}`
const subTitle = `签到脚本可能会导致账号异常, 请暂停使用`
const detail = ``
chavy.msg(title, subTitle, detail)
const title = `${cookieName}`
const subTitle = `签到脚本可能会导致账号异常, 请暂停使用`
const detail = ``
chavy.msg(title, subTitle, detail)
}
function _sign() {
const token = JSON.parse(tokenVal)
let url = { url: `https://m.you.163.com/xhr/points/sign.json?csrf_token=${token.csrf_token}`, headers: { Cookie: cookieVal } }
url.headers['Accept'] = `application/json, text/javascript, */*; q=0.01`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Origin'] = `https://m.you.163.com`
url.headers['Connection'] = `keep-alive`
url.headers['Host'] = `m.you.163.com`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 yanxuan/5.1.2 device-id/d7af0a77d9d88bd33a8ae5b35e6219ad app-chan-id/AppStore trustId/ios_trustid_3353a5577f9c4677bddec1ca7ac490fb`
url.headers['Referer'] = `https://m.you.163.com/points/index`
url.headers['Accept-Language'] = `zh-cn`
url.headers['X-Requested-With'] = `XMLHttpRequest`
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == '200') {
subTitle = `签到结果: 成功`
detail = `积分: ${result.data.point}`
} else if (result.code == '400') {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.errorCode}`
} else {
subTitle = `签到失败: 未知`
detail = `编码: ${result.code}, 说明: ${result.errorCode}`
const token = JSON.parse(tokenVal)
let url = {
url: `https://m.you.163.com/xhr/points/sign.json?csrf_token=${token.csrf_token}`,
headers: {Cookie: cookieVal}
}
chavy.msg(title, subTitle, detail)
})
chavy.done()
url.headers['Accept'] = `application/json, text/javascript, */*; q=0.01`
url.headers['Accept-Encoding'] = `gzip, deflate, br`
url.headers['Origin'] = `https://m.you.163.com`
url.headers['Connection'] = `keep-alive`
url.headers['Host'] = `m.you.163.com`
url.headers['Content-Length'] = `0`
url.headers['User-Agent'] = `Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 yanxuan/5.1.2 device-id/d7af0a77d9d88bd33a8ae5b35e6219ad app-chan-id/AppStore trustId/ios_trustid_3353a5577f9c4677bddec1ca7ac490fb`
url.headers['Referer'] = `https://m.you.163.com/points/index`
url.headers['Accept-Language'] = `zh-cn`
url.headers['X-Requested-With'] = `XMLHttpRequest`
chavy.post(url, (error, response, data) => {
chavy.log(`${cookieName}, data: ${data}`)
const result = JSON.parse(data)
const title = `${cookieName}`
let subTitle = ``
let detail = ``
if (result.code == '200') {
subTitle = `签到结果: 成功`
detail = `积分: ${result.data.point}`
} else if (result.code == '400') {
subTitle = `签到结果: 成功 (重复签到)`
detail = `说明: ${result.errorCode}`
} else {
subTitle = `签到失败: 未知`
detail = `编码: ${result.code}, 说明: ${result.errorCode}`
}
chavy.msg(title, subTitle, detail)
})
chavy.done()
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -10,137 +10,137 @@ var KEY = speed.getdata("CookieFC")
let isGetCookie = typeof $request !== 'undefined'
if (isGetCookie) {
getcookie()
getcookie()
} else {
sign()
sign()
}
function getcookie() {
var url = $request.url;
if (url) {
var UrlKeyFC = "UrlFC";
var UrlValueFC = url;
if (speed.getdata(UrlKeyFC) != (undefined || null)) {
if (speed.getdata(UrlKeyFC) != UrlValueFC) {
var url = speed.setdata(UrlValueFC, UrlKeyFC);
if (!url) {
speed.msg("更新" + appName + "Url失败‼", "", "");
} else {
speed.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
speed.msg(appName + "Url未变化❗", "", "");
}
var url = $request.url;
if (url) {
var UrlKeyFC = "UrlFC";
var UrlValueFC = url;
if (speed.getdata(UrlKeyFC) != (undefined || null)) {
if (speed.getdata(UrlKeyFC) != UrlValueFC) {
var url = speed.setdata(UrlValueFC, UrlKeyFC);
if (!url) {
speed.msg("更新" + appName + "Url失败‼", "", "");
} else {
speed.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
speed.msg(appName + "Url未变化❗", "", "");
}
} else {
var url = speed.setdata(UrlValueFC, UrlKeyFC);
if (!url) {
speed.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
speed.msg("首次写入" + appName + "Url成功🎉", "", "");
}
var url = speed.setdata(UrlValueFC, UrlKeyFC);
if (!url) {
speed.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
speed.msg("首次写入" + appName + "Url成功🎉", "", "");
}
}
} else {
speed.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyFC = "CookieFC";
var CookieValueFC = JSON.stringify($request.headers);
if (speed.getdata(CookieKeyFC) != (undefined || null)) {
if (speed.getdata(CookieKeyFC) != CookieValueFC) {
var cookie = speed.setdata(CookieValueFC, CookieKeyFC);
if (!cookie) {
speed.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
speed.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
speed.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = speed.setdata(CookieValueFC, CookieKeyFC);
if (!cookie) {
speed.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
speed.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
speed.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
speed.done()
}
function sign() {
const url = { url: URL, headers: JSON.parse(KEY) }
speed.get(url, (error, response, data) => {
speed.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const obj = JSON.parse(data)
if (obj.status == 1 && obj.data == 1) {
subTitle = `签到结果: 成功`
} else if (obj.status == 11 && obj.data == false) {
subTitle = `签到结果: 成功(重复)`
detail = `说明: ${obj.message}`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${obj.message}`
speed.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyFC = "CookieFC";
var CookieValueFC = JSON.stringify($request.headers);
if (speed.getdata(CookieKeyFC) != (undefined || null)) {
if (speed.getdata(CookieKeyFC) != CookieValueFC) {
var cookie = speed.setdata(CookieValueFC, CookieKeyFC);
if (!cookie) {
speed.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
speed.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
speed.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = speed.setdata(CookieValueFC, CookieKeyFC);
if (!cookie) {
speed.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
speed.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
speed.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
speed.msg(title, subTitle, detail)
speed.done()
})
}
function sign() {
const url = {url: URL, headers: JSON.parse(KEY)}
speed.get(url, (error, response, data) => {
speed.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const obj = JSON.parse(data)
if (obj.status == 1 && obj.data == 1) {
subTitle = `签到结果: 成功`
} else if (obj.status == 11 && obj.data == false) {
subTitle = `签到结果: 成功(重复)`
detail = `说明: ${obj.message}`
} else {
subTitle = `签到结果: 失败`
detail = `说明: ${obj.message}`
}
speed.msg(title, subTitle, detail)
speed.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -6,56 +6,57 @@ const senku = init()
const requrl = $request.url
if ($request && $request.method != 'OPTIONS') {
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
const signurlVal = requrl
const signheaderVal = JSON.stringify($request.headers)
const signbodyVal = $request.body
if (signurlVal) senku.setdata(signurlVal, signurlKey)
if (signheaderVal) senku.setdata(signheaderVal, signheaderKey)
if (signbodyVal) senku.setdata(signbodyVal, signbodyKey)
senku.msg(cookieName, `获取Cookie: 成功`, ``)
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
senku.done()

View File

@ -10,66 +10,68 @@ const signBodyVal = senku.getdata(signbodyKey)
sign()
function sign() {
const url = { url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal }
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, data: ${data}`)
const res = JSON.parse(data)
let subTitle = ``
let detail = ``
if (res.resultCode == 0) {
subTitle = `签到结果: 成功`
detail = `积分: ${res.credit}`
if (res.coupon!=null) {
detail += `优惠券:${res.coupon}`
}
} else if (res.resultCode == -1) {}{
subTitle = `签到结果: ${res.resultMessage}`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
const url = {url: signurlVal, headers: JSON.parse(signheaderVal), body: signBodyVal}
senku.post(url, (error, response, data) => {
senku.log(`${cookieName}, data: ${data}`)
const res = JSON.parse(data)
let subTitle = ``
let detail = ``
if (res.resultCode == 0) {
subTitle = `签到结果: 成功`
detail = `积分: ${res.credit}`
if (res.coupon != null) {
detail += `优惠券:${res.coupon}`
}
} else if (res.resultCode == -1) {
}
{
subTitle = `签到结果: ${res.resultMessage}`
}
senku.msg(cookieName, subTitle, detail)
senku.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, resp, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}

View File

@ -6,135 +6,135 @@ var KEY = zaker.getdata("CookieZK")
let isGetCookie = typeof $request !== 'undefined'
if (isGetCookie) {
getcookie()
getcookie()
} else {
sign()
sign()
}
function getcookie() {
var url = $request.url;
if (url) {
var UrlKeyZK = "UrlZK";
var UrlValueZK = url;
if (zaker.getdata(UrlKeyZK) != (undefined || null)) {
if (zaker.getdata(UrlKeyZK) != UrlValueZK) {
var url = zaker.setdata(UrlValueZK, UrlKeyZK);
if (!url) {
zaker.msg("更新" + appName + "Url失败‼", "", "");
} else {
zaker.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
zaker.msg(appName + "Url未变化❗", "", "");
}
var url = $request.url;
if (url) {
var UrlKeyZK = "UrlZK";
var UrlValueZK = url;
if (zaker.getdata(UrlKeyZK) != (undefined || null)) {
if (zaker.getdata(UrlKeyZK) != UrlValueZK) {
var url = zaker.setdata(UrlValueZK, UrlKeyZK);
if (!url) {
zaker.msg("更新" + appName + "Url失败‼", "", "");
} else {
zaker.msg("更新" + appName + "Url成功🎉", "", "");
}
} else {
zaker.msg(appName + "Url未变化❗", "", "");
}
} else {
var url = zaker.setdata(UrlValueZK, UrlKeyZK);
if (!url) {
zaker.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
zaker.msg("首次写入" + appName + "Url成功🎉", "", "");
}
var url = zaker.setdata(UrlValueZK, UrlKeyZK);
if (!url) {
zaker.msg("首次写入" + appName + "Url失败‼", "", "");
} else {
zaker.msg("首次写入" + appName + "Url成功🎉", "", "");
}
}
} else {
zaker.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyZK = "CookieZK";
var CookieValueZK = JSON.stringify($request.headers);
if (zaker.getdata(CookieKeyZK) != (undefined || null)) {
if (zaker.getdata(CookieKeyZK) != CookieValueZK) {
var cookie = zaker.setdata(CookieValueZK, CookieKeyZK);
if (!cookie) {
zaker.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
zaker.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
zaker.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = zaker.setdata(CookieValueZK, CookieKeyZK);
if (!cookie) {
zaker.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
zaker.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
zaker.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
zaker.done()
}
function sign() {
const url = { url: URL, headers: JSON.parse(KEY) }
zaker.get(url, (error, response, data) => {
zaker.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.stat == 1) {
subTitle = `签到结果: 成功`
detail = `签到奖励: ${result.data.tips}, 总签到天数: ${result.data.total_day_count}`
} else {
subTitle = `签到结果: 未知`
detail = `说明: ${result.msg}`
zaker.msg("写入" + appName + "Url失败‼", "", "配置错误, 无法读取URL, ");
}
if ($request.headers) {
var CookieKeyZK = "CookieZK";
var CookieValueZK = JSON.stringify($request.headers);
if (zaker.getdata(CookieKeyZK) != (undefined || null)) {
if (zaker.getdata(CookieKeyZK) != CookieValueZK) {
var cookie = zaker.setdata(CookieValueZK, CookieKeyZK);
if (!cookie) {
zaker.msg("更新" + appName + "Cookie失败‼", "", "");
} else {
zaker.msg("更新" + appName + "Cookie成功🎉", "", "");
}
} else {
zaker.msg(appName + "Cookie未变化❗", "", "");
}
} else {
var cookie = zaker.setdata(CookieValueZK, CookieKeyZK);
if (!cookie) {
zaker.msg("首次写入" + appName + "Cookie失败‼", "", "");
} else {
zaker.msg("首次写入" + appName + "Cookie成功🎉", "", "");
}
}
} else {
zaker.msg("写入" + appName + "Cookie失败‼", "", "配置错误, 无法读取请求头, ");
}
zaker.msg(title, subTitle, detail)
zaker.done()
})
}
function sign() {
const url = {url: URL, headers: JSON.parse(KEY)}
zaker.get(url, (error, response, data) => {
zaker.log(`${appName}, data: ${data}`)
const title = `${appName}`
let subTitle = ''
let detail = ''
const result = JSON.parse(data)
if (result.stat == 1) {
subTitle = `签到结果: 成功`
detail = `签到奖励: ${result.data.tips}, 总签到天数: ${result.data.total_day_count}`
} else {
subTitle = `签到结果: 未知`
detail = `说明: ${result.msg}`
}
zaker.msg(title, subTitle, detail)
zaker.done()
})
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done }
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
put = (url, cb) => {
if (isSurge()) {
$httpClient.put(url, cb)
}
if (isQuanX()) {
url.method = 'PUT'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, put, done}
}

View File

@ -4,71 +4,72 @@ const cookieAppKey = 'chavy_cookie_zimuzu_app'
const authUrlAppKey = 'chavy_auth_url_zimuzu_app'
const chavy = init()
if ($request.headers.Host == 'h5.rrhuodong.com') {
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieAppKey)) {
chavy.setdata(``, authUrlAppKey)
chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${cookieVal}`)
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieAppKey)) {
chavy.setdata(``, authUrlAppKey)
chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
}
} else if ($request.headers.Host == `ios.zmzapi.com` && $request.url.indexOf('accesskey') >= 0) {
if (chavy.setdata($request.url, authUrlAppKey)) {
chavy.setdata(``, cookieAppKey)
chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${$request.url}`)
}
} else {
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName} (网页)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (网页)] 获取Cookie: 成功, cookie: ${cookieVal}`)
if (chavy.setdata($request.url, authUrlAppKey)) {
chavy.setdata(``, cookieAppKey)
chavy.msg(`${cookieName} (APP)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (APP)] 获取Cookie: 成功, cookie: ${$request.url}`)
}
} else {
const cookieVal = $request.headers['Cookie']
if (cookieVal) {
if (chavy.setdata(cookieVal, cookieKey)) {
chavy.msg(`${cookieName} (网页)`, '获取Cookie: 成功', '')
chavy.log(`[${cookieName} (网页)] 获取Cookie: 成功, cookie: ${cookieVal}`)
}
}
}
}
function init() {
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
isQuanX = () => {
return undefined === this.$task ? false : true
}
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
isSurge = () => {
return undefined === this.$httpClient ? false : true
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
isQuanX = () => {
return undefined === this.$task ? false : true
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
getdata = (key) => {
if (isSurge()) return $persistentStore.read(key)
if (isQuanX()) return $prefs.valueForKey(key)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
setdata = (key, val) => {
if (isSurge()) return $persistentStore.write(key, val)
if (isQuanX()) return $prefs.setValueForKey(key, val)
}
}
done = (value = {}) => {
$done(value)
}
return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done }
msg = (title, subtitle, body) => {
if (isSurge()) $notification.post(title, subtitle, body)
if (isQuanX()) $notify(title, subtitle, body)
}
log = (message) => console.log(message)
get = (url, cb) => {
if (isSurge()) {
$httpClient.get(url, cb)
}
if (isQuanX()) {
url.method = 'GET'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
post = (url, cb) => {
if (isSurge()) {
$httpClient.post(url, cb)
}
if (isQuanX()) {
url.method = 'POST'
$task.fetch(url).then((resp) => cb(null, {}, resp.body))
}
}
done = (value = {}) => {
$done(value)
}
return {isSurge, isQuanX, msg, log, getdata, setdata, get, post, done}
}
chavy.done()

Some files were not shown because too many files have changed in this diff Show More