更新 'SrcJyPublic.js'

master
src48597962 4 months ago
parent 8f5026891e
commit f19951331d
  1. 145
      SrcJyPublic.js

@ -929,89 +929,90 @@ function shareResource() {
if(options.filter((v, i) => checked[i]).length==0){ if(options.filter((v, i) => checked[i]).length==0){
return "toast://没有选择上传项"; return "toast://没有选择上传项";
} }
return $().lazyRule((options, checked)=>{
let text = {}; let text = {};
options.forEach((option,i)=>{ options.forEach((option,i)=>{
if(checked[i]){ if(checked[i]){
let filepath; let filepath;
if(option=="接口"){ if(option=="接口"){
filepath = globalMap0.getVar('Jy_gmParams').jkfile; filepath = globalMap0.getVar('Jy_gmParams').jkfile;
}else if(option=="解析"){ }else if(option=="解析"){
filepath = globalMap0.getVar('Jy_gmParams').jxfile; filepath = globalMap0.getVar('Jy_gmParams').jxfile;
}else if(option=="云盘"){ }else if(option=="云盘"){
filepath = globalMap0.getVar('Jy_gmParams').ypfile; filepath = globalMap0.getVar('Jy_gmParams').ypfile;
}else if(option=="直播"){ }else if(option=="直播"){
filepath = globalMap0.getVar('Jy_gmParams').rulepath + "liveconfig.json"; filepath = globalMap0.getVar('Jy_gmParams').rulepath + "liveconfig.json";
} }
let datafile = fetch(filepath); let datafile = fetch(filepath);
let datalist = []; let datalist = [];
if(datafile){ if(datafile){
if(option=="直播"){ if(option=="直播"){
eval("let tvconfig=" + datafile+ ";"); eval("let tvconfig=" + datafile+ ";");
text[option] = tvconfig; text[option] = tvconfig;
}else{ }else{
try{ try{
eval("datalist=" + datafile+ ";"); eval("datalist=" + datafile+ ";");
}catch(e){} }catch(e){}
if(datalist.length>600){ if(datalist.length>600){
toast(option+"超过600,建议先精简"); toast(option+"超过600,建议先精简");
}else if(datalist.length==0){ }else if(datalist.length==0){
toast(option+"数量为0"); toast(option+"数量为0");
} }
if(option=="接口"){ if(option=="接口"){
for(let i=0;i<datalist.length;i++){ for(let i=0;i<datalist.length;i++){
let data = datalist[i]; let data = datalist[i];
if(data.url.startsWith(globalMap0.getVar('Jy_gmParams').jkfilespath) && (($.type(data.ext)=="string" && data.ext.startsWith("file")) || !data.ext)){ if(data.url.startsWith(globalMap0.getVar('Jy_gmParams').jkfilespath) && (($.type(data.ext)=="string" && data.ext.startsWith("file")) || !data.ext)){
data.extstr = fetch(data.url) || fetch(data.ext.split("?")[0]); data.extstr = fetch(data.url) || fetch(data.ext.split("?")[0]);
if(!data.extstr){ if(!data.extstr){
datalist.splice(i,1);
i = i - 1;
}
}else if(!data.url.startsWith(globalMap0.getVar('Jy_gmParams').jkfilespath) && data.url.startsWith("hiker")){
datalist.splice(i,1); datalist.splice(i,1);
i = i - 1; i = i - 1;
} }
}else if(!data.url.startsWith(globalMap0.getVar('Jy_gmParams').jkfilespath) && data.url.startsWith("hiker")){
datalist.splice(i,1);
i = i - 1;
} }
} }
} if(datalist.length>0){
if(datalist.length>0){ text[option] = datalist;
text[option] = datalist; }
} }
} }
} }
})
if(Object.keys(text).length==0){
return "toast://无内容分享";
} }
}) let textcontent = globalMap0.getVar('Jy_gmParams').zip(JSON.stringify(text));
if(Object.keys(text).length==0){ log("content="+textcontent+"&path="+it.path+"&auth_code="+it.token);
return "toast://无内容分享"; try{
} let pasteupdate = JSON.parse(request("https://pasteme.tyrantg.com/api/update",{
let textcontent = globalMap0.getVar('Jy_gmParams').zip(JSON.stringify(text)); body: "content="+textcontent+"&path="+it.path+"&auth_code="+it.token,
log("content="+textcontent+"&path="+it.path+"&auth_code="+it.token); method: "POST"
//try{ }));
let pasteupdate = JSON.parse(request("https://pasteme.tyrantg.com/api/update",{ log(pasteupdate);
body: "content="+textcontent+"&path="+it.path+"&auth_code="+it.token, return "toast://"+pasteupdate.message;
method: "POST" /*
})); if(pasteupdate.result_code=="SUCCESS"){
log(pasteupdate); let resources = Juconfig['shareResource'] || [];
return "toast://"+pasteupdate.message; const index = resources.findIndex(item => item.path === it.path);
/* if (index !== -1) {
if(pasteupdate.result_code=="SUCCESS"){ resources[index].time = $.dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
let resources = Juconfig['shareResource'] || []; resources[index].options = options.filter((v, i) => checked[i]).join(",");
const index = resources.findIndex(item => item.path === it.path); }
if (index !== -1) { Juconfig['shareResource'] = resources;
resources[index].time = $.dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss"); writeFile(cfgfile, JSON.stringify(Juconfig));
resources[index].options = options.filter((v, i) => checked[i]).join(","); refreshPage(false);
return "toast://分享同步云端数据成功";
}else{
return 'toast://分享同步云端失败,'+pasteupdate.message;
} }
Juconfig['shareResource'] = resources; */
writeFile(cfgfile, JSON.stringify(Juconfig)); } catch (e) {
refreshPage(false); log('分享上传云端失败:'+e.message + " 错误行#" + e.lineNumber);
return "toast://分享同步云端数据成功"; return 'toast://分享上传云端失败,网络或内容出错';
}else{
return 'toast://分享同步云端失败,'+pasteupdate.message;
} }
*/ }, options, checked)
//} catch (e) {
// log('分享上传云端失败:'+e.message + " 错误行#" + e.lineNumber);
// return 'toast://分享上传云端失败,网络或内容出错';
//}
}, },
centerTitle: "取消" centerTitle: "取消"
}); });

Loading…
Cancel
Save