From ad20f5a4d075003718aa5ce396acceac89043586 Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Fri, 17 Feb 2023 17:10:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJyAlist.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJyAlist.js | 93 ++++++++++++++++----------------------------------- 1 file changed, 29 insertions(+), 64 deletions(-) diff --git a/SrcJyAlist.js b/SrcJyAlist.js index 01b93e68..a9d1facc 100644 --- a/SrcJyAlist.js +++ b/SrcJyAlist.js @@ -25,7 +25,7 @@ datalist = [ "server": "https://alist.shenzjd.com" } ]; -let fileFilter = 0; +let fileFilter = 1; let contain = /\.mp4|\.avi|\.mkv|\.rmvb|\.flv|\.mov|\.mp3|\.m4a|\.wma|\.flac/;//设置可显示的文件后缀 function gethtml(api,path,password) { @@ -84,14 +84,17 @@ function alistHome() { }); d.push({ title: '🔍搜索', - url: "", + url: $().lazyRule(() => { + require(config.依赖.match(/http(s)?:\/\/.*\//)[0] + 'SrcJyAlist.js'); + + }), col_type: 'scroll_button' }); d.push({ col_type: 'line' }); d.push({ - title: "加载中...", + title: "加载中,请稍后...", url: "hiker://empty", col_type: "text_center_1", extra: { @@ -117,7 +120,7 @@ function alistHome() { }); }catch(e){ updateItem('homeloading', { - title: "出错了,下拉刷新重试." + title: "超时或出错了,下拉刷新重试." }); } } else { @@ -137,7 +140,7 @@ function alistList(alistapi){ col_type: 'rich_text' }) d.push({ - title: "加载中...", + title: "加载中,请稍后...", url: "hiker://empty", col_type: "text_center_1", extra: { @@ -160,16 +163,16 @@ function alistList(alistapi){ }); }catch(e){ updateItem(listid, { - title: "出错了,下拉刷新重试." + title: "超时或出错了,下拉刷新重试." }); } } function arrayAdd(list,isdir,alistapi){ + let folderpath = (list.parent||MY_PARAMS.path||"") + "/" + item.name; let d = []; if(isdir){ list.forEach(item => { - let folderpath = (MY_PARAMS.path||"") + "/" + item.name; d.push({ title: item.name, img: item.thumb || config.依赖.match(/http(s)?:\/\/.*\//)[0] + "img/文件夹.svg", @@ -179,13 +182,13 @@ function arrayAdd(list,isdir,alistapi){ },alistapi), col_type: 'avatar', extra: { - path: folderpath + path: folderpath, + cls: "alist" } }) }) }else{ list.forEach(item => { - let path = (MY_PARAMS.path||"") + "/" + item.name; d.push({ title: item.name, img: item.thumb || "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg@Referer=", @@ -194,6 +197,9 @@ function arrayAdd(list,isdir,alistapi){ return alistUrl(api,path,pwd,sign); }, alistapi.server, path, alistapi.password, item.sign), col_type: 'avatar', + extra: { + cls: "alist" + } }) }) } @@ -216,59 +222,18 @@ function alistUrl(api,path,pwd,sign) { } } - - -/* - -hiker://empty@lazyRule=.js:( -(item, url, path, list, u) => { - const type_dict = {0: $.toString((url) => { - return "download://" + url; - } - , url), 2: $.toString((url, list, u, path) => { - var subtitles = $.require("api").getSubtitles(list, u, path); - if (subtitles.length > 1) { - var namelist = subtitles.map(function (item) { - return item.name; - }); - return $(namelist, 1, "\u8bf7\u9009\u62e9\u5b57\u5e55").select((subtitles, namelist, url) => { - return JSON.stringify({urls: [url], subtitle: subtitles[namelist.indexOf(input)].url}); - } - , subtitles, namelist, url); - } else { - return url + "#isVideo=true#"; - } - } - , url, list, u, path), 3: $.toString((url) => { - return url + "#isMusic=true#"; - } - , url), 4: $.toString((url) => { - return "download://" + url; - } - , url), 5: $.toString((url) => { - return url + "#.jpg"; - } - , url)}; - if (item.is_dir) { - return "hiker://page/home?page=fypage"; - } else { - if ($.require("api").getHzm(item.name) == "pdf") { - return "https://alist-org.github.io/pdf.js/web/viewer.html?file=" + url; - } else { - if ($.office.includes($.require("api").getHzm(item.name))) { - return $(["\u5fae\u8f6f", "\u8c37\u6b4c"]).select((url) => { - if (input == "\u5fae\u8f6f") { - return "https://view.officeapps.live.com/op/view.aspx?src=" + url; - } else { - return "https://docs.google.com/gview?&embedded=true&url=" + url; - } - } - , url); - } else { - return eval(type_dict[item.type]); - } - } +function alistSearch(api,key) { + deleteItemByCls('alist'); + try{ + let json = JSON.parse(fetch(api + "/api/fs/search", {body:{"per_page":100,"page":1,"parent":"/","keywords":key},method:'POST',timeout:10000})); + if(json.code==200){ + let dirlist = getlist(json.data.content,1); + addItemBefore('homeloading', arrayAdd(dirlist,1,alistapi)); + + let filelist = getlist(json.data.content,0); + addItemBefore('homeloading', arrayAdd(filelist,0,alistapi)); } -} -)({"name":"微软常用运行库.exe","size":34013425,"is_dir":false,"modified":"2021-11-19T12:42:25.187Z","sign":"eXl-v6t8UDdV7GwVao27L9UB3J1We2VtKXQrGbC2x3M=:0","thumb":"","type":0},"https://pan.ichuguang.com/d/%E7%B2%BE%E5%93%81%E8%BD%AF%E4%BB%B6/%E8%A1%A5%E4%B8%81%E4%BF%AE%E5%A4%8D/%E5%BE%AE%E8%BD%AF%E5%B8%B8%E7%94%A8%E8%BF%90%E8%A1%8C%E5%BA%93.exe?sign=eXl-v6t8UDdV7GwVao27L9UB3J1We2VtKXQrGbC2x3M=:0","/精品软件/补丁修复",[{"name":"微软常用运行库.exe","size":34013425,"is_dir":false,"modified":"2021-11-19T12:42:25.187Z","sign":"eXl-v6t8UDdV7GwVao27L9UB3J1We2VtKXQrGbC2x3M=:0","thumb":"","type":0},{"name":".NET Framework.exe","size":137905904,"is_dir":false,"modified":"2021-11-19T12:42:25.239Z","sign":"xrygxvnHgbXyyWeAIywo4mgzS6qDmd_kEjUAnoxqCtg=:0","thumb":"","type":0},{"name":"dll修复工具.exe","size":199775122,"is_dir":false,"modified":"2021-11-19T12:42:25.3Z","sign":"vg0luZS1OlImU5ufO25z7uW5wrdPo7Ve8k1BRhA_nbE=:0","thumb":"","type":0}],"https://pan.ichuguang.com/") -*/ \ No newline at end of file + }catch(e){ + + } +} \ No newline at end of file