修复空cookie监测失败的bug

This commit is contained in:
EasyChen
2022-05-25 01:15:56 +08:00
parent 24f98636f4
commit adf49bcced
6 changed files with 17 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
"20220524221642"
"20220525011511"
Binary file not shown.
+1
View File
@@ -10,6 +10,7 @@ COPY SourceHanSans.ttf /usr/share/fonts/TTF/SourceHanSans.ttf
# 测试时注释掉下一行
COPY api /api
RUN cd /api/ && npm install
COPY init.sh /init.sh
RUN chmod +x /init.sh
+11 -1
View File
@@ -203,7 +203,9 @@ async function monitor_dom(url, path, delay , cookies)
const page = await browser.newPage();
await page.setDefaultNavigationTimeout(delay+1000*5);
// await page.setDefaultNavigationTimeout(0);
await page.setCookie( ...cookies );
if( isIterable(cookies) )
await page.setCookie( ...cookies );
await page.evaluateOnNewDocument(() => { HTMLVideoElement.prototype.canPlayType = function () { return 'probably' }; });
try {
@@ -254,3 +256,11 @@ async function monitor_dom(url, path, delay , cookies)
}
}
function isIterable(obj) {
// checks for null and undefined
if (obj == null) {
return false;
}
return typeof obj[Symbol.iterator] === 'function';
}
+1 -1
View File
@@ -1 +1 @@
<div class='ext-info'><center>插件最后更新于2022-05-24 22:17:32 Build 20220524221642</center></div>
<div class='ext-info'><center>插件最后更新于2022-05-25 01:15:43 Build 20220525011511</center></div>
+3 -3
View File
@@ -9,7 +9,7 @@
<title>Check酱官网</title>
</head>
<body>
<div class='ext-info'><center>插件最后更新于2022-05-24 22:17:32 Build 20220524221642</center></div><h1>Check酱</h1>
<div class='ext-info'><center>插件最后更新于2022-05-25 01:15:43 Build 20220525011511</center></div><h1>Check酱</h1>
<p><strong>监测网页内容变化,并发送异动到微信</strong></p>
<p><g-emoji class="g-emoji" alias="warning" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/26a0.png">⚠️</g-emoji> docker目录下的代码仅供安全核查和编译多平台镜像,采用附加条件的GPLV3授权:</p>
<ol>
@@ -19,7 +19,7 @@
</ol>
<h2>TLDR版</h2>
<ul>
<li>Chrome/Edge浏览器插件:<a href="ckc.20220524221642.zip">下载</a></li>
<li>Chrome/Edge浏览器插件:<a href="ckc.20220525011511.zip">下载</a></li>
<li>自架版云端 Docker 命令(<code class="notranslate">API Key</code><code class="notranslate">YouRAPiK1</code>:</li>
</ul>
<div class="highlight highlight-source-shell"><pre>docker run -e API_KEY=YouRAPiK1 -e TZ=Asia/Chongqing -e ERROR_IMAGE=NORMAL -p 8088:80 -v <span class="pl-smi">$PWD</span>:/data -d ccr.ccs.tencentyun.com/ftqq/checkchan:latest</pre></div>
@@ -43,7 +43,7 @@
<blockquote>
<p>目前Check酱正在内测,尚未上架Edge商店,只能通过手工方式载入</p>
</blockquote>
<p>下载<a href="ckc.20220524221642.zip">插件ZIP包</a>,解压为目录(后文称其为A)。</p>
<p>下载<a href="ckc.20220525011511.zip">插件ZIP包</a>,解压为目录(后文称其为A)。</p>
<p>打开Edge的插件页面,打开「开发者模式」,点击「Load Unpacked」,选择上边解压得到的目录A。</p>
<p><a target="_blank" rel="noopener noreferrer" href="image/20220521140506.png"><img src="image/20220521140506.png" alt="" style="max-width: 100%;"></a></p>
<p>成功载入的话,就可以看到Check酱界面了。如果失败,通常是因为解压时多了一层目录导致的,可以试试重新选择A目录的下一级目录</p>