From 4e4af821a4da08c2c6a55b7fdca49f87cb9a3daa Mon Sep 17 00:00:00 2001 From: Ctrlcvs <1509167646@qq.com> Date: Mon, 31 Oct 2022 21:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8=E4=B8=AA=E5=88=AB?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8B=E4=BD=93=E5=8A=9B=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=9B=BE=E7=89=87=E6=97=A0=E6=B3=95=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++ apps/Note.js | 9 +++-- apps/admin.js | 5 ++- apps/index.js | 4 +- apps/user.js | 27 +++++++++++++ defSet/config/config.yaml | 2 +- resources/admin/index.html | 78 +++++++++++++++++++------------------- 7 files changed, 80 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 127b75b..161bbec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ * 新增`#图鉴模板更新` * 用于更新体力模板具体来源由**@SunRyK** **@地球生物** **@逍遥** 三位作者上传 * 不会冲突已添加的模板数据,有需求可通过指令拉取 +* 新增`#图鉴设置获取sk开启、关闭` + * 绑定ck时自动获取sk + * 风险自担!!! 插件只负责提供功能 # 1.2.3 * 新增地图资源查询功能 * `#月莲在哪里` 指令类似 `某某物品在哪里` diff --git a/apps/Note.js b/apps/Note.js index 76bf842..4e5d067 100644 --- a/apps/Note.js +++ b/apps/Note.js @@ -430,15 +430,16 @@ export async function Note_appoint(e) { for (let [index, item] of keyType.entries()) { let msg_pass = []; let imgurl; + let pathFile=urlType[item].replace(/\./,_path) if (item.includes(".")) { - imgurl = await segment.image(`file:///${urlType[item]}`); + imgurl = await segment.image(`file:///${pathFile}`); item = item.split(".")[0]; } else { imgurl = await segment.image( - `file:///${urlType[item]}/icon/bg/${fs.readdirSync(`${urlType[item]}/icon/bg/`)[0]}` + `file:///${pathFile}/icon/bg/${fs.readdirSync(`${pathFile}/icon/bg/`)[0]}` ) } - if (isUser && !temp.includes(item)) { + if (isUser && !temp?.includes(item)) { continue; } item = index + 1 + "." + item @@ -489,7 +490,7 @@ export async function Note_appoint(e) { if (typeof tempData[e.user_id]["temp"] === "string") { temp = [tempData[e.user_id]["temp"], msg] } else { - if (!tempData[e.user_id]["temp"].includes(msg)) { + if (!tempData[e.user_id]["temp"]?.includes(msg)) { temp = [...tempData[e.user_id]["temp"], msg] } } diff --git a/apps/admin.js b/apps/admin.js index 313929c..e0f0379 100644 --- a/apps/admin.js +++ b/apps/admin.js @@ -23,6 +23,7 @@ let cfgMap = { "匹配": "sys.Atlas", "戳一戳":"note.poke", "模板": "mb.len", + "获取sk":"ck.sk", "目录":"Atlas.all", }; let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`; @@ -67,6 +68,7 @@ export async function sysCfg(e, { if (!regRet) { return true; } + if (regRet[1]) { // 设置模式 @@ -85,14 +87,13 @@ export async function sysCfg(e, { Cfg.set(cfgKey, val); } } - // e.reply("设置成功!!"); - // return true; let cfg = { help: getStatus("sys.help", false), Note: getStatus("sys.Note",false), Atlas: getStatus("sys.Atlas",false), len:Cfg.get("mb.len", 0), poke: getStatus("note.poke",false), + isSk: getStatus("ck.sk",false), imgPlus: fs.existsSync(plusPath), notePlus: fs.existsSync(notePlus), bg: await rodom(), //获取底图 diff --git a/apps/index.js b/apps/index.js index 2d8327a..e2edc07 100644 --- a/apps/index.js +++ b/apps/index.js @@ -33,7 +33,7 @@ import { userInfo, gclog, mytoken, - bindStoken, + bindStoken,bindLogin_ticket, cloudToken } from "./user.js" import { @@ -50,7 +50,7 @@ export { updateRes,updateTemp, delSign, cloudSign, - seach, + seach,bindLogin_ticket, bbsSign, gclog, mytoken, diff --git a/apps/user.js b/apps/user.js index 69bbd3b..ae9a6b0 100644 --- a/apps/user.js +++ b/apps/user.js @@ -35,6 +35,10 @@ export const rule = { reg: "^(.*)stoken=(.*)$", describe: "绑定stoken" }, + bindLogin_ticket: { + reg: "^(.*)login_ticket=(.*)$", + describe: "绑定ck自动获取sk" + }, cloudToken: { reg: "^(.*)ct(.*)$", describe: "云原神签到token获取" @@ -156,6 +160,29 @@ export async function mytoken(e) { e.reply(sendMsg) return true; } + +export async function bindLogin_ticket(e){ + let user = new User(e); + let ckMap=await utils.getCookieMap(e.original_msg.replace(/'|"/g,"")) + if(ckMap&&Cfg.get("ck.sk")){ + let res= await user.getData("bbsStoken", { + loginUid:ckMap?.get("login_uid") ? ckMap?.get("login_uid") : ckMap?.get("ltuid"), + loginTicket:ckMap.get("login_ticket"), + },false) + if(res?.retcode===0){ + let msg = 'stoken绑定成功您可通过下列指令进行操作:'; + msg += '\n【#米币查询】查询米游币余额' + msg += '\n【#mys原神签到】获取米游币' + msg += '\n【#更新抽卡记录】更新抽卡记录' + msg += '\n【#刷新ck】刷新失效cookie' + msg += '\n【#我的stoken】查看绑定信息' + msg += '\n【#删除stoken】删除绑定信息' + e.reply(msg) + } + } + return false; +} + export async function bindStoken(e) { if (!e.isPrivate) { e.reply("请私聊发送") diff --git a/defSet/config/config.yaml b/defSet/config/config.yaml index c1c0432..842fe17 100644 --- a/defSet/config/config.yaml +++ b/defSet/config/config.yaml @@ -34,6 +34,6 @@ gclogEx: 5 # 体力设置开启关闭权限 1-群管理员才能开启关闭 2-主人才能开启关闭 noteSetAuth: 2 # 体力推送 间隔 10分钟检索一次 -noteTask: 0 0/10 * * ? +noteTask: 0 0/10 * * * ? # 全局开关体力推送 关闭后不可操作体力推送相关内容 true开启 false 关闭 isNoteTask: false \ No newline at end of file diff --git a/resources/admin/index.html b/resources/admin/index.html index 6de3c09..7bd5dca 100644 --- a/resources/admin/index.html +++ b/resources/admin/index.html @@ -5,7 +5,7 @@ <link rel="stylesheet" type="text/css" href="{{_res_path}}/admin/index.css" /> <style> .container { - background: url("{{_res_path}}/admin/imgs/bg/{{bg}}") #000144 top !important; + background: url("{{_res_path}}/admin/imgs/bg/{{bg}}") #000144 top !important; background-size: 520px auto; width: 800px; } @@ -20,33 +20,33 @@ </div> </div> <div class="cfg-box"> - <div class="cfg-group">游戏图鉴卡片展示</div> - <ul class="cfg-ul"> - <li class="cfg-li"> - <div class="cfg-line"> - 图鉴匹配查询 - <span class="cfg-hint"> #图鉴设置匹配 + 开启/关闭</span> - {{@Atlas}} - </div> - <div class="cfg-desc">图鉴匹配规则需要 开启:图鉴结尾 关闭:原魔、圣遗物、食物无需图鉴结尾</div> - </li> - <li class="cfg-li"> - <div class="cfg-line"> - 图鉴目录开关 - <span class="cfg-hint"> #图鉴设置目录 + 开启/关闭</span> - {{@Atlasall}} - </div> - <div class="cfg-desc">图鉴目录 为兼容之前用js版本插件用户可以用指令关闭功能</div> - </li> - <li class="cfg-li"> - <div class="cfg-line"> - 戳一戳卡片 - <span class="cfg-hint"> #图鉴设置戳一戳 + 开启/关闭</span> - {{@poke}} - </div> - </li> - - <!-- <li class="cfg-li"> + <div class="cfg-group">游戏图鉴卡片展示</div> + <ul class="cfg-ul"> + <li class="cfg-li"> + <div class="cfg-line"> + 图鉴匹配查询 + <span class="cfg-hint"> #图鉴设置匹配 + 开启/关闭</span> + {{@Atlas}} + </div> + <div class="cfg-desc">图鉴匹配规则需要 开启:图鉴结尾 关闭:原魔、圣遗物、食物无需图鉴结尾</div> + </li> + <li class="cfg-li"> + <div class="cfg-line"> + 图鉴目录开关 + <span class="cfg-hint"> #图鉴设置目录 + 开启/关闭</span> + {{@Atlasall}} + </div> + <div class="cfg-desc">图鉴目录 为兼容之前用js版本插件用户可以用指令关闭功能</div> + </li> + <li class="cfg-li"> + <div class="cfg-line"> + 戳一戳卡片 + <span class="cfg-hint"> #图鉴设置戳一戳 + 开启/关闭</span> + {{@poke}} + </div> + </li> + + <!-- <li class="cfg-li"> <div class="cfg-line"> 面板查询 <span class="cfg-hint"> #喵喵设置面板 + 开启/关闭</span> @@ -69,7 +69,7 @@ <div class="cfg-desc">面板查询暂不支持查他人</div> </li> --> - </ul> + </ul> </div> <div class="cfg-box"> <div class="cfg-group">图鉴扩展包</div> @@ -111,7 +111,14 @@ </div> <div class="cfg-desc">可选值50~200,建议100。设置高精度会提高图片的精细度,但因图片较大可能会影响渲染与发送速度</div> </li> --> - + <li class="cfg-li"> + <div class="cfg-line"> + 拦截绑定ck自动获取stoken + <span class="cfg-hint">#图鉴设置获取sk + 开启/关闭</span> + {{@isSk}} + </div> + <div class="cfg-desc">开启后将拦截login_ticket自动获取stoken</div> + </li> <li class="cfg-li"> <div class="cfg-line"> 图鉴作为默认帮助 @@ -132,18 +139,11 @@ <div class="cfg-line"> 设置体力模板类型 <span class="cfg-hint">#图鉴设置模板 + (0-2)</span> - <div class="cfg-status">{{@len}}</div> + <div class="cfg-status">{{@len}}</div> </div> <div class="cfg-desc">需开启图鉴版体力作为Yunzai的默认体力,当前模板支持0(随机)以及1-2</div> </li> - <!-- <li class="cfg-li"> - <div class="cfg-line"> - 更新版本 - <div class="cfg-status">#喵喵更新</div> - </div> - <div class="cfg-desc">更新喵喵Plugin,可能需要重启Yunzai-Bot</div> - </li>--> - </ul> + </div> {{/block}}