升级版本并增加更新说明
This commit is contained in:
parent
6e7a923344
commit
af74a42fe7
BIN
base/rules.db
BIN
base/rules.db
Binary file not shown.
24
doc/更新日志.md
24
doc/更新日志.md
@ -1,3 +1,27 @@
|
|||||||
|
###### 2023/04/23
|
||||||
|
- [X] 3.9.41beta8 alist.js更新api,支持识别alist.json文件里的headers
|
||||||
|
参考下面配置,支持Authorization,不需要这个参数的网址一定留空或者不填写否则会出错:
|
||||||
|
```json
|
||||||
|
[{
|
||||||
|
"name": "🙋丫仙女",
|
||||||
|
"server": "http://alist.xiaoya.pro/",
|
||||||
|
"startPage": "/",
|
||||||
|
"showAll": false,
|
||||||
|
"search": true,
|
||||||
|
"headers": {
|
||||||
|
"Authorization":""
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"/abc": {
|
||||||
|
"password": "123"
|
||||||
|
},
|
||||||
|
"/abc/abc": {
|
||||||
|
"password": "123"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
```
|
||||||
|
|
||||||
###### 2023/04/09
|
###### 2023/04/09
|
||||||
- [X] 3.9.41beta4 设置drpy日志只保留3天防止日志太多导致磁盘占满搞挂容器
|
- [X] 3.9.41beta4 设置drpy日志只保留3天防止日志太多导致磁盘占满搞挂容器
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
3.9.41beta7
|
3.9.41beta8
|
||||||
@ -89,8 +89,12 @@ const http = function (url, options = {}) {
|
|||||||
if(!keys.includes('user-agent')){
|
if(!keys.includes('user-agent')){
|
||||||
options.headers['User-Agent'] = UA;
|
options.headers['User-Agent'] = UA;
|
||||||
}
|
}
|
||||||
|
console.log(JSON.stringify(options.headers));
|
||||||
try {
|
try {
|
||||||
const res = req(url, options);
|
const res = req(url, options);
|
||||||
|
// if(options.headers['Authorization']){
|
||||||
|
// console.log(res.content);
|
||||||
|
// }
|
||||||
res.json = () => res&&res.content ? JSON.parse(res.content) : null;
|
res.json = () => res&&res.content ? JSON.parse(res.content) : null;
|
||||||
res.text = () => res&&res.content ? res.content:'';
|
res.text = () => res&&res.content ? res.content:'';
|
||||||
return res
|
return res
|
||||||
@ -124,10 +128,10 @@ function get_drives_path(tid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_drives(name) {
|
function get_drives(name) {
|
||||||
const { settings, api, server } = __drives[name];
|
const { settings, api, server,headers } = __drives[name];
|
||||||
if (settings.v3 == null) { //获取 设置
|
if (settings.v3 == null) { //获取 设置
|
||||||
settings.v3 = false;
|
settings.v3 = false;
|
||||||
const data = http.get(server + '/api/public/settings').json().data;
|
const data = http.get(server + '/api/public/settings',{headers:headers}).json().data;
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
settings.title = data.find(x => x.key === 'title')?.value;
|
settings.title = data.find(x => x.key === 'title')?.value;
|
||||||
settings.v3 = false;
|
settings.v3 = false;
|
||||||
@ -208,13 +212,21 @@ function init(ext) {
|
|||||||
_path_param: _path_param,
|
_path_param: _path_param,
|
||||||
settings: {},
|
settings: {},
|
||||||
api: {},
|
api: {},
|
||||||
|
headers:item.headers||{},
|
||||||
getParams(path) {
|
getParams(path) {
|
||||||
const key = this._path_param.find(x => path.startsWith(x));
|
const key = this._path_param.find(x => path.startsWith(x));
|
||||||
return Object.assign({}, this.params[key], { path });
|
return Object.assign({}, this.params[key], { path });
|
||||||
},
|
},
|
||||||
getPath(path) {
|
getPath(path) {
|
||||||
const res = http.post(this.server + this.api.path, { data: this.getParams(path) }).json();
|
const res = http.post(this.server + this.api.path, { data: this.getParams(path),headers:this.headers }).json();
|
||||||
return this.settings.v3 ? res.data.content : res.data.files
|
// console.log(res);
|
||||||
|
try {
|
||||||
|
return this.settings.v3 ? res.data.content : res.data.files
|
||||||
|
}catch (e) {
|
||||||
|
console.log(`getPath发生错误:${e.message}`);
|
||||||
|
console.log(JSON.stringify(res));
|
||||||
|
return [{name:'error',value:JSON.stringify(res)}]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getFile(path) {
|
getFile(path) {
|
||||||
let raw_url = this.server+'/d'+path;
|
let raw_url = this.server+'/d'+path;
|
||||||
@ -222,7 +234,7 @@ function init(ext) {
|
|||||||
let data = {raw_url:raw_url,raw_url1:raw_url};
|
let data = {raw_url:raw_url,raw_url1:raw_url};
|
||||||
if(playRaw===1){
|
if(playRaw===1){
|
||||||
try {
|
try {
|
||||||
const res = http.post(this.server + this.api.file, { data: this.getParams(path) }).json();
|
const res = http.post(this.server + this.api.file, { data: this.getParams(path),headers:this.headers }).json();
|
||||||
data = this.settings.v3 ? res.data : res.data.files[0];
|
data = this.settings.v3 ? res.data : res.data.files[0];
|
||||||
if (!this.settings.v3) {
|
if (!this.settings.v3) {
|
||||||
data.raw_url = data.url; //v2 的url和v3不一样
|
data.raw_url = data.url; //v2 的url和v3不一样
|
||||||
@ -337,33 +349,44 @@ function category(tid, pg, filter, extend) {
|
|||||||
showMode = fl.show;
|
showMode = fl.show;
|
||||||
}
|
}
|
||||||
list.forEach(item => {
|
list.forEach(item => {
|
||||||
if (drives.is_subt(item)) {
|
if(item.name!=='error') {
|
||||||
subList.push(item.name);
|
if (drives.is_subt(item)) {
|
||||||
|
subList.push(item.name);
|
||||||
|
}
|
||||||
|
if (!drives.showAll && !drives.isFolder(item) && !drives.isVideo(item)) {
|
||||||
|
return //只显示视频文件和文件夹
|
||||||
|
}
|
||||||
|
let vod_time = drives.getTime(item);
|
||||||
|
let vod_size = get_size(item.size);
|
||||||
|
let remark = vod_time.split(' ')[0].substr(3) + '\t' + vod_size;
|
||||||
|
let vod_id = id + item.name + (drives.isFolder(item) ? '/' : '');
|
||||||
|
if (showMode === 'all') {
|
||||||
|
vod_id += '#all#';
|
||||||
|
}
|
||||||
|
print(vod_id);
|
||||||
|
const vod = {
|
||||||
|
'vod_id': vod_id,
|
||||||
|
'vod_name': item.name.replaceAll("$", "").replaceAll("#", ""),
|
||||||
|
'vod_pic': drives.getPic(item),
|
||||||
|
'vod_time': vod_time,
|
||||||
|
'vod_size': item.size,
|
||||||
|
'vod_tag': drives.isFolder(item) ? 'folder' : 'file',
|
||||||
|
'vod_remarks': drives.isFolder(item) ? remark + ' 文件夹' : remark
|
||||||
|
};
|
||||||
|
if (drives.isVideo(item)) {
|
||||||
|
vodFiles.push(vod);
|
||||||
|
}
|
||||||
|
allList.push(vod);
|
||||||
|
}else{
|
||||||
|
console.log(item);
|
||||||
|
const vod = {
|
||||||
|
vod_name: item.value,
|
||||||
|
vod_id: 'no_data',
|
||||||
|
vod_remarks: '不要点,会崩的',
|
||||||
|
vod_pic: 'https://ghproxy.com/https://raw.githubusercontent.com/hjdhnx/dr_py/main/404.jpg'
|
||||||
|
}
|
||||||
|
allList.push(vod);
|
||||||
}
|
}
|
||||||
if (!drives.showAll && !drives.isFolder(item) && !drives.isVideo(item)) {
|
|
||||||
return //只显示视频文件和文件夹
|
|
||||||
}
|
|
||||||
let vod_time = drives.getTime(item);
|
|
||||||
let vod_size = get_size(item.size);
|
|
||||||
let remark = vod_time.split(' ')[0].substr(3)+'\t'+vod_size;
|
|
||||||
let vod_id = id + item.name + (drives.isFolder(item) ? '/' : '');
|
|
||||||
if(showMode==='all'){
|
|
||||||
vod_id+='#all#';
|
|
||||||
}
|
|
||||||
print(vod_id);
|
|
||||||
const vod = {
|
|
||||||
'vod_id': vod_id,
|
|
||||||
'vod_name': item.name.replaceAll("$", "").replaceAll("#", ""),
|
|
||||||
'vod_pic': drives.getPic(item),
|
|
||||||
'vod_time':vod_time ,
|
|
||||||
'vod_size':item.size ,
|
|
||||||
'vod_tag': drives.isFolder(item) ? 'folder' : 'file',
|
|
||||||
'vod_remarks': drives.isFolder(item) ? remark + ' 文件夹' : remark
|
|
||||||
};
|
|
||||||
if (drives.isVideo(item)) {
|
|
||||||
vodFiles.push(vod);
|
|
||||||
}
|
|
||||||
allList.push(vod);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (vodFiles.length === 1 && subList.length > 0) { //只有一个视频 一个或者多个字幕 取相似度最高的
|
if (vodFiles.length === 1 && subList.length > 0) { //只有一个视频 一个或者多个字幕 取相似度最高的
|
||||||
|
|||||||
2
libs/alist.min.js
vendored
2
libs/alist.min.js
vendored
File diff suppressed because one or more lines are too long
@ -4,6 +4,9 @@
|
|||||||
"startPage": "/",
|
"startPage": "/",
|
||||||
"showAll": false,
|
"showAll": false,
|
||||||
"search": true,
|
"search": true,
|
||||||
|
"headers": {
|
||||||
|
"Authorization":"xxcxcxcxc"
|
||||||
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"/abc": {
|
"/abc": {
|
||||||
"password": "123"
|
"password": "123"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user