From 251c4ce8004988ed02bcb84b1586eb65b89582e7 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Wed, 31 Jul 2024 17:21:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJyPublic.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJyPublic.js | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/SrcJyPublic.js b/SrcJyPublic.js index 28bad24e..841b2c63 100644 --- a/SrcJyPublic.js +++ b/SrcJyPublic.js @@ -107,7 +107,7 @@ function checkBoxUrl(input) { let html; try{ showLoading('检测文件有效性'); - if(input.startsWith('/storage/')){input = "file://" + input} + if(input.startsWith('/')){input = "file://" + input} if(input.startsWith('http')){ let tmpFile = cachepath + md5(input) + ".json"; @@ -119,8 +119,10 @@ function checkBoxUrl(input) { }else{ html = fetch(tmpFile); } - }else{ + }else if(input.startsWith('file')){ html = fetch(input); + }else{ + html = ""; } if(html.includes('LuUPraez**')){ html = base64Decode(html.split('LuUPraez**')[1]); @@ -140,6 +142,43 @@ function checkBoxUrl(input) { hideLoading(); return {html: html} } +// urlfile缓存获取逻辑 +function getUrlFile(arr) { + let urlfile; + let extfile = arr.ext; + let filepath = cachepath + 'libs_jk/' + arr.type; + if($.type(extfile)=='object'){ + urlfile = filepath + '_' + arr.name + '.json'; + writeFile(urlfile, JSON.stringify(extfile)); + }else if(/^file/.test(extfile)){ + if(mode==1){ + urlfile = filepath + '_' + (extfile.includes('?')?obj.key:"")+extfile.split('?')[0].substr(extfile.split('?')[0].lastIndexOf('/')+1); + writeFile(urlfile, fetch(extfile)); + }else{ + urlfile = extfile.split('?')[0]; + } + }else if(/^http/.test(extfile)){ + urlfile = filepath + '_' + (extfile.includes('?')?obj.key:"")+extfile.split('?')[0].substr(extfile.split('?')[0].lastIndexOf('/')+1); + if(mode==1){ + try{ + let content = getContnet(extfile); + if (!content) { + urlfile = ''; + }else{ + if(arr.type=="XYQ" && !/分类片单标题/.test(content)){ + arr['onlysearch'] = 1; + } + if(arr.type=="XBPQ" && !/搜索url/.test(content)){ + obj.searchable = 0; + } + writeFile(urlfile, content); + } + }catch(e){ + log(obj.name + 'ext文件缓存失败>' + e.message); + } + } + } +} // 从box配置文件获取 function getBoxSource(input, mode, imports){ //input配置文件地址,mode模式1为导入,2为订阅,3为较验