|
|
|
|
@ -2,14 +2,16 @@ package com.fongmi.android.tv.bean; |
|
|
|
|
|
|
|
|
|
import android.text.TextUtils; |
|
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable; |
|
|
|
|
|
|
|
|
|
import com.fongmi.android.tv.server.Server; |
|
|
|
|
import com.fongmi.android.tv.utils.UrlUtil; |
|
|
|
|
import com.fongmi.hook.Hook; |
|
|
|
|
import com.github.catvod.net.OkHttp; |
|
|
|
|
import com.google.gson.Gson; |
|
|
|
|
import com.google.gson.annotations.SerializedName; |
|
|
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
public class Core { |
|
|
|
|
|
|
|
|
|
@SerializedName("auth") |
|
|
|
|
@ -30,6 +32,14 @@ public class Core { |
|
|
|
|
private String pkg; |
|
|
|
|
@SerializedName("so") |
|
|
|
|
private String so; |
|
|
|
|
@SerializedName("key") |
|
|
|
|
private String key; |
|
|
|
|
@SerializedName("option") |
|
|
|
|
private List<Option> option; |
|
|
|
|
|
|
|
|
|
public static Core objectFrom(String str) { |
|
|
|
|
return new Gson().fromJson(str, Core.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public String getAuth() { |
|
|
|
|
return !getResp().isEmpty() ? Server.get().getAddress("/tvbus") : TextUtils.isEmpty(auth) ? "" : UrlUtil.convert(auth); |
|
|
|
|
@ -67,19 +77,38 @@ public class Core { |
|
|
|
|
return TextUtils.isEmpty(so) ? "" : UrlUtil.convert(so); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<Option> getOption() { |
|
|
|
|
return option == null ? Collections.emptyList() : option; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Hook getHook() { |
|
|
|
|
return !getPkg().isEmpty() && !getSign().isEmpty() ? new Hook(getSign(), getPkg()) : null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getString(String value) { |
|
|
|
|
public static String getString(String value) { |
|
|
|
|
return (value = UrlUtil.convert(value)).startsWith("http") ? OkHttp.string(value) : value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class Option { |
|
|
|
|
|
|
|
|
|
@SerializedName("key") |
|
|
|
|
private String key; |
|
|
|
|
@SerializedName("values") |
|
|
|
|
private List<String> values; |
|
|
|
|
|
|
|
|
|
public String getKey() { |
|
|
|
|
return TextUtils.isEmpty(key) ? "" : key; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<String> getValues() { |
|
|
|
|
return values == null ? Collections.emptyList() : values; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean equals(@Nullable Object obj) { |
|
|
|
|
public boolean equals(Object obj) { |
|
|
|
|
if (this == obj) return true; |
|
|
|
|
if (!(obj instanceof Core)) return false; |
|
|
|
|
Core it = (Core) obj; |
|
|
|
|
if (!(obj instanceof Core it)) return false; |
|
|
|
|
return getSign().equals(it.getSign()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|