mirror of
https://gitlab.com/mangadex-pub/mangadex_at_home.git
synced 2024-01-19 02:48:37 +00:00
107 lines
2.4 KiB
Java
107 lines
2.4 KiB
Java
package mdnet.base;
|
|
|
|
import com.google.gson.annotations.SerializedName;
|
|
|
|
import java.util.Objects;
|
|
|
|
public final class ServerSettings {
|
|
@SerializedName("image_server")
|
|
private final String imageServer;
|
|
private final TlsCert tls;
|
|
|
|
public ServerSettings(String imageServer, TlsCert tls) {
|
|
this.imageServer = Objects.requireNonNull(imageServer);
|
|
this.tls = tls;
|
|
}
|
|
|
|
public String getImageServer() {
|
|
return imageServer;
|
|
}
|
|
|
|
public TlsCert getTls() {
|
|
return tls;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "ServerSettings{" + "imageServer='" + imageServer + '\'' + ", tls=" + "<hidden>" + '}';
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o)
|
|
return true;
|
|
if (o == null || getClass() != o.getClass())
|
|
return false;
|
|
|
|
ServerSettings that = (ServerSettings) o;
|
|
|
|
if (!imageServer.equals(that.imageServer))
|
|
return false;
|
|
return Objects.equals(tls, that.tls);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int result = imageServer.hashCode();
|
|
result = 31 * result + (tls != null ? tls.hashCode() : 0);
|
|
return result;
|
|
}
|
|
|
|
public static final class TlsCert {
|
|
@SerializedName("created_at")
|
|
private final String createdAt;
|
|
@SerializedName("private_key")
|
|
private final String privateKey;
|
|
private final String certificate;
|
|
|
|
public TlsCert(String createdAt, String privateKey, String certificate) {
|
|
this.createdAt = Objects.requireNonNull(createdAt);
|
|
this.privateKey = Objects.requireNonNull(privateKey);
|
|
this.certificate = Objects.requireNonNull(certificate);
|
|
}
|
|
|
|
public String getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
public String getPrivateKey() {
|
|
return privateKey;
|
|
}
|
|
|
|
public String getCertificate() {
|
|
return certificate;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "TlsCert{" + "createdAt='" + createdAt + '\'' + ", privateKey='" + privateKey + '\''
|
|
+ ", certificate='" + certificate + '\'' + '}';
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o)
|
|
return true;
|
|
if (o == null || getClass() != o.getClass())
|
|
return false;
|
|
|
|
TlsCert tlsCert = (TlsCert) o;
|
|
|
|
if (!createdAt.equals(tlsCert.createdAt))
|
|
return false;
|
|
if (!privateKey.equals(tlsCert.privateKey))
|
|
return false;
|
|
return certificate.equals(tlsCert.certificate);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int result = createdAt.hashCode();
|
|
result = 31 * result + privateKey.hashCode();
|
|
result = 31 * result + certificate.hashCode();
|
|
return result;
|
|
}
|
|
}
|
|
}
|