From 049e3b53f6dbb3bfc3c7780ebe89fefc4aa09097 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Sat, 29 Jun 2024 17:47:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJySet.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJySet.js | 114 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 22 deletions(-) diff --git a/SrcJySet.js b/SrcJySet.js index 98509114..8cbe2e82 100644 --- a/SrcJySet.js +++ b/SrcJySet.js @@ -1565,7 +1565,7 @@ function resource() { }) }), extra: { - titleVisible: true, + titleVisible: importtype=="1"?true:false, defaultValue: getMyVar('importinput', ''), onChange: 'putMyVar("importinput",input)' } @@ -1602,9 +1602,9 @@ function resource() { back(true); }else if(input=="删除"){ let importrecord = Juconfig['importrecord']||[]; - for(let i=0;i { - if(getMyVar('importinput', '')==""){ + let input = getMyVar('importinput', ''); + if(input==""){ return 'toast://请先输入链接地址' } - let input = getMyVar('importinput', ''); - if(input){ - let importrecord = Juconfig['importrecord']||[]; - if(importrecord.length>20){//保留20个记录 - importrecord.shift(); - } - if(!importrecord.some(item => item.url==input && item.type==getMyVar('importtype','1'))){ - importrecord.push({type:getMyVar('importtype','1'),url:input}); - Juconfig['importrecord'] = importrecord; - writeFile(cfgfile, JSON.stringify(Juconfig)); - } + + if(input.endsWith('/')){ + input = input.substring(0, input.length - 1); + } + let importrecord = Juconfig['importrecord']||[]; + if(importrecord.length>20){//保留20个记录 + importrecord.shift(); + } + if(!importrecord.some(item => item.url==input && item.type==getMyVar('importtype','1'))){ + importrecord.push({type:getMyVar('importtype','1'),url:input}); + Juconfig['importrecord'] = importrecord; + writeFile(cfgfile, JSON.stringify(Juconfig)); } require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJySet.js'); @@ -1655,8 +1657,78 @@ function resource() { } let html = request(input); let json = JSON.parse(html.split(`data-target="react-app.embeddedData">`)[1].split(``)[0]); - log(json); - return "hiker://empty"; + let list = json.tree.items; + let ghproxy = $.require('ghproxy').getproxy(); + let jiekous = list.filter(v=>v.contentType=="file").map(it=>{ + return { + name: it.name, + url: input + path.substr(path.lastIndexOf('/')), + ghproxy: ghproxy + } + }); + + let urls= []; + let datapath = globalMap0.getMyVar('gmParams').datapath + "libs_jk/"; + //多线程处理 + var task = function(obj) { + function shuffleArray(array) { + array.sort(() => Math.random() - 0.5); + return array; + } + let proxys = obj.ghproxy; + shuffleArray(proxys) + function getcontent() { + for(let i=0;idrpy库文件缓存失败>' + e.message); + } + + if(urlfile){ + arr['url'] = urlfile; + } + if(arr.url){ + urls.push(arr); + } + return 1; + } + + let jiekoutask = jiekous.map((list)=>{ + return { + func: task, + param: list, + id: list.name + } + }); + + be(jiekoutask, { + func: function(obj, id, error, taskResult) { + }, + param: { + } + }); + let jknum = 0; + try{ + jknum = jiekousave(urls, importmode); + }catch(e){ + jknum =-1; + log('TVBox导入接口保存有异常>'+e.message); + } + return 'toast://drpy库>查询'+jiekous.length+',导入'+jknum; } }, Juconfig, cfgfile), col_type: "text_2", @@ -1739,12 +1811,10 @@ function Resourceimport(input,importtype,importmode){ arr = { "name": obj.name, "type": "XBPQ", "ext": extfile}; }else if(/^csp_XYQHiker/.test(obj.api)){ arr = { "name": obj.name, "type": "XYQ", "ext": extfile}; - } - /* - else if(/drpy2/.test(obj.api)){ + }else if(/drpy2/.test(obj.api)){ arr = { "name": obj.name, "type": "drpy", "ext": extfile}; } - */ + if(arr){ let urlfile; if($.type(extfile)=='object'){