diff --git a/README.md b/README.md index 2e0e454..536b4a6 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,10 @@ ## 最新版本 -- 插件·Chrome/Edge:2022.05.31.15.26 [下载](ckc.zip) -- 自架云端Docker镜像:2022.05.31.15.24 [Docker Hub](https://hub.docker.com/repository/docker/easychen/checkchan) +- 插件·Chrome/Edge:2022.06.01.13.42 [下载](ckc.zip) +- 自架云端Docker镜像:2022.06.01.13.38 [Docker Hub](https://hub.docker.com/repository/docker/easychen/checkchan) - 远程桌面版Docker镜像:[Docker Hub](https://hub.docker.com/repository/docker/easychen/checkchan-chrome) -- 文档:2022.05.31.15.26 +- 文档:2022.06.01.13.42 - 更新日志:[GitHub](https://github.com/easychen/checkchan-dist/commits/main) 自架云端 Docker 命令( 将`API Key`从`YouRAPiK1`替换成`任意你想要的安全密码不要带$`): diff --git a/build.txt b/build.txt index 8113a03..66c3cdc 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -"2022.05.31.15.26" \ No newline at end of file +"2022.06.01.13.42" \ No newline at end of file diff --git a/ckc.zip b/ckc.zip index 1a43b0b..5812e70 100644 Binary files a/ckc.zip and b/ckc.zip differ diff --git a/docker.txt b/docker.txt index bc421a0..14b2be6 100644 --- a/docker.txt +++ b/docker.txt @@ -1 +1 @@ -"2022.05.31.15.24" \ No newline at end of file +"2022.06.01.13.38" \ No newline at end of file diff --git a/docker/api/func.js b/docker/api/func.js index 5c8d788..db44959 100644 --- a/docker/api/func.js +++ b/docker/api/func.js @@ -193,7 +193,7 @@ exports.monitor_auto = async ( item, cookies ) => break; case 'dom': default: - ret = await monitor_dom( item.url, item.path, (parseInt(item.delay)||0)*1000, the_cookies, item.id ); + ret = await monitor_dom( item , the_cookies ); return {status:!!(ret&&ret.text),value:ret.text||"",type:item.type,html:ret.html||"",link:ret.link||""}; } } catch (error) { @@ -272,8 +272,9 @@ async function monitor_rss(url,timeout=10000) return ret; } -async function monitor_dom_low(url, path, delay , cookies) +async function monitor_dom_low(item, cookies) { + const { url, path, delay } = item; console.log("in low dom"); try { const response = await fetch( url, { signal: timeoutSignal(delay<1?10000:delay) } ); @@ -302,12 +303,15 @@ async function monitor_dom_low(url, path, delay , cookies) } } -async function monitor_dom(url, path, delay , cookies, id) +async function monitor_dom(item , cookies) { + const { url, path, id } = item; + const delay = (parseInt(item.delay)||0)*1000; + console.log("in dom delay = ",delay); - if((!process.env.SNAP_URL_BASE) && delay < 1 ) + if((!process.env.SNAP_URL_BASE) && delay < 1 && !item.puppeteer_code && !item.browser_code ) { - const first = await monitor_dom_low(url, path, delay , cookies); + const first = await monitor_dom_low( item , cookies); console.log( "low result" , first.text ); if( first && first.text ) return first; }else @@ -336,8 +340,10 @@ async function monitor_dom(url, path, delay , cookies, id) if( isIterable(cookies) ) await page.setCookie( ...cookies ); - await page.evaluateOnNewDocument(() => { HTMLVideoElement.prototype.canPlayType = function () { return 'probably' }; }); - + await page.evaluateOnNewDocument(() => { HTMLVideoElement.prototype.canPlayType = function () { return 'probably' }; }); + + const { puppeteer_code, browser_code } = item; + try { await page.goto(url,{ @@ -350,7 +356,19 @@ async function monitor_dom(url, path, delay , cookies, id) await sleep(delay); } - ret = await page.evaluate( (path) => { + if( puppeteer_code ) + { + const hot_code = `(async( browser,page,puppeteer_code ) => + { + ${puppeteer_code} + })( browser,page,puppeteer_code )`; + // console.log( hot_code ); + eval( hot_code ); + await sleep(1000); + } + + ret = await page.evaluate( (path,browser_code ) => { + if( browser_code ) eval( browser_code ); let ret = window.document.querySelectorAll(path); if( !ret ) return false; console.log("query fail",path,ret); @@ -364,7 +382,7 @@ async function monitor_dom(url, path, delay , cookies, id) html += item.outerHTML ? item.outerHTML + "
" : ""; } return {html,text:path.indexOf(",") >= 0 ? texts.join("\n") :texts[0]||"","all":window.document.documentElement.innerHTML}; - },path); + },path,browser_code); if( !ret ) { diff --git a/index.html b/index.html index 201a25e..6a3254e 100644 --- a/index.html +++ b/index.html @@ -20,10 +20,10 @@

最新版本

自架云端 Docker 命令( 将API KeyYouRAPiK1替换成任意你想要的安全密码不要带$):

diff --git a/readme.html b/readme.html index a598681..117662b 100644 --- a/readme.html +++ b/readme.html @@ -9,10 +9,10 @@

最新版本

自架云端 Docker 命令( 将API KeyYouRAPiK1替换成任意你想要的安全密码不要带$):