🏠 Home 

Bilibili Live Tasks Helper

Enhancing the experience of watching Bilibili live streaming.


ติดตั้งสคริปต์นี้?
  1. // ==UserScript==
  2. // @name Bilibili Live Tasks Helper
  3. // @name:en Bilibili Live Tasks Helper
  4. // @name:zh Bilibili Live Tasks Helper
  5. // @namespace https://github.com/andywang425
  6. // @version 7.1.9
  7. // @author andywang425
  8. // @description Enhancing the experience of watching Bilibili live streaming.
  9. // @description:en Enhancing the experience of watching Bilibili live streaming.
  10. // @description:zh 增强Bilibili直播观看体验。
  11. // @license MIT
  12. // @copyright 2024, andywang425 (https://github.com/andywang425)
  13. // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNDEuMDY1IiBoZWlnaHQ9IjEyNy43NDciIHZpZXdCb3g9IjAgMCAzNy4zMjQgMzMuOCI+PHBhdGggZmlsbD0iIzIwYjBlMyIgZD0iTTg2Ljk2MiAxMTIuMzMyYTIuNjYxIDIuNjYxIDAgMCAxIDIuMjYyIDAgNS41MzYgNS41MzYgMCAwIDEgMS4zODQgMS4wMTFsNS4zMjMgNC42NThoMy44MDVsNS4zMjMtNC42NThhNS41ODkgNS41ODkgMCAwIDEgMS4zODQtMS4wMTEgMi42NjEgMi42NjEgMCAwIDEgMy41NCAyLjIwOSAyLjY2MSAyLjY2MSAwIDAgMS0uNTg2IDEuNzgzIDE0Ljg3NyAxNC44NzcgMCAwIDEtMS4xNzEgMS4wNjUgNy42OTEgNy42OTEgMCAwIDEtLjc0NS42MTJoMy4zMjZhNS42NDIgNS42NDIgMCAwIDEgMy45MTIgMS43NTYgNS42NjkgNS42NjkgMCAwIDEgMS43ODQgMy45MTJ2MTUuMzAzYTEwLjc3OCAxMC43NzggMCAwIDEtLjEzNCAyLjMxNSA1LjkwOCA1LjkwOCAwIDAgMS0yLjY2IDMuNzI2IDUuNzIyIDUuNzIyIDAgMCAxLTMuMDYxLjg1Mkg4Ni4yMTdhMTEuMjg0IDExLjI4NCAwIDAgMS0yLjM5Ni0uMTMzIDUuODgyIDUuODgyIDAgMCAxLTMuNjcyLTIuNjYyIDUuNjk1IDUuNjk1IDAgMCAxLS45MDUtMy4wNnYtMTUuMTQzYTExLjkyMyAxMS45MjMgMCAwIDEgMC0yLjIwOSA1Ljg1NSA1Ljg1NSAwIDAgMSA1LjMyMy00LjczN2gzLjQ4NmMtLjU1OS0uNC0xLjAzOC0uODc4LTEuNTQ0LTEuMzA0YTIuNjYxIDIuNjYxIDAgMCAxLS44NTEtMi4xODMgMi42NjEgMi42NjEgMCAwIDEgMS4zMDQtMi4xMDJtLS42MTIgMTAuMzI2YTIuNjYxIDIuNjYxIDAgMCAwLTIuMTAzIDEuOTE2IDMuNTkzIDMuNTkzIDAgMCAwIDAgMS4wMTF2MTIuNTg4YTIuNjYxIDIuNjYxIDAgMCAwIDEuODM3IDIuNjYyIDMuNTEzIDMuNTEzIDAgMCAwIDEuMTQ0LjE4NmgyMS42###hMi42NjEgMi42NjEgMCAwIDAgMi41MjgtMS41NyAzLjcyNiAzLjcyNiAwIDAgMCAuMjY2LTEuNzU3di0xMS43MWE0LjQ3MSA0LjQ3MSAwIDAgMCAwLTEuMjc3IDIuNjYxIDIuNjYxIDAgMCAwLTEuNzMtMS44MSA0LjI4NSA0LjI4NSAwIDAgMC0xLjY1LS4yMzlIODcuNjAxYTguODg5IDguODg5IDAgMCAwLTEuMjUxIDB6bTAgMCIgc3R5bGU9InN0cm9rZS13aWR0aDouMDMzMDcyOSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTc5LjE5MyAtMTEyLjA4KSIvPjxwYXRoIGQ9Ik04OC45NyAxMjguNjM2Yy4zNjMuMzc3Ljc0NS43NDcgMS4wODggMS4xNDIuNTk3LjY4NyAxLjExOCAxLjE5NyAxLjY2NiAxLjgwOS0uMTI5LTEuMTE3IDEuMzA0LTEuMTk4LjA3NC0xLjc1Ny0uNDA4LjQxNy0uOTQxLjg4NC0xLjM2IDEuMjIzLS4zOTIuMzE2LS44NjMuNjctMS4yMzUuOTUyLTEuOTA3IDEuNDQzLjIyNiA0LjA1MyAyLjEzIDIuNjA3IDAgMCAyLTEuNTM1IDIuODA3LTIuMzAxLjQ0LS40MTcuNjgtLjk1Ni43Mi0xLjU5Mi4wNC0uNjU0LS41MzUtMS4yNC0uNzk0LTEuNDk4LS45Mi0uOTE0LTEuNzQzLTEuOTY4LTIuNTUtMi44MTItMS41NzUtMS44LTQuMTIuNDI4LTIuNTQ2IDIuMjI3ek0xMDYuOTc5IDEyOC42MzZjLS4zNjMuMzc3LS43NDUuNzQ3LTEuMDg4IDEuMTQyLS41OTcuNjg3LTEuMTE4IDEuMTk3LTEuNjY2IDEuODA5LjEyOS0xLjExNy0xLjMwNC0xLjE5OC0uMDc0LTEuNzU3LjQwOC40MTcuOTQxLjg4NCAxLjM2IDEuMjIzLjM5Mi4zMTYuODYzLjY3IDEuMjM1Ljk1MiAxLjkwNyAxLjQ0My0uMjI2IDQuMDUzLTIuMTMgMi42MDcgMCAwLTItMS41MzUtMi44MDctMi4zMDEtLjQ0LS40MTctLjY4LS45NTYtLjcyLTEuNTkyLS4wNC0uNjU0LjUzNS0xLjI0Ljc5NC0xLjQ5OC45Mi0uOTE0IDEuNzQzLTEuOTY4IDIuNTUtMi44MTIgMS41NzUtMS44IDQuMTIuNDI4IDIuNTQ2IDIuMjI3eiIgc3R5bGU9ImZpbGw6IzIwYjBlMztmaWxsLW9wYWNpdHk6MTtzdHJva2Utd2lkdGg6LjUyNDE1OTtzdHJva2UtZGFzaGFycmF5Om5vbmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC03OS4xOTMgLTExMi4wOCkiLz48L3N2Zz4NCg==
  14. // @homepageURL https://github.com/andywang425/BLTH
  15. // @supportURL https://github.com/andywang425/BLTH/issues
  16. // @match *://live.bilibili.com/1*
  17. // @match *://live.bilibili.com/2*
  18. // @match *://live.bilibili.com/3*
  19. // @match *://live.bilibili.com/4*
  20. // @match *://live.bilibili.com/5*
  21. // @match *://live.bilibili.com/6*
  22. // @match *://live.bilibili.com/7*
  23. // @match *://live.bilibili.com/8*
  24. // @match *://live.bilibili.com/9*
  25. // @match *://live.bilibili.com/blanc/1*
  26. // @match *://live.bilibili.com/blanc/2*
  27. // @match *://live.bilibili.com/blanc/3*
  28. // @match *://live.bilibili.com/blanc/4*
  29. // @match *://live.bilibili.com/blanc/5*
  30. // @match *://live.bilibili.com/blanc/6*
  31. // @match *://live.bilibili.com/blanc/7*
  32. // @match *://live.bilibili.com/blanc/8*
  33. // @match *://live.bilibili.com/blanc/9*
  34. // @require https://unpkg.com/vue@3.5.10/dist/vue.global.prod.js
  35. // @require data:application/javascript,%3Bwindow.Vue%3DVue%3Bwindow.VueDemi%3DVue%3B
  36. // @require https://unpkg.com/element-plus@2.8.4/dist/index.full.min.js
  37. // @require https://unpkg.com/@element-plus/icons-vue@2.3.1/dist/index.iife.min.js
  38. // @require https://unpkg.com/pinia@2.2.3/dist/pinia.iife.prod.js
  39. // @require https://unpkg.com/vue-draggable-plus@0.5.3/dist/vue-draggable-plus.iife.js
  40. // @require https://unpkg.com/lodash@4.17.21/lodash.min.js
  41. // @require https://unpkg.com/hotkeys-js@3.13.7/dist/hotkeys.min.js
  42. // @require https://unpkg.com/luxon@3.5.0/build/global/luxon.min.js
  43. // @require https://unpkg.com/crypto-js@4.2.0/crypto-js.js
  44. // @resource element-plus/dist/index.css https://unpkg.com/element-plus@2.8.4/dist/index.css
  45. // @connect api.bilibili.com
  46. // @connect api.live.bilibili.com
  47. // @connect api.vc.bilibili.com
  48. // @connect passport.bilibili.com
  49. // @connect live.bilibili.com
  50. // @connect live-trace.bilibili.com
  51. // @grant GM_addStyle
  52. // @grant GM_getResourceText
  53. // @grant GM_getValue
  54. // @grant GM_setValue
  55. // @grant GM_xmlhttpRequest
  56. // @grant unsafeWindow
  57. // @run-at document-start
  58. // ==/UserScript==
  59. (e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const t=document.createElement("style");t.textContent=e,document.head.append(t)})(" .title[data-v-f383a843]{padding-left:20px;align-items:baseline;display:flex}.header-big-text[data-v-f383a843]{font-size:var(--big-text-size);align-self:unset}.header-small-text[data-v-f383a843]{font-size:var(--small-text-size);align-self:unset;margin-left:10px;--small-text-size: 18px}.collapse-btn[data-v-f383a843]{display:flex;justify-content:center;align-items:center;height:100%;float:left;cursor:pointer}#aside-el-menu[data-v-8ecf0b13]{height:100%}.avatar-wrap[data-v-584fbcd9]{width:80px;height:80px}.avatar[data-v-584fbcd9]{display:flex;justify-content:center;align-items:center;border-radius:50%}.radio-group[data-v-584fbcd9]{display:block;font-size:inherit}.label-text[data-v-1cb0d081]{color:var(--el-text-color-primary);line-height:32px}.base[data-v-24895187]{z-index:1003;position:absolute;background-color:#fff;border-bottom:1px solid #e3e5e7;border-left:1px solid #e3e5e7;border-right:1px solid #e3e5e7}.header[data-v-24895187]{position:relative;box-sizing:border-box;width:100%;font-size:var(--big-text-size);align-items:center;display:flex;border-bottom:1px solid #e3e5e7;height:60px;--big-text-size: 25px}.aside[data-v-24895187]{width:auto}.aside #aside-el-menu[data-v-24895187]:not(.el-menu--collapse){width:150px}.main[data-v-24895187]{--main-top-botton-padding: calc(var(--el-main-padding) * .625);padding-top:var(--main-top-botton-padding);padding-bottom:var(--main-top-botton-padding)}.fade-enter-active[data-v-24895187]{animation:fade-in linear .2s}.info-icon[data-v-38289ed3]{font-size:var(--el-font-size-base);cursor:pointer}.status-icon[data-v-b4254e0f]{font-size:var(--el-font-size-base)}.blth_btn{background-color:#23ade5;font-size:small;margin-inline-start:5px;color:#fff;border-radius:4px;border:none;padding:5px;cursor:pointer;box-shadow:0 0 2px #00000075;line-height:10px;margin-left:15px}.blth_btn:hover{background-color:#1097cc}.blth_btn:hover:active{background-color:#0e86b6;position:relative;top:1px}.el-message-box li{list-style:initial}@media screen and (min-width: 1930px){html[lab-style*=adaptive] .base{zoom:.9375}}@media screen and (min-width: 2058px){html[lab-style*=adaptive] .base{zoom:.75}}@media screen and (min-width: 2570px){html[lab-style*=adaptive] .base{zoom:calc(2 / 3)}}@media screen and (min-width: 3210px){html[lab-style*=adaptive] .base{zoom:.5}}@media screen and (min-width: 3850px){html[lab-style*=adaptive] .base{zoom:.46875}} ");
  60. (async function (vue, pinia$1, _, ElementPlusIconsVue, CryptoJS, luxon, ElementPlus, vueDraggablePlus, hotkeys) {
  61. 'use strict';
  62. function _interopNamespaceDefault(e) {
  63. const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
  64. if (e) {
  65. for (const k in e) {
  66. if (k !== 'default') {
  67. const d = Object.getOwnPropertyDescriptor(e, k);
  68. Object.defineProperty(n, k, d.get ? d : {
  69. enumerable: true,
  70. get: () => e[k]
  71. });
  72. }
  73. }
  74. }
  75. n.default = e;
  76. return Object.freeze(n);
  77. }
  78. const ElementPlusIconsVue__namespace = /*#__PURE__*/_interopNamespaceDefault(ElementPlusIconsVue);
  79. var __defProp = Object.defineProperty;
  80. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  81. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  82. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  83. var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
  84. var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
  85. var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  86. var _unsafeWindow = /* @__PURE__ */ (() => typeof unsafeWindow != "undefined" ? unsafeWindow : void 0)();
  87. const defaultValues = {
  88. ui: {
  89. isCollapse: false,
  90. isShowPanel: true,
  91. activeMenuIndex: "MainSiteTasks",
  92. panelWidthPercent: 40,
  93. medalInfoPanelSortMode: false
  94. },
  95. modules: {
  96. DailyTasks: {
  97. MainSiteTasks: {
  98. login: {
  99. enabled: false,
  100. _lastCompleteTime: 0
  101. },
  102. watch: {
  103. enabled: false,
  104. _lastCompleteTime: 0
  105. },
  106. coin: {
  107. enabled: false,
  108. num: 1,
  109. _lastCompleteTime: 0
  110. },
  111. share: {
  112. enabled: false,
  113. _lastCompleteTime: 0
  114. }
  115. },
  116. LiveTasks: {
  117. sign: {
  118. enabled: false,
  119. _lastCompleteTime: 0
  120. },
  121. medalTasks: {
  122. light: {
  123. enabled: false,
  124. mode: "danmu",
  125. danmuList: [
  126. "(⌒▽⌒)",
  127. "( ̄▽ ̄)",
  128. "(=・ω・=)",
  129. "(`・ω・´)",
  130. "(〜 ̄△ ̄)〜",
  131. "(・∀・)",
  132. "(°∀°)ノ",
  133. "╮( ̄▽ ̄)╭",
  134. "_(:3」∠)_",
  135. "(^・ω・^ )",
  136. "(● ̄(エ) ̄●)",
  137. "ε=ε=(ノ≧∇≦)ノ",
  138. "⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄",
  139. "←◡←",
  140. `(●'◡'●)ノ♥`
  141. ],
  142. _lastCompleteTime: 0
  143. },
  144. watch: {
  145. enabled: false,
  146. time: 25,
  147. _watchingProgress: {},
  148. _lastWatchTime: 0,
  149. _lastCompleteTime: 0
  150. },
  151. isWhiteList: false,
  152. roomidList: []
  153. }
  154. },
  155. OtherTasks: {
  156. groupSign: {
  157. enabled: false,
  158. _lastCompleteTime: 0
  159. },
  160. silverToCoin: {
  161. enabled: false,
  162. _lastCompleteTime: 0
  163. },
  164. coinToSilver: {
  165. enabled: false,
  166. num: 1,
  167. _lastCompleteTime: 0
  168. },
  169. getYearVipPrivilege: {
  170. enabled: false,
  171. _nextReceiveTime: 0
  172. }
  173. }
  174. },
  175. EnhanceExperience: {
  176. switchLiveStreamQuality: {
  177. enabled: false,
  178. qualityDesc: "原画"
  179. },
  180. banp2p: {
  181. enabled: false
  182. },
  183. noReport: {
  184. enabled: false
  185. },
  186. noSleep: {
  187. enabled: false
  188. },
  189. invisibility: {
  190. enabled: false
  191. }
  192. },
  193. RemoveElement: {
  194. removePKBox: {
  195. enabled: false
  196. },
  197. removeLiveWaterMark: {
  198. enabled: false
  199. },
  200. removeShopPopover: {
  201. enabled: false
  202. },
  203. removeGameParty: {
  204. enabled: false
  205. },
  206. removeGiftPopover: {
  207. enabled: false
  208. },
  209. removeMicPopover: {
  210. enabled: false
  211. },
  212. removeComboCard: {
  213. enabled: false
  214. },
  215. removeRank: {
  216. enabled: false
  217. },
  218. removeHeaderStuff: {
  219. enabled: false
  220. },
  221. removeFlipView: {
  222. enabled: false
  223. },
  224. removeRecommendRoom: {
  225. enabled: false
  226. },
  227. removeLiveMosaic: {
  228. enabled: false
  229. }
  230. }
  231. },
  232. cache: {
  233. lastAliveHeartBeatTime: 0
  234. }
  235. };
  236. class Storage {
  237. /**
  238. * 递归合并配置项。删除当前配置中不存在于默认配置的键,补上相对于默认配置缺少的键值,其它键值不变
  239. *
  240. * 该方法不会修改当前配置
  241. *
  242. * @param currentConfig 当前配置
  243. * @param defaultConfig 默认配置
  244. * @returns 修改后的当前配置
  245. * @example
  246. *
  247. * const current_config = { enabled: true, details: { type: 'efg', status: 'ok' }, msg: 'hi' };
  248. * const default_config = { enabled: false, details: { type: 'abc', num: 1 } };
  249. *
  250. * mergeConfigs(current_config, default_config);
  251. * // => { enabled: true, details: { type: 'efg', num: 1 } }
  252. */
  253. static mergeConfigs(currentConfig, defaultConfig) {
  254. const config = _.pick(currentConfig, _.keys(defaultConfig));
  255. _.defaults(config, defaultConfig);
  256. _.forOwn(config, (value, key, object) => {
  257. if (_.isPlainObject(value) && _.isPlainObject(defaultConfig[key]) && !_.isEmpty(defaultConfig[key])) {
  258. object[key] = this.mergeConfigs(value, defaultConfig[key]);
  259. }
  260. });
  261. return config;
  262. }
  263. static setUiConfig(uiConfig) {
  264. _GM_setValue("ui", uiConfig);
  265. }
  266. static getUiConfig() {
  267. return this.mergeConfigs(_GM_getValue("ui", {}), defaultValues.ui);
  268. }
  269. static setModuleConfig(moduleConfig) {
  270. _GM_setValue("modules", moduleConfig);
  271. }
  272. static getModuleConfig() {
  273. return this.mergeConfigs(_GM_getValue("modules", {}), defaultValues.modules);
  274. }
  275. static setCache(cache) {
  276. _GM_setValue("cache", cache);
  277. }
  278. static getCache() {
  279. return this.mergeConfigs(_GM_getValue("cache", {}), defaultValues.cache);
  280. }
  281. }
  282. const index2name = {
  283. MainSiteTasks: "主站任务",
  284. LiveTasks: "直播任务",
  285. OtherTasks: "其它任务",
  286. EnhanceExperience: "体验优化",
  287. RemoveElement: "移除元素",
  288. ScriptSettings: "设置"
  289. };
  290. const useUIStore = pinia$1.defineStore("ui", () => {
  291. const uiConfig = vue.reactive(Storage.getUiConfig());
  292. const activeMenuName = vue.computed(() => index2name[uiConfig.activeMenuIndex]);
  293. const livePlayerRect = vue.reactive({
  294. top: 0,
  295. left: 0,
  296. height: 0,
  297. width: 0
  298. });
  299. const windowScrollPosition = vue.reactive({ x: 0, y: 0 });
  300. const panelStyle = vue.computed(() => ({
  301. // 此处若使用最新的滚动条位置(window.scrollX/Y),用户在调整控制面板宽度时可能导致面板在垂直方向上错位
  302. top: `${livePlayerRect.top + windowScrollPosition.y}px`,
  303. left: `${livePlayerRect.left + windowScrollPosition.x}px`,
  304. height: `${livePlayerRect.height}px`,
  305. width: `${livePlayerRect.width * uiConfig.panelWidthPercent / 100}px`
  306. }));
  307. const isShowPanelButtonText = vue.computed(
  308. () => uiConfig.isShowPanel ? "隐藏控制面板" : "显示控制面板"
  309. );
  310. const scrollBarHeight = vue.computed(() => `${livePlayerRect.height - 60}px`);
  311. function changeCollapse() {
  312. uiConfig.isCollapse = !uiConfig.isCollapse;
  313. }
  314. function changeShowPanel() {
  315. uiConfig.isShowPanel = !uiConfig.isShowPanel;
  316. }
  317. function setActiveMenuIndex(index) {
  318. uiConfig.activeMenuIndex = index;
  319. }
  320. vue.watch(
  321. uiConfig,
  322. _.debounce((newUiConfig) => Storage.setUiConfig(newUiConfig), 350)
  323. );
  324. return {
  325. isShowPanelButtonText,
  326. activeMenuName,
  327. livePlayerRect,
  328. windowScrollPosition,
  329. panelStyle,
  330. scrollBarHeight,
  331. uiConfig,
  332. changeCollapse,
  333. changeShowPanel,
  334. setActiveMenuIndex
  335. };
  336. });
  337. const _hoisted_1$2 = { class: "title" };
  338. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  339. __name: "PanelHeader",
  340. setup(__props) {
  341. const uiStore = useUIStore();
  342. return (_ctx, _cache) => {
  343. const _component_el_icon = vue.resolveComponent("el-icon");
  344. const _component_el_text = vue.resolveComponent("el-text");
  345. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  346. vue.createElementVNode("div", {
  347. class: "collapse-btn",
  348. onClick: _cache[0] || (_cache[0] = //@ts-ignore
  349. (...args) => vue.unref(uiStore).changeCollapse && vue.unref(uiStore).changeCollapse(...args))
  350. }, [
  351. vue.unref(uiStore).uiConfig.isCollapse ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  352. default: vue.withCtx(() => [
  353. vue.createVNode(vue.unref(ElementPlusIconsVue.Expand))
  354. ]),
  355. _: 1
  356. })) : (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 1 }, {
  357. default: vue.withCtx(() => [
  358. vue.createVNode(vue.unref(ElementPlusIconsVue.Fold))
  359. ]),
  360. _: 1
  361. }))
  362. ]),
  363. vue.createElementVNode("div", _hoisted_1$2, [
  364. vue.createVNode(_component_el_text, {
  365. tag: "b",
  366. class: "header-big-text"
  367. }, {
  368. default: vue.withCtx(() => _cache[1] || (_cache[1] = [
  369. vue.createTextVNode("控制面板")
  370. ])),
  371. _: 1
  372. }),
  373. vue.createVNode(_component_el_text, { class: "header-small-text" }, {
  374. default: vue.withCtx(() => [
  375. vue.createTextVNode(vue.toDisplayString(vue.unref(uiStore).activeMenuName), 1)
  376. ]),
  377. _: 1
  378. })
  379. ])
  380. ], 64);
  381. };
  382. }
  383. });
  384. const _export_sfc = (sfc, props) => {
  385. const target = sfc.__vccOpts || sfc;
  386. for (const [key, val] of props) {
  387. target[key] = val;
  388. }
  389. return target;
  390. };
  391. const PanelHeader = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-f383a843"]]);
  392. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  393. __name: "PanelAside",
  394. setup(__props) {
  395. const uiStore = useUIStore();
  396. const items = [
  397. {
  398. icon: "Tasks",
  399. title: "每日任务",
  400. index: "DailyTasks",
  401. // 有子菜单,index 无所谓
  402. subs: [
  403. {
  404. title: "主站任务",
  405. index: "MainSiteTasks"
  406. // index 是组件名
  407. },
  408. {
  409. title: "直播任务",
  410. index: "LiveTasks"
  411. },
  412. {
  413. title: "其它任务",
  414. index: "OtherTasks"
  415. }
  416. ]
  417. },
  418. {
  419. icon: "Monitor",
  420. title: "体验优化",
  421. index: "EnhanceExperience"
  422. },
  423. {
  424. icon: "Scissor",
  425. title: "移除元素",
  426. index: "RemoveElement"
  427. },
  428. {
  429. icon: "Setting",
  430. title: "设置",
  431. index: "ScriptSettings"
  432. }
  433. ];
  434. return (_ctx, _cache) => {
  435. const _component_el_icon = vue.resolveComponent("el-icon");
  436. const _component_el_menu_item = vue.resolveComponent("el-menu-item");
  437. const _component_el_sub_menu = vue.resolveComponent("el-sub-menu");
  438. const _component_el_menu = vue.resolveComponent("el-menu");
  439. return vue.openBlock(), vue.createBlock(_component_el_menu, {
  440. "default-active": vue.unref(uiStore).uiConfig.activeMenuIndex,
  441. style: vue.normalizeStyle({ "min-height": vue.unref(uiStore).scrollBarHeight }),
  442. collapse: vue.unref(uiStore).uiConfig.isCollapse,
  443. "unique-opened": "",
  444. onSelect: _cache[0] || (_cache[0] = (index) => vue.unref(uiStore).setActiveMenuIndex(index)),
  445. id: "aside-el-menu"
  446. }, {
  447. default: vue.withCtx(() => [
  448. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(items, (item) => {
  449. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  450. item.subs ? (vue.openBlock(), vue.createBlock(_component_el_sub_menu, {
  451. index: item.index,
  452. key: item.index
  453. }, {
  454. title: vue.withCtx(() => [
  455. vue.createVNode(_component_el_icon, null, {
  456. default: vue.withCtx(() => [
  457. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.icon)))
  458. ]),
  459. _: 2
  460. }, ####),
  461. vue.createElementVNode("span", null, vue.toDisplayString(item.title), 1)
  462. ]),
  463. default: vue.withCtx(() => [
  464. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(item.subs, (subItem) => {
  465. return vue.openBlock(), vue.createBlock(_component_el_menu_item, {
  466. index: subItem.index,
  467. key: subItem.index
  468. }, {
  469. default: vue.withCtx(() => [
  470. vue.createTextVNode(vue.toDisplayString(subItem.title), 1)
  471. ]),
  472. _: 2
  473. }, 1032, ["index"]);
  474. }), 128))
  475. ]),
  476. _: 2
  477. }, 1032, ["index"])) : (vue.openBlock(), vue.createBlock(_component_el_menu_item, {
  478. index: item.index,
  479. key: item.index
  480. }, {
  481. title: vue.withCtx(() => [
  482. vue.createTextVNode(vue.toDisplayString(item.title), 1)
  483. ]),
  484. default: vue.withCtx(() => [
  485. vue.createVNode(_component_el_icon, null, {
  486. default: vue.withCtx(() => [
  487. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.icon)))
  488. ]),
  489. _: 2
  490. }, ####)
  491. ]),
  492. _: 2
  493. }, 1032, ["index"]))
  494. ], 64);
  495. }), 64))
  496. ]),
  497. _: 1
  498. }, 8, ["default-active", "style", "collapse"]);
  499. };
  500. }
  501. });
  502. const PanelAside = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-8ecf0b13"]]);
  503. luxon.Settings.defaultZone = "Asia/Shanghai";
  504. function isTimestampToday(timestamp, hour = 0, minute = 5) {
  505. const time = luxon.DateTime.fromMillis(timestamp);
  506. const startOfADay = luxon.DateTime.now().set({
  507. hour,
  508. minute,
  509. second: 0,
  510. millisecond: 0
  511. });
  512. const startOfTomorrow = startOfADay.plus({ days: 1 });
  513. const startOfYesterday = startOfADay.minus({ days: 1 });
  514. if (luxon.DateTime.now() >= startOfADay) {
  515. return time >= startOfADay && time < startOfTomorrow;
  516. } else {
  517. return time >= startOfYesterday && time < startOfADay;
  518. }
  519. }
  520. function delayToNextMoment(hour = 0, minute = 5) {
  521. const now = luxon.DateTime.now();
  522. let nextTime = luxon.DateTime.local(now.year, now.month, now.day, hour, minute);
  523. if (now > nextTime) {
  524. nextTime = nextTime.plus({ days: 1 });
  525. }
  526. const diff = nextTime.diff(now);
  527. return {
  528. // 时间戳
  529. ms: diff.toMillis(),
  530. // 便于阅读的字符串,去掉开头的0小时和0分钟
  531. str: diff.toFormat("h小时m分钟s秒").replace(/^0小时/, "").replace(/^0分钟/, "")
  532. };
  533. }
  534. function isNowIn(startHour, startMinute, endHour, endMinute) {
  535. const now = luxon.DateTime.now();
  536. const start = luxon.DateTime.local(now.year, now.month, now.day, startHour, startMinute);
  537. let end = luxon.DateTime.local(now.year, now.month, now.day, endHour, endMinute);
  538. if (start > end) {
  539. end = end.plus({ days: 1 });
  540. }
  541. return now >= start && now < end;
  542. }
  543. function ts() {
  544. return Math.round(luxon.DateTime.now().toSeconds());
  545. }
  546. function tsm() {
  547. return luxon.DateTime.now().toMillis();
  548. }
  549. function uuid() {
  550. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
  551. const randomInt = 16 * Math.random() | 0;
  552. return ("x" === char ? randomInt : 3 & randomInt | 8).toString(16);
  553. });
  554. }
  555. function sleep(miliseconds) {
  556. return new Promise((resolve2) => setTimeout(resolve2, miliseconds));
  557. }
  558. function getFilenameFromUrl(url) {
  559. return url.substring(url.lastIndexOf("/") + 1).split(".")[0];
  560. }
  561. function addURLParams(url, params) {
  562. if (!params) {
  563. return url;
  564. }
  565. if (typeof params === "string") {
  566. return url + "?" + params;
  567. } else {
  568. return url + "?" + new URLSearchParams(params).toString();
  569. }
  570. }
  571. function wbiSign(params) {
  572. params.wts = ts();
  573. const query = Object.keys(params).sort().map((key) => {
  574. const value = params[key].toString().replace(/[!'()*]/g, "");
  575. return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
  576. }).join("&");
  577. const wbiSign2 = CryptoJS.MD5(query + useBiliStore().wbiSalt).toString();
  578. return query + "&w_rid=" + wbiSign2;
  579. }
  580. function packFormData(json) {
  581. const formData = new FormData();
  582. _.forEach(json, (value, key) => formData.append(key, value.toString()));
  583. return formData;
  584. }
  585. function deepestIterate(obj, fn, path) {
  586. _.forOwn(obj, function(value, key) {
  587. const newPath = path ? path + "." + key : key;
  588. if (_.isPlainObject(value) && !_.isEmpty(value)) {
  589. deepestIterate(value, fn, newPath);
  590. } else {
  591. fn(value, newPath);
  592. }
  593. });
  594. }
  595. function getUrlFromFetchInput(input) {
  596. if (typeof input === "string") {
  597. return input;
  598. } else if (input instanceof URL) {
  599. return input.toString();
  600. } else if (input instanceof Request) {
  601. return input.url;
  602. } else {
  603. return "Incorrect input";
  604. }
  605. }
  606. function waitForMoment(moment) {
  607. switch (moment) {
  608. case "document-start": {
  609. return Promise.resolve();
  610. }
  611. case "document-head": {
  612. return new Promise((resolve2) => {
  613. if (document.head) {
  614. resolve2();
  615. } else {
  616. const observer = new MutationObserver(() => {
  617. if (document.head) {
  618. observer.disconnect();
  619. resolve2();
  620. }
  621. });
  622. observer.observe(document.documentElement, { childList: true });
  623. }
  624. });
  625. }
  626. case "document-body": {
  627. return new Promise((resolve2) => {
  628. if (document.body) {
  629. resolve2();
  630. } else {
  631. const observer = new MutationObserver(() => {
  632. if (document.body) {
  633. observer.disconnect();
  634. resolve2();
  635. }
  636. });
  637. observer.observe(document.documentElement, { childList: true });
  638. }
  639. });
  640. }
  641. case "document-end": {
  642. return new Promise((resolve2) => {
  643. if (document.readyState !== "loading") {
  644. resolve2();
  645. } else {
  646. document.addEventListener("DOMContentLoaded", () => resolve2());
  647. }
  648. });
  649. }
  650. case "window-load": {
  651. return new Promise((resolve2) => {
  652. if (document.readyState === "complete") {
  653. resolve2();
  654. } else {
  655. window.addEventListener("load", () => resolve2());
  656. }
  657. });
  658. }
  659. default: {
  660. return Promise.reject("Illegal moment");
  661. }
  662. }
  663. }
  664. function arrayToMap(arr) {
  665. return new Map(arr.map((value, index) => [value, index]));
  666. }
  667. const useBiliStore = pinia$1.defineStore("bili", () => {
  668. const BilibiliLive2 = vue.ref();
  669. const cookies = vue.ref();
  670. const userInfo = vue.ref();
  671. const giftConfig = vue.ref();
  672. const dailyRewardInfo = vue.ref();
  673. const dynamicVideos = vue.ref();
  674. const fansMedals = vue.ref();
  675. const filteredFansMedals = vue.computed(
  676. () => {
  677. var _a;
  678. return ((_a = fansMedals.value) == null ? void 0 : _a.filter((m) => m.room_info.room_id !== 0)) ?? [];
  679. }
  680. );
  681. const fansMedalsStatus = vue.ref();
  682. const wbiSalt = vue.computed(() => {
  683. if (!userInfo.value) {
  684. return "";
  685. }
  686. const imgKey = getFilenameFromUrl(userInfo.value.wbi_img.img_url);
  687. const subKey = getFilenameFromUrl(userInfo.value.wbi_img.sub_url);
  688. const imgAndSubKey = imgKey + subKey;
  689. return [
  690. 46,
  691. 47,
  692. 18,
  693. 2,
  694. 53,
  695. 8,
  696. 23,
  697. 32,
  698. 15,
  699. 50,
  700. 10,
  701. 31,
  702. 58,
  703. 3,
  704. 45,
  705. 35,
  706. 27,
  707. 43,
  708. 5,
  709. 49,
  710. 33,
  711. 9,
  712. 42,
  713. 19,
  714. 29,
  715. 28,
  716. 14,
  717. 39,
  718. 12,
  719. 38,
  720. 41,
  721. 13,
  722. 37,
  723. 48,
  724. 7,
  725. 16,
  726. 24,
  727. 55,
  728. 40,
  729. 61,
  730. 26,
  731. 17,
  732. 0,
  733. 1,
  734. 60,
  735. 51,
  736. 30,
  737. 4,
  738. 22,
  739. 25,
  740. 54,
  741. 21,
  742. 56,
  743. 59,
  744. 6,
  745. 63,
  746. 57,
  747. 62,
  748. 11,
  749. 36,
  750. 20,
  751. 34,
  752. 44,
  753. 52
  754. ].map((n) => imgAndSubKey[n]).join("").slice(0, 32);
  755. });
  756. return {
  757. BilibiliLive: BilibiliLive2,
  758. userInfo,
  759. giftConfig,
  760. cookies,
  761. dailyRewardInfo,
  762. dynamicVideos,
  763. fansMedals,
  764. filteredFansMedals,
  765. fansMedalsStatus,
  766. wbiSalt
  767. };
  768. });
  769. let Request$1 = class Request2 {
  770. constructor(url_prefix, orgin) {
  771. /** 请求 URL 的前缀 */
  772. __publicField(this, "url_prefix");
  773. /**
  774. * 请求 Header 中 Origin 的值,为了方便同时也是 Referer 的值
  775. */
  776. __publicField(this, "origin");
  777. this.url_prefix = url_prefix ?? "";
  778. this.origin = orgin ?? "https://bilibili.com";
  779. }
  780. /**
  781. * 发起一个 GET 请求
  782. * @param url 请求 URL 除去前缀的部分
  783. * @param params URL 参数
  784. * @param otherDetails GM_xmlhttpRequest 的 details 参数
  785. */
  786. get(url, params, otherDetails) {
  787. url = addURLParams(this.url_prefix + url, params);
  788. return new Promise((resolve2, reject2) => {
  789. const defaultDetails = {
  790. method: "GET",
  791. url,
  792. responseType: "json",
  793. headers: {
  794. Accept: "application/json, text/plain, */*",
  795. Referer: this.origin,
  796. Origin: this.origin,
  797. "Sec-Fetch-Site": "same-site"
  798. },
  799. onload: function(response) {
  800. resolve2(response.response);
  801. },
  802. onerror: function(err) {
  803. reject2(new Error(JSON.stringify(err)));
  804. }
  805. };
  806. const details = _.defaultsDeep(otherDetails, defaultDetails);
  807. _GM_xmlhttpRequest(details);
  808. });
  809. }
  810. /**
  811. * 发起一个 POST 请求
  812. * @param url 请求 URL 除去前缀的部分
  813. * @param data POST data
  814. * @param otherDetails GM_xmlhttpRequest 的 details 参数(特别的,可以提供 params 属性作为 URL 参数)
  815. */
  816. post(url, data, otherDetails) {
  817. const headers = {
  818. Accept: "application/json, text/plain, */*",
  819. Referer: this.origin,
  820. Origin: this.origin,
  821. "Sec-Fetch-Site": "same-site",
  822. "Content-Type": "application/x-www-form-urlencoded"
  823. };
  824. if (data instanceof FormData) {
  825. delete headers["Content-Type"];
  826. } else if (typeof data === "object") {
  827. data = new URLSearchParams(data).toString();
  828. }
  829. url = addURLParams(this.url_prefix + url, otherDetails == null ? void 0 : otherDetails.params);
  830. otherDetails == null ? true : delete otherDetails.params;
  831. return new Promise((resolve2, reject2) => {
  832. const defaultDetails = {
  833. method: "POST",
  834. url,
  835. data,
  836. responseType: "json",
  837. headers,
  838. onload: function(response) {
  839. resolve2(response.response);
  840. },
  841. onerror: function(err) {
  842. reject2(new Error(JSON.stringify(err)));
  843. }
  844. };
  845. const details = _.defaultsDeep(otherDetails, defaultDetails);
  846. _GM_xmlhttpRequest(details);
  847. });
  848. }
  849. };
  850. const request = {
  851. live: new Request$1("https://api.live.bilibili.com", "https://live.bilibili.com"),
  852. liveTrace: new Request$1("https://live-trace.bilibili.com", "https://live.bilibili.com"),
  853. passport: new Request$1("https://passport.bilibili.com", "https://passport.bilibili.com/"),
  854. main: new Request$1("https://api.bilibili.com", "https://www.bilibili.com"),
  855. vc: new Request$1("https://api.vc.bilibili.com", "https://message.bilibili.com/"),
  856. raw: new Request$1()
  857. };
  858. const BAPI = {
  859. live: {
  860. roomGiftConfig: (room_id = 0, area_parent_id = 0, area_id = 0, platform = "pc") => {
  861. return request.live.get("/xlive/web-room/v1/giftPanel/roomGiftConfig", {
  862. platform,
  863. room_id,
  864. area_parent_id,
  865. area_id
  866. });
  867. },
  868. doSign: () => {
  869. return request.live.get("/xlive/web-ucenter/v1/sign/DoSign");
  870. },
  871. /**
  872. * 网页直播签到功能已不存在,但该API仍可以使用(并且也存在于B站js代码中)
  873. */
  874. getSignInfo: () => {
  875. return request.live.get("/xlive/web-ucenter/v1/sign/WebGetSignInfo");
  876. },
  877. fansMedalPanel: (page, page_size = 10) => {
  878. return request.live.get("/xlive/app-ucenter/v1/fansMedal/panel", {
  879. page,
  880. page_size
  881. });
  882. },
  883. sendMsg: (msg, roomid, room_type = 0, mode = 1, jumpfrom = 0, fontsize = 25, color = 16777215, bubble = 0, reply_mid = 0, reply_attr = 0, replay_dmid = "", statistics = '{"appId":100,"platform":5}') => {
  884. const biliStore = useBiliStore();
  885. const bili_jct = biliStore.cookies.bili_jct;
  886. return request.live.post(
  887. "/msg/send",
  888. packFormData({
  889. bubble,
  890. msg,
  891. color,
  892. mode,
  893. room_type,
  894. jumpfrom,
  895. reply_mid,
  896. reply_attr,
  897. replay_dmid,
  898. statistics,
  899. fontsize,
  900. rnd: ts(),
  901. roomid,
  902. csrf: bili_jct,
  903. csrf_token: bili_jct
  904. })
  905. );
  906. },
  907. likeReport: (room_id, anchor_id, click_time = 1, visit_id = "") => {
  908. const biliStore = useBiliStore();
  909. const bili_jct = biliStore.cookies.bili_jct;
  910. const uid = biliStore.BilibiliLive.UID;
  911. return request.live.post("/xlive/app-ucenter/v1/like_info_v3/like/likeReportV3", {
  912. click_time,
  913. room_id,
  914. uid,
  915. anchor_id,
  916. csrf_token: bili_jct,
  917. csrf: bili_jct,
  918. visit_id
  919. });
  920. },
  921. /**
  922. * 该API只在带有多层iframe(背景很好看)的直播间中被使用,但参数填任意直播间均可
  923. */
  924. getInfoByRoom: (room_id, web_location = "444.8") => {
  925. return request.live.get(
  926. "/xlive/web-room/v1/index/getInfoByRoom",
  927. wbiSign({
  928. room_id,
  929. web_location
  930. })
  931. );
  932. },
  933. getUserTaskProgress: (target_id = 11153765) => {
  934. const biliStore = useBiliStore();
  935. const bili_jct = biliStore.cookies.bili_jct;
  936. return request.live.get("/xlive/app-ucenter/v1/userTask/GetUserTaskProgress", {
  937. target_id,
  938. csrf: bili_jct,
  939. ts: ts()
  940. });
  941. },
  942. userTaskReceiveRewards: (target_id = 11153765) => {
  943. const biliStore = useBiliStore();
  944. const bili_jct = biliStore.cookies.bili_jct;
  945. return request.live.post("/xlive/app-ucenter/v1/userTask/UserTaskReceiveRewards", {
  946. actionKey: "csrf",
  947. target_id,
  948. csrf: bili_jct,
  949. ts: ts()
  950. });
  951. },
  952. silver2coin: (visit_id = "") => {
  953. const bili_jct = useBiliStore().cookies.bili_jct;
  954. return request.live.post("/xlive/revenue/v1/wallet/silver2coin", {
  955. csrf: bili_jct,
  956. csrf_token: bili_jct,
  957. visit_id
  958. });
  959. },
  960. coin2silver: (num, platform = "pc", visit_id = "") => {
  961. const bili_jct = useBiliStore().cookies.bili_jct;
  962. return request.live.post("/xlive/revenue/v1/wallet/coin2silver", {
  963. num,
  964. csrf: bili_jct,
  965. csrf_token: bili_jct,
  966. platform,
  967. visit_id
  968. });
  969. },
  970. wearMedal: (medal_id, visit_id = "") => {
  971. const bili_jct = useBiliStore().cookies.bili_jct;
  972. return request.live.post("/xlive/web-room/v1/fansMedal/wear", {
  973. medal_id,
  974. csrf_token: bili_jct,
  975. csrf: bili_jct,
  976. visit_id
  977. });
  978. }
  979. },
  980. liveTrace: {
  981. E: (id, device, ruid, is_patch = 0, heart_beat = [], visit_id = "") => {
  982. const bili_jct = useBiliStore().cookies.bili_jct;
  983. return request.liveTrace.post("/xlive/data-interface/v1/x25Kn/E", {
  984. id: JSON.stringify(id),
  985. device: JSON.stringify(device),
  986. ruid,
  987. // 主播 uid
  988. ts: tsm(),
  989. is_patch,
  990. heart_beat: JSON.stringify(heart_beat),
  991. ua: navigator.userAgent,
  992. csrf_token: bili_jct,
  993. csrf: bili_jct,
  994. visit_id
  995. });
  996. },
  997. X: (s, id, device, ruid, ets, benchmark, time, ts2, visit_id = "") => {
  998. const bili_jct = useBiliStore().cookies.bili_jct;
  999. return request.liveTrace.post("/xlive/data-interface/v1/x25Kn/X", {
  1000. s,
  1001. id: JSON.stringify(id),
  1002. device: JSON.stringify(device),
  1003. ruid,
  1004. // 主播 uid
  1005. ets,
  1006. benchmark,
  1007. time,
  1008. ts: ts2,
  1009. ua: navigator.userAgent,
  1010. csrf_token: bili_jct,
  1011. csrf: bili_jct,
  1012. visit_id
  1013. });
  1014. }
  1015. },
  1016. main: {
  1017. nav: () => {
  1018. return request.main.get("/x/web-interface/nav");
  1019. },
  1020. reward: () => {
  1021. return request.main.get("/x/member/web/exp/reward");
  1022. },
  1023. dynamicAll: (type = "video", page = 1, timezone_offset = -480, platform = "web", features = "itemOpusStyle,listOnlyfans,opusBigCover,onlyfansVote,decorationCard,onlyfansAssetsV2,forwardListHidden,u###elete", web_location = "333.1365", x_bili_device_req_json = '{"platform":"web","device":"pc"}', x_bili_web_req_json = '{"spm_id":"333.1365"}') => {
  1024. return request.main.get(
  1025. "/x/polymer/web-dynamic/v1/feed/all",
  1026. {
  1027. timezone_offset,
  1028. type,
  1029. platform,
  1030. page,
  1031. features,
  1032. web_location,
  1033. x_bili_device_req_json,
  1034. x_bili_web_req_json
  1035. },
  1036. {
  1037. Origin: "https://t.bilibili.com",
  1038. Referer: "https://t.bilibili.com/"
  1039. }
  1040. );
  1041. },
  1042. videoHeartbeat: (aid, cid = 1e9, type = 3, sub_type = 0, dt = 2, play_type = 1, realtime = 61, played_time = 62, real_played_time = 62, refer_url = "https://t.bilibili.com/?tab=video", quality = 64, video_duration = 180, last_play_progress_time = 62, max_play_progress_time = 62, outer = 0, spmid = "333.788.0.0", from_spmid = "333.1365.list.card_archive.click", session = uuid().replaceAll("-", ""), extra = '{"player_version":"4.8.43"}', web_location = 1315873) => {
  1043. const biliStore = useBiliStore();
  1044. const start_ts = ts();
  1045. const mid = useBiliStore().userInfo.mid;
  1046. return request.main.post(
  1047. "/x/click-interface/web/heartbeat",
  1048. {
  1049. start_ts,
  1050. mid,
  1051. aid,
  1052. cid,
  1053. type,
  1054. sub_type,
  1055. dt,
  1056. play_type,
  1057. realtime,
  1058. played_time,
  1059. real_played_time,
  1060. refer_url,
  1061. quality,
  1062. video_duration,
  1063. last_play_progress_time,
  1064. max_play_progress_time,
  1065. outer,
  1066. spmid,
  1067. from_spmid,
  1068. session,
  1069. extra,
  1070. csrf: biliStore.cookies.bili_jct
  1071. },
  1072. {
  1073. params: wbiSign({
  1074. w_start_ts: start_ts,
  1075. w_mid: mid,
  1076. w_aid: aid,
  1077. w_dt: dt,
  1078. w_realtime: realtime,
  1079. w_played_time: played_time,
  1080. w_real_played_time: real_played_time,
  1081. w_video_duration: video_duration,
  1082. w_last_play_progress_time: last_play_progress_time,
  1083. web_location
  1084. })
  1085. }
  1086. );
  1087. },
  1088. share: (aid, source = "pc_client_normal", eab_x = 2, ramval = 0, ga = 1, referer = "") => {
  1089. const bili_jct = useBiliStore().cookies.bili_jct;
  1090. return request.main.post("/x/web-interface/share/add", {
  1091. eab_x,
  1092. ramval,
  1093. referer,
  1094. source,
  1095. aid,
  1096. ga,
  1097. csrf: bili_jct
  1098. });
  1099. },
  1100. coinAdd: (aid, num, select_like = 0, cross_domain = true, eab_x = 2, ramval = 6, source = "web_normal", ga = 1) => {
  1101. const bili_jct = useBiliStore().cookies.bili_jct;
  1102. return request.main.post("/x/web-interface/coin/add ", {
  1103. aid,
  1104. multiply: num,
  1105. select_like,
  1106. cross_domain,
  1107. eab_x,
  1108. ramval,
  1109. source,
  1110. ga,
  1111. csrf: bili_jct
  1112. });
  1113. },
  1114. videoRelation: (aid, bvid = "") => {
  1115. return request.main.get("/x/web-interface/archive/relation", {
  1116. aid,
  1117. bvid
  1118. });
  1119. },
  1120. vip: {
  1121. myPrivilege: (web_location = "333.33") => {
  1122. return request.main.get(
  1123. "/x/vip/privilege/my",
  1124. {
  1125. web_location
  1126. },
  1127. {
  1128. headers: {
  1129. Referer: "https://account.bilibili.com/account/big/myPackage",
  1130. Origin: "https://account.bilibili.com"
  1131. }
  1132. }
  1133. );
  1134. },
  1135. receivePrivilege: (type, platform = "web") => {
  1136. const bili_jct = useBiliStore().cookies.bili_jct;
  1137. return request.main.post(
  1138. "/x/vip/privilege/receive",
  1139. {
  1140. type,
  1141. platform,
  1142. csrf: bili_jct
  1143. },
  1144. {
  1145. headers: {
  1146. Referer: "https://account.bilibili.com/account/big/myPackage",
  1147. Origin: "https://account.bilibili.com"
  1148. }
  1149. }
  1150. );
  1151. },
  1152. addExperience: () => {
  1153. const biliStore = useBiliStore();
  1154. const mid = biliStore.BilibiliLive.UID;
  1155. const buvid = biliStore.cookies.buvid3;
  1156. const bili_jct = biliStore.cookies.bili_jct;
  1157. return request.main.post(
  1158. "/x/vip/experience/add",
  1159. {
  1160. mid,
  1161. buvid,
  1162. csrf: bili_jct
  1163. },
  1164. {
  1165. headers: {
  1166. Referer: "https://account.bilibili.com/big",
  1167. Origin: "https://account.bilibili.com"
  1168. }
  1169. }
  1170. );
  1171. }
  1172. }
  1173. },
  1174. vc: {
  1175. myGroups: (build = 0, mobi_app = "web") => {
  1176. return request.vc.get("/link_group/v1/member/my_groups", {
  1177. build,
  1178. mobi_app
  1179. });
  1180. },
  1181. signIn: (group_id, owner_id) => {
  1182. return request.vc.get("/link_setting/v1/link_setting/sign_in", {
  1183. group_id,
  1184. owner_id
  1185. });
  1186. }
  1187. }
  1188. };
  1189. class Logger {
  1190. constructor(title) {
  1191. __publicField(this, "NAME", "BLTH");
  1192. __publicField(this, "prefix_title_str");
  1193. __publicField(this, "title");
  1194. this.title = title;
  1195. this.prefix_title_str = title.split("_").join("][");
  1196. }
  1197. get prefix() {
  1198. return [
  1199. `%c${this.NAME}%c[${(/* @__PURE__ */ new Date()).toLocaleString()}]%c[${this.prefix_title_str}]%c:`,
  1200. "font-weight: bold; color: white; background-color: #23ade5; padding: 1px 4px; border-radius: 4px;",
  1201. "font-weight: bold; color: #0920e6;",
  1202. "font-weight: bold;",
  1203. ""
  1204. ];
  1205. }
  1206. log(...data) {
  1207. console.log(...this.prefix, ...data);
  1208. }
  1209. error(...data) {
  1210. console.error(...this.prefix, ...data);
  1211. }
  1212. warn(...data) {
  1213. console.warn(...this.prefix, ...data);
  1214. }
  1215. }
  1216. class BaseModule {
  1217. constructor(moduleName) {
  1218. /**
  1219. * 模块名称,在被导出时定义
  1220. *
  1221. * 输出控制台日志时会用到
  1222. */
  1223. __publicField(this, "moduleName");
  1224. /**
  1225. * 用于在控制台中输出日志信息
  1226. */
  1227. __publicField(this, "logger");
  1228. /**
  1229. * 储存所有模块信息的 Pinia Store
  1230. */
  1231. __publicField(this, "moduleStore", useModuleStore());
  1232. /**
  1233. * 推荐添加一个 config 属性来表示当前模块的配置项
  1234. *
  1235. * @example config: this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.login
  1236. */
  1237. __publicField(this, "config");
  1238. this.moduleName = moduleName;
  1239. this.logger = new Logger(this.moduleName);
  1240. }
  1241. /**
  1242. * 模块是否启用,默认通过 config.enabled 判断
  1243. *
  1244. * 如果没有 config.enabled 属性,则默认启用(比如默认模块)
  1245. */
  1246. isEnabled() {
  1247. var _a;
  1248. return ((_a = this.config) == null ? void 0 : _a.enabled) ?? true;
  1249. }
  1250. /**
  1251. * 如果需要在控制面板上显示模块状态,推荐添加一个 status setter 用来设置模块状态
  1252. *
  1253. * @example
  1254. * set status(s: moduleStatus) {
  1255. * this.moduleStore.moduleStatus.DailyTasks.MainSiteTasks.login = s
  1256. * }
  1257. */
  1258. set status(_s) {
  1259. throw new Error("Method not implemented.");
  1260. }
  1261. /**
  1262. * 运行模块
  1263. *
  1264. * 默认模块必须返回一个空的Promise,
  1265. * 其它模块若需要使用 await 可以返回一个空的Promise,否则无返回值
  1266. */
  1267. run() {
  1268. throw new Error("Method not implemented.");
  1269. }
  1270. }
  1271. /**
  1272. * 当脚本在多个页面上运行的时候,该模块是否要在每个页面上运行
  1273. *
  1274. * 默认false,即只在Main BLTH运行的页面上运行
  1275. *
  1276. * 该选项为 false 时如果要确保模块不会重复运行,还需将 onFrame 设置为 target 或 top
  1277. */
  1278. __publicField(BaseModule, "runOnMultiplePages", false);
  1279. /**
  1280. * 模块运行时机,默认 document-body
  1281. *
  1282. * `document-start`: 尽可能早,与脚本注入时机相同
  1283. *
  1284. * `document-head`: `document.head`刚刚出现后
  1285. *
  1286. * `document-body`: `document.body`刚刚出现后
  1287. *
  1288. * `document-end`: `document`的`DOMContentLoaded`事件触发后
  1289. *
  1290. * `window-load`: `window`的`load`事件触发后
  1291. *
  1292. * 默认模块的模块运行时机总是为 document-body
  1293. */
  1294. __publicField(BaseModule, "runAt", "document-body");
  1295. /**
  1296. * 模块运行的 frame,默认 target
  1297. *
  1298. * `all`: 所有符合脚本`@match`规则的 frame
  1299. *
  1300. * `target`: window.BilibiliLive 存在的那个 frame
  1301. *
  1302. * `top`: 顶层 frame (`window.top`)
  1303. *
  1304. * 如果设置为 target,那么至少要等到`document-body`时刻才能运行
  1305. *
  1306. * 默认模块运行的 frame 总是为 target
  1307. */
  1308. __publicField(BaseModule, "onFrame", "target");
  1309. /**
  1310. * 是否要等默认模块运行完了再运行,默认 true
  1311. *
  1312. * 如果设置为 true,那么就不能保证该模块被及时地执行
  1313. *
  1314. * 因为默认模块的运行时机总是 document-body,而且默认模块的运行时间是不确定的
  1315. */
  1316. __publicField(BaseModule, "runAfterDefault", true);
  1317. class ModuleError extends Error {
  1318. constructor(moduleName, message) {
  1319. super(message);
  1320. __publicField(this, "name", "ModuleError");
  1321. __publicField(this, "moduleName");
  1322. this.moduleName = moduleName;
  1323. }
  1324. }
  1325. class ModuleCriticalError extends ModuleError {
  1326. constructor(moduleName, message) {
  1327. super(moduleName, message);
  1328. __publicField(this, "name", "ModuleCriticalError");
  1329. __publicField(this, "moduleName");
  1330. this.moduleName = moduleName;
  1331. }
  1332. }
  1333. class UserInfo extends BaseModule {
  1334. /**
  1335. * 通过 BAPI.main.nav 获取用户基本信息
  1336. */
  1337. async getUserInfo() {
  1338. try {
  1339. const response = await BAPI.main.nav();
  1340. this.logger.log("BAPI.main.nav response", response);
  1341. if (response.code === 0) {
  1342. return response.data;
  1343. } else {
  1344. throw new Error(`响应 code 不为 0: ${response.message}`);
  1345. }
  1346. } catch (error) {
  1347. throw new ModuleCriticalError(this.moduleName, `获取用户信息出错: ${error.message}`);
  1348. }
  1349. }
  1350. async run() {
  1351. const biliStore = useBiliStore();
  1352. biliStore.userInfo = await this.getUserInfo();
  1353. setTimeout(
  1354. () => this.run().catch((reason) => this.logger.error(reason)),
  1355. delayToNextMoment(0, 4).ms
  1356. );
  1357. }
  1358. }
  1359. class DailyRewardInfo extends BaseModule {
  1360. /**
  1361. * 获取今日主站每日任务的完成情况
  1362. */
  1363. async getDailyRewardInfo() {
  1364. try {
  1365. const response = await BAPI.main.reward();
  1366. this.logger.log("BAPI.main.reward response", response);
  1367. if (response.code === 0) {
  1368. return response.data;
  1369. } else {
  1370. throw new Error(`响应 code 不为 0: ${response.message}`);
  1371. }
  1372. } catch (error) {
  1373. throw new ModuleError(this.moduleName, `获取主站每日任务完成情况出错: ${error.message}`);
  1374. }
  1375. }
  1376. async run() {
  1377. const biliStore = useBiliStore();
  1378. const mainSiteTasks = this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks;
  1379. if (Object.values(mainSiteTasks).some(
  1380. (t) => t.enabled && !isTimestampToday(t._lastCompleteTime, 0, 4)
  1381. )) {
  1382. biliStore.dailyRewardInfo = await this.getDailyRewardInfo();
  1383. }
  1384. setTimeout(
  1385. () => this.run().catch((reason) => this.logger.error(reason)),
  1386. delayToNextMoment(0, 4).ms
  1387. );
  1388. }
  1389. }
  1390. class DynamicVideos extends BaseModule {
  1391. /**
  1392. * 从动态中获取一页视频的信息
  1393. *
  1394. * 每日观看视频,每日分享视频,每日投币都会用到
  1395. */
  1396. async getDynamicVideos() {
  1397. try {
  1398. const response = await BAPI.main.dynamicAll("video");
  1399. this.logger.log("BAPI.main.dynamicAll response", response);
  1400. if (response.code === 0) {
  1401. return response.data.items;
  1402. } else {
  1403. throw new Error(`响应 code 不为 0: ${response.message}`);
  1404. }
  1405. } catch (error) {
  1406. throw new ModuleError(this.moduleName, `获取主站每日任务完成情况出错: ${error.message}`);
  1407. }
  1408. }
  1409. async run() {
  1410. const biliStore = useBiliStore();
  1411. const mainSiteTasks = this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks;
  1412. const taskValues = [mainSiteTasks.watch, mainSiteTasks.share, mainSiteTasks.coin];
  1413. if (taskValues.some((t) => t.enabled && !isTimestampToday(t._lastCompleteTime, 0, 4))) {
  1414. biliStore.dynamicVideos = await this.getDynamicVideos();
  1415. }
  1416. setTimeout(
  1417. () => this.run().catch((reason) => this.logger.error(reason)),
  1418. delayToNextMoment(0, 4).ms
  1419. );
  1420. }
  1421. }
  1422. class FansMetals extends BaseModule {
  1423. /**
  1424. * 获取粉丝勋章
  1425. *
  1426. * @param pages 获取的页数
  1427. */
  1428. async getFansMetals(pages = Infinity) {
  1429. const fansMetalList = [];
  1430. let total_page = 1;
  1431. try {
  1432. const firstPageResponse = await BAPI.live.fansMedalPanel(1);
  1433. this.logger.log("BAPI.live.fansMedalPanel(1) response", firstPageResponse);
  1434. if (firstPageResponse.code === 0) {
  1435. total_page = firstPageResponse.data.page_info.total_page;
  1436. fansMetalList.push(...firstPageResponse.data.special_list, ...firstPageResponse.data.list);
  1437. } else {
  1438. throw new Error(`获取粉丝勋章列表第1页失败: ${firstPageResponse.message}`);
  1439. }
  1440. for (let page = 2; page <= Math.min(total_page, pages); page++) {
  1441. const response = await BAPI.live.fansMedalPanel(page);
  1442. this.logger.log(`BAPI.live.fansMedalPanel(${page}) response`, response);
  1443. if (firstPageResponse.code === 0) {
  1444. fansMetalList.push(...response.data.list);
  1445. } else {
  1446. this.logger.error(
  1447. `获取粉丝勋章列表第${page}页失败,提前结束获取`,
  1448. firstPageResponse.message
  1449. );
  1450. return fansMetalList;
  1451. }
  1452. await sleep(_.random(300, 500));
  1453. }
  1454. return fansMetalList;
  1455. } catch (error) {
  1456. useBiliStore().fansMedalsStatus = "error";
  1457. throw new ModuleError(this.moduleName, `获取粉丝勋章列表出错: ${error.message}`);
  1458. }
  1459. }
  1460. async run() {
  1461. const biliStore = useBiliStore();
  1462. const emitter = useModuleStore().emitter;
  1463. emitter.off("Default_FansMedals");
  1464. emitter.on("Default_FansMedals", async () => {
  1465. biliStore.fansMedalsStatus = "loading";
  1466. biliStore.fansMedals = await this.getFansMetals(Infinity);
  1467. biliStore.fansMedalsStatus = "loaded";
  1468. });
  1469. const medalTasks = this.moduleStore.moduleConfig.DailyTasks.LiveTasks.medalTasks;
  1470. const taskValues = [medalTasks.light, medalTasks.watch];
  1471. if (taskValues.some((t) => t.enabled && !isTimestampToday(t._lastCompleteTime, 0, 4))) {
  1472. biliStore.fansMedalsStatus = "loading";
  1473. biliStore.fansMedals = await this.getFansMetals();
  1474. biliStore.fansMedalsStatus = "loaded";
  1475. }
  1476. setTimeout(
  1477. () => this.run().catch((reason) => this.logger.error(reason)),
  1478. delayToNextMoment(0, 4).ms
  1479. );
  1480. }
  1481. }
  1482. class Cookie {
  1483. /**
  1484. * 获取所有 cookies
  1485. */
  1486. static getAll() {
  1487. if (document.cookie === "") return {};
  1488. const cookies = document.cookie.split("; ");
  1489. const r###lt = {};
  1490. for (const cookie of cookies) {
  1491. const [name, value] = cookie.split("=", 2);
  1492. r###lt[decodeURIComponent(name)] = decodeURIComponent(value);
  1493. }
  1494. return r###lt;
  1495. }
  1496. /**
  1497. * 获取指定名称的一个或多个 cookies
  1498. * @param names cookie 名称或 cookie 名称数组
  1499. * @param defaultValue 当 cookie 不存在时使用的默认值,默认 undefined
  1500. */
  1501. static get(names, defaultValue) {
  1502. const cookies = this.getAll();
  1503. if (Array.isArray(names)) {
  1504. const r###lt = {};
  1505. for (const name of names) {
  1506. r###lt[name] = cookies[name] ? cookies[name] : defaultValue;
  1507. }
  1508. return r###lt;
  1509. } else {
  1510. return cookies[names] ? cookies[names] : defaultValue;
  1511. }
  1512. }
  1513. /**
  1514. * 获取一组 cookies,如果有 cookie 未获取到,会反复获取直到超时为止
  1515. *
  1516. * TODO: 等 cookieStore 普及后使用监听取代轮询
  1517. *
  1518. * @param names 要获取的 cookie 名称数组
  1519. * @param interval 获取间隔,默认 300 毫秒
  1520. * @param timeout 超时时间,若留空则永不超时
  1521. */
  1522. static getAsync(names, interval = 300, timeout) {
  1523. return new Promise((resolve2, reject2) => {
  1524. let remainCookieNames = [...names];
  1525. const cookies = this.get(remainCookieNames);
  1526. remainCookieNames = remainCookieNames.filter((r) => !cookies[r]);
  1527. if (remainCookieNames.length === 0) {
  1528. resolve2(cookies);
  1529. return;
  1530. }
  1531. let timeoutTimer;
  1532. const timer = setInterval(() => {
  1533. Object.assign(cookies, this.get(remainCookieNames));
  1534. remainCookieNames = remainCookieNames.filter((r) => !cookies[r]);
  1535. if (remainCookieNames.length === 0) {
  1536. if (timeout) clearTimeout(timeoutTimer);
  1537. clearInterval(timer);
  1538. resolve2(cookies);
  1539. }
  1540. }, interval);
  1541. if (timeout) {
  1542. timeoutTimer = setTimeout(() => {
  1543. clearInterval(timer);
  1544. reject2(new Error(`获取以下 cookie 超时:${remainCookieNames}`));
  1545. }, timeout);
  1546. }
  1547. });
  1548. }
  1549. }
  1550. class Cookies extends BaseModule {
  1551. /**
  1552. * 获取 Cookies
  1553. *
  1554. * bili_jct: 常作为参数 csrf 在请求中出现
  1555. * LIVE_BUVID: 如果用户以前从来没看过直播,此时可能为 null
  1556. * buvid3: 作为参数 buvid 在请求中出现,目前仅在主站 API 中使用
  1557. */
  1558. getCookies() {
  1559. return Cookie.getAsync(["bili_jct", "LIVE_BUVID", "buvid3"], 300, 1e4);
  1560. }
  1561. async run() {
  1562. try {
  1563. useBiliStore().cookies = await this.getCookies();
  1564. } catch (error) {
  1565. throw new ModuleCriticalError(this.moduleName, error.message);
  1566. }
  1567. }
  1568. }
  1569. class BilibiliLive extends BaseModule {
  1570. /**
  1571. * 获取 window.BilibiliLive
  1572. */
  1573. getBilibiliLive() {
  1574. this.logger.log("unsafeWindow.BilibiliLive", _unsafeWindow.BilibiliLive);
  1575. return new Promise((resolve2, reject2) => {
  1576. if (_unsafeWindow.BilibiliLive.UID !== 0) {
  1577. resolve2(_unsafeWindow.BilibiliLive);
  1578. return;
  1579. }
  1580. _unsafeWindow.BilibiliLive = new Proxy(_unsafeWindow.BilibiliLive, {
  1581. set(target, prop, value) {
  1582. target[prop] = value;
  1583. if (prop === "UID") {
  1584. _unsafeWindow.BilibiliLive = target;
  1585. resolve2(_unsafeWindow.BilibiliLive);
  1586. }
  1587. return true;
  1588. }
  1589. });
  1590. setTimeout(() => reject2(new Error("获取 BilibiliLive 超时")), 1e4);
  1591. });
  1592. }
  1593. async run() {
  1594. try {
  1595. useBiliStore().BilibiliLive = await this.getBilibiliLive();
  1596. } catch (error) {
  1597. throw new ModuleCriticalError(this.moduleName, error.message);
  1598. }
  1599. }
  1600. }
  1601. __publicField(BilibiliLive, "runOnMultiplePages", true);
  1602. const defaultModules = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  1603. __proto__: null,
  1604. Default_BilibiliLive: BilibiliLive,
  1605. Default_Cookies: Cookies,
  1606. Default_DailyRewardInfo: DailyRewardInfo,
  1607. Default_DynamicVideos: DynamicVideos,
  1608. Default_FansMetals: FansMetals,
  1609. Default_UserInfo: UserInfo
  1610. }, Symbol.toStringTag, { value: "Module" }));
  1611. class LoginTask extends BaseModule {
  1612. constructor() {
  1613. super(...arguments);
  1614. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.login);
  1615. }
  1616. set status(s) {
  1617. this.moduleStore.moduleStatus.DailyTasks.MainSiteTasks.login = s;
  1618. }
  1619. async login() {
  1620. this.logger.log("每日登录任务已完成");
  1621. this.config._lastCompleteTime = tsm();
  1622. this.status = "done";
  1623. return Promise.resolve();
  1624. }
  1625. async run() {
  1626. this.logger.log("每日登录模块开始运行");
  1627. if (!isTimestampToday(this.config._lastCompleteTime)) {
  1628. const biliStore = useBiliStore();
  1629. if (!biliStore.dailyRewardInfo) {
  1630. this.logger.error("主站每日任务完成情况不存在,不执行每日登录任务");
  1631. this.status = "error";
  1632. return;
  1633. }
  1634. this.status = "running";
  1635. if (!biliStore.dailyRewardInfo.login) {
  1636. await this.login();
  1637. } else {
  1638. this.config._lastCompleteTime = tsm();
  1639. this.status = "done";
  1640. }
  1641. } else {
  1642. if (isNowIn(0, 0, 0, 5)) {
  1643. this.logger.log("昨天的每日登录任务已经完成过了,等到今天的00:05再执行");
  1644. } else {
  1645. this.logger.log("今天已经完成过每日登录任务了");
  1646. this.status = "done";
  1647. }
  1648. }
  1649. const diff = delayToNextMoment();
  1650. setTimeout(() => this.run(), diff.ms);
  1651. this.logger.log("距离每日登录模块下次运行时间:", diff.str);
  1652. }
  1653. }
  1654. let WatchTask$1 = class WatchTask extends BaseModule {
  1655. constructor() {
  1656. super(...arguments);
  1657. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.watch);
  1658. }
  1659. set status(s) {
  1660. this.moduleStore.moduleStatus.DailyTasks.MainSiteTasks.watch = s;
  1661. }
  1662. /**
  1663. * 获取第一个视频的 aid
  1664. */
  1665. getAid() {
  1666. return Number(useBiliStore().dynamicVideos[0].modules.module_dynamic.major.archive.aid);
  1667. }
  1668. async watch(aid) {
  1669. try {
  1670. const response = await BAPI.main.videoHeartbeat(aid, _.random(1e9, 2e9));
  1671. this.logger.log(`BAPI.main.videoHeartbeat(${aid}) response`, response);
  1672. if (response.code === 0) {
  1673. this.logger.log("每日观看视频任务已完成");
  1674. this.config._lastCompleteTime = tsm();
  1675. this.status = "done";
  1676. } else {
  1677. this.logger.error("发送观看视频心跳失败", response.message);
  1678. this.status = "error";
  1679. }
  1680. } catch (err) {
  1681. this.logger.error("执行每日观看视频任务出错", err);
  1682. this.status = "error";
  1683. }
  1684. }
  1685. runCheck() {
  1686. const biliStore = useBiliStore();
  1687. if (!biliStore.dailyRewardInfo) {
  1688. this.logger.error("主站每日任务完成情况不存在,不执行每日观看视频任务");
  1689. this.status = "error";
  1690. return false;
  1691. }
  1692. if (!biliStore.dynamicVideos) {
  1693. this.logger.error("动态视频数据不存在,不执行每日观看视频任务");
  1694. this.status = "error";
  1695. return false;
  1696. }
  1697. return true;
  1698. }
  1699. async run() {
  1700. this.logger.log("每日观看视频模块开始运行");
  1701. if (!isTimestampToday(this.config._lastCompleteTime)) {
  1702. if (!this.runCheck()) {
  1703. return;
  1704. }
  1705. const biliStore = useBiliStore();
  1706. this.status = "running";
  1707. if (!biliStore.dailyRewardInfo.watch) {
  1708. const aid = this.getAid();
  1709. await this.watch(aid);
  1710. } else {
  1711. this.config._lastCompleteTime = tsm();
  1712. this.status = "done";
  1713. this.logger.log("每日观看视频任务已完成");
  1714. }
  1715. } else {
  1716. if (isNowIn(0, 0, 0, 5)) {
  1717. this.logger.log("昨天的每日观看视频任务已经完成过了,等到今天的00:05再执行");
  1718. } else {
  1719. this.logger.log("今天已经完成过每日观看视频任务了");
  1720. this.status = "done";
  1721. }
  1722. }
  1723. const diff = delayToNextMoment();
  1724. setTimeout(() => this.run(), diff.ms);
  1725. this.logger.log("距离每日观看视频模块下次运行时间:", diff.str);
  1726. }
  1727. };
  1728. class ShareTask extends BaseModule {
  1729. constructor() {
  1730. super(...arguments);
  1731. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.share);
  1732. }
  1733. set status(s) {
  1734. this.moduleStore.moduleStatus.DailyTasks.MainSiteTasks.share = s;
  1735. }
  1736. getAid() {
  1737. const biliStore = useBiliStore();
  1738. return biliStore.dynamicVideos[0].modules.module_dynamic.major.archive.aid;
  1739. }
  1740. async share(aid) {
  1741. try {
  1742. const response = await BAPI.main.share(aid);
  1743. this.logger.log(`BAPI.main.share(${aid}) response`, response);
  1744. if (response.code === 0 || response.code === 71e3) {
  1745. this.logger.log("每日分享视频任务已完成");
  1746. this.config._lastCompleteTime = tsm();
  1747. this.status = "done";
  1748. } else {
  1749. this.logger.error("分享视频失败", response.message);
  1750. this.status = "error";
  1751. }
  1752. } catch (err) {
  1753. this.logger.error("执行每日分享视频任务出错", err);
  1754. this.status = "error";
  1755. }
  1756. }
  1757. runCheck() {
  1758. const biliStore = useBiliStore();
  1759. if (!biliStore.dailyRewardInfo) {
  1760. this.logger.error("主站每日任务完成情况不存在,不执行每日分享视频任务");
  1761. this.status = "error";
  1762. return false;
  1763. }
  1764. if (!biliStore.dynamicVideos) {
  1765. this.logger.error("动态视频数据不存在,不执行每日分享视频任务");
  1766. this.status = "error";
  1767. return false;
  1768. }
  1769. return true;
  1770. }
  1771. async run() {
  1772. this.logger.log("每日分享视频模块开始运行");
  1773. if (!isTimestampToday(this.config._lastCompleteTime)) {
  1774. if (!this.runCheck()) {
  1775. return;
  1776. }
  1777. const biliStore = useBiliStore();
  1778. this.status = "running";
  1779. if (!biliStore.dailyRewardInfo.share) {
  1780. const aid = this.getAid();
  1781. await this.share(aid);
  1782. } else {
  1783. this.config._lastCompleteTime = tsm();
  1784. this.status = "done";
  1785. this.logger.log("每日分享视频任务已完成");
  1786. }
  1787. } else {
  1788. if (isNowIn(0, 0, 0, 5)) {
  1789. this.logger.log("昨天的每日分享任务已经完成过了,等到今天的00:05再执行");
  1790. } else {
  1791. this.logger.log("今天已经完成过每日分享任务了");
  1792. this.status = "done";
  1793. }
  1794. }
  1795. const diff = delayToNextMoment();
  1796. setTimeout(() => this.run(), diff.ms);
  1797. this.logger.log("距离每日分享视频模块下次运行时间:", diff.str);
  1798. }
  1799. }
  1800. class CoinTask extends BaseModule {
  1801. constructor() {
  1802. super(...arguments);
  1803. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.coin);
  1804. // 暂时先限制每个视频最多投一个币
  1805. // 因为转载视频只能投一个币,原创视频能投两个币
  1806. // 但是想查询视频是否为转载,我目前只知道一个 /x/web-interface/wbi/view
  1807. // 通过其响应的copyright字段(1原创,2转载)来判断
  1808. // 不过视频数量足够多,所以干脆直接限制每个视频最多投一个币
  1809. __publicField(this, "MAX_COIN", 1);
  1810. }
  1811. set status(s) {
  1812. this.moduleStore.moduleStatus.DailyTasks.MainSiteTasks.coin = s;
  1813. }
  1814. /**
  1815. * 获取动态视频的 aid 和 bvid
  1816. */
  1817. getDynamicVideoIds() {
  1818. const biliStore = useBiliStore();
  1819. return biliStore.dynamicVideos.map((item) => {
  1820. const archive = item.modules.module_dynamic.major.archive;
  1821. return {
  1822. aid: archive.aid,
  1823. bvid: archive.bvid
  1824. };
  1825. });
  1826. }
  1827. /**
  1828. * 获取一个视频的你的已投硬币数量
  1829. *
  1830. * @returns 你的已投硬币数
  1831. */
  1832. async getVideoCoinInfo(aid, bvid) {
  1833. try {
  1834. const response = await BAPI.main.videoRelation(aid, bvid);
  1835. this.logger.log(`BAPI.main.videoRelation(${aid}, ${bvid}) response`, response);
  1836. if (response.code === 0) {
  1837. return response.data.coin;
  1838. } else {
  1839. this.logger.error(`获取视频投币信息失败 aid = ${aid} bvid = ${bvid}`, response.message);
  1840. return 0;
  1841. }
  1842. } catch (error) {
  1843. this.logger.error(`获取视频投币信息出错 aid = ${aid} bvid = ${bvid}`, error);
  1844. return 0;
  1845. }
  1846. }
  1847. /**
  1848. * 给动态中的视频投币
  1849. * @param left_coin_num 还需要投的硬币数
  1850. */
  1851. async coinDynamicVideos(left_coin_num) {
  1852. const ids = this.getDynamicVideoIds();
  1853. for (const { aid, bvid } of ids) {
  1854. const coined_num = await this.getVideoCoinInfo(aid, bvid);
  1855. const allowed_coin_num = this.MAX_COIN - coined_num;
  1856. if (allowed_coin_num > 0) {
  1857. const coin_num = Math.min(allowed_coin_num, left_coin_num);
  1858. const r###lt = await this.coin(aid, coin_num);
  1859. if (r###lt === 0) {
  1860. left_coin_num -= coin_num;
  1861. if (left_coin_num === 0) {
  1862. this.logger.log("每日投币任务已完成");
  1863. this.config._lastCompleteTime = tsm();
  1864. this.status = "done";
  1865. break;
  1866. }
  1867. } else if (r###lt === 1) {
  1868. this.logger.warn("硬币余额不足,每日投币任务终止");
  1869. this.status = "error";
  1870. break;
  1871. }
  1872. }
  1873. }
  1874. if (left_coin_num > 0) {
  1875. this.logger.warn("硬币余额不足,每日投币任务终止");
  1876. this.status = "error";
  1877. }
  1878. }
  1879. /**
  1880. * 投币
  1881. */
  1882. async coin(aid, num) {
  1883. try {
  1884. const response = await BAPI.main.coinAdd(aid, num);
  1885. this.logger.log(`BAPI.main.coinAdd(${aid}) response`, response);
  1886. if (response.code === 0) {
  1887. this.logger.log(`投币成功 视频aid = ${aid} 投币数量num = ${num}`);
  1888. return 0;
  1889. } else if (response.code === -104) {
  1890. this.logger.warn("硬币余额不足,每日投币任务终止");
  1891. return 1;
  1892. } else {
  1893. this.logger.error(`投币失败 视频aid = ${aid} 投币数量num = ${num}`, response.message);
  1894. return 2;
  1895. }
  1896. } catch (err) {
  1897. this.logger.error(`投币出错 视频aid = ${aid} 投币数量num = ${num}`, err);
  1898. return 3;
  1899. }
  1900. }
  1901. /**
  1902. * 运行前检查
  1903. */
  1904. runCheck() {
  1905. const biliStore = useBiliStore();
  1906. if (!biliStore.dailyRewardInfo) {
  1907. this.logger.error("主站每日任务完成情况不存在,不执行每日投币任务");
  1908. this.status = "error";
  1909. return false;
  1910. }
  1911. if (!biliStore.dynamicVideos) {
  1912. this.logger.error("动态视频数据不存在,不执行每日投币任务");
  1913. this.status = "error";
  1914. return false;
  1915. }
  1916. return true;
  1917. }
  1918. async run() {
  1919. this.logger.log("每日投币模块开始运行");
  1920. if (!isTimestampToday(this.config._lastCompleteTime)) {
  1921. if (!this.runCheck()) {
  1922. return;
  1923. }
  1924. const biliStore = useBiliStore();
  1925. this.status = "running";
  1926. const total_coined_num = biliStore.dailyRewardInfo.coins / 10;
  1927. if (total_coined_num < this.config.num) {
  1928. const left_coin_num = this.config.num - total_coined_num;
  1929. const money = biliStore.userInfo.money ?? 5;
  1930. if (left_coin_num > money) {
  1931. this.logger.log("硬币余额不足,不执行每日投币任务");
  1932. this.status = "done";
  1933. } else {
  1934. await this.coinDynamicVideos(left_coin_num);
  1935. }
  1936. } else {
  1937. this.config._lastCompleteTime = tsm();
  1938. this.status = "done";
  1939. this.logger.log("每日投币任务已完成");
  1940. }
  1941. } else {
  1942. if (isNowIn(0, 0, 0, 5)) {
  1943. this.logger.log("昨天的每日投币任务已经完成过了,等到今天的00:05再执行");
  1944. } else {
  1945. this.logger.log("今天已经完成过每日投币任务了");
  1946. this.status = "done";
  1947. }
  1948. }
  1949. const diff = delayToNextMoment();
  1950. setTimeout(() => this.run(), diff.ms);
  1951. this.logger.log("距离每日投币模块下次运行时间:", diff.str);
  1952. }
  1953. }
  1954. class SignTask extends BaseModule {
  1955. constructor() {
  1956. super(...arguments);
  1957. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.LiveTasks.sign);
  1958. }
  1959. set status(s) {
  1960. this.moduleStore.moduleStatus.DailyTasks.LiveTasks.sign = s;
  1961. }
  1962. async getSignInfo() {
  1963. try {
  1964. const response = await BAPI.live.getSignInfo();
  1965. this.logger.log("BAPI.live.getSignInfo response", response);
  1966. if (response.code === 0) {
  1967. return response.data;
  1968. } else {
  1969. this.logger.error("获取直播签到信息失败", response.message);
  1970. return null;
  1971. }
  1972. } catch (error) {
  1973. this.logger.error("获取直播签到信息出错", error);
  1974. return null;
  1975. }
  1976. }
  1977. async sign() {
  1978. try {
  1979. const response = await BAPI.live.doSign();
  1980. this.logger.log(`BAPI.live.doSign response`, response);
  1981. if (response.code === 0) {
  1982. this.logger.log("直播签到成功,获得奖励:", response.data.text);
  1983. this.config._lastCompleteTime = tsm();
  1984. this.status = "done";
  1985. this.logger.log("直播签到任务已完成");
  1986. } else {
  1987. this.logger.error("直播签到失败", response.message);
  1988. this.status = "error";
  1989. }
  1990. } catch (err) {
  1991. this.logger.error("执行直播签到任务出错", err);
  1992. this.status = "error";
  1993. }
  1994. }
  1995. async run() {
  1996. this.logger.log("直播签到模块开始运行");
  1997. if (!isTimestampToday(this.config._lastCompleteTime)) {
  1998. this.status = "running";
  1999. const signInfo = await this.getSignInfo();
  2000. if (signInfo) {
  2001. if (signInfo.status === 0) {
  2002. await this.sign();
  2003. } else {
  2004. this.config._lastCompleteTime = tsm();
  2005. this.status = "done";
  2006. }
  2007. } else {
  2008. await this.sign();
  2009. }
  2010. } else {
  2011. if (!isNowIn(0, 0, 0, 5)) {
  2012. this.logger.log("今天已经完成过直播签到任务了");
  2013. this.status = "done";
  2014. } else {
  2015. this.logger.log("昨天的直播签到任务已经完成过了,等到今天的00:05再执行");
  2016. }
  2017. }
  2018. const diff = delayToNextMoment();
  2019. setTimeout(() => this.run(), diff.ms);
  2020. this.logger.log("距离直播签到模块下次运行时间:", diff.str);
  2021. }
  2022. }
  2023. class MedalModule extends BaseModule {
  2024. /**
  2025. * 等待粉丝勋章数据获取完毕
  2026. *
  2027. * @returns 是否获取成功
  2028. */
  2029. waitForFansMedals() {
  2030. return new Promise((resolve2) => {
  2031. const { fansMedalsStatus } = pinia$1.storeToRefs(useBiliStore());
  2032. if (fansMedalsStatus.value === "loaded") {
  2033. resolve2(true);
  2034. } else {
  2035. const unwatch = vue.watch(fansMedalsStatus, (newValue) => {
  2036. if (newValue === "loaded") {
  2037. unwatch();
  2038. resolve2(true);
  2039. } else if (newValue === "error") {
  2040. unwatch();
  2041. resolve2(false);
  2042. }
  2043. });
  2044. }
  2045. });
  2046. }
  2047. }
  2048. class LightTask extends MedalModule {
  2049. constructor() {
  2050. super(...arguments);
  2051. __publicField(this, "medalTasksConfig", this.moduleStore.moduleConfig.DailyTasks.LiveTasks.medalTasks);
  2052. __publicField(this, "config", this.medalTasksConfig.light);
  2053. }
  2054. set status(s) {
  2055. this.moduleStore.moduleStatus.DailyTasks.LiveTasks.medalTasks.light = s;
  2056. }
  2057. /**
  2058. * 获取粉丝勋章,过滤不符合黑白名单要求和不需要点亮的粉丝勋章
  2059. * @returns 数组,数组中的每个元素都是数组:[房间号,主播uid]
  2060. */
  2061. getRoomidTargetidList() {
  2062. const filtered = useBiliStore().filteredFansMedals.filter(
  2063. (medal) => medal.medal.level < 20 && (this.medalTasksConfig.isWhiteList ? this.medalTasksConfig.roomidList.includes(medal.room_info.room_id) : !this.medalTasksConfig.roomidList.includes(medal.room_info.room_id)) && medal.medal.is_lighted === 0
  2064. ).map((medal) => [medal.room_info.room_id, medal.medal.target_id]);
  2065. if (this.medalTasksConfig.isWhiteList) {
  2066. const orderMap = arrayToMap(this.medalTasksConfig.roomidList);
  2067. return filtered.sort((a, b) => orderMap.get(a[0]) - orderMap.get(b[0]));
  2068. }
  2069. return filtered;
  2070. }
  2071. /**
  2072. * 点赞
  2073. * @param roomid 直播间号
  2074. * @param target_id 主播UID
  2075. * @param click_time 点赞次数
  2076. */
  2077. async like(roomid, target_id, click_time) {
  2078. try {
  2079. const response = await BAPI.live.likeReport(roomid, target_id, click_time);
  2080. this.logger.log(`BAPI.live.likeReport(${roomid}, ${target_id}, ${click_time})`, response);
  2081. if (response.code === 0) {
  2082. this.logger.log(
  2083. `点亮熄灭勋章-点赞 房间号 = ${roomid} 主播UID = ${target_id} 点赞次数 = ${click_time} 成功`
  2084. );
  2085. } else {
  2086. this.logger.error(
  2087. `点亮熄灭勋章-点赞 房间号 = ${roomid} 主播UID = ${target_id} 点赞次数 = ${click_time} 失败`,
  2088. response.message
  2089. );
  2090. }
  2091. } catch (error) {
  2092. this.logger.error(
  2093. `点亮熄灭勋章-点赞 房间号 = ${roomid} 主播UID = ${target_id} 点赞次数 = ${click_time} 出错`,
  2094. error
  2095. );
  2096. }
  2097. }
  2098. /**
  2099. * 发弹幕
  2100. * @param danmu 弹幕内容
  2101. * @param roomid 直播间号
  2102. */
  2103. async sendDanmu(danmu, roomid) {
  2104. try {
  2105. const response = await BAPI.live.sendMsg(danmu, roomid);
  2106. this.logger.log(`BAPI.live.sendMsg(${danmu}, ${roomid})`, response);
  2107. if (response.code === 0) {
  2108. if (response.msg === "k") {
  2109. this.logger.warn(
  2110. `点亮熄灭勋章-发送弹幕 在直播间 ${roomid} 发送弹幕 ${danmu} 异常,弹幕可能包含屏蔽词`
  2111. );
  2112. } else {
  2113. this.logger.log(`点亮熄灭勋章-发送弹幕 在直播间 ${roomid} 发送弹幕 ${danmu} 成功`);
  2114. }
  2115. } else {
  2116. this.logger.error(
  2117. `点亮熄灭勋章-发送弹幕 在直播间 ${roomid} 发送弹幕 ${danmu} 失败`,
  2118. response.message
  2119. );
  2120. }
  2121. } catch (error) {
  2122. this.logger.error(`点亮熄灭勋章-发送弹幕 在直播间 ${roomid} 发送弹幕 ${danmu} 出错`, error);
  2123. }
  2124. }
  2125. async run() {
  2126. this.logger.log("点亮熄灭勋章模块开始运行");
  2127. if (!isTimestampToday(this.config._lastCompleteTime)) {
  2128. if (!await this.waitForFansMedals()) {
  2129. this.logger.error("粉丝勋章数据不存在,不执行点亮熄灭勋章任务");
  2130. this.status = "error";
  2131. return;
  2132. }
  2133. this.status = "running";
  2134. const roomidTargetidList = this.getRoomidTargetidList();
  2135. if (roomidTargetidList.length > 0) {
  2136. for (let i = 0; i < roomidTargetidList.length; i++) {
  2137. const [roomid, target_id] = roomidTargetidList[i];
  2138. if (this.config.mode === "like") {
  2139. await this.like(roomid, target_id, _.random(31, 33));
  2140. } else {
  2141. await this.sendDanmu(this.config.danmuList[i % this.config.danmuList.length], roomid);
  2142. }
  2143. await sleep(_.random(3e3, 5e3));
  2144. }
  2145. }
  2146. this.config._lastCompleteTime = tsm();
  2147. this.status = "done";
  2148. this.logger.log("点亮熄灭勋章任务已完成");
  2149. } else {
  2150. if (isNowIn(0, 0, 0, 5)) {
  2151. this.logger.log("昨天的给点亮熄灭勋章任务已经完成过了,等到今天的00:05再执行");
  2152. } else {
  2153. this.logger.log("今天已经完成过点亮熄灭勋章任务了");
  2154. this.status = "done";
  2155. }
  2156. }
  2157. const diff = delayToNextMoment();
  2158. setTimeout(() => this.run(), diff.ms);
  2159. this.logger.log("距离点亮熄灭勋章模块下次运行时间:", diff.str);
  2160. }
  2161. }
  2162. class RoomHeart {
  2163. constructor(roomID, areaID, parentID, ruid, watchedSeconds) {
  2164. __publicField(this, "logger", new Logger("RoomHeart"));
  2165. __publicField(this, "config");
  2166. /** 今日当前直播间已观看时间(秒) */
  2167. __publicField(this, "watchedSeconds");
  2168. __publicField(this, "timer");
  2169. __publicField(this, "areaID");
  2170. __publicField(this, "parentID");
  2171. __publicField(this, "roomID");
  2172. /** 主播的 UID */
  2173. __publicField(this, "ruid");
  2174. __publicField(this, "seq", 0);
  2175. /** Cookie LIVE_BUVID */
  2176. __publicField(this, "buvid", useBiliStore().cookies.LIVE_BUVID);
  2177. __publicField(this, "uuid", uuid());
  2178. /** 计算签名和发送请求时均需要 JSON.stringify */
  2179. __publicField(this, "device", [this.buvid, this.uuid]);
  2180. /** 浏览器 user agent */
  2181. __publicField(this, "ua", navigator.userAgent);
  2182. __publicField(this, "heartBeatInterval");
  2183. __publicField(this, "secretKey");
  2184. __publicField(this, "secretRule");
  2185. /** ets */
  2186. __publicField(this, "timestamp");
  2187. this.roomID = roomID;
  2188. this.areaID = areaID;
  2189. this.parentID = parentID;
  2190. this.ruid = ruid;
  2191. this.watchedSeconds = watchedSeconds;
  2192. this.config = useModuleStore().moduleConfig.DailyTasks.LiveTasks.medalTasks.watch;
  2193. }
  2194. set status(s) {
  2195. useModuleStore().moduleStatus.DailyTasks.LiveTasks.medalTasks.watch = s;
  2196. }
  2197. /** 计算签名和发送请求时均需要 JSON.stringify */
  2198. get id() {
  2199. return [this.parentID, this.areaID, this.seq, this.roomID];
  2200. }
  2201. /** 更新当前直播间的观看任务进度 */
  2202. updateProgress() {
  2203. this.watchedSeconds += this.heartBeatInterval;
  2204. useModuleStore().moduleConfig.DailyTasks.LiveTasks.medalTasks.watch._watchingProgress[this.roomID] = this.watchedSeconds;
  2205. }
  2206. /**
  2207. * 开始心跳
  2208. */
  2209. start() {
  2210. if (!this.buvid) {
  2211. this.logger.error(`缺少buvid,无法为直播间 ${this.roomID} 执行观看直播任务,请尝试刷新页面`);
  2212. return Promise.resolve();
  2213. }
  2214. return this.E();
  2215. }
  2216. /**
  2217. * E心跳,开始时发送一次
  2218. */
  2219. async E() {
  2220. try {
  2221. const response = await BAPI.liveTrace.E(this.id, this.device, this.ruid);
  2222. this.logger.log(
  2223. `BAPI.liveTrace.E(${this.id}, ${this.device}, ${this.ruid}) response`,
  2224. response
  2225. );
  2226. if (response.code === 0) {
  2227. this.seq += 1;
  2228. ({
  2229. heartbeat_interval: this.heartBeatInterval,
  2230. secret_key: this.secretKey,
  2231. secret_rule: this.secretRule,
  2232. timestamp: this.timestamp
  2233. } = response.data);
  2234. await sleep(this.heartBeatInterval * 1e3);
  2235. return this.X();
  2236. } else {
  2237. this.logger.error(
  2238. `BAPI.liveTrace.E(${this.id}, ${this.device}, ${this.ruid}) 失败`,
  2239. response.message
  2240. );
  2241. }
  2242. } catch (error) {
  2243. this.logger.error(`BAPI.liveTrace.E(${this.id}, ${this.device}, ${this.ruid}) 出错`, error);
  2244. }
  2245. }
  2246. /**
  2247. * X心跳,E心跳过后都是X心跳
  2248. */
  2249. async X() {
  2250. if (isNowIn(23, 59, 0, 5)) {
  2251. this.logger.log(`即将或刚刚发生跨天,停止直播间 ${this.roomID} X心跳`);
  2252. return;
  2253. }
  2254. try {
  2255. const sypderData = {
  2256. id: JSON.stringify(this.id),
  2257. device: JSON.stringify(this.device),
  2258. ets: this.timestamp,
  2259. benchmark: this.secretKey,
  2260. time: this.heartBeatInterval,
  2261. ts: tsm(),
  2262. ua: this.ua
  2263. };
  2264. const s = this.spyder(JSON.stringify(sypderData), this.secretRule);
  2265. const response = await BAPI.liveTrace.X(
  2266. s,
  2267. this.id,
  2268. this.device,
  2269. this.ruid,
  2270. this.timestamp,
  2271. this.secretKey,
  2272. this.heartBeatInterval,
  2273. sypderData.ts
  2274. );
  2275. this.logger.log(
  2276. `BAPI.liveTrace.X(${s}, ${this.id}, ${this.device}, ${this.ruid}, ${this.timestamp}, ${this.secretKey}, ${this.heartBeatInterval}, ${sypderData.ts}) response`,
  2277. response
  2278. );
  2279. if (response.code === 0) {
  2280. this.seq += 1;
  2281. this.updateProgress();
  2282. if (this.watchedSeconds >= this.config.time * 60) {
  2283. clearTimeout(this.timer);
  2284. return;
  2285. }
  2286. ;
  2287. ({
  2288. heartbeat_interval: this.heartBeatInterval,
  2289. secret_key: this.secretKey,
  2290. secret_rule: this.secretRule,
  2291. timestamp: this.timestamp
  2292. } = response.data);
  2293. await sleep(this.heartBeatInterval * 1e3);
  2294. return this.X();
  2295. } else {
  2296. this.logger.error(
  2297. `BAPI.liveTrace.X(${s}, ${this.id}, ${this.device}, ${this.ruid}, ${this.timestamp}, ${this.secretKey}, ${this.heartBeatInterval}) 失败`,
  2298. response.message
  2299. );
  2300. }
  2301. } catch (error) {
  2302. this.logger.error(
  2303. `BAPI.liveTrace.X(s, ${this.id}, ${this.device}, ${this.ruid}, ${this.timestamp}, ${this.secretKey}, ${this.heartBeatInterval}) 出错`,
  2304. error
  2305. );
  2306. }
  2307. }
  2308. /**
  2309. * wasm 导出的 spyder 函数的 javascript 实现
  2310. * @param str 一个经过 JSON.stringify 的 json 字符串
  2311. * @param rule secret_rule 数组
  2312. * @returns s
  2313. */
  2314. spyder(str, rule) {
  2315. const data = JSON.parse(str);
  2316. const [parent_id, area_id, seq_id, room_id] = JSON.parse(data.id);
  2317. const [buvid, uuid2] = JSON.parse(data.device);
  2318. const key = data.benchmark;
  2319. const newData = {
  2320. platform: "web",
  2321. parent_id,
  2322. area_id,
  2323. seq_id,
  2324. room_id,
  2325. buvid,
  2326. uuid: uuid2,
  2327. ets: data.ets,
  2328. time: data.time,
  2329. ts: data.ts
  2330. };
  2331. let s = JSON.stringify(newData);
  2332. for (const r of rule) {
  2333. switch (r) {
  2334. case 0:
  2335. s = CryptoJS.HmacMD5(s, key).toString(CryptoJS.enc.Hex);
  2336. break;
  2337. case 1:
  2338. s = CryptoJS.HmacSHA1(s, key).toString(CryptoJS.enc.Hex);
  2339. break;
  2340. case 2:
  2341. s = CryptoJS.HmacSHA256(s, key).toString(CryptoJS.enc.Hex);
  2342. break;
  2343. case 3:
  2344. s = CryptoJS.HmacSHA224(s, key).toString(CryptoJS.enc.Hex);
  2345. break;
  2346. case 4:
  2347. s = CryptoJS.HmacSHA512(s, key).toString(CryptoJS.enc.Hex);
  2348. break;
  2349. case 5:
  2350. s = CryptoJS.HmacSHA384(s, key).toString(CryptoJS.enc.Hex);
  2351. break;
  2352. default:
  2353. s = CryptoJS.HmacMD5(s, key).toString(CryptoJS.enc.Hex);
  2354. }
  2355. }
  2356. return s;
  2357. }
  2358. }
  2359. class WatchTask2 extends MedalModule {
  2360. constructor() {
  2361. super(...arguments);
  2362. __publicField(this, "medalTasksConfig", this.moduleStore.moduleConfig.DailyTasks.LiveTasks.medalTasks);
  2363. __publicField(this, "config", this.medalTasksConfig.watch);
  2364. }
  2365. set status(s) {
  2366. this.moduleStore.moduleStatus.DailyTasks.LiveTasks.medalTasks.watch = s;
  2367. }
  2368. /**
  2369. * 获取粉丝勋章的房间号和主播uid,过滤等级大于等于20或不符合黑白名单要求的粉丝勋章
  2370. * @returns 数组,数组中的每个元素都是数组:[房间号,主播uid]
  2371. */
  2372. getRoomidUidList() {
  2373. const filtered = useBiliStore().filteredFansMedals.filter(
  2374. (medal) => medal.medal.level < 20 && (this.medalTasksConfig.isWhiteList ? this.medalTasksConfig.roomidList.includes(medal.room_info.room_id) : !this.medalTasksConfig.roomidList.includes(medal.room_info.room_id))
  2375. ).map((medal) => [medal.room_info.room_id, medal.medal.target_id]).slice(0, 199);
  2376. if (this.medalTasksConfig.isWhiteList) {
  2377. const orderMap = arrayToMap(this.medalTasksConfig.roomidList);
  2378. return filtered.sort((a, b) => orderMap.get(a[0]) - orderMap.get(b[0]));
  2379. }
  2380. return filtered;
  2381. }
  2382. /**
  2383. * 获取指定直播间的 area_id 和 parent_area_id
  2384. *
  2385. * 出错时返回 [-1, -1]
  2386. *
  2387. * @param roomid 房间号
  2388. * @returns [area_id, parent_area_id]
  2389. */
  2390. async getAreaInfo(roomid) {
  2391. try {
  2392. const response = await BAPI.live.getInfoByRoom(roomid);
  2393. this.logger.log(`BAPI.live.getInfoByRoom(${roomid}) response`, response);
  2394. if (response.code === 0) {
  2395. const room_info = response.data.room_info;
  2396. return [room_info.area_id, room_info.parent_area_id];
  2397. } else {
  2398. return [-1, -1];
  2399. }
  2400. } catch (error) {
  2401. this.logger.error(
  2402. `获取指定直播间的 area_id parent_area_id(roomid = ${roomid}) 出错`,
  2403. error
  2404. );
  2405. return [-1, -1];
  2406. }
  2407. }
  2408. async run() {
  2409. this.logger.log("观看直播模块开始运行");
  2410. if (!isTimestampToday(this.config._lastCompleteTime)) {
  2411. if (!await this.waitForFansMedals()) {
  2412. this.logger.error("粉丝勋章数据不存在,不执行观看直播任务");
  2413. this.status = "error";
  2414. return;
  2415. }
  2416. this.status = "running";
  2417. if (!isTimestampToday(this.config._lastWatchTime, 0, 0)) {
  2418. this.config._watchingProgress = {};
  2419. } else {
  2420. _.forOwn(this.config._watchingProgress, (value, key, object) => {
  2421. object[key] -= value % 300;
  2422. });
  2423. }
  2424. this.config._lastWatchTime = tsm();
  2425. const roomidUidList = this.getRoomidUidList();
  2426. if (roomidUidList.length > 0) {
  2427. let i;
  2428. for (i = 0; i < roomidUidList.length; i++) {
  2429. const [roomid, uid] = roomidUidList[i];
  2430. const [area_id, parent_area_id] = await this.getAreaInfo(roomid);
  2431. if (area_id > 0 && parent_area_id > 0) {
  2432. if (!this.config._watchingProgress[roomid] || this.config._watchingProgress[roomid] < this.config.time * 60) {
  2433. if (isNowIn(23, 55, 0, 5)) {
  2434. this.logger.log("即将或刚刚发生跨天,提早结束本轮观看直播任务");
  2435. break;
  2436. }
  2437. this.logger.log(`开始直播间${roomid}的观看直播任务`);
  2438. await new RoomHeart(
  2439. roomid,
  2440. area_id,
  2441. parent_area_id,
  2442. uid,
  2443. this.config._watchingProgress[roomid] ?? 0
  2444. ).start();
  2445. }
  2446. }
  2447. }
  2448. if (i === roomidUidList.length) {
  2449. this.config._lastCompleteTime = tsm();
  2450. this.logger.log("观看直播任务已完成");
  2451. this.status = "done";
  2452. }
  2453. } else {
  2454. this.status = "done";
  2455. this.config._lastCompleteTime = tsm();
  2456. }
  2457. } else {
  2458. if (isNowIn(0, 0, 0, 5)) {
  2459. this.logger.log("昨天的观看直播任务已经完成过了,等到今天的00:05再执行");
  2460. } else {
  2461. this.logger.log("今天已经完成过观看直播任务了");
  2462. this.status = "done";
  2463. }
  2464. }
  2465. const diff = delayToNextMoment();
  2466. setTimeout(() => this.run(), diff.ms);
  2467. this.logger.log("距离观看直播模块下次运行时间:", diff.str);
  2468. }
  2469. }
  2470. __publicField(WatchTask2, "runAt", "window-load");
  2471. class GroupSignTask extends BaseModule {
  2472. constructor() {
  2473. super(...arguments);
  2474. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.OtherTasks.groupSign);
  2475. }
  2476. set status(s) {
  2477. this.moduleStore.moduleStatus.DailyTasks.OtherTasks.groupSign = s;
  2478. }
  2479. /**
  2480. * 获取应援团 id 和拥有者 uid
  2481. * @returns 数组,每个元素都是数组:[应援团 id,拥有者 uid]
  2482. */
  2483. async getGroupidOwneruidList() {
  2484. try {
  2485. const response = await BAPI.vc.myGroups();
  2486. this.logger.log(`BAPI.vc.myGroups response`, response);
  2487. if (response.code === 0) {
  2488. return response.data.list.map((item) => [item.group_id, item.owner_uid]);
  2489. } else {
  2490. this.logger.error(`获取应援团信息失败`, response.message);
  2491. this.status = "error";
  2492. }
  2493. } catch (error) {
  2494. this.logger.error(`获取应援团信息出错`, error);
  2495. this.status = "error";
  2496. }
  2497. }
  2498. async sign(group_id, owner_uid) {
  2499. try {
  2500. const response = await BAPI.vc.signIn(group_id, owner_uid);
  2501. this.logger.log(`BAPI.vc.signIn(${group_id}, ${owner_uid}) response`, response);
  2502. if (response.code === 0) {
  2503. this.logger.log(
  2504. `应援团签到 应援团ID = ${group_id} 拥有者UID = ${owner_uid} 成功, 粉丝勋章亲密度+${response.data.add_num}`
  2505. );
  2506. } else {
  2507. this.logger.error(
  2508. `应援团签到 应援团ID = ${group_id} 拥有者UID = ${owner_uid} 失败`,
  2509. response.message
  2510. );
  2511. }
  2512. } catch (error) {
  2513. this.logger.error(`应援团签到 应援团ID = ${group_id} 拥有者UID = ${owner_uid} 出错`, error);
  2514. }
  2515. }
  2516. async run() {
  2517. this.logger.log("应援团签到模块开始运行");
  2518. if (!isTimestampToday(this.config._lastCompleteTime, 8, 5)) {
  2519. this.status = "running";
  2520. const idList = await this.getGroupidOwneruidList();
  2521. if (idList) {
  2522. for (const [group_id, owner_uid] of idList) {
  2523. await this.sign(group_id, owner_uid);
  2524. await sleep(2e3);
  2525. }
  2526. this.config._lastCompleteTime = tsm();
  2527. this.logger.log("应援团签到任务已完成");
  2528. this.status = "done";
  2529. }
  2530. } else {
  2531. if (!isNowIn(0, 0, 8, 5)) {
  2532. this.logger.log("今天已经完成过应援团签到任务了");
  2533. this.status = "done";
  2534. } else {
  2535. this.logger.log("昨天的应援团签到任务已经完成过了,等到今天早上八点零五分再次执行");
  2536. }
  2537. }
  2538. const diff = delayToNextMoment(8, 5);
  2539. setTimeout(() => this.run(), diff.ms);
  2540. this.logger.log("距离应援团签到模块下次运行时间:", diff.str);
  2541. }
  2542. }
  2543. class SilverToCoinTask extends BaseModule {
  2544. constructor() {
  2545. super(...arguments);
  2546. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.OtherTasks.silverToCoin);
  2547. }
  2548. set status(s) {
  2549. this.moduleStore.moduleStatus.DailyTasks.OtherTasks.silverToCoin = s;
  2550. }
  2551. async exchange() {
  2552. try {
  2553. const response = await BAPI.live.silver2coin();
  2554. this.logger.log(`BAPI.live.silver2coin response`, response);
  2555. if (response.code === 0) {
  2556. this.logger.log(`银瓜子换硬币已完成,获得硬币:`, response.data.coin);
  2557. this.config._lastCompleteTime = tsm();
  2558. this.status = "done";
  2559. } else if (response.code === 403) {
  2560. this.logger.log("每天最多只能用银瓜子兑换1个硬币");
  2561. this.config._lastCompleteTime = tsm();
  2562. this.status = "done";
  2563. } else {
  2564. this.logger.error("银瓜子换硬币失败", response.message);
  2565. this.status = "error";
  2566. }
  2567. } catch (err) {
  2568. this.logger.error("银瓜子换硬币出错", err);
  2569. this.status = "error";
  2570. }
  2571. }
  2572. run() {
  2573. this.logger.log("银瓜子换硬币模块开始运行");
  2574. if (!isTimestampToday(this.config._lastCompleteTime)) {
  2575. this.status = "running";
  2576. this.exchange();
  2577. } else {
  2578. if (isNowIn(0, 0, 0, 5)) {
  2579. this.logger.log("昨天的银瓜子换硬币任务已经完成过了,等到今天的00:05再执行");
  2580. } else {
  2581. this.logger.log("今天已经完成过银瓜子换硬币任务了");
  2582. this.status = "done";
  2583. }
  2584. }
  2585. const diff = delayToNextMoment();
  2586. setTimeout(() => this.run(), diff.ms);
  2587. this.logger.log("银瓜子换硬币模块下次运行时间:", diff.str);
  2588. }
  2589. }
  2590. class CoinToSilverTask extends BaseModule {
  2591. constructor() {
  2592. super(...arguments);
  2593. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.OtherTasks.coinToSilver);
  2594. }
  2595. set status(s) {
  2596. this.moduleStore.moduleStatus.DailyTasks.OtherTasks.coinToSilver = s;
  2597. }
  2598. async exchange() {
  2599. try {
  2600. const response = await BAPI.live.coin2silver(this.config.num);
  2601. this.logger.log(`BAPI.live.coin2silver{${this.config.num}} response`, response);
  2602. if (response.code === 0) {
  2603. this.logger.log("硬币换银瓜子已完成,获得银瓜子:", response.data.silver);
  2604. this.config._lastCompleteTime = tsm();
  2605. this.status = "done";
  2606. } else {
  2607. this.logger.error("硬币换银瓜子失败", response.message);
  2608. this.status = "error";
  2609. }
  2610. } catch (err) {
  2611. this.logger.error("硬币换银瓜子出错", err);
  2612. this.status = "error";
  2613. }
  2614. }
  2615. async run() {
  2616. this.logger.log("硬币换银瓜子模块开始运行");
  2617. if (!isTimestampToday(this.config._lastCompleteTime)) {
  2618. this.status = "running";
  2619. await this.exchange();
  2620. } else {
  2621. if (!isNowIn(0, 0, 0, 5)) {
  2622. this.logger.log("今天已经完成过硬币换银瓜子任务了");
  2623. this.status = "done";
  2624. } else {
  2625. this.logger.log("昨天的硬币换银瓜子任务已经完成过了,等到今天的00:05再执行");
  2626. }
  2627. }
  2628. const diff = delayToNextMoment();
  2629. setTimeout(() => this.run(), diff.ms);
  2630. this.logger.log("硬币换银瓜子模块下次运行时间:", diff.str);
  2631. }
  2632. }
  2633. class GetYearVipPrivilegeTask extends BaseModule {
  2634. constructor() {
  2635. super(...arguments);
  2636. __publicField(this, "config", this.moduleStore.moduleConfig.DailyTasks.OtherTasks.getYearVipPrivilege);
  2637. __publicField(this, "type2Name", {
  2638. 1: "年度专享B币赠送",
  2639. 2: "年度专享会员购优惠券",
  2640. 3: "年度专享漫画礼包 - 漫画福利券",
  2641. 4: "大会员专享会员购包邮券",
  2642. 5: "年度专享漫画礼包 - 漫画商城优惠券",
  2643. 6: "大会员专享会员体验卡",
  2644. 7: "大会员专享课堂优惠券",
  2645. 15: "年度专享会员购星光宝盒88折券",
  2646. 16: "大会员专享会员购10魔晶",
  2647. 17: "年度专享游戏优惠券"
  2648. });
  2649. }
  2650. set status(s) {
  2651. this.moduleStore.moduleStatus.DailyTasks.OtherTasks.getYearVipPrivilege = s;
  2652. }
  2653. /**
  2654. * 获取会员权益
  2655. * @returns 会员权益列表
  2656. */
  2657. async myPrivilege() {
  2658. try {
  2659. const response = await BAPI.main.vip.myPrivilege();
  2660. this.logger.log(`BAPI.main.vip.myPrivilege response`, response);
  2661. if (response.code === 0) {
  2662. return response.data.list;
  2663. } else {
  2664. this.logger.error(`获取年度大会员权益信息失败`, response.message);
  2665. this.status = "error";
  2666. }
  2667. } catch (error) {
  2668. this.logger.error(`获取年度大会员权益信息出错`, error);
  2669. this.status = "error";
  2670. }
  2671. }
  2672. /**
  2673. * 领取权益
  2674. * @param type 权益种类
  2675. */
  2676. async receivePrivilege(type) {
  2677. try {
  2678. const response = await BAPI.main.vip.receivePrivilege(type);
  2679. this.logger.log(`BAPI.main.vip.receivePrivilege(${type}) response`, response);
  2680. if (response.code === 0) {
  2681. this.logger.log(
  2682. `领取年度大会员权益(type = ${type}, ${this.type2Name[type] ?? "未知"})成功`
  2683. );
  2684. } else {
  2685. this.logger.error(
  2686. `领取年度大会员权益(type = ${type}, ${this.type2Name[type] ?? "未知"})失败`,
  2687. response.message
  2688. );
  2689. }
  2690. } catch (error) {
  2691. this.logger.error(
  2692. `领取年度大会员权益(type = ${type}, ${this.type2Name[type] ?? "未知"})出错`,
  2693. error
  2694. );
  2695. }
  2696. }
  2697. /**
  2698. * 领取专属等级加速包(10主站经验)
  2699. */
  2700. async addExperience() {
  2701. try {
  2702. const response = await BAPI.main.vip.addExperience();
  2703. this.logger.log(`BAPI.main.vip.addExperience response`, response);
  2704. if (response.code === 0) {
  2705. this.logger.log(`领取年度大会员权益(type = 9,专属等级加速包(10主站经验))成功`);
  2706. } else {
  2707. this.logger.error(
  2708. `领取年度大会员权益(type = 9,专属等级加速包(10主站经验))失败`,
  2709. response.message
  2710. );
  2711. }
  2712. } catch (error) {
  2713. this.logger.error(`领取年度大会员权益(type = 9,专属等级加速包(10主站经验))出错`, error);
  2714. }
  2715. }
  2716. /**
  2717. * 判断当前账号是否是年度大会员
  2718. */
  2719. isYearVip() {
  2720. const biliStore = useBiliStore();
  2721. const userInfo = biliStore.userInfo;
  2722. if (userInfo.vip.status === 1 && userInfo.vip.type === 2) {
  2723. return true;
  2724. } else {
  2725. this.logger.log("当前账号不是年度大会员,不领取权益");
  2726. return false;
  2727. }
  2728. }
  2729. async run() {
  2730. this.logger.log("领取年度大会员权益模块开始运行");
  2731. if (this.isYearVip()) {
  2732. if (ts() >= this.config._nextReceiveTime) {
  2733. this.status = "running";
  2734. const list = await this.myPrivilege();
  2735. if (list) {
  2736. for (const i of list) {
  2737. if (i.type === 8 || i.type === 14) {
  2738. continue;
  2739. }
  2740. if (i.state === 0) {
  2741. if (i.type === 9) {
  2742. await this.addExperience();
  2743. } else {
  2744. await this.receivePrivilege(i.type);
  2745. }
  2746. } else if (i.state === 1) {
  2747. this.logger.log(`该权益(type = ${i.type})已经领取过了`);
  2748. } else {
  2749. if (i.type === 9) {
  2750. const watchTaskConfig = this.moduleStore.moduleConfig.DailyTasks.MainSiteTasks.watch;
  2751. if (watchTaskConfig.enabled) {
  2752. this.logger.log("等待观看视频任务完成后再领取专属等级加速包(10主站经验)...");
  2753. vue.watch(
  2754. () => watchTaskConfig._lastCompleteTime,
  2755. () => sleep(3e3).then(() => this.addExperience()),
  2756. { once: true }
  2757. );
  2758. } else {
  2759. this.logger.warn(
  2760. "领取专属等级加速包(10主站经验)前需要观看任意一个视频,请打开【主站任务】中的【每日观看视频】,或是在运行脚本前手动观看"
  2761. );
  2762. }
  2763. }
  2764. }
  2765. await sleep(200);
  2766. }
  2767. this.status = "done";
  2768. this.config._nextReceiveTime = Math.min(...list.map((i) => i.period_end_unix));
  2769. }
  2770. }
  2771. const diff = this.config._nextReceiveTime - ts() + 3e5;
  2772. if (diff < 86400) {
  2773. this.logger.log(
  2774. "领取年度大会员权益模块下次运行时间:",
  2775. luxon.DateTime.fromSeconds(this.config._nextReceiveTime).toJSDate()
  2776. );
  2777. setTimeout(() => this.run(), diff * 1e3);
  2778. } else {
  2779. this.logger.log("距离下次领取年度大会员权益的时间超过一天,不计划下次运行");
  2780. }
  2781. }
  2782. }
  2783. }
  2784. const dq = document.querySelector.bind(document);
  2785. document.querySelectorAll.bind(document);
  2786. const dce = document.createElement.bind(document);
  2787. function waitForElement(parentElement, selector, timeout = 5e3) {
  2788. return new Promise((resolve2, reject2) => {
  2789. const element = parentElement.querySelector(selector);
  2790. if (element) {
  2791. resolve2(element);
  2792. return;
  2793. }
  2794. const observer = new MutationObserver(() => {
  2795. const element2 = parentElement.querySelector(selector);
  2796. if (element2) {
  2797. clearTimeout(timeoutId);
  2798. observer.disconnect();
  2799. resolve2(element2);
  2800. }
  2801. });
  2802. observer.observe(parentElement, {
  2803. childList: true,
  2804. subtree: true
  2805. });
  2806. const timeoutId = setTimeout(() => {
  2807. observer.disconnect();
  2808. reject2(new Error(`无法在${timeout}毫秒内找到${parentElement.localName}的子节点${selector}`));
  2809. }, timeout);
  2810. });
  2811. }
  2812. const isTargetFrame = () => document.head.innerHTML.includes("BilibiliLive");
  2813. const isSelfTopFrame = () => window.self === window.top;
  2814. const topFrameDocumentElement = () => {
  2815. var _a;
  2816. return (_a = window.top) == null ? void 0 : _a.document.documentElement;
  2817. };
  2818. class SwitchLiveStreamQuality extends BaseModule {
  2819. constructor() {
  2820. super(...arguments);
  2821. __publicField(this, "config", this.moduleStore.moduleConfig.EnhanceExperience.switchLiveStreamQuality);
  2822. }
  2823. async waitForPlayer() {
  2824. return new Promise((resolve2, reject2) => {
  2825. const topWindow = _unsafeWindow.top ? _unsafeWindow.top : _unsafeWindow;
  2826. const findPlayertimer = setInterval(() => {
  2827. if (topWindow.livePlayer && Object.hasOwn(topWindow.livePlayer, "switchQuality") && Object.hasOwn(topWindow.livePlayer, "getPlayerInfo")) {
  2828. clearInterval(findPlayertimer);
  2829. clearTimeout(timeoutTimer);
  2830. resolve2(topWindow.livePlayer);
  2831. }
  2832. }, 200);
  2833. const timeoutTimer = setTimeout(() => {
  2834. clearInterval(findPlayertimer);
  2835. clearTimeout(timeoutTimer);
  2836. reject2("等待播放器超时");
  2837. }, 1e4);
  2838. });
  2839. }
  2840. switchQuality(livePlayer) {
  2841. const playerInfo = livePlayer.getPlayerInfo();
  2842. if (playerInfo.liveStatus === 0) {
  2843. this.logger.log("当前直播间未开播,无需切换画质");
  2844. } else {
  2845. setTimeout(
  2846. () => {
  2847. const targetQuality = playerInfo.qualityCandidates.find(
  2848. ({ desc }) => desc === this.config.qualityDesc
  2849. );
  2850. if (targetQuality) {
  2851. if (playerInfo.quality !== targetQuality.qn) {
  2852. livePlayer.switchQuality(targetQuality.qn);
  2853. this.logger.log(`已将画质切换为${this.config.qualityDesc}`, targetQuality);
  2854. } else {
  2855. this.logger.log("当前画质已经是目标画质了,无需切换画质");
  2856. }
  2857. } else {
  2858. this.logger.log("当前直播不支持目标画质,保持默认画质");
  2859. }
  2860. },
  2861. // 这里针对特殊直播间和普通直播间设置了两套超时时间,特殊直播间超时时间更长
  2862. isSelfTopFrame() ? 2500 : 5e3
  2863. );
  2864. }
  2865. }
  2866. async run() {
  2867. this.logger.log("自动切换画质模块开始运行");
  2868. try {
  2869. const livePlayer = await this.waitForPlayer();
  2870. this.switchQuality(livePlayer);
  2871. } catch (e) {
  2872. this.logger.error("自动切换画质模块出错", e);
  2873. }
  2874. }
  2875. }
  2876. __publicField(SwitchLiveStreamQuality, "runOnMultiplePages", true);
  2877. __publicField(SwitchLiveStreamQuality, "runAt", "window-load");
  2878. __publicField(SwitchLiveStreamQuality, "runAfterDefault", false);
  2879. class BanP2P extends BaseModule {
  2880. constructor() {
  2881. super(...arguments);
  2882. __publicField(this, "config", this.moduleStore.moduleConfig.EnhanceExperience.banp2p);
  2883. }
  2884. banP2P() {
  2885. const RTClist = [
  2886. "RTCPeerConnection",
  2887. "mozRTCPeerConnection",
  2888. "webkitRTCPeerConnection"
  2889. ];
  2890. for (const i of RTClist) {
  2891. if (Object.hasOwn(_unsafeWindow, i)) {
  2892. Object.defineProperty(_unsafeWindow, i, {
  2893. value: class {
  2894. constructor() {
  2895. }
  2896. addEventListener() {
  2897. }
  2898. removeEventListener() {
  2899. }
  2900. createDataChannel() {
  2901. return { close: function() {
  2902. } };
  2903. }
  2904. createOffer() {
  2905. return Promise.resolve();
  2906. }
  2907. setLocalDescription() {
  2908. return Promise.resolve();
  2909. }
  2910. close() {
  2911. }
  2912. setRemoteDescription() {
  2913. return Promise.resolve();
  2914. }
  2915. createAnswer() {
  2916. }
  2917. },
  2918. enumerable: false,
  2919. writable: false,
  2920. configurable: false
  2921. });
  2922. }
  2923. }
  2924. }
  2925. run() {
  2926. this.logger.log("禁用P2P模块开始运行");
  2927. try {
  2928. this.banP2P();
  2929. } catch (e) {
  2930. this.logger.error("禁用P2P失败", e);
  2931. }
  2932. }
  2933. }
  2934. __publicField(BanP2P, "runOnMultiplePages", true);
  2935. __publicField(BanP2P, "runAt", "document-start");
  2936. __publicField(BanP2P, "onFrame", "all");
  2937. __publicField(BanP2P, "runAfterDefault", false);
  2938. var events = ["load", "loadend", "timeout", "error", "readystatechange", "abort"];
  2939. var OriginXhr = "__origin_xhr";
  2940. function configEvent(event, xhrProxy) {
  2941. var e = {};
  2942. for (var attr in event) e[attr] = event[attr];
  2943. e.target = e.currentTarget = xhrProxy;
  2944. return e;
  2945. }
  2946. function hook$1(proxy2, win) {
  2947. win = win || window;
  2948. var originXhr = win.XMLHttpRequest;
  2949. var hooking = true;
  2950. var HookXMLHttpRequest = function() {
  2951. var xhr = new originXhr();
  2952. for (var i = 0; i < events.length; ++i) {
  2953. var key = "on" + events[i];
  2954. if (xhr[key] === void 0) xhr[key] = null;
  2955. }
  2956. for (var attr in xhr) {
  2957. var type = "";
  2958. try {
  2959. type = typeof xhr[attr];
  2960. } catch (e) {
  2961. }
  2962. if (type === "function") {
  2963. this[attr] = hookFunction(attr);
  2964. } else if (attr !== OriginXhr) {
  2965. Object.defineProperty(this, attr, {
  2966. get: getterFactory(attr),
  2967. set: setterFactory(attr),
  2968. enumerable: true
  2969. });
  2970. }
  2971. }
  2972. var that = this;
  2973. xhr.getProxy = function() {
  2974. return that;
  2975. };
  2976. this[OriginXhr] = xhr;
  2977. };
  2978. HookXMLHttpRequest.prototype = originXhr.prototype;
  2979. HookXMLHttpRequest.prototype.constructor = HookXMLHttpRequest;
  2980. win.XMLHttpRequest = HookXMLHttpRequest;
  2981. Object.assign(win.XMLHttpRequest, { UNSENT: 0, OPENED: 1, HEADERS_RECEIVED: 2, LOADING: 3, DONE: 4 });
  2982. function getterFactory(attr) {
  2983. return function() {
  2984. var originValue = this[OriginXhr][attr];
  2985. if (hooking) {
  2986. var v = this.hasOwnProperty(attr + "_") ? this[attr + "_"] : originValue;
  2987. var attrGetterHook = (proxy2[attr] || {})["getter"];
  2988. return attrGetterHook && attrGetterHook(v, this) || v;
  2989. } else {
  2990. return originValue;
  2991. }
  2992. };
  2993. }
  2994. function setterFactory(attr) {
  2995. return function(v) {
  2996. var xhr = this[OriginXhr];
  2997. if (hooking) {
  2998. var that = this;
  2999. var hook2 = proxy2[attr];
  3000. if (attr.substring(0, 2) === "on") {
  3001. that[attr + "_"] = v;
  3002. xhr[attr] = function(e) {
  3003. e = configEvent(e, that);
  3004. var ret = proxy2[attr] && proxy2[attr].call(that, xhr, e);
  3005. ret || v.call(that, e);
  3006. };
  3007. } else {
  3008. var attrSetterHook = (hook2 || {})["setter"];
  3009. v = attrSetterHook && attrSetterHook(v, that) || v;
  3010. this[attr + "_"] = v;
  3011. try {
  3012. xhr[attr] = v;
  3013. } catch (e) {
  3014. }
  3015. }
  3016. } else {
  3017. xhr[attr] = v;
  3018. }
  3019. };
  3020. }
  3021. function hookFunction(fun) {
  3022. return function() {
  3023. var args = [].slice.call(arguments);
  3024. if (proxy2[fun] && hooking) {
  3025. var ret = proxy2[fun].call(this, args, this[OriginXhr]);
  3026. if (ret) return ret;
  3027. }
  3028. return this[OriginXhr][fun].apply(this[OriginXhr], args);
  3029. };
  3030. }
  3031. function unHook() {
  3032. hooking = false;
  3033. if (win.XMLHttpRequest === HookXMLHttpRequest) {
  3034. win.XMLHttpRequest = originXhr;
  3035. HookXMLHttpRequest.prototype.constructor = originXhr;
  3036. originXhr = void 0;
  3037. }
  3038. }
  3039. return { originXhr, unHook };
  3040. }
  3041. var eventLoad = events[0], eventLoadEnd = events[1], eventTimeout = events[2], eventError = events[3], eventReadyStateChange = events[4], eventAbort = events[5];
  3042. var prototype = "prototype";
  3043. function proxy(proxy2, win) {
  3044. win = win || window;
  3045. return proxyAjax(proxy2, win);
  3046. }
  3047. function trim(str) {
  3048. return str.replace(/^\s+|\s+$/g, "");
  3049. }
  3050. function getEventTarget(xhr) {
  3051. return xhr.watcher || (xhr.watcher = document.createElement("a"));
  3052. }
  3053. function triggerListener(xhr, name) {
  3054. var xhrProxy = xhr.getProxy();
  3055. var callback = "on" + name + "_";
  3056. var event = configEvent({ type: name }, xhrProxy);
  3057. xhrProxy[callback] && xhrProxy[callback](event);
  3058. var evt;
  3059. if (typeof Event === "function") {
  3060. evt = new Event(name, { bubbles: false });
  3061. } else {
  3062. evt = document.createEvent("Event");
  3063. evt.initEvent(name, false, true);
  3064. }
  3065. getEventTarget(xhr).dispatchEvent(evt);
  3066. }
  3067. function Handler(xhr) {
  3068. this.xhr = xhr;
  3069. this.xhrProxy = xhr.getProxy();
  3070. }
  3071. Handler[prototype] = /* @__PURE__ */ Object.create({
  3072. resolve: function resolve(response) {
  3073. var xhrProxy = this.xhrProxy;
  3074. var xhr = this.xhr;
  3075. xhrProxy.readyState = 4;
  3076. xhr.resHeader = response.headers;
  3077. xhrProxy.response = xhrProxy.responseText = response.response;
  3078. xhrProxy.statusText = response.statusText;
  3079. xhrProxy.status = response.status;
  3080. triggerListener(xhr, eventReadyStateChange);
  3081. triggerListener(xhr, eventLoad);
  3082. triggerListener(xhr, eventLoadEnd);
  3083. },
  3084. reject: function reject(error) {
  3085. this.xhrProxy.status = 0;
  3086. triggerListener(this.xhr, error.type);
  3087. triggerListener(this.xhr, eventLoadEnd);
  3088. }
  3089. });
  3090. function makeHandler(next) {
  3091. function sub(xhr) {
  3092. Handler.call(this, xhr);
  3093. }
  3094. sub[prototype] = Object.create(Handler[prototype]);
  3095. sub[prototype].next = next;
  3096. return sub;
  3097. }
  3098. var RequestHandler$1 = makeHandler(function(rq) {
  3099. var xhr = this.xhr;
  3100. rq = rq || xhr.config;
  3101. xhr.withCredentials = rq.withCredentials;
  3102. xhr.open(rq.method, rq.url, rq.async !== false, rq.user, rq.password);
  3103. for (var key in rq.headers) {
  3104. xhr.setRequestHeader(key, rq.headers[key]);
  3105. }
  3106. xhr.send(rq.body);
  3107. });
  3108. var ResponseHandler$1 = makeHandler(function(response) {
  3109. this.resolve(response);
  3110. });
  3111. var ErrorHandler = makeHandler(function(error) {
  3112. this.reject(error);
  3113. });
  3114. function proxyAjax(proxy2, win) {
  3115. var onRequest = proxy2.onRequest, onResponse = proxy2.onResponse, onError = proxy2.onError;
  3116. function getResponseData(xhrProxy) {
  3117. var responseType = xhrProxy.responseType;
  3118. if (!responseType || responseType === "text") {
  3119. return xhrProxy.responseText;
  3120. }
  3121. var response = xhrProxy.response;
  3122. if (responseType === "json" && !response) {
  3123. try {
  3124. return JSON.parse(xhrProxy.responseText);
  3125. } catch (e) {
  3126. console.warn(e);
  3127. }
  3128. }
  3129. return response;
  3130. }
  3131. function handleResponse(xhr, xhrProxy) {
  3132. var handler = new ResponseHandler$1(xhr);
  3133. var ret = {
  3134. response: getResponseData(xhrProxy),
  3135. status: xhrProxy.status,
  3136. statusText: xhrProxy.statusText,
  3137. config: xhr.config,
  3138. headers: xhr.resHeader || xhr.getAllResponseHeaders().split("\r\n").reduce(function(ob, str) {
  3139. if (str === "") return ob;
  3140. var m = str.split(":");
  3141. ob[m.shift()] = trim(m.join(":"));
  3142. return ob;
  3143. }, {})
  3144. };
  3145. if (!onResponse) return handler.resolve(ret);
  3146. onResponse(ret, handler);
  3147. }
  3148. function onerror(xhr, xhrProxy, error, errorType) {
  3149. var handler = new ErrorHandler(xhr);
  3150. error = { config: xhr.config, error, type: errorType };
  3151. if (onError) {
  3152. onError(error, handler);
  3153. } else {
  3154. handler.next(error);
  3155. }
  3156. }
  3157. function preventXhrProxyCallback() {
  3158. return true;
  3159. }
  3160. function errorCallback(errorType) {
  3161. return function(xhr, e) {
  3162. onerror(xhr, this, e, errorType);
  3163. return true;
  3164. };
  3165. }
  3166. function stateChangeCallback(xhr, xhrProxy) {
  3167. if (xhr.readyState === 4 && xhr.status !== 0) {
  3168. handleResponse(xhr, xhrProxy);
  3169. } else if (xhr.readyState !== 4) {
  3170. triggerListener(xhr, eventReadyStateChange);
  3171. }
  3172. return true;
  3173. }
  3174. var { originXhr, unHook } = hook$1({
  3175. onload: preventXhrProxyCallback,
  3176. onloadend: preventXhrProxyCallback,
  3177. onerror: errorCallback(eventError),
  3178. ontimeout: errorCallback(eventTimeout),
  3179. onabort: errorCallback(eventAbort),
  3180. onreadystatechange: function(xhr) {
  3181. return stateChangeCallback(xhr, this);
  3182. },
  3183. open: function open(args, xhr) {
  3184. var _this = this;
  3185. var config = xhr.config = { headers: {} };
  3186. config.method = args[0];
  3187. config.url = args[1];
  3188. config.async = args[2];
  3189. config.user = args[3];
  3190. config.password = args[4];
  3191. config.xhr = xhr;
  3192. var evName = "on" + eventReadyStateChange;
  3193. if (!xhr[evName]) {
  3194. xhr[evName] = function() {
  3195. return stateChangeCallback(xhr, _this);
  3196. };
  3197. }
  3198. if (onRequest) return true;
  3199. },
  3200. send: function(args, xhr) {
  3201. var config = xhr.config;
  3202. config.withCredentials = xhr.withCredentials;
  3203. config.body = args[0];
  3204. if (onRequest) {
  3205. var req = function() {
  3206. onRequest(config, new RequestHandler$1(xhr));
  3207. };
  3208. config.async === false ? req() : setTimeout(req);
  3209. return true;
  3210. }
  3211. },
  3212. setRequestHeader: function(args, xhr) {
  3213. xhr.config.headers[args[0].toLowerCase()] = args[1];
  3214. if (onRequest) return true;
  3215. },
  3216. addEventListener: function(args, xhr) {
  3217. var _this = this;
  3218. if (events.indexOf(args[0]) !== -1) {
  3219. var handler = args[1];
  3220. getEventTarget(xhr).addEventListener(args[0], function(e) {
  3221. var event = configEvent(e, _this);
  3222. event.type = args[0];
  3223. event.isTrusted = true;
  3224. handler.call(_this, event);
  3225. });
  3226. return true;
  3227. }
  3228. },
  3229. getAllResponseHeaders: function(_2, xhr) {
  3230. var headers = xhr.resHeader;
  3231. if (headers) {
  3232. var header = "";
  3233. for (var key in headers) {
  3234. header += key + ": " + headers[key] + "\r\n";
  3235. }
  3236. return header;
  3237. }
  3238. },
  3239. getResponseHeader: function(args, xhr) {
  3240. var headers = xhr.resHeader;
  3241. if (headers) {
  3242. return headers[(args[0] || "").toLowerCase()];
  3243. }
  3244. }
  3245. }, win);
  3246. return {
  3247. originXhr,
  3248. unProxy: unHook
  3249. };
  3250. }
  3251. const _fetch = window.fetch;
  3252. class RequestHandler {
  3253. constructor() {
  3254. __publicField(this, "_resolve");
  3255. __publicField(this, "_error");
  3256. __publicField(this, "_next", false);
  3257. __publicField(this, "_input");
  3258. __publicField(this, "_init");
  3259. }
  3260. resolve(response) {
  3261. this._resolve = Promise.resolve(response);
  3262. }
  3263. error(error) {
  3264. this._error = error;
  3265. }
  3266. next(config) {
  3267. this._next = true;
  3268. this._input = config.input;
  3269. this._init = config.init;
  3270. }
  3271. }
  3272. class ResponseHandler {
  3273. constructor() {
  3274. __publicField(this, "_resolve");
  3275. __publicField(this, "_error");
  3276. __publicField(this, "_next", false);
  3277. __publicField(this, "_response");
  3278. }
  3279. resolve(response) {
  3280. this._resolve = Promise.resolve(response);
  3281. }
  3282. error(error) {
  3283. this._error = error;
  3284. }
  3285. next(response) {
  3286. this._next = true;
  3287. this._response = response;
  3288. }
  3289. }
  3290. let isHooked = false;
  3291. let onRequestHandlers = [];
  3292. let onResponseHandlers = [];
  3293. const hook = (win) => {
  3294. win.fetch = async (input, init) => {
  3295. for (const handler of onRequestHandlers) {
  3296. const requestHandler = new RequestHandler();
  3297. await handler.apply(_unsafeWindow, [{ input, init }, requestHandler]);
  3298. if (requestHandler._resolve) {
  3299. return requestHandler._resolve;
  3300. }
  3301. if (requestHandler._error) {
  3302. throw requestHandler._error;
  3303. }
  3304. if (!requestHandler._next) {
  3305. break;
  3306. }
  3307. input = requestHandler._input;
  3308. init = requestHandler._init;
  3309. }
  3310. let response = await _fetch.apply(_unsafeWindow, [input, init]);
  3311. for (const handler of onResponseHandlers) {
  3312. const responseHandler = new ResponseHandler();
  3313. await handler.apply(_unsafeWindow, [response, responseHandler]);
  3314. if (responseHandler._resolve) {
  3315. return responseHandler._resolve;
  3316. }
  3317. if (responseHandler._error) {
  3318. throw responseHandler._error;
  3319. }
  3320. if (!responseHandler._next) {
  3321. break;
  3322. }
  3323. response = responseHandler._response;
  3324. }
  3325. return response;
  3326. };
  3327. };
  3328. const fproxy = (proxy2, win = _unsafeWindow) => {
  3329. if (proxy2.onRequest) {
  3330. onRequestHandlers.push(proxy2.onRequest);
  3331. }
  3332. if (proxy2.onResponse) {
  3333. onResponseHandlers.push(proxy2.onResponse);
  3334. }
  3335. if (!isHooked) {
  3336. hook(win);
  3337. isHooked = true;
  3338. }
  3339. return {
  3340. unProxy: () => {
  3341. if (proxy2.onRequest) {
  3342. onRequestHandlers.splice(
  3343. onRequestHandlers.findIndex((handler) => handler === proxy2.onRequest),
  3344. 1
  3345. );
  3346. }
  3347. if (proxy2.onResponse) {
  3348. onResponseHandlers.splice(
  3349. onResponseHandlers.findIndex((handler) => handler === proxy2.onResponse),
  3350. 1
  3351. );
  3352. }
  3353. },
  3354. unHook: () => {
  3355. win.fetch = _fetch;
  3356. onRequestHandlers = [];
  3357. onResponseHandlers = [];
  3358. },
  3359. originFetch: _fetch
  3360. };
  3361. };
  3362. const _NoReport = class _NoReport extends BaseModule {
  3363. constructor() {
  3364. super(...arguments);
  3365. __publicField(this, "config", this.moduleStore.moduleConfig.EnhanceExperience.noReport);
  3366. }
  3367. /**
  3368. * 判断是否是需要拦截的 URL
  3369. * @param url 需要判断的 URL
  3370. */
  3371. static isTargetURL(url) {
  3372. return url.includes("//data.bilibili.com") || url.includes("//data.bilivideo.com");
  3373. }
  3374. /**
  3375. * 劫持一些能减少日志上报的方法
  3376. * @param win window
  3377. */
  3378. hookProperties(win) {
  3379. Object.defineProperty(win.navigator, "sendBeacon", {
  3380. value: () => {
  3381. return true;
  3382. }
  3383. });
  3384. Object.defineProperties(win, {
  3385. reportObserver: {
  3386. get() {
  3387. return {
  3388. reportCustomData: function() {
  3389. }
  3390. };
  3391. },
  3392. set() {
  3393. }
  3394. },
  3395. reportConfig: {
  3396. get() {
  3397. return {};
  3398. },
  3399. set() {
  3400. }
  3401. }
  3402. });
  3403. }
  3404. /**
  3405. * 劫持 XHR 和 fetch 请求
  3406. */
  3407. ajaxHook() {
  3408. const ajaxHookProxyConfig = {
  3409. onRequest: (config, handler) => {
  3410. if (_NoReport.isTargetURL(config.url)) {
  3411. handler.resolve({
  3412. config,
  3413. status: 200,
  3414. headers: {
  3415. "Content-Type": "text/plain; charset=utf-8"
  3416. },
  3417. response: "ok"
  3418. });
  3419. } else {
  3420. handler.next(config);
  3421. }
  3422. }
  3423. };
  3424. const fetchHookConfig = {
  3425. onRequest(config, handler) {
  3426. const url = getUrlFromFetchInput(config.input);
  3427. if (_NoReport.isTargetURL(url)) {
  3428. handler.resolve(new Response("ok"));
  3429. } else {
  3430. handler.next(config);
  3431. }
  3432. },
  3433. onResponse(response, handler) {
  3434. handler.next(response);
  3435. }
  3436. };
  3437. proxy(ajaxHookProxyConfig, _unsafeWindow);
  3438. fproxy(fetchHookConfig, _unsafeWindow);
  3439. }
  3440. run() {
  3441. this.logger.log("拦截日志数据上报模块开始运行");
  3442. try {
  3443. this.hookProperties(_unsafeWindow);
  3444. this.ajaxHook();
  3445. } catch (e) {
  3446. this.logger.error("拦截日志数据上报失败", e);
  3447. }
  3448. }
  3449. };
  3450. __publicField(_NoReport, "runOnMultiplePages", true);
  3451. __publicField(_NoReport, "runAt", "document-start");
  3452. __publicField(_NoReport, "onFrame", "all");
  3453. __publicField(_NoReport, "runAfterDefault", false);
  3454. let NoReport = _NoReport;
  3455. class NoSleep extends BaseModule {
  3456. constructor() {
  3457. super(...arguments);
  3458. __publicField(this, "config", this.moduleStore.moduleConfig.EnhanceExperience.noSleep);
  3459. }
  3460. run() {
  3461. this.logger.log("屏蔽挂机检测模块开始运行");
  3462. setInterval(() => {
  3463. document.dispatchEvent(new MouseEvent("mousemove"));
  3464. }, 3e5);
  3465. }
  3466. }
  3467. __publicField(NoSleep, "runOnMultiplePages", true);
  3468. __publicField(NoSleep, "runAt", "window-load");
  3469. __publicField(NoSleep, "runAfterDefault", false);
  3470. class Invisibility extends BaseModule {
  3471. constructor() {
  3472. super(...arguments);
  3473. __publicField(this, "config", this.moduleStore.moduleConfig.EnhanceExperience.invisibility);
  3474. }
  3475. run() {
  3476. this.logger.log("隐身入场模块开始运行");
  3477. proxy(
  3478. {
  3479. onRequest: (config, handler) => {
  3480. if (config.url.includes("//api.live.bilibili.com/xlive/web-room/v1/index/getInfoByUser")) {
  3481. config.url = config.url.replace("not_mock_enter_effect=0", "not_mock_enter_effect=1");
  3482. }
  3483. handler.next(config);
  3484. }
  3485. },
  3486. _unsafeWindow
  3487. );
  3488. }
  3489. }
  3490. __publicField(Invisibility, "runOnMultiplePages", true);
  3491. __publicField(Invisibility, "runAt", "document-start");
  3492. __publicField(Invisibility, "runAfterDefault", false);
  3493. __publicField(Invisibility, "onFrame", "all");
  3494. class RemovePKBox extends BaseModule {
  3495. constructor() {
  3496. super(...arguments);
  3497. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removePKBox);
  3498. }
  3499. removePKNode() {
  3500. _GM_addStyle("#awesome-pk-vm { display: none !important }");
  3501. }
  3502. removePKToast() {
  3503. const blackWordList = ["主播即将结束PK", "连线断开中"];
  3504. const pkOB = new MutationObserver((mutationsList) => {
  3505. for (const mutation of mutationsList) {
  3506. mutation.addedNodes.forEach((addedNode) => {
  3507. if (addedNode instanceof HTMLElement && addedNode.classList.contains("link-toast") && blackWordList.some((word) => {
  3508. var _a;
  3509. return (_a = addedNode.textContent) == null ? void 0 : _a.includes(word);
  3510. })) {
  3511. addedNode.style.display = "none";
  3512. }
  3513. });
  3514. }
  3515. });
  3516. pkOB.observe(document.body, { childList: true });
  3517. }
  3518. async run() {
  3519. this.logger.log("移除大乱斗元素模块开始运行");
  3520. this.removePKNode();
  3521. this.removePKToast();
  3522. }
  3523. }
  3524. __publicField(RemovePKBox, "runOnMultiplePages", true);
  3525. class RemoveLiveWaterMark extends BaseModule {
  3526. constructor() {
  3527. super(...arguments);
  3528. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeLiveWaterMark);
  3529. }
  3530. async run() {
  3531. this.logger.log("移除直播间水印模块开始运行");
  3532. _GM_addStyle(".web-player-icon-roomStatus { display: none !important }");
  3533. }
  3534. }
  3535. __publicField(RemoveLiveWaterMark, "runOnMultiplePages", true);
  3536. class RemoveShopPopover extends BaseModule {
  3537. constructor() {
  3538. super(...arguments);
  3539. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeShopPopover);
  3540. }
  3541. async run() {
  3542. this.logger.log("移除直播间小橙车弹窗模块开始运行");
  3543. _GM_addStyle(".shop-popover { display: none !important }");
  3544. }
  3545. }
  3546. __publicField(RemoveShopPopover, "runOnMultiplePages", true);
  3547. class RemoveGameParty extends BaseModule {
  3548. constructor() {
  3549. super(...arguments);
  3550. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeGameParty);
  3551. }
  3552. async run() {
  3553. this.logger.log("移除直播间幻星派对标志模块开始运行");
  3554. _GM_addStyle("#game-id { display: none !important }");
  3555. }
  3556. }
  3557. __publicField(RemoveGameParty, "runMultiple", true);
  3558. class removeGiftPopover extends BaseModule {
  3559. constructor() {
  3560. super(...arguments);
  3561. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeGiftPopover);
  3562. }
  3563. async run() {
  3564. this.logger.log("移除礼物赠送提示弹窗模块开始运行");
  3565. _GM_addStyle(".function-card { display: none !important }");
  3566. }
  3567. }
  3568. __publicField(removeGiftPopover, "runOnMultiplePages", true);
  3569. class removeMicPopover extends BaseModule {
  3570. constructor() {
  3571. super(...arguments);
  3572. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeMicPopover);
  3573. }
  3574. async run() {
  3575. this.logger.log("移除连麦状态提示模块开始运行");
  3576. _GM_addStyle(".lin-mic-cntr { display: none !important }");
  3577. }
  3578. }
  3579. __publicField(removeMicPopover, "runOnMultiplePages", true);
  3580. class RemoveComboCard extends BaseModule {
  3581. constructor() {
  3582. super(...arguments);
  3583. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeComboCard);
  3584. }
  3585. async run() {
  3586. this.logger.log("移除直播间相同弹幕连续提示模块开始运行");
  3587. _GM_addStyle("#combo-card { display: none !important }");
  3588. }
  3589. }
  3590. __publicField(RemoveComboCard, "runOnMultiplePages", true);
  3591. class RemoveRank extends BaseModule {
  3592. constructor() {
  3593. super(...arguments);
  3594. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeRank);
  3595. }
  3596. async run() {
  3597. this.logger.log("移除排行榜模块开始运行");
  3598. _GM_addStyle(".popular-and-hot-rank { display: none !important }");
  3599. }
  3600. }
  3601. __publicField(RemoveRank, "runOnMultiplePages", true);
  3602. class RemoveHeaderStuff extends BaseModule {
  3603. constructor() {
  3604. super(...arguments);
  3605. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeHeaderStuff);
  3606. }
  3607. async run() {
  3608. this.logger.log("移除活动入口模块开始运行");
  3609. _GM_addStyle(".header-info-ctnr .rows-ctnr .lower-row .right-ctnr { display: none !important }");
  3610. }
  3611. }
  3612. __publicField(RemoveHeaderStuff, "runOnMultiplePages", true);
  3613. class RemoveFlipView extends BaseModule {
  3614. constructor() {
  3615. super(...arguments);
  3616. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeFlipView);
  3617. }
  3618. async run() {
  3619. this.logger.log("移除礼物栏下方广告模块开始运行");
  3620. _GM_addStyle(".flip-view { display: none !important }");
  3621. }
  3622. }
  3623. __publicField(RemoveFlipView, "runOnMultiplePages", true);
  3624. class RemoveRecommendRoom extends BaseModule {
  3625. constructor() {
  3626. super(...arguments);
  3627. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeRecommendRoom);
  3628. }
  3629. async run() {
  3630. this.logger.log("移除礼物栏下方推荐直播间模块开始运行");
  3631. _GM_addStyle(".room-info-ctnr { display: none !important }");
  3632. }
  3633. }
  3634. __publicField(RemoveRecommendRoom, "runOnMultiplePages", true);
  3635. class RemoveLiveMosaic extends BaseModule {
  3636. constructor() {
  3637. super(...arguments);
  3638. __publicField(this, "config", this.moduleStore.moduleConfig.RemoveElement.removeLiveMosaic);
  3639. }
  3640. async run() {
  3641. this.logger.log("移除直播间马赛克模块开始运行");
  3642. _GM_addStyle("#web-player-module-area-mask-panel { opacity: 0 !important }");
  3643. }
  3644. }
  3645. __publicField(RemoveLiveMosaic, "runOnMultiplePages", true);
  3646. const otherModules = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  3647. __proto__: null,
  3648. DailyTask_LiveTask_LightTask: LightTask,
  3649. DailyTask_LiveTask_SignTask: SignTask,
  3650. DailyTask_LiveTask_WatchTask: WatchTask2,
  3651. DailyTask_MainSiteTask_CoinTask: CoinTask,
  3652. DailyTask_MainSiteTask_LoginTask: LoginTask,
  3653. DailyTask_MainSiteTask_ShareTask: ShareTask,
  3654. DailyTask_MainSiteTask_WatchTask: WatchTask$1,
  3655. DailyTask_OtherTask_CoinToSilverTask: CoinToSilverTask,
  3656. DailyTask_OtherTask_GetYearVipPrivilegeTask: GetYearVipPrivilegeTask,
  3657. DailyTask_OtherTask_GroupSignTask: GroupSignTask,
  3658. DailyTask_OtherTask_SilverToCoinTask: SilverToCoinTask,
  3659. EnhanceExperience_BanP2P: BanP2P,
  3660. EnhanceExperience_Invisibility: Invisibility,
  3661. EnhanceExperience_NoReport: NoReport,
  3662. EnhanceExperience_NoSleep: NoSleep,
  3663. EnhanceExperience_SwitchLiveStreamQuality: SwitchLiveStreamQuality,
  3664. RemoveElement_RemoveComboCard: RemoveComboCard,
  3665. RemoveElement_RemoveFlipView: RemoveFlipView,
  3666. RemoveElement_RemoveGameParty: RemoveGameParty,
  3667. RemoveElement_RemoveGiftPopover: removeGiftPopover,
  3668. RemoveElement_RemoveHeaderStuff: RemoveHeaderStuff,
  3669. RemoveElement_RemoveLiveMosaic: RemoveLiveMosaic,
  3670. RemoveElement_RemoveLiveWaterMark: RemoveLiveWaterMark,
  3671. RemoveElement_RemoveMicPopover: removeMicPopover,
  3672. RemoveElement_RemovePKBox: RemovePKBox,
  3673. RemoveElement_RemoveRank: RemoveRank,
  3674. RemoveElement_RemoveRecommendRoom: RemoveRecommendRoom,
  3675. RemoveElement_RemoveShopPopover: RemoveShopPopover
  3676. }, Symbol.toStringTag, { value: "Module" }));
  3677. function mitt(n) {
  3678. return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
  3679. var i = n.get(t);
  3680. i ? i.push(e) : n.set(t, [e]);
  3681. }, off: function(t, e) {
  3682. var i = n.get(t);
  3683. i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
  3684. }, emit: function(t, e) {
  3685. var i = n.get(t);
  3686. i && i.slice().map(function(n2) {
  3687. n2(e);
  3688. }), (i = n.get("*")) && i.slice().map(function(n2) {
  3689. n2(t, e);
  3690. });
  3691. } };
  3692. }
  3693. function mittOnce(all) {
  3694. const emitter = mitt(all);
  3695. return {
  3696. // 继承原生 mitt 的方法
  3697. ...emitter,
  3698. once(type, handler) {
  3699. emitter.on(type, function fn(evt) {
  3700. emitter.off(type, fn);
  3701. handler(evt);
  3702. });
  3703. }
  3704. };
  3705. }
  3706. const useCacheStore = pinia$1.defineStore("cache", () => {
  3707. const cache = vue.reactive(Storage.getCache());
  3708. const currentScriptType = vue.ref("Main");
  3709. function startMainBLTHAliveHeartBeat() {
  3710. cache.lastAliveHeartBeatTime = Date.now();
  3711. const timer = setInterval(() => cache.lastAliveHeartBeatTime = Date.now(), 5e3);
  3712. window.addEventListener("unload", () => {
  3713. clearInterval(timer);
  3714. cache.lastAliveHeartBeatTime = 0;
  3715. });
  3716. }
  3717. function checkCurrentScriptType() {
  3718. if (cache.lastAliveHeartBeatTime !== 0 && Date.now() - cache.lastAliveHeartBeatTime < 8e3) {
  3719. if (sessionStorage.getItem("main_blth_flag") === null) {
  3720. currentScriptType.value = "Other";
  3721. } else {
  3722. currentScriptType.value = "SubMain";
  3723. }
  3724. } else {
  3725. currentScriptType.value = "Main";
  3726. sessionStorage.setItem("main_blth_flag", "🚩");
  3727. }
  3728. }
  3729. vue.watch(cache, (newCache) => Storage.setCache(newCache));
  3730. return {
  3731. cache,
  3732. currentScriptType,
  3733. startMainBLTHAliveHeartBeat,
  3734. checkCurrentScriptType
  3735. };
  3736. });
  3737. const defaultModuleStatus = {
  3738. DailyTasks: {
  3739. MainSiteTasks: {
  3740. login: "",
  3741. watch: "",
  3742. coin: "",
  3743. share: ""
  3744. },
  3745. LiveTasks: {
  3746. sign: "",
  3747. medalTasks: {
  3748. light: "",
  3749. watch: ""
  3750. }
  3751. },
  3752. OtherTasks: {
  3753. groupSign: "",
  3754. silverToCoin: "",
  3755. coinToSilver: "",
  3756. getYearVipPrivilege: ""
  3757. }
  3758. }
  3759. };
  3760. const allAndTopFrameModuleNames = [];
  3761. function loadDefaultModules() {
  3762. const cacheStore2 = useCacheStore();
  3763. const promiseArray = [];
  3764. for (const [name, module] of Object.entries(defaultModules)) {
  3765. if (module.runOnMultiplePages || cacheStore2.currentScriptType !== "Other") {
  3766. promiseArray.push(runModule(module, name));
  3767. }
  3768. }
  3769. return Promise.allSettled(promiseArray);
  3770. }
  3771. function runModule(module, name) {
  3772. const moduleInstance = new module(name);
  3773. if (moduleInstance.isEnabled()) {
  3774. return moduleInstance.run();
  3775. }
  3776. }
  3777. const useModuleStore = pinia$1.defineStore("module", () => {
  3778. const moduleConfig = vue.reactive(Storage.getModuleConfig());
  3779. const emitter = mittOnce();
  3780. const moduleStatus = vue.reactive(defaultModuleStatus);
  3781. function loadModules(isOnTargetFrame) {
  3782. const cacheStore2 = useCacheStore();
  3783. if (isOnTargetFrame === "unknown") {
  3784. for (const [name, module] of Object.entries(otherModules)) {
  3785. if (module.onFrame === "all" || module.onFrame === "top" && isSelfTopFrame()) {
  3786. if (module.runOnMultiplePages || cacheStore2.currentScriptType !== "Other") {
  3787. if (!module.runAfterDefault) {
  3788. waitForMoment(module.runAt).then(() => runModule(module, name));
  3789. allAndTopFrameModuleNames.push(name);
  3790. }
  3791. }
  3792. }
  3793. }
  3794. } else {
  3795. const moduleAfterDefault = {};
  3796. const defaultModulesLoadingR###lt = loadDefaultModules();
  3797. for (const [name, module] of Object.entries(otherModules)) {
  3798. if (module.onFrame === "target" || module.onFrame === "top" && isSelfTopFrame() && !allAndTopFrameModuleNames.includes(name) || module.onFrame === "all" && !allAndTopFrameModuleNames.includes(name)) {
  3799. if (module.runOnMultiplePages || cacheStore2.currentScriptType !== "Other") {
  3800. if (module.runAfterDefault) {
  3801. moduleAfterDefault[name] = module;
  3802. } else {
  3803. waitForMoment(module.runAt).then(() => runModule(module, name));
  3804. }
  3805. }
  3806. }
  3807. }
  3808. defaultModulesLoadingR###lt.then((r###lts) => {
  3809. for (const r###lt of r###lts) {
  3810. if (r###lt.status === "rejected") {
  3811. const error = r###lt.reason;
  3812. if (error instanceof ModuleCriticalError) {
  3813. new Logger(error.moduleName).error(error.message);
  3814. return;
  3815. } else if (error instanceof ModuleError) {
  3816. new Logger(error.moduleName).error(error.message);
  3817. } else {
  3818. new Logger("ModuleStore").error(`意外错误: ${error.message}`);
  3819. return;
  3820. }
  3821. }
  3822. }
  3823. for (const [name, module] of Object.entries(moduleAfterDefault)) {
  3824. waitForMoment(module.runAt).then(() => runModule(module, name));
  3825. }
  3826. });
  3827. }
  3828. }
  3829. vue.watch(
  3830. moduleConfig,
  3831. _.debounce((newModuleConfig) => Storage.setModuleConfig(newModuleConfig), 250, {
  3832. leading: true,
  3833. trailing: true
  3834. })
  3835. );
  3836. (function clearStatus() {
  3837. setTimeout(() => {
  3838. deepestIterate(moduleStatus, (_value, path) => {
  3839. _.set(moduleStatus, path, "");
  3840. });
  3841. clearStatus();
  3842. }, delayToNextMoment(0, 0).ms);
  3843. })();
  3844. return {
  3845. moduleConfig,
  3846. emitter,
  3847. moduleStatus,
  3848. loadModules
  3849. };
  3850. });
  3851. const helpInfo = {
  3852. DailyTasks: {
  3853. MainSiteTasks: {
  3854. login: {
  3855. title: "每日登录",
  3856. message: "完成主站的每日登录任务。"
  3857. },
  3858. watch: {
  3859. title: "每日观看视频",
  3860. message: vue.h("p", [
  3861. vue.h("div", "完成主站的每日观看视频任务。"),
  3862. vue.h("div", "从动态中选取视频观看,会产生观看历史记录。")
  3863. ])
  3864. },
  3865. coin: {
  3866. title: "每日投币",
  3867. message: vue.h("p", [
  3868. vue.h("div", "完成主站的每日投币任务。"),
  3869. vue.h("div", "从动态中选取视频投币,会根据你今天已经投过的币的数量计算还要投几个币。")
  3870. ])
  3871. },
  3872. share: {
  3873. title: "每日分享视频",
  3874. message: vue.h("p", [
  3875. vue.h("div", "完成主站的每日分享视频任务。"),
  3876. vue.h("div", "不会真的分享到某处。")
  3877. ])
  3878. }
  3879. },
  3880. LiveTasks: {
  3881. sign: {
  3882. title: "直播签到",
  3883. message: vue.h("p", [vue.h("div", "完成直播签到任务。")])
  3884. },
  3885. medalTasks: {
  3886. list: {
  3887. title: "黑白名单 / 排序模式",
  3888. message: vue.h("p", [
  3889. vue.h(
  3890. "div",
  3891. "为了更精细地控制为哪些粉丝勋章执行点亮熄灭勋章和观看直播任务,你可以使用黑名单或白名单模式。"
  3892. ),
  3893. vue.h("div", [
  3894. vue.h("li", [
  3895. vue.h("span", "黑名单:仅为"),
  3896. vue.h("strong", "不在"),
  3897. vue.h("span", "名单中的粉丝勋章执行任务。")
  3898. ]),
  3899. vue.h("li", [
  3900. vue.h("span", "白名单:仅为"),
  3901. vue.h("strong", "在"),
  3902. vue.h("span", "名单中的粉丝勋章执行任务。")
  3903. ])
  3904. ]),
  3905. vue.h("div", "点击编辑名单按钮,然后使用第一列的多选框即可编辑名单中的粉丝勋章。"),
  3906. vue.h(
  3907. "div",
  3908. "使用白名单模式时,可点击【编辑名单】窗口右下角的按钮即可从【常规模式】切换到【排序模式】。"
  3909. ),
  3910. vue.h("div", "在排序模式下,你可以调整脚本执行观看任务的粉丝勋章顺序。"),
  3911. vue.h("div", [
  3912. vue.h("li", "使用鼠标拖拽表格中的行来调整顺序。"),
  3913. vue.h("li", "拖拽行至表格的顶部和底部可以触发滚动。")
  3914. ])
  3915. ])
  3916. },
  3917. light: {
  3918. main: {
  3919. title: "点亮熄灭勋章",
  3920. message: vue.h("p", [
  3921. vue.h("div", "在你的每个已熄灭的粉丝勋章对应的直播间完成点亮任务,从而点亮粉丝勋章。"),
  3922. vue.h("div", "支持两种点亮方式,可自由选择:"),
  3923. vue.h("div", [
  3924. vue.h("li", [vue.h("span", "点赞(不推荐):点赞30次")]),
  3925. vue.h("li", [vue.h("strong", "发送弹幕(推荐):"), vue.h("span", "发送弹幕1条")])
  3926. ])
  3927. ])
  3928. },
  3929. like: {
  3930. title: "点赞",
  3931. message: vue.h("p", [
  3932. vue.h("div", "在已熄灭粉丝勋章对应的直播间给主播点赞,点亮粉丝勋章。"),
  3933. vue.h("div", [
  3934. vue.h("li", [vue.h("span", "点赞次数为略微超过任务要求的随机值。")]),
  3935. vue.h("li", [vue.h("span", "部分直播间无法完成该任务,原因未知。")])
  3936. ]),
  3937. vue.h("div", [
  3938. vue.h("strong", "注意:"),
  3939. vue.h("span", "点赞只能点亮正在直播的直播间对应的粉丝勋章。")
  3940. ])
  3941. ])
  3942. },
  3943. danmu: {
  3944. title: "发送弹幕",
  3945. message: vue.h("p", [
  3946. vue.h("div", "在已熄灭粉丝勋章对应的直播间发送一条弹幕,点亮粉丝勋章。"),
  3947. vue.h("div", [
  3948. vue.h("span", "点击编辑弹幕按钮编辑发送的弹幕,脚本会从中按顺序循环抽取弹幕发送。"),
  3949. vue.h("span", "部分直播间无法完成该任务,可能的原因有:"),
  3950. vue.h("div", [
  3951. vue.h("li", "你被禁言了"),
  3952. vue.h("li", "发言有粉丝勋章等级要求"),
  3953. vue.h("li", [
  3954. vue.h("span", "特殊直播间(比如"),
  3955. vue.h(
  3956. "a",
  3957. { href: "https://live.bilibili.com/54", rel: "noreferrer", target: "_blank" },
  3958. "54"
  3959. ),
  3960. vue.h("span", ")")
  3961. ])
  3962. ])
  3963. ])
  3964. ])
  3965. }
  3966. },
  3967. watch: {
  3968. title: "观看直播",
  3969. message: vue.h("p", [
  3970. vue.h("div", "完成粉丝勋章的观看直播任务。"),
  3971. vue.h("div", [
  3972. vue.h("li", "部分直播间因为没有设置直播分区导致任务无法完成。"),
  3973. vue.h("li", "主播当前是否开播不会影响该任务的完成。"),
  3974. vue.h(
  3975. "li",
  3976. "根据目前的亲密度规则,将每个直播间的观看时长设置为25分钟即可获得全部亲密度。"
  3977. )
  3978. ]),
  3979. vue.h("div", [
  3980. vue.h("strong", "注意:"),
  3981. vue.h(
  3982. "span",
  3983. "使用本功能时不能以任何方式观看直播(网页、APP、电视),否则可能无法获得任何亲密度。"
  3984. )
  3985. ])
  3986. ])
  3987. }
  3988. }
  3989. },
  3990. OtherTasks: {
  3991. groupSign: {
  3992. title: "应援团签到",
  3993. message: "完成应援团签到任务。"
  3994. },
  3995. silverToCoin: {
  3996. title: "银瓜子换硬币",
  3997. message: vue.h("p", [
  3998. vue.h("div", "把银瓜子兑换为硬币。"),
  3999. vue.h("div", "具体兑换规则请点击直播间页面的“立即充值→银瓜子商店”查看。")
  4000. ])
  4001. },
  4002. coinToSilver: {
  4003. title: "硬币换银瓜子",
  4004. message: vue.h("p", [
  4005. vue.h("div", "把硬币兑换为银瓜子。"),
  4006. vue.h("div", "具体兑换规则请点击直播间页面的“立即充值→银瓜子商店”查看。")
  4007. ])
  4008. },
  4009. getYearVipPrivilege: {
  4010. title: "领取年度大会员权益",
  4011. message: vue.h("p", [
  4012. vue.h("div", "自动领取年度大会员权益。"),
  4013. vue.h("div", [
  4014. vue.h("span", "具体权益请前往"),
  4015. vue.h(
  4016. "a",
  4017. {
  4018. href: "https://account.bilibili.com/account/big/myPackage",
  4019. rel: "noreferrer",
  4020. target: "_blank"
  4021. },
  4022. "卡券包"
  4023. ),
  4024. vue.h("span", "查看。")
  4025. ])
  4026. ])
  4027. }
  4028. }
  4029. },
  4030. EnhanceExperience: {
  4031. switchLiveStreamQuality: {
  4032. title: "自动切换画质",
  4033. message: vue.h("p", [
  4034. vue.h("div", "打开直播间后自动把播放器切换到指定画质。"),
  4035. vue.h("div", "如果指定画质不存在,则还是使用B站的默认画质。")
  4036. ])
  4037. },
  4038. banp2p: {
  4039. title: "禁用P2P",
  4040. message: vue.h("p", [
  4041. vue.h("div", "禁用直播流的P2P上传/下载"),
  4042. vue.h(
  4043. "div",
  4044. "B站使用WebRTC技术把许多浏览器点对点(P2P)地连接起来,实现视频流和音频流的传输。这样做是为了减轻B站服务器的压力,但是会占用你一定的上行带宽(大约几百kb每秒)。如果你不想被占用上行带宽,可以开启该功能。若开启后发现观看直播时有明显卡顿,请关闭。"
  4045. )
  4046. ])
  4047. },
  4048. noReport: {
  4049. title: "拦截日志数据上报",
  4050. message: vue.h("p", [
  4051. vue.h("div", "禁止B站上报日志数据。"),
  4052. vue.h("div", [
  4053. vue.h(
  4054. "span",
  4055. "B站会实时地上报大量日志信息,比如直播观看情况、代码报错等等。开启本功能后绝大多数日志上报都会被劫持或拦截并返回一个成功的响应。相比于带有广告拦截功能的浏览器拓展,比如"
  4056. ),
  4057. vue.h(
  4058. "a",
  4059. {
  4060. href: "https://github.com/gorhill/uBlock",
  4061. rel: "noreferrer",
  4062. target: "_blank"
  4063. },
  4064. "uBlock Origin"
  4065. ),
  4066. vue.h(
  4067. "span",
  4068. ",本功能会通过劫持的方式从根源上阻止部分日志上报,并模拟成功的响应来尽可能地减少B站代码的报错。理论上来说这样做会有更好的性能表现。"
  4069. )
  4070. ])
  4071. ])
  4072. },
  4073. noSleep: {
  4074. title: "屏蔽挂机检测",
  4075. message: vue.h("p", [
  4076. vue.h("div", "屏蔽B站直播间的挂机检测。"),
  4077. vue.h(
  4078. "div",
  4079. "如果长时间没有操作,会提示“检测到您已离开当前屏幕,倒计时后即将暂停播放”。开启本功能后即可避免这种情况。"
  4080. )
  4081. ])
  4082. },
  4083. invisibility: {
  4084. title: "隐身入场",
  4085. message: vue.h("p", [vue.h("div", "进入直播间时其他人不会收到提示,但还是会出现在高能用户榜单上。")])
  4086. }
  4087. },
  4088. RemoveElement: {
  4089. removePKBox: {
  4090. title: "移除大乱斗元素",
  4091. message: "移除直播间的大乱斗元素(进度条,弹出的提示等)。"
  4092. },
  4093. removeLiveWaterMark: {
  4094. title: "移除直播间水印",
  4095. message: "移除直播画面左上角的水印。"
  4096. },
  4097. removeShopPopover: {
  4098. title: "移除直播间小橙车弹窗",
  4099. message: "移除直播间左上角的小橙车弹窗。"
  4100. },
  4101. removeGameParty: {
  4102. title: "移除直播间幻星派对标志",
  4103. message: "移除直播间右下角的幻星派对标志。"
  4104. },
  4105. removeGiftPopover: {
  4106. title: "移除礼物赠送提示弹窗",
  4107. message: "移除直播间右下角的礼物赠送提示弹窗(赠送一个牛蛙牛蛙支持主播)。"
  4108. },
  4109. removeMicPopover: {
  4110. title: "移除连麦状态提示",
  4111. message: "移除直播间左上角的连麦提示弹窗(连线功能只能在手机端使用,快使用手机登录吧~)。"
  4112. },
  4113. removeComboCard: {
  4114. title: "移除直播间相同弹幕连续提示",
  4115. message: "移除直播间相同弹幕连续提示。"
  4116. },
  4117. removeRank: {
  4118. title: "移除排行榜",
  4119. message: "移除直播画面上方的人气榜/航海榜,赠送人气票的入口也在这里。"
  4120. },
  4121. removeHeaderStuff: {
  4122. title: "移除直播画面上方杂项",
  4123. message: "移除直播画面上方各种杂七杂八的东西,比如排行榜、活动轮播图等。"
  4124. },
  4125. removeFlipView: {
  4126. title: "移除礼物栏下方广告",
  4127. message: "移除礼物栏下方广告。"
  4128. },
  4129. removeRecommendRoom: {
  4130. title: "移除礼物栏下方推荐直播间",
  4131. message: "移除礼物栏下方推荐直播间。"
  4132. },
  4133. removeLiveMosaic: {
  4134. title: "移除直播间马赛克",
  4135. message: "移除部分直播间特有的马赛克。"
  4136. }
  4137. }
  4138. };
  4139. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  4140. __name: "MainSiteTasks",
  4141. setup(__props) {
  4142. const moduleStore2 = useModuleStore();
  4143. const config = moduleStore2.moduleConfig.DailyTasks.MainSiteTasks;
  4144. const status = moduleStore2.moduleStatus.DailyTasks.MainSiteTasks;
  4145. return (_ctx, _cache) => {
  4146. const _component_el_switch = vue.resolveComponent("el-switch");
  4147. const _component_Info = vue.resolveComponent("Info");
  4148. const _component_TaskStatus = vue.resolveComponent("TaskStatus");
  4149. const _component_el_space = vue.resolveComponent("el-space");
  4150. const _component_el_row = vue.resolveComponent("el-row");
  4151. const _component_el_option = vue.resolveComponent("el-option");
  4152. const _component_el_select = vue.resolveComponent("el-select");
  4153. const _component_el_text = vue.resolveComponent("el-text");
  4154. const _component_el_divider = vue.resolveComponent("el-divider");
  4155. const _component_el_link = vue.resolveComponent("el-link");
  4156. return vue.openBlock(), vue.createElementBlock("div", null, [
  4157. vue.createVNode(_component_el_row, null, {
  4158. default: vue.withCtx(() => [
  4159. vue.createVNode(_component_el_space, {
  4160. wrap: "",
  4161. size: [8, 0]
  4162. }, {
  4163. default: vue.withCtx(() => [
  4164. vue.createVNode(_component_el_switch, {
  4165. modelValue: vue.unref(config).login.enabled,
  4166. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(config).login.enabled = $event),
  4167. "active-text": "每日登录"
  4168. }, null, 8, ["modelValue"]),
  4169. vue.createVNode(_component_Info, {
  4170. item: vue.unref(helpInfo).DailyTasks.MainSiteTasks.login
  4171. }, null, 8, ["item"]),
  4172. vue.createVNode(_component_TaskStatus, {
  4173. status: vue.unref(status).login
  4174. }, null, 8, ["status"])
  4175. ]),
  4176. _: 1
  4177. })
  4178. ]),
  4179. _: 1
  4180. }),
  4181. vue.createVNode(_component_el_row, null, {
  4182. default: vue.withCtx(() => [
  4183. vue.createVNode(_component_el_space, {
  4184. wrap: "",
  4185. size: [8, 0]
  4186. }, {
  4187. default: vue.withCtx(() => [
  4188. vue.createVNode(_component_el_switch, {
  4189. modelValue: vue.unref(config).watch.enabled,
  4190. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(config).watch.enabled = $event),
  4191. "active-text": "每日观看视频"
  4192. }, null, 8, ["modelValue"]),
  4193. vue.createVNode(_component_Info, {
  4194. item: vue.unref(helpInfo).DailyTasks.MainSiteTasks.watch
  4195. }, null, 8, ["item"]),
  4196. vue.createVNode(_component_TaskStatus, {
  4197. status: vue.unref(status).watch
  4198. }, null, 8, ["status"])
  4199. ]),
  4200. _: 1
  4201. })
  4202. ]),
  4203. _: 1
  4204. }),
  4205. vue.createVNode(_component_el_row, null, {
  4206. default: vue.withCtx(() => [
  4207. vue.createVNode(_component_el_space, {
  4208. wrap: "",
  4209. size: [8, 0]
  4210. }, {
  4211. default: vue.withCtx(() => [
  4212. vue.createVNode(_component_el_switch, {
  4213. modelValue: vue.unref(config).coin.enabled,
  4214. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(config).coin.enabled = $event),
  4215. "active-text": "每日投币"
  4216. }, null, 8, ["modelValue"]),
  4217. vue.createVNode(_component_el_select, {
  4218. modelValue: vue.unref(config).coin.num,
  4219. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(config).coin.num = $event),
  4220. placeholder: "Select",
  4221. style: { "width": "64px" }
  4222. }, {
  4223. default: vue.withCtx(() => [
  4224. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(5, (i) => {
  4225. return vue.createVNode(_component_el_option, {
  4226. key: i,
  4227. label: i,
  4228. value: i
  4229. }, null, 8, ["label", "value"]);
  4230. }), 64))
  4231. ]),
  4232. _: 1
  4233. }, 8, ["modelValue"]),
  4234. vue.createVNode(_component_el_text, null, {
  4235. default: vue.withCtx(() => _cache[5] || (_cache[5] = [
  4236. vue.createTextVNode("个")
  4237. ])),
  4238. _: 1
  4239. }),
  4240. vue.createVNode(_component_Info, {
  4241. item: vue.unref(helpInfo).DailyTasks.MainSiteTasks.coin
  4242. }, null, 8, ["item"]),
  4243. vue.createVNode(_component_TaskStatus, {
  4244. status: vue.unref(status).coin
  4245. }, null, 8, ["status"])
  4246. ]),
  4247. _: 1
  4248. })
  4249. ]),
  4250. _: 1
  4251. }),
  4252. vue.createVNode(_component_el_row, null, {
  4253. default: vue.withCtx(() => [
  4254. vue.createVNode(_component_el_space, {
  4255. wrap: "",
  4256. size: [8, 0]
  4257. }, {
  4258. default: vue.withCtx(() => [
  4259. vue.createVNode(_component_el_switch, {
  4260. modelValue: vue.unref(config).share.enabled,
  4261. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(config).share.enabled = $event),
  4262. "active-text": "每日分享视频"
  4263. }, null, 8, ["modelValue"]),
  4264. vue.createVNode(_component_Info, {
  4265. item: vue.unref(helpInfo).DailyTasks.MainSiteTasks.share
  4266. }, null, 8, ["item"]),
  4267. vue.createVNode(_component_TaskStatus, {
  4268. status: vue.unref(status).share
  4269. }, null, 8, ["status"])
  4270. ]),
  4271. _: 1
  4272. })
  4273. ]),
  4274. _: 1
  4275. }),
  4276. vue.createVNode(_component_el_divider),
  4277. vue.createVNode(_component_el_row, null, {
  4278. default: vue.withCtx(() => [
  4279. vue.createVNode(_component_el_text, null, {
  4280. default: vue.withCtx(() => [
  4281. vue.createVNode(_component_el_text, null, {
  4282. default: vue.withCtx(() => _cache[6] || (_cache[6] = [
  4283. vue.createTextVNode("  主站每日任务的完成情况可在")
  4284. ])),
  4285. _: 1
  4286. }),
  4287. vue.createVNode(_component_el_link, {
  4288. rel: "noreferrer",
  4289. type: "primary",
  4290. href: "https://account.bilibili.com/account/home",
  4291. target: "_blank",
  4292. style: { "vertical-align": "unset" }
  4293. }, {
  4294. default: vue.withCtx(() => _cache[7] || (_cache[7] = [
  4295. vue.createTextVNode("个人中心")
  4296. ])),
  4297. _: 1
  4298. }),
  4299. vue.createVNode(_component_el_text, null, {
  4300. default: vue.withCtx(() => _cache[8] || (_cache[8] = [
  4301. vue.createTextVNode("查看。")
  4302. ])),
  4303. _: 1
  4304. }),
  4305. vue.createVNode(_component_el_text, null, {
  4306. default: vue.withCtx(() => _cache[9] || (_cache[9] = [
  4307. vue.createTextVNode("数据更新可能有一定的延时。")
  4308. ])),
  4309. _: 1
  4310. })
  4311. ]),
  4312. _: 1
  4313. })
  4314. ]),
  4315. _: 1
  4316. })
  4317. ]);
  4318. };
  4319. }
  4320. });
  4321. const _hoisted_1$1 = { class: "avatar-wrap" };
  4322. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  4323. __name: "LiveTasks",
  4324. setup(__props) {
  4325. const moduleStore2 = useModuleStore();
  4326. const biliStore = useBiliStore();
  4327. const uiStore = useUIStore();
  4328. const medalTableMaxHeight = screen.height * 0.55;
  4329. const danmuTableMaxHeight = screen.height * 0.5;
  4330. const config = moduleStore2.moduleConfig.DailyTasks.LiveTasks;
  4331. const status = moduleStore2.moduleStatus.DailyTasks.LiveTasks;
  4332. const medalDanmuPanelVisible = vue.ref(false);
  4333. const danmuTableData = vue.computed(
  4334. () => config.medalTasks.light.danmuList.map((danmu) => {
  4335. return { content: danmu };
  4336. })
  4337. );
  4338. const handleEditDanmu = (index, row) => {
  4339. ElementPlus.ElMessageBox.prompt("请输入新的弹幕内容", "修改弹幕", {
  4340. confirmButtonText: "确认",
  4341. cancelButtonText: "取消",
  4342. inputPattern: /^.{1,30}$/,
  4343. inputErrorMessage: "弹幕内容不得为空且长度不能超过30",
  4344. inputValue: row.content,
  4345. lockScroll: false
  4346. }).then(({ value }) => {
  4347. config.medalTasks.light.danmuList[index] = value;
  4348. }).catch(() => {
  4349. });
  4350. };
  4351. const handleDeleteDanmu = (index) => {
  4352. if (config.medalTasks.light.danmuList.length === 1) {
  4353. ElementPlus.ElMessage.warning({
  4354. message: "至少要有一条弹幕",
  4355. appendTo: ".el-dialog"
  4356. });
  4357. return;
  4358. }
  4359. config.medalTasks.light.danmuList.splice(index, 1);
  4360. };
  4361. const handleAddDanmu = () => {
  4362. ElementPlus.ElMessageBox.prompt("请输入新增的弹幕内容", "新增弹幕", {
  4363. confirmButtonText: "确认",
  4364. cancelButtonText: "取消",
  4365. inputPattern: /^.{1,30}$/,
  4366. inputErrorMessage: "弹幕内容不得为空且长度不能超过30",
  4367. lockScroll: false
  4368. }).then(({ value }) => {
  4369. config.medalTasks.light.danmuList.push(value);
  4370. }).catch(() => {
  4371. });
  4372. };
  4373. const medalInfoPanelVisible = vue.ref(false);
  4374. const medalInfoTableData = vue.computed({
  4375. get() {
  4376. const medals = biliStore.filteredFansMedals.map((medal) => ({
  4377. avatar: medal.anchor_info.avatar,
  4378. nick_name: medal.anchor_info.nick_name,
  4379. medal_name: medal.medal.medal_name,
  4380. medal_level: medal.medal.level,
  4381. roomid: medal.room_info.room_id
  4382. }));
  4383. if (uiStore.uiConfig.medalInfoPanelSortMode) {
  4384. const filteredMedals = medals.filter(
  4385. (medal) => config.medalTasks.isWhiteList ? config.medalTasks.roomidList.includes(medal.roomid) : !config.medalTasks.roomidList.includes(medal.roomid)
  4386. );
  4387. const orderMap = arrayToMap(config.medalTasks.roomidList);
  4388. return filteredMedals.sort((a, b) => orderMap.get(a.roomid) - orderMap.get(b.roomid));
  4389. }
  4390. return medals;
  4391. },
  4392. set(newValue) {
  4393. config.medalTasks.roomidList = newValue.map((row) => row.roomid);
  4394. }
  4395. });
  4396. const medalInfoLoading = vue.ref(false);
  4397. let firstClickEditList = true;
  4398. const handleEditList = async () => {
  4399. medalInfoPanelVisible.value = true;
  4400. if (firstClickEditList) {
  4401. firstClickEditList = false;
  4402. await vue.nextTick();
  4403. if (!biliStore.fansMedals) {
  4404. medalInfoLoading.value = true;
  4405. vue.watch(
  4406. medalInfoTableData,
  4407. (newData) => {
  4408. vue.nextTick(() => {
  4409. initSelection(newData);
  4410. medalInfoLoading.value = false;
  4411. });
  4412. },
  4413. { once: true }
  4414. );
  4415. moduleStore2.emitter.emit("Default_FansMedals", {
  4416. module: "LiveTasks"
  4417. });
  4418. } else {
  4419. initSelection(medalInfoTableData.value);
  4420. }
  4421. }
  4422. };
  4423. const medalInfoTableRef = vue.ref();
  4424. const initSelection = (rows) => {
  4425. if (rows) {
  4426. config.medalTasks.roomidList.forEach((roomid, index) => {
  4427. var _a;
  4428. const row = rows.find((row2) => row2.roomid === roomid);
  4429. if (row) {
  4430. (_a = medalInfoTableRef.value) == null ? void 0 : _a.toggleRowSelection(row, true);
  4431. } else {
  4432. config.medalTasks.roomidList.splice(index, 1);
  4433. }
  4434. });
  4435. }
  4436. };
  4437. function handleSelect(selection) {
  4438. config.medalTasks.roomidList = selection.map((row) => row.roomid);
  4439. }
  4440. function handleRowClick(row) {
  4441. var _a, _b;
  4442. (_a = medalInfoTableRef.value) == null ? void 0 : _a.toggleRowSelection(row);
  4443. const selection = (_b = medalInfoTableRef.value) == null ? void 0 : _b.getSelectionRows();
  4444. config.medalTasks.roomidList = selection.map((row2) => row2.roomid);
  4445. }
  4446. return (_ctx, _cache) => {
  4447. const _component_el_switch = vue.resolveComponent("el-switch");
  4448. const _component_Info = vue.resolveComponent("Info");
  4449. const _component_TaskStatus = vue.resolveComponent("TaskStatus");
  4450. const _component_el_space = vue.resolveComponent("el-space");
  4451. const _component_el_row = vue.resolveComponent("el-row");
  4452. const _component_el_divider = vue.resolveComponent("el-divider");
  4453. const _component_SemiSelect = vue.resolveComponent("SemiSelect");
  4454. const _component_el_icon = vue.resolveComponent("el-icon");
  4455. const _component_el_radio = vue.resolveComponent("el-radio");
  4456. const _component_el_button = vue.resolveComponent("el-button");
  4457. const _component_el_radio_group = vue.resolveComponent("el-radio-group");
  4458. const _component_el_option = vue.resolveComponent("el-option");
  4459. const _component_el_select = vue.resolveComponent("el-select");
  4460. const _component_el_text = vue.resolveComponent("el-text");
  4461. const _component_el_link = vue.resolveComponent("el-link");
  4462. const _component_el_table_column = vue.resolveComponent("el-table-column");
  4463. const _component_el_dialog = vue.resolveComponent("el-dialog");
  4464. const _component_el_image = vue.resolveComponent("el-image");
  4465. const _directive_loading = vue.resolveDirective("loading");
  4466. return vue.openBlock(), vue.createElementBlock("div", null, [
  4467. vue.createVNode(_component_el_row, null, {
  4468. default: vue.withCtx(() => [
  4469. vue.createVNode(_component_el_space, {
  4470. wrap: "",
  4471. size: [8, 0]
  4472. }, {
  4473. default: vue.withCtx(() => [
  4474. vue.createVNode(_component_el_switch, {
  4475. modelValue: vue.unref(config).sign.enabled,
  4476. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(config).sign.enabled = $event),
  4477. "active-text": "直播签到"
  4478. }, null, 8, ["modelValue"]),
  4479. vue.createVNode(_component_Info, {
  4480. item: vue.unref(helpInfo).DailyTasks.LiveTasks.sign
  4481. }, null, 8, ["item"]),
  4482. vue.createVNode(_component_TaskStatus, {
  4483. status: vue.unref(status).sign
  4484. }, null, 8, ["status"])
  4485. ]),
  4486. _: 1
  4487. })
  4488. ]),
  4489. _: 1
  4490. }),
  4491. vue.createVNode(_component_el_divider),
  4492. vue.createVNode(_component_el_row, null, {
  4493. default: vue.withCtx(() => [
  4494. vue.createVNode(_component_el_space, {
  4495. wrap: "",
  4496. size: [8, 0]
  4497. }, {
  4498. default: vue.withCtx(() => [
  4499. vue.createVNode(_component_el_switch, {
  4500. modelValue: vue.unref(config).medalTasks.light.enabled,
  4501. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(config).medalTasks.light.enabled = $event),
  4502. "active-text": "点亮熄灭勋章"
  4503. }, null, 8, ["modelValue"]),
  4504. vue.createVNode(_component_Info, {
  4505. item: vue.unref(helpInfo).DailyTasks.LiveTasks.medalTasks.light.main
  4506. }, null, 8, ["item"]),
  4507. vue.createVNode(_component_TaskStatus, {
  4508. status: vue.unref(status).medalTasks.light
  4509. }, null, 8, ["status"])
  4510. ]),
  4511. _: 1
  4512. })
  4513. ]),
  4514. _: 1
  4515. }),
  4516. vue.createVNode(_component_el_row, null, {
  4517. default: vue.withCtx(() => [
  4518. vue.createVNode(_component_el_radio_group, {
  4519. modelValue: vue.unref(config).medalTasks.light.mode,
  4520. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(config).medalTasks.light.mode = $event),
  4521. class: "radio-group"
  4522. }, {
  4523. default: vue.withCtx(() => [
  4524. vue.createVNode(_component_el_row, null, {
  4525. default: vue.withCtx(() => [
  4526. vue.createVNode(_component_el_space, {
  4527. wrap: "",
  4528. size: [8, 0]
  4529. }, {
  4530. default: vue.withCtx(() => [
  4531. vue.createVNode(_component_el_icon, null, {
  4532. default: vue.withCtx(() => [
  4533. vue.createVNode(_component_SemiSelect)
  4534. ]),
  4535. _: 1
  4536. }),
  4537. vue.createVNode(_component_el_radio, { value: "like" }, {
  4538. default: vue.withCtx(() => _cache[14] || (_cache[14] = [
  4539. vue.createTextVNode("点赞")
  4540. ])),
  4541. _: 1
  4542. }),
  4543. vue.createVNode(_component_Info, {
  4544. item: vue.unref(helpInfo).DailyTasks.LiveTasks.medalTasks.light.like
  4545. }, null, 8, ["item"])
  4546. ]),
  4547. _: 1
  4548. })
  4549. ]),
  4550. _: 1
  4551. }),
  4552. vue.createVNode(_component_el_row, null, {
  4553. default: vue.withCtx(() => [
  4554. vue.createVNode(_component_el_space, {
  4555. wrap: "",
  4556. size: [8, 0]
  4557. }, {
  4558. default: vue.withCtx(() => [
  4559. vue.createVNode(_component_el_icon, null, {
  4560. default: vue.withCtx(() => [
  4561. vue.createVNode(_component_SemiSelect)
  4562. ]),
  4563. _: 1
  4564. }),
  4565. vue.createVNode(_component_el_radio, { value: "danmu" }, {
  4566. default: vue.withCtx(() => _cache[15] || (_cache[15] = [
  4567. vue.createTextVNode("发送弹幕")
  4568. ])),
  4569. _: 1
  4570. }),
  4571. vue.createVNode(_component_el_button, {
  4572. type: "primary",
  4573. size: "small",
  4574. icon: vue.unref(ElementPlusIconsVue.Edit),
  4575. onClick: _cache[2] || (_cache[2] = ($event) => medalDanmuPanelVisible.value = !medalDanmuPanelVisible.value)
  4576. }, {
  4577. default: vue.withCtx(() => _cache[16] || (_cache[16] = [
  4578. vue.createTextVNode("编辑弹幕 ")
  4579. ])),
  4580. _: 1
  4581. }, 8, ["icon"]),
  4582. vue.createVNode(_component_Info, {
  4583. item: vue.unref(helpInfo).DailyTasks.LiveTasks.medalTasks.light.danmu
  4584. }, null, 8, ["item"])
  4585. ]),
  4586. _: 1
  4587. })
  4588. ]),
  4589. _: 1
  4590. })
  4591. ]),
  4592. _: 1
  4593. }, 8, ["modelValue"])
  4594. ]),
  4595. _: 1
  4596. }),
  4597. vue.createVNode(_component_el_row, null, {
  4598. default: vue.withCtx(() => [
  4599. vue.createVNode(_component_el_space, {
  4600. wrap: "",
  4601. size: [8, 0]
  4602. }, {
  4603. default: vue.withCtx(() => [
  4604. vue.createVNode(_component_el_switch, {
  4605. modelValue: vue.unref(config).medalTasks.watch.enabled,
  4606. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(config).medalTasks.watch.enabled = $event),
  4607. "active-text": "观看直播"
  4608. }, null, 8, ["modelValue"]),
  4609. vue.createVNode(_component_el_select, {
  4610. modelValue: vue.unref(config).medalTasks.watch.time,
  4611. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.unref(config).medalTasks.watch.time = $event),
  4612. placeholder: "Select",
  4613. style: { "width": "70px" }
  4614. }, {
  4615. default: vue.withCtx(() => [
  4616. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(6, (i) => {
  4617. return vue.createVNode(_component_el_option, {
  4618. key: i,
  4619. label: i * 5,
  4620. value: i * 5
  4621. }, null, 8, ["label", "value"]);
  4622. }), 64))
  4623. ]),
  4624. _: 1
  4625. }, 8, ["modelValue"]),
  4626. vue.createVNode(_component_el_text, null, {
  4627. default: vue.withCtx(() => _cache[17] || (_cache[17] = [
  4628. vue.createTextVNode("分钟 / 直播间")
  4629. ])),
  4630. _: 1
  4631. }),
  4632. vue.createVNode(_component_Info, {
  4633. item: vue.unref(helpInfo).DailyTasks.LiveTasks.medalTasks.watch
  4634. }, null, 8, ["item"]),
  4635. vue.createVNode(_component_TaskStatus, {
  4636. status: vue.unref(status).medalTasks.watch
  4637. }, null, 8, ["status"])
  4638. ]),
  4639. _: 1
  4640. })
  4641. ]),
  4642. _: 1
  4643. }),
  4644. vue.createVNode(_component_el_row, null, {
  4645. default: vue.withCtx(() => [
  4646. vue.createVNode(_component_el_space, {
  4647. wrap: "",
  4648. size: [8, 0]
  4649. }, {
  4650. default: vue.withCtx(() => [
  4651. vue.createVNode(_component_el_switch, {
  4652. modelValue: vue.unref(config).medalTasks.isWhiteList,
  4653. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vue.unref(config).medalTasks.isWhiteList = $event),
  4654. "active-text": "白名单",
  4655. "inactive-text": "黑名单",
  4656. onChange: _cache[7] || (_cache[7] = (val) => !val && (vue.unref(uiStore).uiConfig.medalInfoPanelSortMode = false))
  4657. }, null, 8, ["modelValue"]),
  4658. vue.createVNode(_component_el_button, {
  4659. type: "primary",
  4660. size: "small",
  4661. icon: vue.unref(ElementPlusIconsVue.Edit),
  4662. onClick: handleEditList
  4663. }, {
  4664. default: vue.withCtx(() => _cache[18] || (_cache[18] = [
  4665. vue.createTextVNode("编辑名单 ")
  4666. ])),
  4667. _: 1
  4668. }, 8, ["icon"]),
  4669. vue.createVNode(_component_Info, {
  4670. item: vue.unref(helpInfo).DailyTasks.LiveTasks.medalTasks.list
  4671. }, null, 8, ["item"])
  4672. ]),
  4673. _: 1
  4674. })
  4675. ]),
  4676. _: 1
  4677. }),
  4678. vue.createVNode(_component_el_divider),
  4679. vue.createVNode(_component_el_row, null, {
  4680. default: vue.withCtx(() => [
  4681. vue.createVNode(_component_el_text, null, {
  4682. default: vue.withCtx(() => _cache[19] || (_cache[19] = [
  4683. vue.createTextVNode("直播任务相关信息可在")
  4684. ])),
  4685. _: 1
  4686. }),
  4687. vue.createVNode(_component_el_link, {
  4688. rel: "noreferrer",
  4689. type: "primary",
  4690. href: "https://link.bilibili.com/p/help/index#/audience-fans-medal",
  4691. target: "_blank"
  4692. }, {
  4693. default: vue.withCtx(() => _cache[20] || (_cache[20] = [
  4694. vue.createTextVNode("帮助中心 ")
  4695. ])),
  4696. _: 1
  4697. }),
  4698. vue.createVNode(_component_el_text, null, {
  4699. default: vue.withCtx(() => _cache[21] || (_cache[21] = [
  4700. vue.createTextVNode("查看。")
  4701. ])),
  4702. _: 1
  4703. })
  4704. ]),
  4705. _: 1
  4706. }),
  4707. _cache[25] || (_cache[25] = vue.createElementVNode("br", null, null, -1)),
  4708. vue.createVNode(_component_el_dialog, {
  4709. modelValue: medalDanmuPanelVisible.value,
  4710. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => medalDanmuPanelVisible.value = $event),
  4711. title: "编辑弹幕内容",
  4712. "lock-scroll": false,
  4713. width: "40%"
  4714. }, {
  4715. footer: vue.withCtx(() => [
  4716. vue.createVNode(_component_el_button, {
  4717. type: "primary",
  4718. onClick: handleAddDanmu
  4719. }, {
  4720. default: vue.withCtx(() => _cache[24] || (_cache[24] = [
  4721. vue.createTextVNode("新增弹幕")
  4722. ])),
  4723. _: 1
  4724. })
  4725. ]),
  4726. default: vue.withCtx(() => [
  4727. vue.createVNode(vue.unref(ElementPlus.ElTable), {
  4728. data: danmuTableData.value,
  4729. "max-height": danmuTableMaxHeight
  4730. }, {
  4731. default: vue.withCtx(() => [
  4732. vue.createVNode(_component_el_table_column, {
  4733. type: "index",
  4734. width: "80"
  4735. }),
  4736. vue.createVNode(_component_el_table_column, {
  4737. prop: "content",
  4738. label: "弹幕内容"
  4739. }),
  4740. vue.createVNode(_component_el_table_column, {
  4741. label: "操作",
  4742. width: "220",
  4743. align: "center"
  4744. }, {
  4745. default: vue.withCtx((scope) => [
  4746. vue.createVNode(_component_el_button, {
  4747. text: "",
  4748. icon: vue.unref(ElementPlusIconsVue.Edit),
  4749. onClick: ($event) => handleEditDanmu(scope.$index, scope.row)
  4750. }, {
  4751. default: vue.withCtx(() => _cache[22] || (_cache[22] = [
  4752. vue.createTextVNode(" 修改 ")
  4753. ])),
  4754. _: 2
  4755. }, 1032, ["icon", "onClick"]),
  4756. vue.createVNode(_component_el_button, {
  4757. text: "",
  4758. icon: vue.unref(ElementPlusIconsVue.Delete),
  4759. type: "danger",
  4760. onClick: ($event) => handleDeleteDanmu(scope.$index)
  4761. }, {
  4762. default: vue.withCtx(() => _cache[23] || (_cache[23] = [
  4763. vue.createTextVNode(" 删除 ")
  4764. ])),
  4765. _: 2
  4766. }, 1032, ["icon", "onClick"])
  4767. ]),
  4768. _: 1
  4769. })
  4770. ]),
  4771. _: 1
  4772. }, 8, ["data"])
  4773. ]),
  4774. _: 1
  4775. }, 8, ["modelValue"]),
  4776. vue.createVNode(_component_el_dialog, {
  4777. modelValue: medalInfoPanelVisible.value,
  4778. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => medalInfoPanelVisible.value = $event),
  4779. title: "编辑粉丝勋章名单",
  4780. "lock-scroll": false
  4781. }, {
  4782. footer: vue.withCtx(() => [
  4783. vue.createVNode(_component_el_switch, {
  4784. disabled: !vue.unref(config).medalTasks.isWhiteList,
  4785. modelValue: vue.unref(uiStore).uiConfig.medalInfoPanelSortMode,
  4786. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => vue.unref(uiStore).uiConfig.medalInfoPanelSortMode = $event),
  4787. "inactive-text": "常规模式",
  4788. "active-text": "排序模式",
  4789. onChange: _cache[12] || (_cache[12] = (val) => !val && vue.nextTick(() => initSelection(medalInfoTableData.value)))
  4790. }, null, 8, ["disabled", "modelValue"])
  4791. ]),
  4792. default: vue.withCtx(() => [
  4793. vue.createVNode(vue.unref(vueDraggablePlus.VueDraggable), {
  4794. modelValue: medalInfoTableData.value,
  4795. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => medalInfoTableData.value = $event),
  4796. target: "#draggable-fans-medal-table table tbody",
  4797. disabled: !vue.unref(uiStore).uiConfig.medalInfoPanelSortMode,
  4798. animation: 150,
  4799. "scroll-sensitivity": 36,
  4800. "scroll-speed": 8
  4801. }, {
  4802. default: vue.withCtx(() => [
  4803. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElTable), {
  4804. id: "draggable-fans-medal-table",
  4805. ref_key: "medalInfoTableRef",
  4806. ref: medalInfoTableRef,
  4807. data: medalInfoTableData.value,
  4808. "max-height": medalTableMaxHeight,
  4809. "empty-text": "没有粉丝勋章",
  4810. onSelect: handleSelect,
  4811. onSelectAll: handleSelect,
  4812. onRowClick: handleRowClick,
  4813. "row-key": (row) => row.roomid.toString()
  4814. }, {
  4815. default: vue.withCtx(() => [
  4816. !vue.unref(uiStore).uiConfig.medalInfoPanelSortMode ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
  4817. key: 0,
  4818. type: "selection",
  4819. align: "center",
  4820. width: "80"
  4821. })) : (vue.openBlock(), vue.createBlock(_component_el_table_column, {
  4822. key: 1,
  4823. type: "index",
  4824. align: "center",
  4825. width: "80"
  4826. })),
  4827. vue.createVNode(_component_el_table_column, {
  4828. prop: "avatar",
  4829. label: "头像",
  4830. width: "100"
  4831. }, {
  4832. default: vue.withCtx((scope) => [
  4833. vue.createElementVNode("div", _hoisted_1$1, [
  4834. vue.createVNode(_component_el_image, {
  4835. src: scope.row.avatar,
  4836. loading: "lazy",
  4837. referrerpolicy: "origin",
  4838. class: "avatar"
  4839. }, {
  4840. error: vue.withCtx(() => [
  4841. vue.createVNode(_component_el_image, {
  4842. src: "//i0.hdslb.com/bfs/face/member/noface.jpg",
  4843. referrerpolicy: "origin",
  4844. class: "avatar"
  4845. })
  4846. ]),
  4847. _: 2
  4848. }, 1032, ["src"])
  4849. ])
  4850. ]),
  4851. _: 1
  4852. }),
  4853. vue.createVNode(_component_el_table_column, {
  4854. prop: "nick_name",
  4855. label: "昵称"
  4856. }),
  4857. vue.createVNode(_component_el_table_column, {
  4858. prop: "medal_name",
  4859. label: "粉丝勋章"
  4860. }),
  4861. vue.createVNode(_component_el_table_column, {
  4862. prop: "medal_level",
  4863. label: "等级",
  4864. width: "80",
  4865. sortable: ""
  4866. }),
  4867. vue.createVNode(_component_el_table_column, {
  4868. prop: "roomid",
  4869. label: "房间号"
  4870. }, {
  4871. default: vue.withCtx((scope) => [
  4872. vue.createVNode(_component_el_link, {
  4873. href: "https://live.bilibili.com/" + scope.row.roomid + "?visit_id=",
  4874. rel: "noreferrer",
  4875. type: "primary",
  4876. target: "_blank",
  4877. onClick: _cache[9] || (_cache[9] = vue.withModifiers(() => {
  4878. }, ["stop"]))
  4879. }, {
  4880. default: vue.withCtx(() => [
  4881. vue.createTextVNode(vue.toDisplayString(scope.row.roomid), 1)
  4882. ]),
  4883. _: 2
  4884. }, 1032, ["href"])
  4885. ]),
  4886. _: 1
  4887. })
  4888. ]),
  4889. _: 1
  4890. }, 8, ["data", "row-key"])), [
  4891. [_directive_loading, medalInfoLoading.value]
  4892. ])
  4893. ]),
  4894. _: 1
  4895. }, 8, ["modelValue", "disabled"])
  4896. ]),
  4897. _: 1
  4898. }, 8, ["modelValue"])
  4899. ]);
  4900. };
  4901. }
  4902. });
  4903. const LiveTasks = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-584fbcd9"]]);
  4904. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  4905. __name: "OtherTasks",
  4906. setup(__props) {
  4907. const moduleStore2 = useModuleStore();
  4908. const config = moduleStore2.moduleConfig.DailyTasks.OtherTasks;
  4909. const status = moduleStore2.moduleStatus.DailyTasks.OtherTasks;
  4910. return (_ctx, _cache) => {
  4911. const _component_el_switch = vue.resolveComponent("el-switch");
  4912. const _component_Info = vue.resolveComponent("Info");
  4913. const _component_TaskStatus = vue.resolveComponent("TaskStatus");
  4914. const _component_el_space = vue.resolveComponent("el-space");
  4915. const _component_el_row = vue.resolveComponent("el-row");
  4916. const _component_el_text = vue.resolveComponent("el-text");
  4917. const _component_el_option = vue.resolveComponent("el-option");
  4918. const _component_el_select = vue.resolveComponent("el-select");
  4919. const _component_el_divider = vue.resolveComponent("el-divider");
  4920. return vue.openBlock(), vue.createElementBlock("div", null, [
  4921. vue.createVNode(_component_el_row, null, {
  4922. default: vue.withCtx(() => [
  4923. vue.createVNode(_component_el_space, { wrap: "" }, {
  4924. default: vue.withCtx(() => [
  4925. vue.createVNode(_component_el_switch, {
  4926. modelValue: vue.unref(config).groupSign.enabled,
  4927. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(config).groupSign.enabled = $event),
  4928. "active-text": "应援团签到"
  4929. }, null, 8, ["modelValue"]),
  4930. vue.createVNode(_component_Info, {
  4931. item: vue.unref(helpInfo).DailyTasks.OtherTasks.groupSign
  4932. }, null, 8, ["item"]),
  4933. vue.createVNode(_component_TaskStatus, {
  4934. status: vue.unref(status).groupSign
  4935. }, null, 8, ["status"])
  4936. ]),
  4937. _: 1
  4938. })
  4939. ]),
  4940. _: 1
  4941. }),
  4942. vue.createVNode(_component_el_row, null, {
  4943. default: vue.withCtx(() => [
  4944. vue.createVNode(_component_el_space, { wrap: "" }, {
  4945. default: vue.withCtx(() => [
  4946. vue.createVNode(_component_el_switch, {
  4947. modelValue: vue.unref(config).silverToCoin.enabled,
  4948. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(config).silverToCoin.enabled = $event),
  4949. "active-text": "银瓜子换硬币"
  4950. }, null, 8, ["modelValue"]),
  4951. vue.createVNode(_component_Info, {
  4952. item: vue.unref(helpInfo).DailyTasks.OtherTasks.silverToCoin
  4953. }, null, 8, ["item"]),
  4954. vue.createVNode(_component_TaskStatus, {
  4955. status: vue.unref(status).silverToCoin
  4956. }, null, 8, ["status"])
  4957. ]),
  4958. _: 1
  4959. })
  4960. ]),
  4961. _: 1
  4962. }),
  4963. vue.createVNode(_component_el_row, null, {
  4964. default: vue.withCtx(() => [
  4965. vue.createVNode(_component_el_space, {
  4966. wrap: "",
  4967. size: [8, 0]
  4968. }, {
  4969. default: vue.withCtx(() => [
  4970. vue.createVNode(_component_el_switch, {
  4971. modelValue: vue.unref(config).coinToSilver.enabled,
  4972. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(config).coinToSilver.enabled = $event),
  4973. "active-text": "硬币换银瓜子"
  4974. }, null, 8, ["modelValue"]),
  4975. vue.createVNode(_component_el_text, null, {
  4976. default: vue.withCtx(() => _cache[5] || (_cache[5] = [
  4977. vue.createTextVNode("花费硬币")
  4978. ])),
  4979. _: 1
  4980. }),
  4981. vue.createVNode(_component_el_select, {
  4982. modelValue: vue.unref(config).coinToSilver.num,
  4983. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(config).coinToSilver.num = $event),
  4984. placeholder: "Select",
  4985. style: { "width": "64px" }
  4986. }, {
  4987. default: vue.withCtx(() => [
  4988. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(50, (i) => {
  4989. return vue.createVNode(_component_el_option, {
  4990. key: i,
  4991. label: i,
  4992. value: i
  4993. }, null, 8, ["label", "value"]);
  4994. }), 64))
  4995. ]),
  4996. _: 1
  4997. }, 8, ["modelValue"]),
  4998. vue.createVNode(_component_el_text, null, {
  4999. default: vue.withCtx(() => _cache[6] || (_cache[6] = [
  5000. vue.createTextVNode("个")
  5001. ])),
  5002. _: 1
  5003. }),
  5004. vue.createVNode(_component_Info, {
  5005. item: vue.unref(helpInfo).DailyTasks.OtherTasks.coinToSilver
  5006. }, null, 8, ["item"]),
  5007. vue.createVNode(_component_TaskStatus, {
  5008. status: vue.unref(status).coinToSilver
  5009. }, null, 8, ["status"])
  5010. ]),
  5011. _: 1
  5012. })
  5013. ]),
  5014. _: 1
  5015. }),
  5016. vue.createVNode(_component_el_row, null, {
  5017. default: vue.withCtx(() => [
  5018. vue.createVNode(_component_el_space, {
  5019. wrap: "",
  5020. size: [8, 0]
  5021. }, {
  5022. default: vue.withCtx(() => [
  5023. vue.createVNode(_component_el_switch, {
  5024. modelValue: vue.unref(config).getYearVipPrivilege.enabled,
  5025. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(config).getYearVipPrivilege.enabled = $event),
  5026. "active-text": "领取年度大会员权益"
  5027. }, null, 8, ["modelValue"]),
  5028. vue.createVNode(_component_Info, {
  5029. item: vue.unref(helpInfo).DailyTasks.OtherTasks.getYearVipPrivilege
  5030. }, null, 8, ["item"]),
  5031. vue.createVNode(_component_TaskStatus, {
  5032. status: vue.unref(status).getYearVipPrivilege
  5033. }, null, 8, ["status"])
  5034. ]),
  5035. _: 1
  5036. })
  5037. ]),
  5038. _: 1
  5039. }),
  5040. vue.createVNode(_component_el_divider)
  5041. ]);
  5042. };
  5043. }
  5044. });
  5045. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  5046. __name: "EnhanceExperience",
  5047. setup(__props) {
  5048. const moduleStore2 = useModuleStore();
  5049. const config = moduleStore2.moduleConfig.EnhanceExperience;
  5050. const qualityDescList = ["原画", "蓝光PRO", "蓝光", "超清PRO", "超清", "高清"];
  5051. return (_ctx, _cache) => {
  5052. const _component_el_switch = vue.resolveComponent("el-switch");
  5053. const _component_el_option = vue.resolveComponent("el-option");
  5054. const _component_el_select = vue.resolveComponent("el-select");
  5055. const _component_Info = vue.resolveComponent("Info");
  5056. const _component_el_space = vue.resolveComponent("el-space");
  5057. const _component_el_row = vue.resolveComponent("el-row");
  5058. const _component_el_divider = vue.resolveComponent("el-divider");
  5059. return vue.openBlock(), vue.createElementBlock("div", null, [
  5060. vue.createVNode(_component_el_row, null, {
  5061. default: vue.withCtx(() => [
  5062. vue.createVNode(_component_el_space, {
  5063. wrap: "",
  5064. size: [8, 0]
  5065. }, {
  5066. default: vue.withCtx(() => [
  5067. vue.createVNode(_component_el_switch, {
  5068. modelValue: vue.unref(config).switchLiveStreamQuality.enabled,
  5069. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(config).switchLiveStreamQuality.enabled = $event),
  5070. "active-text": "自动切换画质"
  5071. }, null, 8, ["modelValue"]),
  5072. vue.createVNode(_component_el_select, {
  5073. modelValue: vue.unref(config).switchLiveStreamQuality.qualityDesc,
  5074. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(config).switchLiveStreamQuality.qualityDesc = $event),
  5075. placeholder: "Select",
  5076. style: { "width": "110px" }
  5077. }, {
  5078. default: vue.withCtx(() => [
  5079. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(qualityDescList, (i) => {
  5080. return vue.createVNode(_component_el_option, {
  5081. key: i,
  5082. label: i,
  5083. value: i
  5084. }, null, 8, ["label", "value"]);
  5085. }), 64))
  5086. ]),
  5087. _: 1
  5088. }, 8, ["modelValue"]),
  5089. vue.createVNode(_component_Info, {
  5090. item: vue.unref(helpInfo).EnhanceExperience.switchLiveStreamQuality
  5091. }, null, 8, ["item"])
  5092. ]),
  5093. _: 1
  5094. })
  5095. ]),
  5096. _: 1
  5097. }),
  5098. vue.createVNode(_component_el_row, null, {
  5099. default: vue.withCtx(() => [
  5100. vue.createVNode(_component_el_space, {
  5101. wrap: "",
  5102. size: [8, 0]
  5103. }, {
  5104. default: vue.withCtx(() => [
  5105. vue.createVNode(_component_el_switch, {
  5106. modelValue: vue.unref(config).banp2p.enabled,
  5107. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(config).banp2p.enabled = $event),
  5108. "active-text": "禁用P2P"
  5109. }, null, 8, ["modelValue"]),
  5110. vue.createVNode(_component_Info, {
  5111. item: vue.unref(helpInfo).EnhanceExperience.banp2p
  5112. }, null, 8, ["item"])
  5113. ]),
  5114. _: 1
  5115. })
  5116. ]),
  5117. _: 1
  5118. }),
  5119. vue.createVNode(_component_el_row, null, {
  5120. default: vue.withCtx(() => [
  5121. vue.createVNode(_component_el_space, {
  5122. wrap: "",
  5123. size: [8, 0]
  5124. }, {
  5125. default: vue.withCtx(() => [
  5126. vue.createVNode(_component_el_switch, {
  5127. modelValue: vue.unref(config).noReport.enabled,
  5128. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(config).noReport.enabled = $event),
  5129. "active-text": "拦截日志数据上报"
  5130. }, null, 8, ["modelValue"]),
  5131. vue.createVNode(_component_Info, {
  5132. item: vue.unref(helpInfo).EnhanceExperience.noReport
  5133. }, null, 8, ["item"])
  5134. ]),
  5135. _: 1
  5136. })
  5137. ]),
  5138. _: 1
  5139. }),
  5140. vue.createVNode(_component_el_row, null, {
  5141. default: vue.withCtx(() => [
  5142. vue.createVNode(_component_el_space, {
  5143. wrap: "",
  5144. size: [8, 0]
  5145. }, {
  5146. default: vue.withCtx(() => [
  5147. vue.createVNode(_component_el_switch, {
  5148. modelValue: vue.unref(config).noSleep.enabled,
  5149. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(config).noSleep.enabled = $event),
  5150. "active-text": "屏蔽挂机检测"
  5151. }, null, 8, ["modelValue"]),
  5152. vue.createVNode(_component_Info, {
  5153. item: vue.unref(helpInfo).EnhanceExperience.noSleep
  5154. }, null, 8, ["item"])
  5155. ]),
  5156. _: 1
  5157. })
  5158. ]),
  5159. _: 1
  5160. }),
  5161. vue.createVNode(_component_el_row, null, {
  5162. default: vue.withCtx(() => [
  5163. vue.createVNode(_component_el_space, {
  5164. wrap: "",
  5165. size: [8, 0]
  5166. }, {
  5167. default: vue.withCtx(() => [
  5168. vue.createVNode(_component_el_switch, {
  5169. modelValue: vue.unref(config).invisibility.enabled,
  5170. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.unref(config).invisibility.enabled = $event),
  5171. "active-text": "隐身入场"
  5172. }, null, 8, ["modelValue"]),
  5173. vue.createVNode(_component_Info, {
  5174. item: vue.unref(helpInfo).EnhanceExperience.invisibility
  5175. }, null, 8, ["item"])
  5176. ]),
  5177. _: 1
  5178. })
  5179. ]),
  5180. _: 1
  5181. }),
  5182. vue.createVNode(_component_el_divider)
  5183. ]);
  5184. };
  5185. }
  5186. });
  5187. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  5188. __name: "RemoveElement",
  5189. setup(__props) {
  5190. const moduleStore2 = useModuleStore();
  5191. const config = moduleStore2.moduleConfig.RemoveElement;
  5192. return (_ctx, _cache) => {
  5193. const _component_el_switch = vue.resolveComponent("el-switch");
  5194. const _component_Info = vue.resolveComponent("Info");
  5195. const _component_el_space = vue.resolveComponent("el-space");
  5196. const _component_el_row = vue.resolveComponent("el-row");
  5197. const _component_el_divider = vue.resolveComponent("el-divider");
  5198. return vue.openBlock(), vue.createElementBlock("div", null, [
  5199. vue.createVNode(_component_el_row, null, {
  5200. default: vue.withCtx(() => [
  5201. vue.createVNode(_component_el_space, {
  5202. wrap: "",
  5203. size: [8, 0]
  5204. }, {
  5205. default: vue.withCtx(() => [
  5206. vue.createVNode(_component_el_switch, {
  5207. modelValue: vue.unref(config).removePKBox.enabled,
  5208. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(config).removePKBox.enabled = $event),
  5209. "active-text": "移除大乱斗元素"
  5210. }, null, 8, ["modelValue"]),
  5211. vue.createVNode(_component_Info, {
  5212. item: vue.unref(helpInfo).RemoveElement.removePKBox
  5213. }, null, 8, ["item"])
  5214. ]),
  5215. _: 1
  5216. })
  5217. ]),
  5218. _: 1
  5219. }),
  5220. vue.createVNode(_component_el_row, null, {
  5221. default: vue.withCtx(() => [
  5222. vue.createVNode(_component_el_space, {
  5223. wrap: "",
  5224. size: [8, 0]
  5225. }, {
  5226. default: vue.withCtx(() => [
  5227. vue.createVNode(_component_el_switch, {
  5228. modelValue: vue.unref(config).removeLiveWaterMark.enabled,
  5229. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.unref(config).removeLiveWaterMark.enabled = $event),
  5230. "active-text": "移除直播间水印"
  5231. }, null, 8, ["modelValue"]),
  5232. vue.createVNode(_component_Info, {
  5233. item: vue.unref(helpInfo).RemoveElement.removeLiveWaterMark
  5234. }, null, 8, ["item"])
  5235. ]),
  5236. _: 1
  5237. })
  5238. ]),
  5239. _: 1
  5240. }),
  5241. vue.createVNode(_component_el_row, null, {
  5242. default: vue.withCtx(() => [
  5243. vue.createVNode(_component_el_space, {
  5244. wrap: "",
  5245. size: [8, 0]
  5246. }, {
  5247. default: vue.withCtx(() => [
  5248. vue.createVNode(_component_el_switch, {
  5249. modelValue: vue.unref(config).removeShopPopover.enabled,
  5250. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.unref(config).removeShopPopover.enabled = $event),
  5251. "active-text": "移除直播间小橙车弹窗"
  5252. }, null, 8, ["modelValue"]),
  5253. vue.createVNode(_component_Info, {
  5254. item: vue.unref(helpInfo).RemoveElement.removeShopPopover
  5255. }, null, 8, ["item"])
  5256. ]),
  5257. _: 1
  5258. })
  5259. ]),
  5260. _: 1
  5261. }),
  5262. vue.createVNode(_component_el_row, null, {
  5263. default: vue.withCtx(() => [
  5264. vue.createVNode(_component_el_space, {
  5265. wrap: "",
  5266. size: [8, 0]
  5267. }, {
  5268. default: vue.withCtx(() => [
  5269. vue.createVNode(_component_el_switch, {
  5270. modelValue: vue.unref(config).removeGameParty.enabled,
  5271. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.unref(config).removeGameParty.enabled = $event),
  5272. "active-text": "移除直播间幻星派对标志"
  5273. }, null, 8, ["modelValue"]),
  5274. vue.createVNode(_component_Info, {
  5275. item: vue.unref(helpInfo).RemoveElement.removeGameParty
  5276. }, null, 8, ["item"])
  5277. ]),
  5278. _: 1
  5279. })
  5280. ]),
  5281. _: 1
  5282. }),
  5283. vue.createVNode(_component_el_row, null, {
  5284. default: vue.withCtx(() => [
  5285. vue.createVNode(_component_el_space, {
  5286. wrap: "",
  5287. size: [8, 0]
  5288. }, {
  5289. default: vue.withCtx(() => [
  5290. vue.createVNode(_component_el_switch, {
  5291. modelValue: vue.unref(config).removeGiftPopover.enabled,
  5292. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.unref(config).removeGiftPopover.enabled = $event),
  5293. "active-text": "移除礼物赠送提示弹窗"
  5294. }, null, 8, ["modelValue"]),
  5295. vue.createVNode(_component_Info, {
  5296. item: vue.unref(helpInfo).RemoveElement.removeGiftPopover
  5297. }, null, 8, ["item"])
  5298. ]),
  5299. _: 1
  5300. })
  5301. ]),
  5302. _: 1
  5303. }),
  5304. vue.createVNode(_component_el_row, null, {
  5305. default: vue.withCtx(() => [
  5306. vue.createVNode(_component_el_space, {
  5307. wrap: "",
  5308. size: [8, 0]
  5309. }, {
  5310. default: vue.withCtx(() => [
  5311. vue.createVNode(_component_el_switch, {
  5312. modelValue: vue.unref(config).removeMicPopover.enabled,
  5313. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.unref(config).removeMicPopover.enabled = $event),
  5314. "active-text": "移除连麦状态提示"
  5315. }, null, 8, ["modelValue"]),
  5316. vue.createVNode(_component_Info, {
  5317. item: vue.unref(helpInfo).RemoveElement.removeMicPopover
  5318. }, null, 8, ["item"])
  5319. ]),
  5320. _: 1
  5321. })
  5322. ]),
  5323. _: 1
  5324. }),
  5325. vue.createVNode(_component_el_row, null, {
  5326. default: vue.withCtx(() => [
  5327. vue.createVNode(_component_el_space, {
  5328. wrap: "",
  5329. size: [8, 0]
  5330. }, {
  5331. default: vue.withCtx(() => [
  5332. vue.createVNode(_component_el_switch, {
  5333. modelValue: vue.unref(config).removeComboCard.enabled,
  5334. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => vue.unref(config).removeComboCard.enabled = $event),
  5335. "active-text": "移除直播间相同弹幕连续提示"
  5336. }, null, 8, ["modelValue"]),
  5337. vue.createVNode(_component_Info, {
  5338. item: vue.unref(helpInfo).RemoveElement.removeComboCard
  5339. }, null, 8, ["item"])
  5340. ]),
  5341. _: 1
  5342. })
  5343. ]),
  5344. _: 1
  5345. }),
  5346. vue.createVNode(_component_el_row, null, {
  5347. default: vue.withCtx(() => [
  5348. vue.createVNode(_component_el_space, {
  5349. wrap: "",
  5350. size: [8, 0]
  5351. }, {
  5352. default: vue.withCtx(() => [
  5353. vue.createVNode(_component_el_switch, {
  5354. modelValue: vue.unref(config).removeRank.enabled,
  5355. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => vue.unref(config).removeRank.enabled = $event),
  5356. "active-text": "移除排行榜"
  5357. }, null, 8, ["modelValue"]),
  5358. vue.createVNode(_component_Info, {
  5359. item: vue.unref(helpInfo).RemoveElement.removeRank
  5360. }, null, 8, ["item"])
  5361. ]),
  5362. _: 1
  5363. })
  5364. ]),
  5365. _: 1
  5366. }),
  5367. vue.createVNode(_component_el_row, null, {
  5368. default: vue.withCtx(() => [
  5369. vue.createVNode(_component_el_space, {
  5370. wrap: "",
  5371. size: [8, 0]
  5372. }, {
  5373. default: vue.withCtx(() => [
  5374. vue.createVNode(_component_el_switch, {
  5375. modelValue: vue.unref(config).removeHeaderStuff.enabled,
  5376. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => vue.unref(config).removeHeaderStuff.enabled = $event),
  5377. "active-text": "移除直播画面上方杂项"
  5378. }, null, 8, ["modelValue"]),
  5379. vue.createVNode(_component_Info, {
  5380. item: vue.unref(helpInfo).RemoveElement.removeHeaderStuff
  5381. }, null, 8, ["item"])
  5382. ]),
  5383. _: 1
  5384. })
  5385. ]),
  5386. _: 1
  5387. }),
  5388. vue.createVNode(_component_el_row, null, {
  5389. default: vue.withCtx(() => [
  5390. vue.createVNode(_component_el_space, {
  5391. wrap: "",
  5392. size: [8, 0]
  5393. }, {
  5394. default: vue.withCtx(() => [
  5395. vue.createVNode(_component_el_switch, {
  5396. modelValue: vue.unref(config).removeFlipView.enabled,
  5397. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => vue.unref(config).removeFlipView.enabled = $event),
  5398. "active-text": "移除礼物栏下方广告"
  5399. }, null, 8, ["modelValue"]),
  5400. vue.createVNode(_component_Info, {
  5401. item: vue.unref(helpInfo).RemoveElement.removeFlipView
  5402. }, null, 8, ["item"])
  5403. ]),
  5404. _: 1
  5405. })
  5406. ]),
  5407. _: 1
  5408. }),
  5409. vue.createVNode(_component_el_row, null, {
  5410. default: vue.withCtx(() => [
  5411. vue.createVNode(_component_el_space, { "wrap:size": "[8, 0]" }, {
  5412. default: vue.withCtx(() => [
  5413. vue.createVNode(_component_el_switch, {
  5414. modelValue: vue.unref(config).removeRecommendRoom.enabled,
  5415. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => vue.unref(config).removeRecommendRoom.enabled = $event),
  5416. "active-text": "移除礼物栏下方推荐直播间"
  5417. }, null, 8, ["modelValue"]),
  5418. vue.createVNode(_component_Info, {
  5419. item: vue.unref(helpInfo).RemoveElement.removeRecommendRoom
  5420. }, null, 8, ["item"])
  5421. ]),
  5422. _: 1
  5423. })
  5424. ]),
  5425. _: 1
  5426. }),
  5427. vue.createVNode(_component_el_row, null, {
  5428. default: vue.withCtx(() => [
  5429. vue.createVNode(_component_el_space, {
  5430. wrap: "",
  5431. size: [8, 0]
  5432. }, {
  5433. default: vue.withCtx(() => [
  5434. vue.createVNode(_component_el_switch, {
  5435. modelValue: vue.unref(config).removeLiveMosaic.enabled,
  5436. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => vue.unref(config).removeLiveMosaic.enabled = $event),
  5437. "active-text": "移除直播间马赛克"
  5438. }, null, 8, ["modelValue"]),
  5439. vue.createVNode(_component_Info, {
  5440. item: vue.unref(helpInfo).RemoveElement.removeLiveMosaic
  5441. }, null, 8, ["item"])
  5442. ]),
  5443. _: 1
  5444. })
  5445. ]),
  5446. _: 1
  5447. }),
  5448. vue.createVNode(_component_el_divider)
  5449. ]);
  5450. };
  5451. }
  5452. });
  5453. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  5454. __name: "ScriptSettings",
  5455. setup(__props) {
  5456. const uiConfig = useUIStore().uiConfig;
  5457. return (_ctx, _cache) => {
  5458. const _component_el_text = vue.resolveComponent("el-text");
  5459. const _component_el_slider = vue.resolveComponent("el-slider");
  5460. const _component_el_space = vue.resolveComponent("el-space");
  5461. const _component_el_row = vue.resolveComponent("el-row");
  5462. return vue.openBlock(), vue.createElementBlock("div", null, [
  5463. vue.createVNode(_component_el_row, { align: "middle" }, {
  5464. default: vue.withCtx(() => [
  5465. vue.createVNode(_component_el_space, {
  5466. wrap: "",
  5467. size: [16, 0]
  5468. }, {
  5469. default: vue.withCtx(() => [
  5470. vue.createVNode(_component_el_text, { class: "label-text" }, {
  5471. default: vue.withCtx(() => _cache[1] || (_cache[1] = [
  5472. vue.createTextVNode("控制面板宽度")
  5473. ])),
  5474. _: 1
  5475. }),
  5476. vue.createVNode(_component_el_slider, {
  5477. style: { "width": "150px" },
  5478. class: "slider",
  5479. modelValue: vue.unref(uiConfig).panelWidthPercent,
  5480. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(uiConfig).panelWidthPercent = $event),
  5481. min: 30,
  5482. max: 60
  5483. }, null, 8, ["modelValue"])
  5484. ]),
  5485. _: 1
  5486. })
  5487. ]),
  5488. _: 1
  5489. })
  5490. ]);
  5491. };
  5492. }
  5493. });
  5494. const ScriptSettings = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-1cb0d081"]]);
  5495. const __default__ = vue.defineComponent({
  5496. components: {
  5497. MainSiteTasks: _sfc_main$a,
  5498. LiveTasks,
  5499. OtherTasks: _sfc_main$8,
  5500. EnhanceExperience: _sfc_main$7,
  5501. RemoveElement: _sfc_main$6,
  5502. ScriptSettings
  5503. }
  5504. });
  5505. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  5506. ...__default__,
  5507. __name: "PanelMain",
  5508. setup(__props) {
  5509. const uiStore = useUIStore();
  5510. return (_ctx, _cache) => {
  5511. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(uiStore).uiConfig.activeMenuIndex));
  5512. };
  5513. }
  5514. });
  5515. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  5516. __name: "App",
  5517. setup(__props) {
  5518. const uiStore = useUIStore();
  5519. const logger2 = new Logger("App.vue");
  5520. let isShowPanel = uiStore.uiConfig.isShowPanel;
  5521. uiStore.uiConfig.isShowPanel = false;
  5522. let livePlayer;
  5523. let button;
  5524. function updatePosition() {
  5525. const rect = livePlayer.getBoundingClientRect();
  5526. uiStore.livePlayerRect.top = rect.top;
  5527. uiStore.livePlayerRect.left = rect.left;
  5528. uiStore.livePlayerRect.height = rect.height;
  5529. uiStore.livePlayerRect.width = rect.width;
  5530. uiStore.windowScrollPosition.x = _unsafeWindow.scrollX;
  5531. uiStore.windowScrollPosition.y = _unsafeWindow.scrollY;
  5532. }
  5533. function buttonOnClick() {
  5534. uiStore.changeShowPanel();
  5535. button.innerText = uiStore.isShowPanelButtonText;
  5536. }
  5537. const throttleButtonOnClick = _.throttle(buttonOnClick, 300);
  5538. livePlayer = dq("#live-player-ctnr");
  5539. if (livePlayer) {
  5540. updatePosition();
  5541. waitForElement(dq("#player-ctnr"), ".left-ctnr.left-header-area", 1e4).then((playerHeaderLeft) => {
  5542. button = dce("button");
  5543. button.setAttribute("class", "blth_btn");
  5544. button.onclick = throttleButtonOnClick;
  5545. button.innerText = uiStore.isShowPanelButtonText;
  5546. playerHeaderLeft.append(button);
  5547. if (!isSelfTopFrame()) {
  5548. hotkeys(
  5549. "alt+b",
  5550. {
  5551. element: topFrameDocumentElement()
  5552. },
  5553. throttleButtonOnClick
  5554. );
  5555. }
  5556. hotkeys("alt+b", throttleButtonOnClick);
  5557. }).catch((e) => logger2.error(e));
  5558. window.addEventListener("resize", () => updatePosition());
  5559. const observer = new MutationObserver(() => updatePosition());
  5560. observer.observe(document.body, { attributes: true });
  5561. observer.observe(document.documentElement, { attributes: true });
  5562. if (isShowPanel) {
  5563. uiStore.uiConfig.isShowPanel = true;
  5564. }
  5565. } else {
  5566. logger2.error("livePlayer not found");
  5567. }
  5568. return (_ctx, _cache) => {
  5569. const _component_el_header = vue.resolveComponent("el-header");
  5570. const _component_el_aside = vue.resolveComponent("el-aside");
  5571. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  5572. const _component_el_main = vue.resolveComponent("el-main");
  5573. const _component_el_container = vue.resolveComponent("el-container");
  5574. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  5575. return vue.openBlock(), vue.createBlock(_component_el_collapse_transition, null, {
  5576. default: vue.withCtx(() => [
  5577. vue.withDirectives(vue.createVNode(_component_el_container, {
  5578. style: vue.normalizeStyle(vue.unref(uiStore).panelStyle),
  5579. class: "base"
  5580. }, {
  5581. default: vue.withCtx(() => [
  5582. vue.createVNode(_component_el_header, { class: "header" }, {
  5583. default: vue.withCtx(() => [
  5584. vue.createVNode(PanelHeader)
  5585. ]),
  5586. _: 1
  5587. }),
  5588. vue.createVNode(_component_el_container, null, {
  5589. default: vue.withCtx(() => [
  5590. vue.createVNode(_component_el_aside, { class: "aside" }, {
  5591. default: vue.withCtx(() => [
  5592. vue.createVNode(PanelAside)
  5593. ]),
  5594. _: 1
  5595. }),
  5596. vue.createVNode(_component_el_main, { class: "main" }, {
  5597. default: vue.withCtx(() => [
  5598. vue.createVNode(_component_el_scrollbar, {
  5599. height: vue.unref(uiStore).scrollBarHeight
  5600. }, {
  5601. default: vue.withCtx(() => [
  5602. (vue.openBlock(), vue.createBlock(vue.KeepAlive, null, [
  5603. vue.createVNode(vue.Transition, {
  5604. name: "fade",
  5605. mode: "out-in"
  5606. }, {
  5607. default: vue.withCtx(() => [
  5608. vue.createVNode(_sfc_main$4)
  5609. ]),
  5610. _: 1
  5611. })
  5612. ], ####))
  5613. ]),
  5614. _: 1
  5615. }, 8, ["height"])
  5616. ]),
  5617. _: 1
  5618. })
  5619. ]),
  5620. _: 1
  5621. })
  5622. ]),
  5623. _: 1
  5624. }, 8, ["style"]), [
  5625. [vue.vShow, vue.unref(uiStore).uiConfig.isShowPanel]
  5626. ])
  5627. ]),
  5628. _: 1
  5629. });
  5630. };
  5631. }
  5632. });
  5633. const App = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-24895187"]]);
  5634. const cssLoader = (e) => {
  5635. const t = GM_getResourceText(e);
  5636. return GM_addStyle(t), t;
  5637. };
  5638. cssLoader("element-plus/dist/index.css");
  5639. const _sfc_main$2 = {};
  5640. const _hoisted_1 = {
  5641. xmlns: "http://www.w3.org/2000/svg",
  5642. width: "128",
  5643. height: "128",
  5644. class: "icon",
  5645. viewBox: "0 0 #### ####"
  5646. };
  5647. function _sfc_render(_ctx, _cache) {
  5648. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [
  5649. vue.createElementVNode("path", { d: "M831.825 63.94H191.94c-70.692 0-128 57.308-128 128v639.885c0 70.692 57.308 128 128 128h639.885c70.692 0 128-57.308 128-128V191.94c0-70.692-57.308-128-128-128zM895.885 832a63.835 63.835 0 0 1-63.973 63.886H192.088c-17.112 0-33.27-6.575-45.372-18.676S127.88 849.112 127.88 832V192a64.236 64.236 0 0 1 64.208-64.12h639.824A64.038 64.038 0 0 1 895.885 192v640z" }, null, -1),
  5650. vue.createElementVNode("path", { d: "M791.998 351.852H536a31.97 31.97 0 0 0 0 63.94h256a31.97 31.97 0 0 0 0-63.94zm0 256.121H536a31.97 31.97 0 0 0 0 63.94h256a31.97 31.97 0 0 0 0-63.94zm-447.###-79.975c-61.856 0-111.986 50.144-111.986 111.985S282.16 751.97 344.002 751.97s111.985-50.144 111.985-111.986-50.13-111.985-111.985-111.985zm33.982 145.982a48.045 48.045 0 1 1 14.088-33.982 47.746 47.746 0 0 1-14.088 33.986zm39.412-376.586L311.999 402.787l-41.391-41.395a31.97 31.97 0 1 0-45.213 45.213l63.997 64.002a31.97 31.97 0 0 0 45.214 0l128-128a31.97 31.97 0 0 0-45.21-45.213z" }, null, -1)
  5651. ]));
  5652. }
  5653. const TasksIcon = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
  5654. const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
  5655. __name: "InfoIcon",
  5656. props: {
  5657. item: {}
  5658. },
  5659. setup(__props) {
  5660. const props = __props;
  5661. const open = () => {
  5662. const { title, message } = props.item;
  5663. ElementPlus.ElMessageBox({
  5664. title,
  5665. message,
  5666. lockScroll: false,
  5667. autofocus: true,
  5668. confirmButtonText: "OK"
  5669. }).catch(() => {
  5670. });
  5671. };
  5672. return (_ctx, _cache) => {
  5673. const _component_el_icon = vue.resolveComponent("el-icon");
  5674. return vue.openBlock(), vue.createBlock(_component_el_icon, {
  5675. class: "info-icon",
  5676. onClick: open
  5677. }, {
  5678. default: vue.withCtx(() => _cache[0] || (_cache[0] = [
  5679. vue.createElementVNode("svg", {
  5680. xmlns: "http://www.w3.org/2000/svg",
  5681. width: "128",
  5682. height: "128",
  5683. class: "icon",
  5684. viewBox: "0 0 #### ####"
  5685. }, [
  5686. vue.createElementVNode("path", {
  5687. fill: "#276BC0",
  5688. d: "M512.67 959.47c-246.343 0-446.76-200.632-446.76-447.24S266.326 64.98 512.67 64.98s446.76 200.642 446.76 447.25-200.416 447.24-446.76 447.24zm0-829.04c-210.291 0-381.38 171.283-381.38 381.8s171.089 381.79 381.38 381.79 381.381-171.273 381.381-381.79-171.09-381.8-381.38-381.8z"
  5689. }),
  5690. vue.createElementVNode("path", {
  5691. fill: "#276BC0",
  5692. d: "M447.29 317.172a63.891 63.959 0 1 0 130.76 0 63.891 63.959 0 1 0-130.76 0Zm64.907 503.047c-30.093 0-54.235-24.416-54.235-54.541V482.062c0-30.126 24.142-54.541 54.235-54.541 30.094 0 54.236 24.416 54.236 54.541v283.616c0 30.125-24.142 54.54-54.236 54.54z"
  5693. })
  5694. ], -1)
  5695. ])),
  5696. _: 1
  5697. });
  5698. };
  5699. }
  5700. });
  5701. const InfoIcon = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-38289ed3"]]);
  5702. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  5703. __name: "TaskStatusIcon",
  5704. props: {
  5705. status: {}
  5706. },
  5707. setup(__props) {
  5708. return (_ctx, _cache) => {
  5709. const _component_Loading = vue.resolveComponent("Loading");
  5710. const _component_el_icon = vue.resolveComponent("el-icon");
  5711. const _component_Select = vue.resolveComponent("Select");
  5712. const _component_CloseBold = vue.resolveComponent("CloseBold");
  5713. return _ctx.status === "running" ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  5714. key: 0,
  5715. class: "status-icon is-loading"
  5716. }, {
  5717. default: vue.withCtx(() => [
  5718. vue.createVNode(_component_Loading)
  5719. ]),
  5720. _: 1
  5721. })) : _ctx.status === "done" ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  5722. key: 1,
  5723. class: "status-icon",
  5724. style: { "color": "#1ab059" }
  5725. }, {
  5726. default: vue.withCtx(() => [
  5727. vue.createVNode(_component_Select)
  5728. ]),
  5729. _: 1
  5730. })) : _ctx.status === "error" ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  5731. key: 2,
  5732. class: "status-icon",
  5733. style: { "color": "#ff6464" }
  5734. }, {
  5735. default: vue.withCtx(() => [
  5736. vue.createVNode(_component_CloseBold)
  5737. ]),
  5738. _: 1
  5739. })) : vue.createCommentVNode("", true);
  5740. };
  5741. }
  5742. });
  5743. const TaskStatusIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b4254e0f"]]);
  5744. const MyIconsVue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5745. __proto__: null,
  5746. Info: InfoIcon,
  5747. TaskStatus: TaskStatusIcon,
  5748. Tasks: TasksIcon
  5749. }, Symbol.toStringTag, { value: "Module" }));
  5750. const logger = new Logger("Main");
  5751. logger.log("document.readyState", document.readyState);
  5752. const pinia = pinia$1.createPinia();
  5753. const cacheStore = useCacheStore(pinia);
  5754. const moduleStore = useModuleStore(pinia);
  5755. cacheStore.checkCurrentScriptType();
  5756. logger.log("当前脚本的类型为", cacheStore.currentScriptType);
  5757. if (cacheStore.currentScriptType === "Main") {
  5758. cacheStore.startMainBLTHAliveHeartBeat();
  5759. }
  5760. moduleStore.loadModules("unknown");
  5761. await( waitForMoment("document-body"));
  5762. if (isTargetFrame()) {
  5763. const app = vue.createApp(App);
  5764. app.use(ElementPlus);
  5765. app.use(pinia);
  5766. for (const [key, component] of Object.entries(ElementPlusIconsVue__namespace)) {
  5767. app.component(key, component);
  5768. }
  5769. for (const [key, component] of Object.entries(MyIconsVue)) {
  5770. app.component(key, component);
  5771. }
  5772. moduleStore.loadModules("yes");
  5773. await( waitForMoment("document-end"));
  5774. const div = dce("div");
  5775. div.id = "BLTH";
  5776. document.body.append(div);
  5777. app.mount(div);
  5778. }
  5779. })(Vue, Pinia, _, ElementPlusIconsVue, CryptoJS, luxon, ElementPlus, VueDraggablePlus, hotkeys);