X-plore v4.37.09版本的 MD5 值为:1ac588cd7c13e9578c2d4266387e2f4f
以下内容为反编译后的 a.java 源代码,内容仅作参考
package K6;
import F6.AbstractC1143l;
import F6.C;
import F6.C1141j;
import F6.P;
import F7.w;
import X6.m;
import android.net.Uri;
import b7.C1953d;
import b7.x;
import c3.dDy.EPlQ;
import com.lonelycatgames.Xplore.FileSystem.h;
import h7.AbstractC6736y;
import h7.C6709J;
import h7.C6730s;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import t6.k;
import u6.AbstractC7556B;
import v7.InterfaceC7625a;
import v7.l;
import v7.p;
import w7.AbstractC7771k;
import w7.AbstractC7777q;
import w7.AbstractC7780t;
import w7.AbstractC7781u;
import z6.AbstractC7990b;
import z6.AbstractC7992d;
import z6.C7989a;
public final class a extends K6.b implements AbstractC7992d.j {
private long f6708w0;
private final String f6709x0;
public static final d f6706y0 = new d(null);
public static final int f6707z0 = 8;
private static final AbstractC7990b.C0993b f6704A0 = new b(AbstractC7556B.f55788r0, c.f6713I);
private static final SimpleDateFormat f6705B0 = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ssZZZZZ", Locale.US);
public static final class C0195a extends A6.a {
public static final class C0196a extends AbstractC7781u implements InterfaceC7625a {
final String f6710b;
C0196a(String str) {
super(0);
this.f6710b = str;
}
@Override
public final Object c() {
return a.f6706y0.e("authorization_code", "code=" + this.f6710b);
}
}
public static final class b extends AbstractC7781u implements l {
b() {
super(1);
}
public final void a(Object obj) {
AbstractC7780t.f(obj, "r");
String str = obj instanceof String ? (String) obj : null;
if (obj instanceof JSONObject) {
JSONObject jSONObject = (JSONObject) obj;
String optString = jSONObject.optString("access_token");
AbstractC7780t.c(optString);
if (optString.length() > 0) {
C0195a.J(C0195a.this).u3(optString, jSONObject.optString("refresh_token"));
C0195a.this.f();
int i9 = (7 ^ 0) | 0;
C1141j.o1(C0195a.J(C0195a.this), C0195a.this.u(), false, null, 6, null);
return;
}
String optString2 = jSONObject.optString("error_description");
AbstractC7780t.c(optString2);
String str2 = optString2.length() > 0 ? optString2 : null;
str = str2 == null ? jSONObject.optString("error", "Auth failed") : str2;
}
C0195a.this.G(str);
}
@Override
public Object h(Object obj) {
a(obj);
return C6709J.f49946a;
}
}
public C0195a(m mVar, a aVar) {
super(mVar, aVar, "https://www.lonelycatgames.com/internal/xplore/authcode", !aVar.T2());
AbstractC7780t.f(mVar, "p");
AbstractC7780t.f(aVar, "server");
}
public static final a J(C0195a c0195a) {
return (a) c0195a.v();
}
@Override
protected void A(String str) {
AbstractC7780t.f(str, "url");
Uri parse = Uri.parse(str);
AbstractC7780t.e(parse, "parse(...)");
L(parse);
}
@Override
public void H() {
w().loadUrl(((a) v()).E3().toString());
}
public final void L(Uri uri) {
AbstractC7780t.f(uri, "uri");
String queryParameter = uri.getQueryParameter("code");
if (queryParameter != null) {
B(new C0196a(queryParameter), new b());
} else {
String queryParameter2 = uri.getQueryParameter("error_description");
if (queryParameter2 == null) {
queryParameter2 = uri.getQueryParameter("error");
}
G(queryParameter2);
}
}
}
public static final class b extends AbstractC7990b.C0993b {
private final String f6712f;
b(int i9, c cVar) {
super(i9, "Box.net", cVar, false, 8, null);
this.f6712f = "Box";
}
@Override
public String c() {
return this.f6712f;
}
}
class c extends AbstractC7777q implements p {
public static final c f6713I = new c();
c() {
super(2, a.class, "<init>", "<init>(Lcom/lonelycatgames/Xplore/FileSystem/net/CloudFileSystem;Landroid/net/Uri;)V", 0);
}
@Override
public final a r(C7989a c7989a, Uri uri) {
AbstractC7780t.f(c7989a, "p0");
AbstractC7780t.f(uri, "p1");
return new a(c7989a, uri, null);
}
}
public static final class d {
private d() {
}
public d(AbstractC7771k abstractC7771k) {
this();
}
public final void c(JSONObject jSONObject, String str) {
jSONObject.put("parent", k.c0(AbstractC6736y.a("id", Long.valueOf(Long.parseLong(str)))));
}
public final String d(C c9) {
return c9 instanceof P ? "files" : "folders";
}
public final JSONObject e(String str, String str2) {
String str3;
String o02;
AbstractC7780t.f(str, "grantType");
AbstractC7780t.f(str2, "cmd");
URLConnection openConnection = new URL("https://www.box.com/api/oauth2/token").openConnection();
AbstractC7780t.d(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
OutputStream outputStream = httpURLConnection.getOutputStream();
AbstractC7780t.e(outputStream, "getOutputStream(...)");
k.N0(outputStream, "grant_type=" + str + "&client_id=znv9api6cexl0gyhuic3my76gb70ud8a&client_secret=K2OJrt2Nm8JdoYH069NcoFmobhwNSmzf&" + str2);
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
InputStream inputStream = httpURLConnection.getInputStream();
AbstractC7780t.e(inputStream, "getInputStream(...)");
return new JSONObject(k.o0(inputStream));
}
InputStream errorStream = httpURLConnection.getErrorStream();
if (errorStream == null || (o02 = k.o0(errorStream)) == null || (str3 = k.X(new JSONObject(o02), "error_description")) == null) {
str3 = "Invalid response: " + responseCode;
}
throw new IOException(str3);
}
public final AbstractC7990b.C0993b f() {
return a.f6704A0;
}
}
public static final class e extends AbstractC7781u implements l {
final String f6714b;
e(String str) {
super(1);
this.f6714b = str;
}
public final void a(HttpURLConnection httpURLConnection) {
AbstractC7780t.f(httpURLConnection, "$this$createAndRunHttpConnection");
if (this.f6714b != null) {
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
OutputStream outputStream = httpURLConnection.getOutputStream();
AbstractC7780t.e(outputStream, "getOutputStream(...)");
k.N0(outputStream, this.f6714b);
}
}
@Override
public Object h(Object obj) {
a((HttpURLConnection) obj);
return C6709J.f49946a;
}
}
private a(C7989a c7989a, Uri uri) {
super(c7989a, uri, f6704A0.d(), null, 8, null);
this.f6709x0 = "0";
t2(uri);
}
public a(C7989a c7989a, Uri uri, AbstractC7771k abstractC7771k) {
this(c7989a, uri);
}
private final JSONObject B3(String str, String str2, String str3) {
JSONObject jSONObject;
String h9 = AbstractC7990b.f60542s0.h(N2(str, "https://api.box.com/2.0/" + str2, new e(str3)));
if (h9.length() == 0) {
jSONObject = null;
} else {
try {
jSONObject = new JSONObject(h9);
} catch (JSONException e9) {
throw new IOException(k.Q(e9));
}
}
return jSONObject;
}
static JSONObject C3(a aVar, String str, String str2, String str3, int i9, Object obj) {
if ((i9 & 4) != 0) {
str3 = null;
}
return aVar.B3(str, str2, str3);
}
private final JSONObject D3(C1141j c1141j, String str, String str2, String str3) {
JSONArray optJSONArray;
try {
String str4 = "search?ancestor_folder_ids=" + AbstractC7990b.f60542s0.f(c1141j) + EPlQ.GAnnXiVbp + Uri.encode(str);
if (str2 != null) {
str4 = str4 + "&type=" + str2;
}
if (str3 != null) {
str4 = str4 + "&fields=" + str3;
}
JSONObject C32 = C3(this, null, str4, null, 4, null);
if (C32 != null && (optJSONArray = C32.optJSONArray("entries")) != null) {
AbstractC7780t.c(optJSONArray);
if (optJSONArray.length() == 1) {
return optJSONArray.getJSONObject(0);
}
}
} catch (Exception unused) {
}
return null;
}
public final Uri.Builder E3() {
return new Uri.Builder().scheme("https").authority("account.box.com").path("api/oauth2/authorize").appendQueryParameter("response_type", "code").appendQueryParameter("client_id", "znv9api6cexl0gyhuic3my76gb70ud8a").appendQueryParameter("redirect_uri", "https://www.lonelycatgames.com/internal/xplore/authcode");
}
public final void A3(m mVar) {
AbstractC7780t.f(mVar, "pane");
if (!T2()) {
G(new C0195a(mVar, this), mVar);
return;
}
Uri.Builder E32 = E3();
AbstractC7780t.e(E32, "<get-loginUrl>(...)");
AbstractC7990b.E2(this, mVar, E32, null, null, 12, null);
}
@Override
public boolean F2(C1141j c1141j) {
AbstractC7780t.f(c1141j, "de");
return true;
}
@Override
public boolean K2(C c9) {
AbstractC7780t.f(c9, "le");
return true;
}
@Override
protected boolean M2(C1141j c1141j, String str) {
AbstractC7780t.f(c1141j, "dir");
AbstractC7780t.f(str, "name");
return D3(c1141j, str, null, null) != null;
}
@Override
public C1141j P2(C1141j c1141j, String str) {
JSONObject D32;
AbstractC7780t.f(c1141j, "parent");
AbstractC7780t.f(str, "name");
String f9 = AbstractC7990b.f60542s0.f(c1141j);
if (f9 == null) {
throw new IOException("Invalid parent");
}
try {
JSONObject c02 = k.c0(AbstractC6736y.a("name", str));
f6706y0.c(c02, f9);
JSONObject B32 = B3("POST", "folders", c02.toString());
if (B32 != null) {
String string = B32.getString("id");
AbstractC7780t.e(string, "getString(...)");
return new AbstractC7992d.b(this, string, 0L, null, 12, null);
}
} catch (x.c e9) {
if (e9.b() == 409 && (D32 = D3(c1141j, str, "folder", "id")) != null) {
String string2 = D32.getString("id");
AbstractC7780t.e(string2, "getString(...)");
return new AbstractC7992d.b(this, string2, 0L, null, 12, null);
}
}
throw new IOException("Can't create dir");
}
@Override
public void R2(C c9) {
AbstractC7780t.f(c9, "le");
String str = f6706y0.d(c9) + '/' + AbstractC7990b.f60542s0.f(c9);
if (c9 instanceof C1141j) {
str = str + "?recursive=true";
}
C3(this, "DELETE", str, null, 4, null);
}
@Override
public OutputStream S1(C c9, String str, long j9, Long l9) {
Object obj;
AbstractC7780t.f(c9, "le");
long j10 = this.f6708w0;
if (1 <= j10 && j10 < j9) {
throw new IOException("File too big, file size limit is " + C1953d.f22030a.e(this.f6708w0));
}
String f9 = AbstractC7990b.f60542s0.f(c9);
if (f9 == null) {
throw new IOException("Invalid parent");
}
Uri.Builder appendPath = Uri.parse("https://upload.box.com/api/2.0").buildUpon().appendPath("files");
String p02 = str == null ? c9.p0() : str;
AbstractC7990b.g gVar = new AbstractC7990b.g(new String[0]);
if (str != null) {
if ((c9 instanceof C7989a.b) && ((C7989a.b) c9).E().contains(p02)) {
h.f fVar = new h.f((C1141j) c9, null, null, false, false, false, 62, null);
try {
j2(fVar);
Iterator it = fVar.j().iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
C c10 = (C) obj;
if (!c10.H0() && AbstractC7780t.a(c10.p0(), p02)) {
break;
}
}
C c11 = (C) obj;
String f10 = c11 != null ? AbstractC7990b.f60542s0.f(c11) : null;
if (f10 != null) {
appendPath.appendEncodedPath(f10);
}
} catch (Exception e9) {
e9.printStackTrace();
}
}
gVar.e("parent_id", f9);
} else {
appendPath.appendEncodedPath(f9);
}
appendPath.appendPath("content");
try {
String builder = appendPath.toString();
AbstractC7780t.e(builder, "toString(...)");
return new AbstractC7990b.d(this, Q2("POST", builder), "file", p02, gVar, 0L, null, false, 0, 240, null);
} catch (IOException e10) {
throw e10;
} catch (Exception e11) {
throw new IOException(k.Q(e11));
}
}
@Override
public AbstractC7990b.C0993b U2() {
return f6704A0;
}
@Override
public String V1(String str, String str2) {
boolean D8;
AbstractC7780t.f(str, "content");
if (str2 != null) {
D8 = w.D(str2, "application/json", false, 2, null);
if (D8) {
try {
String optString = new JSONObject(str).optString("message");
AbstractC7780t.c(optString);
if (optString.length() > 0) {
return optString;
}
} catch (Exception e9) {
e9.printStackTrace();
}
}
}
return super.V1(str, str2);
}
@Override
public String a() {
return this.f6709x0;
}
@Override
public Object clone() {
return super.clone();
}
@Override
public void d3(C c9, C1141j c1141j, String str) {
AbstractC7780t.f(c9, "le");
AbstractC7780t.f(c1141j, "newParent");
AbstractC7990b.c cVar = AbstractC7990b.f60542s0;
String f9 = cVar.f(c9);
String f10 = cVar.f(c1141j);
if (f10 == null) {
throw new FileNotFoundException();
}
d dVar = f6706y0;
String d9 = dVar.d(c9);
JSONObject jSONObject = new JSONObject();
dVar.c(jSONObject, f10);
if (str != null) {
jSONObject.put("name", str);
}
JSONObject B32 = B3("PUT", d9 + '/' + f9, jSONObject.toString());
if (B32 == null) {
throw new IOException();
}
if (!AbstractC7780t.a(B32.getJSONObject("parent").getString("id"), f10)) {
throw new IOException("Failed to move");
}
}
@Override
public boolean e3() {
return false;
}
@Override
public void f3(Uri uri, m mVar) {
AbstractC7780t.f(uri, "uri");
AbstractC7780t.f(mVar, "pane");
C0195a c0195a = new C0195a(mVar, this);
c0195a.L(uri);
G(c0195a, mVar);
}
@Override
public int i(String str) {
return AbstractC7992d.j.a.c(this, str);
}
@Override
public void i3(C c9, String str) {
AbstractC7780t.f(c9, "le");
AbstractC7780t.f(str, "newName");
if (AbstractC7780t.a(c9, this)) {
super.i3(c9, str);
} else {
JSONObject B32 = B3("PUT", f6706y0.d(c9) + '/' + AbstractC7990b.f60542s0.f(c9), k.c0(AbstractC6736y.a("name", str)).toString());
if (B32 == null) {
throw new IOException();
}
if (!AbstractC7780t.a(B32.getString("name"), str)) {
throw new IOException("Failed to rename");
}
}
}
@Override
public void j2(h.f fVar) {
String str;
int i9;
int i10;
JSONArray jSONArray;
C c9;
AbstractC7780t.f(fVar, "lister");
super.j2(fVar);
try {
String str2 = "folders/" + AbstractC7990b.f60542s0.f(fVar.m()) + "/items?fields=name,modified_at,size&limit=1000&offset=";
int i11 = Integer.MAX_VALUE;
int i12 = 0;
while (i12 < i11 && !fVar.r()) {
JSONObject C32 = C3(this, null, str2 + i12, null, 4, null);
if (C32 == null) {
throw new IOException();
}
if (i11 == Integer.MAX_VALUE) {
i11 = C32.getInt("total_count");
}
int i13 = i11;
JSONArray jSONArray2 = C32.getJSONArray("entries");
int length = jSONArray2.length();
int i14 = i12 + length;
int i15 = 0;
while (i15 < length) {
JSONObject jSONObject = jSONArray2.getJSONObject(i15);
String string = jSONObject.getString("type");
String string2 = jSONObject.getString("id");
String string3 = jSONObject.getString("name");
AbstractC7990b.c cVar = AbstractC7990b.f60542s0;
String string4 = jSONObject.getString("modified_at");
AbstractC7780t.e(string4, "getString(...)");
long e9 = cVar.e(string4, f6705B0, false);
if (AbstractC7780t.a(string, "folder")) {
AbstractC7780t.c(string2);
c9 = new AbstractC7992d.b(this, string2, e9, null, 8, null);
str = string3;
i9 = i15;
i10 = length;
jSONArray = jSONArray2;
} else if (AbstractC7780t.a(string, "file")) {
AbstractC7780t.c(string3);
str = string3;
i9 = i15;
i10 = length;
jSONArray = jSONArray2;
c9 = AbstractC7992d.R1(this, fVar, string3, e9, jSONObject.getLong("size"), string2, null, 32, null);
} else {
str = string3;
i9 = i15;
i10 = length;
jSONArray = jSONArray2;
c9 = null;
}
if (c9 != null) {
AbstractC7780t.c(str);
fVar.c(c9, str);
}
i15 = i9 + 1;
jSONArray2 = jSONArray;
length = i10;
}
i11 = i13;
i12 = i14;
}
} catch (JSONException e10) {
throw new IOException(k.Q(e10));
}
}
@Override
public InputStream k2(C c9, int i9, long j9) {
AbstractC7780t.f(c9, "le");
if (!(c9 instanceof AbstractC7992d.j)) {
throw new FileNotFoundException(c9.i0());
}
try {
return AbstractC7990b.h3(this, "https://api.box.com/2.0/files/" + AbstractC7990b.f60542s0.f(c9) + "/content", j9, false, 4, null);
} catch (h.j e9) {
throw new IOException(k.Q(e9));
}
}
@Override
public boolean o(String str) {
return AbstractC7992d.j.a.b(this, str);
}
@Override
public C1141j o2(C c9) {
AbstractC7780t.f(c9, "le");
JSONObject C32 = C3(this, null, f6706y0.d(c9) + '/' + AbstractC7990b.f60542s0.f(c9) + "?fields=parent", null, 4, null);
if (C32 == null) {
return null;
}
String string = C32.getJSONObject("parent").getString("id");
AbstractC7780t.c(string);
return new AbstractC7992d.b(this, string, 0L, null, 12, null);
}
@Override
protected void r3() {
JSONObject C32 = C3(this, null, "users/me", null, 4, null);
if (C32 != null) {
Uri a22 = a2();
if ((a22 != null ? a22.getFragment() : null) == null) {
String optString = C32.optString("name");
AbstractC7780t.c(optString);
if (optString.length() > 0) {
i3(this, optString);
}
}
m3(new AbstractC1143l.b(C32.optLong("space_used"), C32.optLong("space_amount")));
this.f6708w0 = C32.optLong("max_upload_size");
}
}
@Override
public String s(String str) {
return AbstractC7992d.j.a.d(this, str);
}
@Override
public Map t() {
return AbstractC7992d.j.a.a(this);
}
@Override
protected C6730s t3(String str) {
AbstractC7780t.f(str, "refreshToken");
JSONObject e9 = f6706y0.e("refresh_token", "refresh_token=" + str);
return AbstractC6736y.a(e9.getString("access_token"), e9.getString("refresh_token"));
}
}