vConsole.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. /**
  2. * 脚本名称:网页调试助手(修改自id77)
  3. * 更新时间:2023-08-20
  4. */
  5. const $ = new Env('调试助手');
  6. let html = $response.body || '';
  7. let clicker_frequency = 10;
  8. let clicker_off_zIndex = 10001;
  9. let prefix = randomInteger(1000, 10000);
  10. try {
  11. let url = $request.url.replace(/&un_area=[\d_]+/g, '');
  12. let tools = `
  13. <div id="_${prefix}_id77_btns">
  14. <div id="_${prefix}_top"></div>
  15. <div id="_${prefix}_bottom">
  16. <div id="clicker" class="_${prefix}_id77_btn _${prefix}_id77_hide"></div>
  17. <div id="open_url" class="_${prefix}_id77_btn _${prefix}_id77_hide"></div>
  18. <div id="reload" class="_${prefix}_id77_btn _${prefix}_id77_hide" onclick="location.reload()"></div>
  19. </div>
  20. </div>
  21. `;
  22. let copyObject = `
  23. <script ignore>
  24. if(window.localStorage) {
  25. window.localStorageCopy = window.localStorage
  26. }
  27. if(window.sessionStorage) {
  28. window.sessionStorageCopy = window.sessionStorage
  29. }
  30. const _${prefix}_id77_Map = Map;
  31. </script>
  32. `;
  33. let scriptDoms = `<script src="https://unpkg.com/[email protected]/dist/vconsole.min.js" ignore></script>`;
  34. let mitmContent = `
  35. <style>
  36. body > a {
  37. display: inline-block !important;
  38. }
  39. .vc-tab._${prefix}_id77_hide {
  40. display: none !important;
  41. }
  42. * {
  43. -webkit-user-select: auto !important;
  44. user-select: auto !important;
  45. }
  46. #clicker {
  47. top: 0;
  48. background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNjgxODg0MTU4NjEyIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE4ODEiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iNzIiIGhlaWdodD0iNzIiPjxwYXRoIGQ9Ik0zMDMuODcyIDM1MS4yNTMzMzNjMjEuMDc3MzMzLTYxLjAxMzMzMyA4OS43MjgtODggMTUzLjE5NDY2Ny02MC4zNzMzMzNsNDA1LjA1NiAxNzYuMjM0NjY3YTE0MC4zMDkzMzMgMTQwLjMwOTMzMyAwIDAgMSA3NC4yNCA3Ny4xNDEzMzNjMjUuMDI0IDY0LjM2MjY2Ny01LjAzNDY2NyAxMzEuNDEzMzMzLTY3LjA5MzMzNCAxNDkuNzgxMzMz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pZD0iNzgxNCI+PC9wYXRoPjwvc3ZnPg==) #FFF no-repeat 0.3571em/1.88em;
  57. }
  58. .vc-panel {
  59. z-index: 100000 !important;
  60. }
  61. #_${prefix}_top {
  62. position: fixed;
  63. z-index: 99999;
  64. top: 22%;
  65. right: 0;
  66. }
  67. #_${prefix}_bottom {
  68. position: fixed;
  69. z-index: 99999;
  70. bottom: 25%;
  71. right: 0;
  72. }
  73. ._${prefix}_id77_btn, ._${prefix}_id77_btn_b {
  74. position: absolute;
  75. right: 0;
  76. box-sizing: content-box;
  77. width: 1.14em;
  78. height: 2.1429em;
  79. padding: 0 1.4286em 0 0;
  80. border: 1px solid rgba(255,255,255,0.8);
  81. background: #FFF;
  82. border-radius: 50px 0 0 50px;
  83. background-size: 80%;
  84. overflow: hidden;
  85. }
  86. ._${prefix}_id77_btn img, ._${prefix}_id77_btn_b img {
  87. box-sizing: content-box;
  88. max-width: 2.1429em !important;
  89. width: 2.1429em !important;
  90. height: 2.1429em !important;
  91. border: 1px solid rgba(255,255,255,0.8);
  92. background: #FFF;
  93. border-radius: 50px 0 0 50px;
  94. }
  95. #_${prefix}_id77_btns {
  96. font-size: 14px;
  97. }
  98. ._${prefix}_id77_btn._${prefix}_id77_hide {
  99. display: none !important;
  100. }
  101. </style>
  102. <script ignore>
  103. const _${prefix}_id77_needHideSwitch = localStorage.getItem('vConsole_switch_hide') === 'Y';
  104. const _${prefix}_id77_btnsDom = \`${tools}\`;
  105. _${prefix}_id77_onReady(_${prefix}_id77_init);
  106. function _${prefix}_id77_onReady(fn){
  107. try {
  108. const readyState = document.readyState;
  109. if(readyState === 'interactive' || readyState === 'complete') {
  110. fn()
  111. }else{
  112. window.addEventListener("DOMContentLoaded",fn);
  113. }
  114. } catch (error) {
  115. console.error(arguments.callee.name, error);
  116. }
  117. }
  118. function _${prefix}_id77_changeBtns() {
  119. const \$btns = document.querySelectorAll('._${prefix}_id77_btn');
  120. Array.prototype.forEach.call(\$btns, function(el, i){
  121. if (el.classList.contains('_${prefix}_id77_hide')){
  122. el.classList.remove('_${prefix}_id77_hide');
  123. } else {
  124. el.classList.add('_${prefix}_id77_hide');
  125. }
  126. });
  127. }
  128. function _${prefix}_id77_changeMitmUI() {
  129. const vcSwitch = document.querySelector('.vc-switch');
  130. if (vcSwitch.style.display == 'none') {
  131. _${prefix}_id77_vConsole.showSwitch();
  132. localStorage.setItem('vConsole_switch_hide', 'N')
  133. } else {
  134. _${prefix}_id77_vConsole.hideSwitch();
  135. localStorage.setItem('vConsole_switch_hide', 'Y')
  136. }
  137. _${prefix}_id77_changeBtns();
  138. }
  139. document.addEventListener('dblclick', function (e) {
  140. _${prefix}_id77_changeMitmUI();
  141. });
  142. function _${prefix}_id77_init () {
  143. document.querySelector('body').insertAdjacentHTML('beforeend', _${prefix}_id77_btnsDom);
  144. try {
  145. if(!window.localStorage) {
  146. window.localStorage = window.localStorageCopy
  147. }
  148. if(!window.sessionStorage) {
  149. window.sessionStorage = window.sessionStorageCopy
  150. }
  151. const _${prefix}_id77_vConsoleOptions = {
  152. onReady: () => {
  153. setTimeout(() => {
  154. console.log("vConsole v3.14.6 #${prefix}");
  155. console.info(window.location.href);
  156. },3000);
  157. }
  158. }
  159. Map = _${prefix}_id77_Map;
  160. window._${prefix}_id77_vConsole = new VConsole(_${prefix}_id77_vConsoleOptions);
  161. if (_${prefix}_id77_needHideSwitch) {
  162. _${prefix}_id77_vConsole.hideSwitch();
  163. }
  164. const _Plugin = new VConsole.VConsolePlugin("id77_plugin", "工具");
  165. _Plugin.on("addTool", function (callback) {
  166. const toolList = [];
  167. const clickerDom = document.querySelector('#clicker');
  168. if (clickerDom) {
  169. clickerDom.addEventListener('click', (e) => {
  170. document.querySelector('#id77_clicker').style.display = 'block';
  171. e.stopPropagation();
  172. });
  173. }
  174. const openUrlDom = document.querySelector('#open_url');
  175. if (openUrlDom) {
  176. openUrlDom.addEventListener('click', function() {
  177. window.location.href = 'Foxok://url?${url}';
  178. });
  179. }
  180. callback(toolList);
  181. });
  182. _Plugin.on('ready', function() {
  183. if (!_${prefix}_id77_needHideSwitch) {
  184. const \$btns = document.querySelectorAll('._${prefix}_id77_btn');
  185. Array.prototype.forEach.call(\$btns, function(el, i){
  186. el.classList.remove('_${prefix}_id77_hide');
  187. });
  188. }
  189. const fontSize = document.querySelector('#__vconsole').style.fontSize;
  190. if(fontSize) {
  191. document.querySelector('#_${prefix}_id77_btns').style.fontSize = fontSize;
  192. }
  193. });
  194. function scrollTopToCKDom(reset) {
  195. const fontSize = document.querySelector('#__vconsole').style.fontSize;
  196. const _VCcontext = document.querySelector('.vc-content');
  197. if (reset) {
  198. _VCcontext.scrollTop = 0;
  199. return;
  200. }
  201. if(!window.localStorage) {
  202. window.localStorage = window.localStorageCopy
  203. }
  204. if(!window.sessionStorage) {
  205. window.sessionStorage = window.sessionStorageCopy
  206. }
  207. }
  208. _Plugin.on('show', scrollTopToCKDom);
  209. _Plugin.on('showConsole', scrollTopToCKDom);
  210. _Plugin.on('hideConsole', () => scrollTopToCKDom(true));
  211. _${prefix}_id77_vConsole.addPlugin(_Plugin);
  212. _${prefix}_id77_vConsole.showPlugin("id77_plugin");
  213. _${prefix}_id77_vConsole.showPlugin("default");
  214. function createDom(str) {
  215. let newDiv = document.createElement("div");
  216. let newContent = document.createTextNode(str);
  217. newDiv.appendChild(newContent);
  218. newDiv.style.fontSize = "16px";
  219. newDiv.addEventListener('click', (e) => {
  220. _${prefix}_id77_copyText(str)
  221. })
  222. return newDiv;
  223. }
  224. } catch (err) {
  225. console.log(arguments.callee.name, err);
  226. }
  227. }
  228. function _${prefix}_id77_copyText(text) {
  229. const input = document.createElement('input');
  230. input.setAttribute('readonly', 'readonly');
  231. input.setAttribute('value', text);
  232. document.body.appendChild(input);
  233. input.setSelectionRange(0, input.value.length);
  234. if (document.execCommand('copy')) {
  235. document.execCommand('copy');
  236. console.log('复制成功');
  237. }
  238. document.body.removeChild(input);
  239. }
  240. </script>
  241. <style>
  242. [data-tippy-root] {
  243. z-index: ${clicker_off_zIndex} !important;
  244. }
  245. #id77_clicker {
  246. background: #fff;
  247. z-index: 8888;
  248. font-size:16px;
  249. }
  250. .id77_float {
  251. float: left;
  252. margin-right: 15px;
  253. }
  254. .tippy-box .el-tgl {
  255. display: none !important;
  256. }
  257. .id77_clicker_main p {
  258. font-weight: bold;
  259. }
  260. #id77_clicker_timerTime {
  261. font-size: 16px;
  262. width: 80px;
  263. }
  264. #id77_clicker_timerBeforehandTime {
  265. font-size: 16px;
  266. }
  267. .id77_clicker_add {
  268. color: #fff;
  269. background: #0075ff;
  270. border-radius: 50%;
  271. width: 50px;
  272. height: 50px;
  273. line-height: 50px;
  274. text-align: center;
  275. font-size: 30px;
  276. margin: 10px auto;
  277. }
  278. #id77_timer input[type="checkbox"] {
  279. /*
  280. display: none;这样会让tab键无法选取自定义的checkbox,所以使用下面的方法
  281. clip 属性剪裁绝对定位元素。
  282. */
  283. position: absolute;
  284. clip: rect(0, 0, 0, 0)
  285. }
  286. #id77_timer input[type="checkbox"] {
  287. display: inline-block;
  288. width: 48%;
  289. margin-top: 10px;
  290. margin-left: 5px;
  291. text-align: left;
  292. box-sizing: border-box;
  293. }
  294. #id77_timer label::before {
  295. content: '\\a0';
  296. display: inline-block;
  297. border: 1px solid silver;
  298. text-align: center;
  299. width: 20px;
  300. height: 20px;
  301. font-weight: bold;
  302. }
  303. #id77_timer input[type="checkbox"]:checked+label::before {
  304. content: '\\2713';
  305. color: #0075ff;
  306. }
  307. .id77_clicker_main input,
  308. .id77_clicker_main select {
  309. margin-bottom: 15px;
  310. font-size: 14px;
  311. }
  312. .id77_clicker_main {
  313. padding: 5px 16px;
  314. margin: 0 0 80px;
  315. }
  316. .id77_clicker_main input[type='number'],
  317. .id77_clicker_main input[type='time'],
  318. .id77_clicker_main select {
  319. border: 1px solid #e5e5e5 !important;
  320. border-radius: 5px;
  321. height: 36px;
  322. box-sizing: border-box;
  323. padding: 10px;
  324. float: left;
  325. margin-right: 15px;
  326. }
  327. /* ----------------*/
  328. .moveable-control-box {
  329. display: none !important;
  330. all: initial;
  331. }
  332. .tippy-box {
  333. max-width: min(350px, 90vw) !important;
  334. }
  335. .tippy-box:focus {
  336. outline: 0;
  337. }
  338. .tpa-tooltip-content-root {
  339. text-shadow: initial;
  340. margin: 0;
  341. padding: 8px;
  342. color: grey;
  343. background-color: white;
  344. border-color: lightgray;
  345. border-style: solid;
  346. border-width: 1px;
  347. border-radius: 8px;
  348. user-select: none;
  349. }
  350. .tpa-tooltip-options-container {
  351. display: flex;
  352. flex-direction: row;
  353. align-content: center;
  354. align-items: center;
  355. }
  356. .tpa-tooltip-options-container > * {
  357. all: initial;
  358. }
  359. .tpa-tooltip-content-root-arrow-icon {
  360. width: 30px;
  361. height: 30px;
  362. display: inline-block;
  363. line-height: 30px;
  364. -webkit-flex-shrink: 0;
  365. -ms-flex-negative: 0;
  366. flex-shrink: 0;
  367. color: white;
  368. vertical-align: middle;
  369. }
  370. .tpa-tooltip-content-root-arrow {
  371. background-color: transparent;
  372. border: 0;
  373. animation: tpa-tooltip-content-root-arrow-ani 500ms ease-in-out;
  374. animation-iteration-count: infinite;
  375. animation-direction: alternate-reverse;
  376. }
  377. .tpa-tooltip-content-root-options {
  378. font-family: initial;
  379. font-size: 16px !important;
  380. }
  381. .tpa-tooltip-content-root-drag {
  382. font-size: 16px !important;
  383. word-wrap: break-word !important;
  384. }
  385. .tpa-tooltip-content-root-drag strong {
  386. font: initial;
  387. font-size: 16px !important;
  388. font-weight: bold;
  389. }
  390. .tpa-tooltip-content-root span {
  391. color: #eb1313 !important;
  392. }
  393. .tpa-inner-clicker {
  394. filter: unset !important;
  395. box-shadow: unset !important;
  396. text-shadow: unset !important;
  397. float: left !important;
  398. /*position: static !important;*/
  399. border-radius: 50% !important;
  400. width: 48px !important;
  401. height: 48px !important;
  402. font-size: 30px;
  403. }
  404. .tpa-inner-clicker-error {
  405. padding-left: 3px;
  406. }
  407. div.tpa-click-effect {
  408. position: absolute !important;
  409. box-sizing: border-box !important;
  410. border-style: solid !important;
  411. border-radius: 50% !important;
  412. animation: tpa-click-effect-ani 200ms ease-out !important;
  413. border-width: 2px !important;
  414. /*border-color: #86d993;*/
  415. /*border-color: #7056ff;*/
  416. border-color: lightgray !important;
  417. }
  418. @keyframes tpa-tooltip-content-root-arrow-ani {
  419. 0% {
  420. transform: none;
  421. }
  422. 100% {
  423. transform: translateX(-30px);
  424. }
  425. }
  426. @keyframes tpa-click-effect-ani {
  427. 0% {
  428. width: 9px;
  429. height: 9px;
  430. margin: -4.5px;
  431. opacity: 1;
  432. }
  433. 100% {
  434. width: 48px;
  435. height: 48px;
  436. margin: -24px;
  437. opacity: 0.2;
  438. }
  439. }
  440. </style>
  441. <div id="id77_clicker" style="position: fixed; bottom: 0; width: 100%; display: none;">
  442. <div
  443. class="id77_clicker_header"
  444. style="
  445. background: #f2f2f2;
  446. padding: 10px;
  447. text-align: center;
  448. font-weight: bold;
  449. border-top: 1px solid #c5c5c5;
  450. border-bottom: 1px solid #c5c5c5;
  451. border-radius: 5px 5px 0 0;
  452. "
  453. >
  454. Clicker
  455. </div>
  456. <div
  457. class="id77_clicker_close"
  458. style="
  459. position: absolute;
  460. top: 0px;
  461. text-align: center;
  462. padding: 10px;
  463. right: 0;
  464. font-weight: bold;
  465. color: #2e85ed;
  466. "
  467. >
  468. 完成
  469. </div>
  470. <div class="id77_clicker_main">
  471. <div class="id77_clicker_add">+</div>
  472. <div style="overflow: hidden">
  473. <p>频率(每秒点击次数)</p>
  474. <input type="number" id="id77_clicker_frequency_text" value="${clicker_frequency}"/>
  475. <input
  476. type="range"
  477. id="id77_clicker_frequency"
  478. name="volume"
  479. value="${clicker_frequency}"
  480. min="1"
  481. max="60"
  482. />
  483. </div>
  484. <div style="overflow: hidden">
  485. <p>结束条件</p>
  486. <input id="id77_clicker_conditionValue" value="86400" type="number" />
  487. <select id="id77_clicker_condition" name="type">
  488. <option selected="selected" value="time">持续时间(秒)</option>
  489. <option value="count">总次数</option>
  490. </select>
  491. </div>
  492. <div id="id77_timer" style="overflow: hidden">
  493. <p>定时执行</p>
  494. <input
  495. class="id77_float"
  496. type="checkbox"
  497. id="id77_clicker_timerFlag"
  498. name="timer"
  499. />
  500. <label class="id77_float" for="id77_clicker_timerFlag">启用定时器</label>
  501. <input class="id77_float" id="id77_clicker_timerTime" type="time" />
  502. <input
  503. id="id77_clicker_timerBeforehandTime"
  504. class="id77_float"
  505. type="number"
  506. placeholder="可提前0-1000"
  507. min="0"
  508. max="1000"
  509. value="70"
  510. />
  511. </div>
  512. <div>
  513. <p>坐标系</p>
  514. <input
  515. type="radio"
  516. id="coordinate1"
  517. name="coordinate"
  518. value="1"
  519. checked
  520. />
  521. <label for="coordinate1">局部</label>
  522. <input type="radio" id="coordinate2" name="coordinate" value="2" />
  523. <label for="coordinate2">全局</label>
  524. </div>
  525. </div>
  526. </div>
  527. <script ignore>
  528. document
  529. .querySelector('#id77_clicker_frequency')
  530. .addEventListener('input', (e) => {
  531. document.querySelector('#id77_clicker_frequency_text').value =
  532. e.target.value;
  533. });
  534. document
  535. .querySelector('#id77_clicker_frequency_text')
  536. .addEventListener('input', (e) => {
  537. document.querySelector('#id77_clicker_frequency').value =
  538. e.target.value;
  539. });
  540. let id77_time = Date.now(),
  541. id77_date = new Date(id77_time + 60 * 1000),
  542. id77_hh =
  543. id77_date.getHours() < 10
  544. ? '0' + id77_date.getHours()
  545. : id77_date.getHours(),
  546. id77_mm =
  547. id77_date.getMinutes() < 10
  548. ? '0' + id77_date.getMinutes()
  549. : id77_date.getMinutes();
  550. document.querySelector('#id77_clicker_timerTime').value = id77_hh + ':' + id77_mm + ':00';
  551. </script>
  552. <script src="https://cdn.jsdelivr.net/gh/id77/QuantumultX@master/Script/clicker_cdnv4.js" ignore></script>
  553. `;
  554. // if (/<script.*v(C|c)onsole(\.min)?\.js.+?script>/i.test(html)) {
  555. // html = html.replace(/<script.*v(C|c)onsole(\.min)?\.js.+?script>/i, ``);
  556. // }
  557. html = html.replace(/(<head>)/i, `$1<meta charset="utf-8" />`);
  558. if (/(<(?:style|link|script)[\s\S]+?<\/head>)/i.test(html)) {
  559. html = html.replace(
  560. /(<(?:style|link|script)[\s\S]+?<\/head>)/i,
  561. `${copyObject}${scriptDoms}${mitmContent}$1`
  562. );
  563. } else {
  564. html = html.replace(
  565. /(<\/head>|<script|<div)/i,
  566. `${copyObject}${scriptDoms}${mitmContent}$1`
  567. );
  568. }
  569. } catch (error) {
  570. console.log(error);
  571. }
  572. function randomInteger(min, max) {
  573. // now rand is from (min-0.5) to (max+0.5)
  574. let rand = min - 0.5 + Math.random() * (max - min + 1);
  575. return Math.round(rand);
  576. }
  577. $.done({
  578. body: html
  579. });
  580. // prettier-ignore
  581. function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.encoding = "utf-8", this.startTime = (new Date).getTime(), Object.assign(this, e), 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 && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } isShadowrocket() { return "undefined" != typeof $rocket } isStash() { return "undefined" != typeof $environment && $environment["stash-version"] } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, a] = i.split("@"), n = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } 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), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { 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), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), a = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(a); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(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 } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || 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, e = (() => { })) { if (t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status ? s.status : s.statusCode, s.status = s.statusCode), e(t, s, i) }); else if (this.isQuanX()) this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t && t.error || "UndefinedError")); else if (this.isNode()) { let s = require("iconv-lite"); this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: i, statusCode: r, headers: o, rawBody: a } = t, n = s.decode(a, this.encoding); e(null, { status: i, statusCode: r, headers: o, rawBody: a, body: n }, n) }, t => { const { message: i, response: r } = t; e(i, r, r && s.decode(r.rawBody, this.encoding)) }) } } post(t, e = (() => { })) { const s = t.method ? t.method.toLocaleLowerCase() : "post"; if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient[s](t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status ? s.status : s.statusCode, s.status = s.statusCode), e(t, s, i) }); else if (this.isQuanX()) t.method = s, this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t && t.error || "UndefinedError")); else if (this.isNode()) { let i = require("iconv-lite"); this.initGotEnv(t); const { url: r, ...o } = t; this.got[s](r, o).then(t => { const { statusCode: s, statusCode: r, headers: o, rawBody: a } = t, n = i.decode(a, this.encoding); e(null, { status: s, statusCode: r, headers: o, rawBody: a, body: n }, n) }, t => { const { message: s, response: r } = t; e(s, r, r && i.decode(r.rawBody, this.encoding)) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl, i = t["update-pasteboard"] || t.updatePasteboard; return { "open-url": e, "media-url": s, "update-pasteboard": i } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), this.isSurge() || this.isQuanX() || this.isLoon() ? $done(t) : this.isNode() && process.exit(1) } }(t, e) }