From f273aeb40029546c0feeae64cea5216c0c9aa440 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Thu, 27 Apr 2023 12:41:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJuSet.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJuSet.js | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/SrcJuSet.js b/SrcJuSet.js index 4ad5c709..39a93138 100644 --- a/SrcJuSet.js +++ b/SrcJuSet.js @@ -23,7 +23,6 @@ function SRCSet() { let sourcenames = yidatalist.map(it=>{ return it.name; }) - d.push({ title: sourcename?sourcename:'设置主页源', @@ -133,6 +132,9 @@ function SRCSet() { d.push({ title: '导入', url: $("", "聚分享口令的云剪贴板").input((sourcefile,ImportType) => { + require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJuSet.js'); + JYimport(input) + /* try { let inputname = input.split('¥')[0]; if (inputname == "聚阅接口") { @@ -174,6 +176,7 @@ function SRCSet() { log('√口令解析失败>'+e.message); return "toast://口令有误"; } + */ }, sourcefile, Juconfig['ImportType']), img: "https://lanmeiguojiang.com/tubiao/more/43.png", col_type: "icon_4", @@ -585,4 +588,38 @@ function jiekouapi(sourcefile, data) { }, sourcefile) }); setResult(d); +} + +function JYimport(input) { + try { + let inputname = input.split('¥')[0]; + if (inputname == "聚阅接口") { + showLoading("正在导入,请稍后..."); + let parseurl = aesDecode('SrcJu', input.split('¥')[1]); + let content = parsePaste(parseurl); + let datalist2 = JSON.parse(aesDecode('SrcJu', content)); + let num = 0; + for (let i = 0; i < datalist2.length; i++) { + if (Juconfig['ImportType']!="Skip" && datalist.some(item => item.name == datalist2[i].name && item.type==datalist2[i].type)) { + let index = datalist.indexOf(datalist.filter(d => d.name == datalist2[i].name && d.type==datalist2[i].type)[0]); + datalist.splice(index, 1); + datalist.push(datalist2[i]); + num = num + 1; + }else if (!datalist.some(item => item.name == datalist2[i].name && item.type==datalist2[i].type)) { + datalist.push(datalist2[i]); + num = num + 1; + } + } + writeFile(sourcefile, JSON.stringify(datalist)); + clearMyVar('searchMark'); + hideLoading(); + refreshPage(false); + return "toast://合计" + datalist2.length + "个,导入" + num + "个"; + } else { + return "toast://非法口令"; + } + } catch (e) { + log('√口令解析失败>'+e.message); + return "toast://口令有误"; + } } \ No newline at end of file