mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
e77d9e3d60
commit
189b21dbde
5 changed files with 40 additions and 4 deletions
|
@ -2,6 +2,7 @@ package org.asamk.signal.manager;
|
|||
|
||||
import org.asamk.signal.manager.api.AlreadyReceivingException;
|
||||
import org.asamk.signal.manager.api.AttachmentInvalidException;
|
||||
import org.asamk.signal.manager.api.CaptchaRejectedException;
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.Configuration;
|
||||
import org.asamk.signal.manager.api.Device;
|
||||
|
@ -136,7 +137,10 @@ public interface Manager extends Closeable {
|
|||
|
||||
void deleteAccount() throws IOException;
|
||||
|
||||
void submitRateLimitRecaptchaChallenge(String challenge, String captcha) throws IOException;
|
||||
void submitRateLimitRecaptchaChallenge(
|
||||
String challenge,
|
||||
String captcha
|
||||
) throws IOException, CaptchaRejectedException;
|
||||
|
||||
List<Device> getLinkedDevices() throws IOException;
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class CaptchaRejectedException extends Exception {
|
||||
|
||||
public CaptchaRejectedException() {
|
||||
super("Captcha rejected");
|
||||
}
|
||||
|
||||
public CaptchaRejectedException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CaptchaRejectedException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ package org.asamk.signal.manager.internal;
|
|||
import org.asamk.signal.manager.Manager;
|
||||
import org.asamk.signal.manager.api.AlreadyReceivingException;
|
||||
import org.asamk.signal.manager.api.AttachmentInvalidException;
|
||||
import org.asamk.signal.manager.api.CaptchaRejectedException;
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.Configuration;
|
||||
import org.asamk.signal.manager.api.Device;
|
||||
|
@ -407,10 +408,17 @@ public class ManagerImpl implements Manager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void submitRateLimitRecaptchaChallenge(String challenge, String captcha) throws IOException {
|
||||
public void submitRateLimitRecaptchaChallenge(
|
||||
String challenge,
|
||||
String captcha
|
||||
) throws IOException, CaptchaRejectedException {
|
||||
captcha = captcha == null ? null : captcha.replace("signalcaptcha://", "");
|
||||
|
||||
dependencies.getAccountManager().submitRateLimitRecaptchaChallenge(challenge, captcha);
|
||||
try {
|
||||
dependencies.getAccountManager().submitRateLimitRecaptchaChallenge(challenge, captcha);
|
||||
} catch (org.whispersystems.signalservice.api.push.exceptions.CaptchaRejectedException ignored) {
|
||||
throw new CaptchaRejectedException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue