更新 'SrcJyAliDisk.js'

main
src48597962 2 years ago
parent eb39da2e3f
commit 35e652b80d
  1. 234
      SrcJyAliDisk.js

@ -1,68 +1,137 @@
function aliShare(share_id, folder_id, share_pwd) {
let rulepages = storage0.getMyVar('rulepages') || [];
if(rulepages.indexOf(folder_id)==-1){
rulepages.push(folder_id);
storage0.putMyVar('rulepages',rulepages);
clearMyVar('聚影云盘自动返回');
}
addListener("onClose", $.toString(() => {
let rulepages = storage0.getMyVar('rulepages') || [];
rulepages.length = rulepages.length-1;
storage0.putMyVar('rulepages',rulepages);
if(rulepages.length>0 && getMyVar('聚影云盘自动返回')=="1"){
back(false);
}
}));
setPageTitle(typeof (MY_PARAMS) != "undefined" && MY_PARAMS.dirname ? MY_PARAMS.dirname : '云盘共享文件 | 聚影√');
let d = [];
setPageTitle(typeof(MY_PARAMS)!="undefined" && MY_PARAMS.dirname ? MY_PARAMS.dirname : '云盘共享文件 | 聚影√');
share_pwd = share_pwd || "";
try{
let sharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token', { headers: headers, body: { "share_pwd": share_pwd, "share_id": share_id }, method: 'POST', timeout: 6000 })).share_token;
let orders = {
名称正序: 'name#ASC',
名称倒序: 'name#DESC',
时间正序: 'updated_at#ASC',
时间倒序: 'updated_at#DESC',
聚影排序: 'name#DESC'
};
let ordersKeys = Object.keys(orders);
let orderskey = orders[getItem('aliyun_order', '聚影排序')];
let style = getItem('aliyun_style', 'avatar');
let postdata = { "share_id": share_id, "parent_file_id": folder_id || "root", "limit": 200, "image_thumbnail_process": "image/resize,w_256/format,jpeg", "image_url_process": "image/resize,w_1920/format,jpeg/interlace,1", "video_thumbnail_process": "video/snapshot,t_1000,f_jpg,ar_auto,w_256", "order_by": orderskey.split('#')[0], "order_direction": orderskey.split('#')[1] };
headers['x-share-token'] = sharetoken;
let sharelist = JSON.parse(request('https://api.aliyundrive.com/adrive/v2/file/list_by_share', { headers: headers, body: postdata, method: 'POST' })).items;
if(sharelist.length>0){
if(!userinfo.nick_name){
d = d.concat(myDiskMenu(0));
let orders = {
名称正序: 'name#ASC',
名称倒序: 'name#DESC',
时间正序: 'updated_at#ASC',
时间倒序: 'updated_at#DESC',
聚影排序: 'name#DESC'
};
let ordersKeys = Object.keys(orders);
let orderskey = orders[getItem('aliyun_order', '聚影排序')];
let style = getItem('aliyun_style', 'avatar');
d.push(
{
title: "换源",
url: $().lazyRule((name) => {
if(getMyVar('SrcJy$back')=='1' || !name){
putMyVar('聚影云盘自动返回','1');
back(false);
return 'hiker://empty';
}else if(name){
return $('hiker://empty#noRecordHistory##noHistory#').rule((name) => {
let d = [];
d.push({
title: name+"-云盘聚合搜索",
url: "hiker://empty",
col_type: "text_center_1",
extra: {
id: "listloading",
lineVisible: false
}
})
setResult(d);
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliDisk.js');
aliDiskSearch(name);
}, name)
}
},MY_PARAMS.name||""),
col_type: 'icon_5',
img: 'https://hikerfans.com/tubiao/grey/175.png',
},
{
title: "样式",
url: $(['text_1', 'movie_2', 'card_pic_3', 'avatar']).select(() => {
setItem('aliyun_style', input);
refreshPage();
return 'toast://已切换';
}),
col_type: 'icon_5',//icon_round_small_4
img: 'https://hikerfans.com/tubiao/grey/168.png',
},
{
title: "排序",
url: $(ordersKeys, 2).select(() => {
setItem('aliyun_order', input);
refreshPage();
return 'toast://切换成功';
}),
col_type: 'icon_5',
img: 'https://hikerfans.com/tubiao/grey/221.png',
},
{
title: getItem('aliyun_playMode', '智能'),
url: $(['转码', '原画', '智能']).select(() => {
setItem('aliyun_playMode', input);
refreshPage();
return 'toast://切换成功';
}),
col_type: 'icon_5',
img: 'https://hikerfans.com/tubiao/grey/100.png',
},
{
title: '转存',
url: `smartdrive://share/browse?shareId=${share_id}&sharePwd=${share_pwd}`,
col_type: 'icon_5',
img: 'https://hikerfans.com/tubiao/grey/206.png',
},
{
col_type: 'line_blank',
}
)
try {
if (!userinfo.nick_name) {
d = d.concat(myDiskMenu(0));
} else {
share_pwd = share_pwd || "";
let getsharetoken = JSON.parse(request('https://api.aliyundrive.com/v2/share_link/get_share_token', { headers: headers, body: { "share_pwd": share_pwd, "share_id": share_id }, method: 'POST' }));
let sharetoken = getsharetoken.share_token;
let getShare = {};
if(errorCode[getsharetoken.code]){
d.push({
title: errorCode[getsharetoken.code],
url: 'hiker://empty',
col_type: "text_center_1"
})
setResult(d);
}else{
d.push(
{
title: getItem('aliyun_style', 'avatar'),
url: $(['text_1', 'movie_2', 'card_pic_3', 'avatar']).select(() => {
setItem('aliyun_style', input);
refreshPage();
return 'toast://已切换';
}),
col_type: 'icon_round_small_4',
img: 'https://hikerfans.com/img/ali_icon.svg',
},
{
title: getItem('aliyun_order', '聚影排序'),
url: $(ordersKeys, 2).select(() => {
setItem('aliyun_order', input);
refreshPage();
return 'toast://切换成功';
}),
col_type: 'icon_round_small_4',
img: 'https://hikerfans.com/img/ali_sort.svg',
},
{
title: getItem('aliyun_playMode', '智能') + '播放',
url: $(['转码', '原画', '智能']).select(() => {
setItem('aliyun_playMode', input);
refreshPage();
return 'toast://切换成功';
}),
col_type: 'icon_round_small_4',
img: 'https://hikerfans.com/img/ali_play.svg',
},
{
title: '转存网盘',
url: `smartdrive://share/browse?shareId=${share_id}&sharePwd=${share_pwd}`,
col_type: 'icon_round_small_4',
img: 'https://hikerfans.com/img/ali_fileinto.svg',
},
{
col_type: 'line_blank',
}
)
let postdata = { "share_id": share_id, "parent_file_id": folder_id || "root", "limit": 200, "image_thumbnail_process": "image/resize,w_256/format,jpeg", "image_url_process": "image/resize,w_1920/format,jpeg/interlace,1", "video_thumbnail_process": "video/snapshot,t_1000,f_jpg,ar_auto,w_256", "order_by": orderskey.split('#')[0], "order_direction": orderskey.split('#')[1] };
headers['x-share-token'] = sharetoken;
getShare = JSON.parse(request('https://api.aliyundrive.com/adrive/v2/file/list_by_share', { headers: headers, body: postdata, method: 'POST' }));
if(errorCode[getShare.code]){
d.push({
title: errorCode[getShare.code],
url: 'hiker://empty',
col_type: "text_center_1"
})
setResult(d);
}
}
let sharelist = getShare.items || [];
sharelist = sharelist.filter(item => {
return item.type == "file" || (item.type == "folder" && !folderFilter.test(item.name));
})
if(sharelist.length==1 && sharelist[0].type=="folder"){
rulepages.length = rulepages.length-1;
storage0.putMyVar('rulepages',rulepages);
aliShare(share_id, sharelist[0].file_id, share_pwd);
}else if (sharelist.length > 0) {
let sublist = sharelist.filter(item => {
return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
})
@ -73,20 +142,21 @@ function aliShare(share_id, folder_id, share_pwd) {
d.push({
title: item.name,
img: "hiker://files/cache/src/文件夹.svg",//#noRecordHistory##noHistory#
url: $("hiker://empty##https://www.aliyundrive.com/s/"+item.share_id+(item.file_id?"/folder/"+item.file_id:"")).rule((share_id, folder_id, share_pwd) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliDisk.js');
url: $("hiker://empty##https://www.aliyundrive.com/s/" + item.share_id + (item.file_id ? "/folder/" + item.file_id : "")).rule((share_id, folder_id, share_pwd) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/', '/master/') + 'SrcJyAliDisk.js');
aliShare(share_id, folder_id, share_pwd);
}, item.share_id, item.file_id, share_pwd),
col_type: style,
extra: {
dirname: item.name
dirname: item.name,
name: MY_PARAMS.name||""
}
})
})
let filelist = sharelist.filter((item) => {
return item.type == "file";
})
if(getItem('aliyun_order','聚影排序')=="聚影排序"){
if (getItem('aliyun_order', '聚影排序') == "聚影排序") {
filelist.sort(SortList);
}
filelist.forEach((item) => {
@ -96,18 +166,18 @@ function aliShare(share_id, folder_id, share_pwd) {
sub_file_id = sublist[0].file_id;
} else if (sublist.length > 1) {
sublist.forEach(it => {
let subnmae = it.name.substring(0, it.name.lastIndexOf(".")).replace(/\.chs|\.eng/g,'');
let subnmae = it.name.substring(0, it.name.lastIndexOf(".")).replace(/\.chs|\.eng/g, '');
if (item.name.includes(subnmae)) {
sub_file_id = it.file_id;
}
})
}
let filesize = item.size/1024/1024;
let filesize = item.size / 1024 / 1024;
d.push({
title: item.name,
img: item.thumbnail || (item.category == "video" ? "hiker://files/cache/src/影片.svg" : item.category == "audio" ? "hiker://files/cache/src/音乐.svg" : item.category == "image" ? "hiker://files/cache/src/图片.png" : "https://img.alicdn.com/imgextra/i1/O1CN01mhaPJ21R0UC8s9oik_!!6000000002049-2-tps-80-80.png"),
url: $("hiker://empty##").lazyRule((share_id, file_id, sub_file_id, share_pwd) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliPublic.js');
url: $("").lazyRule((share_id, file_id, sub_file_id, share_pwd) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/', '/master/') + 'SrcJyAliPublic.js');
let play = getAliUrl(share_id, file_id, share_pwd);
if (play.urls) {
let subtitle;
@ -118,11 +188,11 @@ function aliShare(share_id, folder_id, share_pwd) {
play['subtitle'] = subtitle;
}
return JSON.stringify(play);
}else{
} else {
return "toast://获取播放列表失败,看日志有无异常或token无效";
}
}, item.share_id, item.file_id, sub_file_id||"", share_pwd),
desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
}, item.share_id, item.file_id, sub_file_id || "", share_pwd),
desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize / 1024).toFixed(2) + 'GB',
col_type: style,
extra: {
id: item.file_id
@ -135,20 +205,21 @@ function aliShare(share_id, folder_id, share_pwd) {
url: "hiker://empty",
col_type: "text_center_1"
})
} else {
toast('列表为空');
}
}else{
toast('列表为空');
}
}catch(e){
} catch (e) {
log('获取共享文件列表失败>'+e.message);
d.push({
title: '该分享已失效或异常',
url: 'hiker://empty##',
url: 'hiker://empty',
col_type: "text_center_1"
})
toast('该分享已失效或异常,可刷新确认下');
}
setResult(d);
setLastChapterRule('js:' + $.toString(()=>{
setLastChapterRule('js:' + $.toString(() => {
setResult('');
}))
}
@ -189,27 +260,28 @@ function aliDiskSearch(input,data) {
col_type: "avatar",
extra: {
cls: "loadlist",
name: input,
dirname: input
}
};
let home = "https://www.aliyundrive.com/s/";
if(obj.name=="我的云盘"){
arr.url = $("hiker://empty##").rule((input) => {
arr.url = $(item.url).rule((input) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliDisk.js');
aliMyDisk(input);
},item.url);
}else if(item.url.includes(home)){
arr.url = $("hiker://empty##").rule((input) => {
arr.url = $(item.url).rule((input) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliDisk.js');
aliShareUrl(input);
},item.url);
} else if (obj.erparse) {
arr.url = $("hiker://empty##").lazyRule((url,erparse) => {
arr.url = $("hiker://empty").lazyRule((url,erparse) => {
eval('let Parse = '+erparse)
let aurl = Parse(url);
if(aurl.indexOf('aliyundrive.com')>-1){
return $("hiker://empty##").rule((input) => {
return $(aurl).rule((input) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0].replace('/Ju/','/master/') + 'SrcJyAliDisk.js');
aliShareUrl(input);
},aurl)

Loading…
Cancel
Save