P2X v5.6.5版本的 MD5 值为:c9754e3fb9716daeb935e470461cc2a2
以下内容为反编译后的 c.java 源代码,内容仅作参考
package z6;
import android.content.Context;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.JsonReader;
import com.lzy.okgo.cookie.SerializableCookie;
import com.lzy.okgo.model.HttpHeaders;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import org.json.JSONException;
import org.json.JSONObject;
import w.o;
public final class c {
public static final Pattern d = Pattern.compile("[0-9]+s");
public static final Charset f8107e = Charset.forName("UTF-8");
public final Context f8108a;
public final w6.c f8109b;
public final e f8110c = new e();
public c(Context context, w6.c cVar) {
this.f8108a = context;
this.f8109b = cVar;
}
public static URL a(String str) {
try {
return new URL(String.format("https://%s/%s/%s", "firebaseinstallations.googleapis.com", "v1", str));
} catch (MalformedURLException e7) {
throw new x6.f(e7.getMessage());
}
}
public static void b(HttpURLConnection httpURLConnection, String str, String str2, String str3) {
String a5;
InputStream errorStream = httpURLConnection.getErrorStream();
String str4 = null;
if (errorStream != null) {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(errorStream, f8107e));
try {
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
sb.append('\n');
}
str4 = String.format("Error when communicating with the Firebase Installations server API. HTTP response: [%d %s: %s]", Integer.valueOf(httpURLConnection.getResponseCode()), httpURLConnection.getResponseMessage(), sb);
} catch (IOException unused) {
} catch (Throwable th) {
try {
bufferedReader.close();
} catch (IOException unused2) {
}
throw th;
}
try {
bufferedReader.close();
} catch (IOException unused3) {
}
}
if (!TextUtils.isEmpty(str4)) {
Object[] objArr = new Object[3];
objArr[0] = str2;
objArr[1] = str3;
if (TextUtils.isEmpty(str)) {
a5 = "";
} else {
a5 = o.a(", ", str);
}
objArr[2] = a5;
String.format("Firebase options used while communicating with Firebase server APIs: %s, %s%s", objArr);
}
}
public static long d(String str) {
if (d.matcher(str).matches()) {
if (str != null && str.length() != 0) {
return Long.parseLong(str.substring(0, str.length() - 1));
}
return 0L;
}
throw new IllegalArgumentException("Invalid Expiration Timestamp.");
}
public static a e(HttpURLConnection httpURLConnection) {
String str;
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f8107e));
Long l9 = 0L;
jsonReader.beginObject();
String str2 = null;
String str3 = null;
String str4 = null;
String str5 = null;
b bVar = null;
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals(SerializableCookie.NAME)) {
str3 = jsonReader.nextString();
} else if (nextName.equals("fid")) {
str4 = jsonReader.nextString();
} else if (nextName.equals("refreshToken")) {
str5 = jsonReader.nextString();
} else if (nextName.equals("authToken")) {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
String nextName2 = jsonReader.nextName();
if (nextName2.equals("token")) {
str2 = jsonReader.nextString();
} else if (nextName2.equals("expiresIn")) {
l9 = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
if (l9 == null) {
str = " tokenExpirationTimestamp";
} else {
str = "";
}
if (str.isEmpty()) {
bVar = new b(str2, l9.longValue(), null);
jsonReader.endObject();
} else {
throw new IllegalStateException("Missing required properties:".concat(str));
}
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
return new a(str3, str4, str5, bVar, d.OK);
}
public static b f(HttpURLConnection httpURLConnection) {
String str;
InputStream inputStream = httpURLConnection.getInputStream();
JsonReader jsonReader = new JsonReader(new InputStreamReader(inputStream, f8107e));
Long l9 = 0L;
jsonReader.beginObject();
String str2 = null;
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (nextName.equals("token")) {
str2 = jsonReader.nextString();
} else if (nextName.equals("expiresIn")) {
l9 = Long.valueOf(d(jsonReader.nextString()));
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
jsonReader.close();
inputStream.close();
f fVar = f.OK;
if (l9 == null) {
str = " tokenExpirationTimestamp";
} else {
str = "";
}
if (str.isEmpty()) {
return new b(str2, l9.longValue(), fVar);
}
throw new IllegalStateException("Missing required properties:".concat(str));
}
public static void g(HttpURLConnection httpURLConnection, String str, String str2) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("fid", str);
jSONObject.put("appId", str2);
jSONObject.put("authVersion", "FIS_v2");
jSONObject.put("sdkVersion", "a:17.0.3");
i(httpURLConnection, jSONObject.toString().getBytes("UTF-8"));
} catch (JSONException e7) {
throw new IllegalStateException(e7);
}
}
public static void h(HttpURLConnection httpURLConnection) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sdkVersion", "a:17.0.3");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("installation", jSONObject);
i(httpURLConnection, jSONObject2.toString().getBytes("UTF-8"));
} catch (JSONException e7) {
throw new IllegalStateException(e7);
}
}
public static void i(URLConnection uRLConnection, byte[] bArr) {
OutputStream outputStream = uRLConnection.getOutputStream();
if (outputStream == null) {
throw new IOException("Cannot send request to FIS servers. No OutputStream available.");
}
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(outputStream);
try {
gZIPOutputStream.write(bArr);
} finally {
try {
gZIPOutputStream.close();
outputStream.close();
} catch (IOException unused) {
}
}
}
public final HttpURLConnection c(URL url, String str) {
String str2;
byte[] h;
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setUseCaches(false);
httpURLConnection.setReadTimeout(10000);
httpURLConnection.addRequestProperty(HttpHeaders.HEAD_KEY_CONTENT_TYPE, "application/json");
httpURLConnection.addRequestProperty(HttpHeaders.HEAD_KEY_ACCEPT, "application/json");
httpURLConnection.addRequestProperty(HttpHeaders.HEAD_KEY_CONTENT_ENCODING, "gzip");
httpURLConnection.addRequestProperty(HttpHeaders.HEAD_KEY_CACHE_CONTROL, "no-cache");
Context context = this.f8108a;
httpURLConnection.addRequestProperty("X-Android-Package", context.getPackageName());
v6.f fVar = (v6.f) this.f8109b.get();
if (fVar != null) {
try {
httpURLConnection.addRequestProperty("x-firebase-client", (String) kotlin.jvm.internal.f.d(((v6.d) fVar).a()));
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (ExecutionException unused2) {
}
}
try {
h = com.bumptech.glide.d.h(context, context.getPackageName());
} catch (PackageManager.NameNotFoundException unused3) {
context.getPackageName();
}
if (h == null) {
context.getPackageName();
str2 = null;
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
}
str2 = com.bumptech.glide.e.g(h);
httpURLConnection.addRequestProperty("X-Android-Cert", str2);
httpURLConnection.addRequestProperty("x-goog-api-key", str);
return httpURLConnection;
} catch (IOException unused4) {
throw new x6.f("Firebase Installations Service is unavailable. Please try again later.");
}
}
}