Update alist pass json format
This commit is contained in:
parent
5b5e4d27f8
commit
a5a69ef7d7
|
|
@ -20,7 +20,7 @@ public class Drive {
|
|||
@SerializedName("drives")
|
||||
private List<Drive> drives;
|
||||
@SerializedName("params")
|
||||
private Map<String, String> params;
|
||||
private List<Param> params;
|
||||
@SerializedName("login")
|
||||
private Login login;
|
||||
@SerializedName("vodPic")
|
||||
|
|
@ -44,8 +44,8 @@ public class Drive {
|
|||
return drives == null ? new ArrayList<>() : drives;
|
||||
}
|
||||
|
||||
public Map<String, String> getParams() {
|
||||
return params == null ? new HashMap<>() : params;
|
||||
public List<Param> getParams() {
|
||||
return params == null ? new ArrayList<>() : params;
|
||||
}
|
||||
|
||||
public Login getLogin() {
|
||||
|
|
@ -153,6 +153,11 @@ public class Drive {
|
|||
return headers;
|
||||
}
|
||||
|
||||
public String findPass(String path) {
|
||||
for (Param param : getParams()) if (path.startsWith(param.getPath())) return param.getPass();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) return true;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.github.catvod.bean.alist;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Param {
|
||||
|
||||
@SerializedName("path")
|
||||
private String path;
|
||||
@SerializedName("pass")
|
||||
private String pass;
|
||||
|
||||
public String getPath() {
|
||||
return TextUtils.isEmpty(path) ? "" : path;
|
||||
}
|
||||
|
||||
public String getPass() {
|
||||
return TextUtils.isEmpty(pass) ? "" : pass;
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ public class AList extends Spider {
|
|||
path = path.startsWith(drive.getPath()) ? path : drive.getPath() + path;
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("path", path);
|
||||
params.put("password", drive.getParams().get(path));
|
||||
params.put("password", drive.findPass(path));
|
||||
String response = post(drive, drive.getApi(), params.toString());
|
||||
return Item.objectFrom(getDetailJson(drive.isNew(), response));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -182,7 +182,7 @@ public class AList extends Spider {
|
|||
path = path.startsWith(drive.getPath()) ? path : drive.getPath() + path;
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("path", path);
|
||||
params.put("password", drive.getParams().get(path));
|
||||
params.put("password", drive.findPass(path));
|
||||
String response = post(drive, drive.listApi(), params.toString());
|
||||
List<Item> items = Item.arrayFrom(getListJson(drive.isNew(), response));
|
||||
Iterator<Item> iterator = items.iterator();
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
9eeae00749e17517c5041546a98418cd
|
||||
4556ab64060bfdf40d0e6dcc0145862e
|
||||
|
|
|
|||
Loading…
Reference in New Issue