更新 'SrcJyAliDisk.js'

master
src48597962 2 years ago
parent 106de44062
commit 2c7d980bc5
  1. 207
      SrcJyAliDisk.js

@ -93,7 +93,7 @@ function aliShare(share_id, folder_id, share_pwd) {
}else{
return "toast://获取转码播放列表失败,阿里token无效";
}
}, item.share_id, item.file_id, sub_file_id, share_pwd),
}, 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: 'avatar',
extra: {
@ -234,93 +234,150 @@ function aliDiskSearch(input) {
function aliMyDisk(folder_id,nofilter) {
let d = [];
setPageTitle(typeof(MY_PARAMS)!="undefined" && MY_PARAMS.dirname ? MY_PARAMS.dirname : '我的云盘文件 | 聚影√');
try{
let drive_id = userinfo.default_drive_id;
let postdata = {"drive_id":drive_id,"parent_file_id":folder_id,"limit":200,"all":true,"url_expire_sec":86400,"image_thumbnail_process":"image/resize,w_400/format,jpeg","image_url_process":"image/resize,w_1920/format,jpeg","video_thumbnail_process":"video/snapshot,t_1000,f_jpg,ar_auto,w_300","order_by":"name","order_direction":"ASC"};
headers['authorization'] = 'Bearer ' + userinfo.access_token;
let myfilelist = JSON.parse(request('https://api.aliyundrive.com/adrive/v3/file/list', { headers: headers, body: postdata, method: 'POST' })).items;
let sublist = myfilelist.filter(item => {
return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
})
let dirlist = myfilelist.filter((item) => {
return item.type == "folder";
})
dirlist.forEach((item) => {
if(userinfo&&userinfo.user_id){
if(folder_id=="root"){
log(userinfo.user_id);
d.push({
title: item.name,
img: "hiker://files/cache/src/文件夹.svg",
url: $("hiker://empty").rule((folder_id,nofilter) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
aliMyDisk(folder_id,nofilter);
}, item.file_id,nofilter),
col_type: 'avatar',
extra: {
dirname: item.name
}
title: "我的云盘",
url: "",
col_type: 'avatar'
})
})
let filelist = myfilelist.filter((item) => {
return item.type == "file";
})
filelist.sort(SortList);
filelist.forEach((item) => {
if (item.category == "video" || nofilter) {
let sub_file_url;
if (sublist.length == 1) {
sub_file_url = sublist[0].url;
} else if (sublist.length > 1) {
sublist.forEach(it => {
if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
sub_file_url = it.url;
}
})
}
let filesize = item.size/1024/1024;
}
try{
let drive_id = userinfo.default_drive_id;
let postdata = {"drive_id":drive_id,"parent_file_id":folder_id,"limit":200,"all":true,"url_expire_sec":86400,"image_thumbnail_process":"image/resize,w_400/format,jpeg","image_url_process":"image/resize,w_1920/format,jpeg","video_thumbnail_process":"video/snapshot,t_1000,f_jpg,ar_auto,w_300","order_by":"name","order_direction":"ASC"};
headers['authorization'] = 'Bearer ' + userinfo.access_token;
let myfilelist = JSON.parse(request('https://api.aliyundrive.com/adrive/v3/file/list', { headers: headers, body: postdata, method: 'POST' })).items;
let sublist = myfilelist.filter(item => {
return item.type == "file" && /srt|vtt|ass/.test(item.file_extension);
})
let dirlist = myfilelist.filter((item) => {
return item.type == "folder";
})
dirlist.forEach((item) => {
d.push({
title: item.name,
img: item.thumbnail+"@Referer=https://www.aliyundrive.com/" || (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((file_id,file_url,sub_file_url) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
if(alitoken){
file_url = base64Decode(file_url);
sub_file_url = sub_file_url?base64Decode(sub_file_url):"";
let play = aliMyPlayUrl(file_id);
if (play.urls) {
if (sub_file_url) {
play['subtitle'] = sub_file_url;
img: "hiker://files/cache/src/文件夹.svg",
url: $("hiker://empty").rule((folder_id,nofilter) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliDisk.js');
aliMyDisk(folder_id,nofilter);
}, item.file_id,nofilter),
col_type: 'avatar',
extra: {
dirname: item.name
}
})
})
let filelist = myfilelist.filter((item) => {
return item.type == "file";
})
filelist.sort(SortList);
filelist.forEach((item) => {
if (item.category == "video" || nofilter) {
let sub_file_url;
if (sublist.length == 1) {
sub_file_url = sublist[0].url;
} else if (sublist.length > 1) {
sublist.forEach(it => {
if (it.name.substring(0, it.name.lastIndexOf(".")) == item.name.substring(0, item.name.lastIndexOf("."))) {
sub_file_url = it.url;
}
})
}
let filesize = item.size/1024/1024;
d.push({
title: item.name,
img: item.thumbnail+"@Referer=https://www.aliyundrive.com/" || (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((file_id,file_url,sub_file_url) => {
require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAliPublic.js');
if(alitoken){
file_url = base64Decode(file_url);
sub_file_url = sub_file_url?base64Decode(sub_file_url):"";
let play = aliMyPlayUrl(file_id);
if (play.urls) {
if (sub_file_url) {
play['subtitle'] = sub_file_url;
}
play.urls.unshift(file_url+ "#.m3u8#pre#");
play.names.unshift("原始 文件");
play.headers.unshift({'Referer':'https://www.aliyundrive.com/'});
return JSON.stringify(play);
}else{
return "toast://"+play.message;
}
play.urls.unshift(file_url+ "#.m3u8#pre#");
play.names.unshift("原始 文件");
play.headers.unshift({'Referer':'https://www.aliyundrive.com/'});
log(play)
return JSON.stringify(play);
}else{
return "toast://"+play.message;
return "toast://未获取到阿里token";
}
}else{
return "toast://未获取到阿里token";
}, item.file_id, base64Encode(item.url), sub_file_url?base64Encode(sub_file_url):""),
desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
col_type: 'avatar',
extra: {
id: item.file_id
}
}, item.file_id, base64Encode(item.url), sub_file_url?base64Encode(sub_file_url):""),
desc: filesize < 1024 ? filesize.toFixed(2) + 'MB' : (filesize/1024).toFixed(2) + 'GB',
col_type: 'avatar',
})
}
})
if(!nofilter){
d.push({
title: "““””<small><font color=#f20c00>已开启文件过滤,仅显示视频文件</font></small>",
url: "hiker://empty",
col_type: "text_center_1"
})
}
}catch(e){
log(e.message);
toast('有异常,可查看日志');
}
}else{
d.push({
title: "登录",
url: $("hiker://empty##").rule(() => {
var d = [];
let url = 'https://auth.aliyundrive.com/v2/oauth/authorize?login_type=custom&response_type=code&redirect_uri=https%3A%2F%2Fwww.aliyundrive.com%2Fsign%2Fcallback&client_id=25dzX3vbYqktVxyX&state=%7B%22origin%22%3A%22*%22%7D#/login'
var js = $.toString(() => {
const tokenFunction = function() {
var token = JSON.parse(localStorage.getItem('token'))
if (token && token.refresh_token) {
let alistfile = "hiker://files/rules/Src/Juying/Alist.json";
try {
var alistData = JSON.parse(fy_bridge_app.fetch(alistfile));
} catch (e) {
var alistData = {};
}
let alistconfig = alistData.config || {};
alistconfig.alitoken = token.refresh_token;
alistData.config = alistconfig;
fy_bridge_appwriteFile(alistfile, JSON.stringify(alistData));
localStorage.clear();
alert('TOKEN获取成功,请勿泄漏个人隐私!退出该页面后刷新重试!');
fy_bridge_app.back(true);
return;
} else {
token_timer();
}
}
var token_timer = function() {
setTimeout(tokenFunction, 300)
};
token_timer();
//tokenFunction();
})
d.push({
url: url,
col_type: 'x5_webview_single',
desc: '100%&&float',
extra: {
id: item.file_id
canBack: true,
js: js
}
})
}
setResult(d);
}),
col_type: 'avatar'
})
if(!nofilter){
d.push({
title: "““””<small><font color=#f20c00>已开启文件过滤,仅显示视频文件</font></small>",
url: "hiker://empty",
col_type: "text_center_1"
})
}
}catch(e){
log(e.message);
toast('有异常,可查看日志');
}
setResult(d);
setLastChapterRule('js:' + $.toString(()=>{
setResult('');

Loading…
Cancel
Save