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