mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Compare commits
49 Commits
1387-persi
...
2248-featu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8e07414e7 | ||
|
|
707802c459 | ||
|
|
65be2d2b26 | ||
|
|
d2a39da3e0 | ||
|
|
d13e4c976e | ||
|
|
20b52804bf | ||
|
|
5b27eb354c | ||
|
|
c340071469 | ||
|
|
506e274dff | ||
|
|
423356fdda | ||
|
|
043a173828 | ||
|
|
f0501bbfab | ||
|
|
5cafde7b14 | ||
|
|
5117dbad7e | ||
|
|
3a22388495 | ||
|
|
1d4de46dfd | ||
|
|
d805069dfe | ||
|
|
74cb2a6ce5 | ||
|
|
2880a4adac | ||
|
|
e032e0ccd5 | ||
|
|
38a07e1d54 | ||
|
|
07b35db4d4 | ||
|
|
3b03db9f43 | ||
|
|
de3a74eedf | ||
|
|
5a39f9730f | ||
|
|
bdf02bbc6c | ||
|
|
d5b2ebdb23 | ||
|
|
98bb8d4af1 | ||
|
|
75cc19e578 | ||
|
|
aad87e6e98 | ||
|
|
dad895c30d | ||
|
|
f8b3d79813 | ||
|
|
0a98566298 | ||
|
|
93a03d7e15 | ||
|
|
3eb3dbde09 | ||
|
|
fd56176450 | ||
|
|
d29812f055 | ||
|
|
403601b9f2 | ||
|
|
992215b78a | ||
|
|
658ca8de21 | ||
|
|
e0e2c0cc89 | ||
|
|
114d80ad43 | ||
|
|
8d5803098b | ||
|
|
a9ed9da822 | ||
|
|
2295db4361 | ||
|
|
7aa1073bf5 | ||
|
|
6c702bad0a | ||
|
|
d3dbcfd62d | ||
|
|
c4c70f5ac2 |
@@ -33,6 +33,7 @@ test:
|
||||
stage: test
|
||||
script:
|
||||
- ./gradlew --no-daemon -Djava.security.egd=file:/dev/urandom animalSnifferMain animalSnifferTest
|
||||
- ./gradlew --no-daemon -Djava.security.egd=file:/dev/urandom :briar-headless:linuxJars
|
||||
- ./gradlew --no-daemon -Djava.security.egd=file:/dev/urandom compileOfficialDebugAndroidTestSources compileScreenshotDebugAndroidTestSources check
|
||||
rules:
|
||||
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
||||
|
||||
@@ -22,6 +22,15 @@ our site.
|
||||
|
||||
[Wiki](https://code.briarproject.org/briar/briar/-/wikis/home)
|
||||
|
||||
## Reproducible builds
|
||||
|
||||
We provide [docker images](https://code.briarproject.org/briar/briar-reproducer#briar-reproducer)
|
||||
to ease the task of verifying that the published APK binaries
|
||||
include nothing but our publicly available source code.
|
||||
|
||||
You can either use those images or use them as a blueprint to build your own environment
|
||||
for reproduction.
|
||||
|
||||
## Donate
|
||||
|
||||
[](https://liberapay.com/Briar/donate) [](https://flattr.com/t/592836/)
|
||||
|
||||
@@ -15,8 +15,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 10401
|
||||
versionName "1.4.1"
|
||||
versionCode 10403
|
||||
versionName "1.4.3"
|
||||
consumerProguardFiles 'proguard-rules.txt'
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -53,7 +53,7 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
||||
}
|
||||
|
||||
def torBinariesDir = 'src/main/res/raw'
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.briarproject.bramble.api.db.DatabaseConfig;
|
||||
import org.briarproject.bramble.api.identity.IdentityManager;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -44,7 +44,7 @@ public class AndroidAccountManagerTest extends BrambleMockTestCase {
|
||||
private AndroidAccountManager accountManager;
|
||||
|
||||
public AndroidAccountManagerTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
app = context.mock(Application.class);
|
||||
applicationInfo = new ApplicationInfo();
|
||||
applicationInfo.dataDir = testDir.getAbsolutePath();
|
||||
|
||||
@@ -13,7 +13,6 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
|
||||
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
|
||||
}
|
||||
|
||||
@@ -10,4 +10,12 @@ public interface FeatureFlags {
|
||||
boolean shouldEnableProfilePictures();
|
||||
|
||||
boolean shouldEnableDisappearingMessages();
|
||||
|
||||
boolean shouldEnableIntroductionsInCore();
|
||||
|
||||
boolean shouldEnablePrivateGroupsInCore();
|
||||
|
||||
boolean shouldEnableForumsInCore();
|
||||
|
||||
boolean shouldEnableBlogsInCore();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.briarproject.briar.feed;
|
||||
package org.briarproject.bramble.api;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.inject.Provider;
|
||||
* collected.
|
||||
*/
|
||||
@NotNullByDefault
|
||||
abstract class WeakSingletonProvider<T> implements Provider<T> {
|
||||
public abstract class WeakSingletonProvider<T> implements Provider<T> {
|
||||
|
||||
private final Object lock = new Object();
|
||||
@GuardedBy("lock")
|
||||
@@ -31,5 +31,5 @@ abstract class WeakSingletonProvider<T> implements Provider<T> {
|
||||
}
|
||||
}
|
||||
|
||||
abstract T createInstance();
|
||||
public abstract T createInstance();
|
||||
}
|
||||
@@ -107,6 +107,32 @@ public interface ContactManager {
|
||||
*/
|
||||
String getHandshakeLink() throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the handshake link that needs to be sent to a contact we want
|
||||
* to add.
|
||||
*/
|
||||
String getHandshakeLink(Transaction txn) throws DbException;
|
||||
|
||||
/**
|
||||
* Creates a {@link PendingContact} from the given handshake link and
|
||||
* alias, adds it to the database and returns it.
|
||||
*
|
||||
* @param link The handshake link received from the pending contact
|
||||
* @param alias The alias the user has given this pending contact
|
||||
* @throws UnsupportedVersionException If the link uses a format version
|
||||
* that is not supported
|
||||
* @throws FormatException If the link is invalid
|
||||
* @throws GeneralSecurityException If the pending contact's handshake
|
||||
* public key is invalid
|
||||
* @throws ContactExistsException If a contact with the same handshake
|
||||
* public key already exists
|
||||
* @throws PendingContactExistsException If a pending contact with the same
|
||||
* handshake public key already exists
|
||||
*/
|
||||
PendingContact addPendingContact(Transaction txn, String link, String alias)
|
||||
throws DbException, FormatException, GeneralSecurityException,
|
||||
ContactExistsException, PendingContactExistsException;
|
||||
|
||||
/**
|
||||
* Creates a {@link PendingContact} from the given handshake link and
|
||||
* alias, adds it to the database and returns it.
|
||||
@@ -140,6 +166,13 @@ public interface ContactManager {
|
||||
Collection<Pair<PendingContact, PendingContactState>> getPendingContacts()
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a list of {@link PendingContact PendingContacts} and their
|
||||
* {@link PendingContactState states}.
|
||||
*/
|
||||
Collection<Pair<PendingContact, PendingContactState>> getPendingContacts(Transaction txn)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Removes a {@link PendingContact}.
|
||||
*/
|
||||
|
||||
@@ -471,6 +471,14 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
Map<MessageId, Integer> getUnackedMessagesToSend(Transaction txn,
|
||||
ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Reset the transmission count, expiry time and ETA of all messages that
|
||||
* are eligible to be sent to the given contact. This includes messages that
|
||||
* have already been sent and are not yet due for retransmission.
|
||||
*/
|
||||
void resetUnackedMessagesToSend(Transaction txn, ContactId c)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the total length, including headers, of all messages that are
|
||||
* eligible to be sent to the given contact. This may include messages
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.bramble.api.mailbox;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
@@ -23,4 +24,10 @@ public interface MailboxSettingsManager {
|
||||
|
||||
void recordFailedConnectionAttempt(Transaction txn, long now)
|
||||
throws DbException;
|
||||
|
||||
void setPendingUpload(Transaction txn, ContactId id,
|
||||
@Nullable String filename) throws DbException;
|
||||
|
||||
@Nullable
|
||||
String getPendingUpload(Transaction txn, ContactId id) throws DbException;
|
||||
}
|
||||
|
||||
@@ -113,9 +113,25 @@ public interface KeyManager {
|
||||
/**
|
||||
* Looks up the given tag and returns a {@link StreamContext} for reading
|
||||
* from the corresponding stream, or null if an error occurs or the tag was
|
||||
* unexpected.
|
||||
* unexpected. Marks the tag as recognised and updates the reordering
|
||||
* window.
|
||||
*/
|
||||
@Nullable
|
||||
StreamContext getStreamContext(TransportId t, byte[] tag)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Looks up the given tag and returns a {@link StreamContext} for reading
|
||||
* from the corresponding stream, or null if an error occurs or the tag was
|
||||
* unexpected. Only returns the StreamContext; does not mark the tag as
|
||||
* recognised.
|
||||
*/
|
||||
@Nullable
|
||||
StreamContext getStreamContextOnly(TransportId t, byte[] tag)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Marks the tag as recognised and updates the reordering window.
|
||||
*/
|
||||
void markTagAsRecognised(TransportId t, byte[] tag) throws DbException;
|
||||
}
|
||||
|
||||
@@ -10,13 +10,17 @@ apply from: '../dagger.gradle'
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ':bramble-api', configuration: 'default')
|
||||
implementation 'org.bouncycastle:bcprov-jdk15on:1.69'
|
||||
implementation 'org.bouncycastle:bcprov-jdk15to18:1.70'
|
||||
//noinspection GradleDependency
|
||||
implementation 'com.h2database:h2:1.4.192' // The last version that supports Java 1.6
|
||||
implementation 'org.bitlet:weupnp:0.1.4'
|
||||
implementation 'net.i2p.crypto:eddsa:0.2.0'
|
||||
implementation 'org.whispersystems:curve25519-java:0.5.0'
|
||||
implementation 'org.briarproject:jtorctl:0.3'
|
||||
|
||||
//noinspection GradleDependency
|
||||
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
|
||||
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||
@@ -25,7 +29,7 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
||||
|
||||
testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
|
||||
@@ -121,28 +121,39 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
||||
|
||||
@Override
|
||||
public String getHandshakeLink() throws DbException {
|
||||
KeyPair keyPair = db.transactionWithResult(true,
|
||||
identityManager::getHandshakeKeys);
|
||||
return db.transactionWithResult(true, this::getHandshakeLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHandshakeLink(Transaction txn) throws DbException {
|
||||
KeyPair keyPair = identityManager.getHandshakeKeys(txn);
|
||||
return pendingContactFactory.createHandshakeLink(keyPair.getPublic());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingContact addPendingContact(Transaction txn, String link, String alias)
|
||||
throws DbException, FormatException, GeneralSecurityException {
|
||||
PendingContact p =
|
||||
pendingContactFactory.createPendingContact(link, alias);
|
||||
AuthorId local = identityManager.getLocalAuthor(txn).getId();
|
||||
db.addPendingContact(txn, p, local);
|
||||
KeyPair ourKeyPair = identityManager.getHandshakeKeys(txn);
|
||||
keyManager.addPendingContact(txn, p.getId(), p.getPublicKey(),
|
||||
ourKeyPair);
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingContact addPendingContact(String link, String alias)
|
||||
throws DbException, FormatException, GeneralSecurityException {
|
||||
PendingContact p =
|
||||
pendingContactFactory.createPendingContact(link, alias);
|
||||
Transaction txn = db.startTransaction(false);
|
||||
try {
|
||||
AuthorId local = identityManager.getLocalAuthor(txn).getId();
|
||||
db.addPendingContact(txn, p, local);
|
||||
KeyPair ourKeyPair = identityManager.getHandshakeKeys(txn);
|
||||
keyManager.addPendingContact(txn, p.getId(), p.getPublicKey(),
|
||||
ourKeyPair);
|
||||
PendingContact p = addPendingContact(txn, link, alias);
|
||||
db.commitTransaction(txn);
|
||||
return p;
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,8 +165,13 @@ class ContactManagerImpl implements ContactManager, EventListener {
|
||||
@Override
|
||||
public Collection<Pair<PendingContact, PendingContactState>> getPendingContacts()
|
||||
throws DbException {
|
||||
Collection<PendingContact> pendingContacts =
|
||||
db.transactionWithResult(true, db::getPendingContacts);
|
||||
return db.transactionWithResult(true, this::getPendingContacts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Pair<PendingContact, PendingContactState>> getPendingContacts(Transaction txn)
|
||||
throws DbException {
|
||||
Collection<PendingContact> pendingContacts = db.getPendingContacts(txn);
|
||||
List<Pair<PendingContact, PendingContactState>> pairs =
|
||||
new ArrayList<>(pendingContacts.size());
|
||||
for (PendingContact p : pendingContacts) {
|
||||
|
||||
@@ -757,6 +757,13 @@ interface Database<T> {
|
||||
*/
|
||||
void resetExpiryTime(T txn, ContactId c, MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Resets the transmission count, expiry time and ETA of all messages that
|
||||
* are eligible to be sent to the given contact. This includes messages that
|
||||
* have already been sent and are not yet due for retransmission.
|
||||
*/
|
||||
void resetUnackedMessagesToSend(T txn, ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the cleanup timer duration for the given message. This does not
|
||||
* start the message's cleanup timer.
|
||||
@@ -845,8 +852,8 @@ interface Database<T> {
|
||||
* of the given message with respect to the given contact, using the latency
|
||||
* of the transport over which it was sent.
|
||||
*/
|
||||
void updateExpiryTimeAndEta(T txn, ContactId c, MessageId m, long maxLatency)
|
||||
throws DbException;
|
||||
void updateExpiryTimeAndEta(T txn, ContactId c, MessageId m,
|
||||
long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Stores the given transport keys, deleting any keys they have replaced.
|
||||
|
||||
@@ -750,6 +750,15 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
return db.getUnackedMessagesToSend(txn, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetUnackedMessagesToSend(Transaction transaction, ContactId c)
|
||||
throws DbException {
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
throw new NoSuchContactException();
|
||||
db.resetUnackedMessagesToSend(txn, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUnackedMessageBytesToSend(Transaction transaction,
|
||||
ContactId c) throws DbException {
|
||||
|
||||
@@ -429,8 +429,11 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
compactAndClose();
|
||||
logDuration(LOG, "Compacting database", start);
|
||||
// Allow the next transaction to reopen the DB
|
||||
synchronized (connectionsLock) {
|
||||
connectionsLock.lock();
|
||||
try {
|
||||
closed = false;
|
||||
} finally {
|
||||
connectionsLock.unlock();
|
||||
}
|
||||
txn = startTransaction();
|
||||
try {
|
||||
@@ -3290,6 +3293,29 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetUnackedMessagesToSend(Connection txn, ContactId c)
|
||||
throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
try {
|
||||
String sql = "UPDATE statuses SET expiry = 0, txCount = 0, eta = 0"
|
||||
+ " WHERE contactId = ? AND state = ?"
|
||||
+ " AND groupShared = TRUE AND messageShared = TRUE"
|
||||
+ " AND deleted = FALSE AND seen = FALSE";
|
||||
ps = txn.prepareStatement(sql);
|
||||
ps.setInt(1, c.getInt());
|
||||
ps.setInt(2, DELIVERED.getValue());
|
||||
int affected = ps.executeUpdate();
|
||||
if (affected < 0) {
|
||||
throw new DbStateException();
|
||||
}
|
||||
ps.close();
|
||||
} catch (SQLException e) {
|
||||
tryToClose(ps, LOG, WARNING);
|
||||
throw new DbException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCleanupTimerDuration(Connection txn, MessageId m,
|
||||
long duration) throws DbException {
|
||||
|
||||
@@ -1,18 +1,49 @@
|
||||
package org.briarproject.bramble.io;
|
||||
|
||||
import org.briarproject.bramble.api.WeakSingletonProvider;
|
||||
import org.briarproject.bramble.api.io.TimeoutMonitor;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
@Module
|
||||
public class IoModule {
|
||||
|
||||
private static final int CONNECT_TIMEOUT = 60_000; // Milliseconds
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
TimeoutMonitor provideTimeoutMonitor(TimeoutMonitorImpl timeoutMonitor) {
|
||||
return timeoutMonitor;
|
||||
}
|
||||
|
||||
// Share an HTTP client instance between requests where possible, while
|
||||
// allowing the client to be garbage-collected between requests. The
|
||||
// provider keeps a weak reference to the last client instance and reuses
|
||||
// the instance until it gets garbage-collected. See
|
||||
// https://medium.com/@leandromazzuquini/if-you-are-using-okhttp-you-should-know-this-61d68e065a2b
|
||||
@Provides
|
||||
@Singleton
|
||||
WeakSingletonProvider<OkHttpClient> provideOkHttpClientProvider(
|
||||
SocketFactory torSocketFactory, Dns noDnsLookups) {
|
||||
return new WeakSingletonProvider<OkHttpClient>() {
|
||||
@Override
|
||||
@Nonnull
|
||||
public OkHttpClient createInstance() {
|
||||
return new OkHttpClient.Builder()
|
||||
.socketFactory(torSocketFactory)
|
||||
.dns(noDnsLookups) // Don't make local DNS lookups
|
||||
.connectTimeout(CONNECT_TIMEOUT, MILLISECONDS)
|
||||
.build();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.bramble.mailbox;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxProperties;
|
||||
@@ -9,6 +10,7 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.settings.Settings;
|
||||
import org.briarproject.bramble.api.settings.SettingsManager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -25,6 +27,7 @@ class MailboxSettingsManagerImpl implements MailboxSettingsManager {
|
||||
static final String SETTINGS_KEY_LAST_ATTEMPT = "lastAttempt";
|
||||
static final String SETTINGS_KEY_LAST_SUCCESS = "lastSuccess";
|
||||
static final String SETTINGS_KEY_ATTEMPTS = "attempts";
|
||||
static final String SETTINGS_UPLOADS_NAMESPACE = "mailbox-uploads";
|
||||
|
||||
private final SettingsManager settingsManager;
|
||||
|
||||
@@ -83,4 +86,24 @@ class MailboxSettingsManagerImpl implements MailboxSettingsManager {
|
||||
newSettings.putInt(SETTINGS_KEY_ATTEMPTS, attempts + 1);
|
||||
settingsManager.mergeSettings(txn, newSettings, SETTINGS_NAMESPACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPendingUpload(Transaction txn, ContactId id,
|
||||
@Nullable String filename) throws DbException {
|
||||
Settings s = new Settings();
|
||||
String value = filename == null ? "" : filename;
|
||||
s.put(String.valueOf(id.getInt()), value);
|
||||
settingsManager.mergeSettings(txn, s, SETTINGS_UPLOADS_NAMESPACE);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getPendingUpload(Transaction txn, ContactId id)
|
||||
throws DbException {
|
||||
Settings s =
|
||||
settingsManager.getSettings(txn, SETTINGS_UPLOADS_NAMESPACE);
|
||||
String filename = s.get(String.valueOf(id.getInt()));
|
||||
if (isNullOrEmpty(filename)) return null;
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,71 @@
|
||||
package org.briarproject.bramble.plugin.tor;
|
||||
|
||||
import org.briarproject.bramble.api.lifecycle.IoExecutor;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// TODO: Create a module for this so it doesn't have to be public
|
||||
|
||||
@NotNullByDefault
|
||||
public interface CircumventionProvider {
|
||||
|
||||
enum BridgeType {
|
||||
DEFAULT_OBFS4,
|
||||
NON_DEFAULT_OBFS4,
|
||||
MEEK
|
||||
}
|
||||
|
||||
/**
|
||||
* Countries where Tor is blocked, i.e. vanilla Tor connection won't work.
|
||||
*
|
||||
* <p>
|
||||
* See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
* and https://trac.torproject.org/projects/tor/wiki/doc/OONI/censorshipwiki
|
||||
*/
|
||||
String[] BLOCKED = {"CN", "IR", "EG", "BY", "TR", "SY", "VE"};
|
||||
String[] BLOCKED = {"CN", "IR", "EG", "BY", "TR", "SY", "VE", "RU"};
|
||||
|
||||
/**
|
||||
* Countries where obfs4 or meek bridge connections are likely to work.
|
||||
* Should be a subset of {@link #BLOCKED}.
|
||||
* Should be a subset of {@link #BLOCKED} and the union of
|
||||
* {@link #DEFAULT_OBFS4_BRIDGES}, {@link #NON_DEFAULT_OBFS4_BRIDGES} and
|
||||
* {@link #MEEK_BRIDGES}.
|
||||
*/
|
||||
String[] BRIDGES = { "CN", "IR", "EG", "BY", "TR", "SY", "VE" };
|
||||
String[] BRIDGES = {"CN", "IR", "EG", "BY", "TR", "SY", "VE", "RU"};
|
||||
|
||||
/**
|
||||
* Countries where default obfs4 bridges are likely to work.
|
||||
* Should be a subset of {@link #BRIDGES}.
|
||||
*/
|
||||
String[] DEFAULT_OBFS4_BRIDGES = {"EG", "BY", "TR", "SY", "VE"};
|
||||
|
||||
/**
|
||||
* Countries where non-default obfs4 bridges are likely to work.
|
||||
* Should be a subset of {@link #BRIDGES}.
|
||||
*/
|
||||
String[] NON_DEFAULT_OBFS4_BRIDGES = {"RU"};
|
||||
|
||||
/**
|
||||
* Countries where obfs4 bridges won't work and meek is needed.
|
||||
* Should be a subset of {@link #BRIDGES}.
|
||||
*/
|
||||
String[] NEEDS_MEEK = {"CN", "IR"};
|
||||
String[] MEEK_BRIDGES = {"CN", "IR"};
|
||||
|
||||
/**
|
||||
* Returns true if vanilla Tor connections are blocked in the given country.
|
||||
*/
|
||||
boolean isTorProbablyBlocked(String countryCode);
|
||||
|
||||
/**
|
||||
* Returns true if bridge connections of some type work in the given
|
||||
* country.
|
||||
*/
|
||||
boolean doBridgesWork(String countryCode);
|
||||
|
||||
boolean needsMeek(String countryCode);
|
||||
/**
|
||||
* Returns the best type of bridge connection for the given country, or
|
||||
* {@link #DEFAULT_OBFS4_BRIDGES} if no bridge type is known to work.
|
||||
*/
|
||||
BridgeType getBestBridgeType(String countryCode);
|
||||
|
||||
@IoExecutor
|
||||
List<String> getBridges(boolean meek);
|
||||
List<String> getBridges(BridgeType type);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.bramble.plugin.tor;
|
||||
|
||||
import org.briarproject.bramble.api.lifecycle.IoExecutor;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
@@ -9,24 +10,31 @@ import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.briarproject.bramble.api.nullsafety.NullSafety.requireNonNull;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.DEFAULT_OBFS4;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.MEEK;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.NON_DEFAULT_OBFS4;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
class CircumventionProviderImpl implements CircumventionProvider {
|
||||
|
||||
private final static String BRIDGE_FILE_NAME = "bridges";
|
||||
|
||||
private static final Set<String> BLOCKED_IN_COUNTRIES =
|
||||
new HashSet<>(asList(BLOCKED));
|
||||
private static final Set<String> BRIDGES_WORK_IN_COUNTRIES =
|
||||
private static final Set<String> BRIDGE_COUNTRIES =
|
||||
new HashSet<>(asList(BRIDGES));
|
||||
private static final Set<String> BRIDGES_NEED_MEEK =
|
||||
new HashSet<>(asList(NEEDS_MEEK));
|
||||
|
||||
@Nullable
|
||||
private volatile List<String> bridges = null;
|
||||
private static final Set<String> DEFAULT_OBFS4_BRIDGE_COUNTRIES =
|
||||
new HashSet<>(asList(DEFAULT_OBFS4_BRIDGES));
|
||||
private static final Set<String> NON_DEFAULT_OBFS4_BRIDGE_COUNTRIES =
|
||||
new HashSet<>(asList(NON_DEFAULT_OBFS4_BRIDGES));
|
||||
private static final Set<String> MEEK_COUNTRIES =
|
||||
new HashSet<>(asList(MEEK_BRIDGES));
|
||||
|
||||
@Inject
|
||||
CircumventionProviderImpl() {
|
||||
@@ -39,33 +47,42 @@ class CircumventionProviderImpl implements CircumventionProvider {
|
||||
|
||||
@Override
|
||||
public boolean doBridgesWork(String countryCode) {
|
||||
return BRIDGES_WORK_IN_COUNTRIES.contains(countryCode);
|
||||
return BRIDGE_COUNTRIES.contains(countryCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsMeek(String countryCode) {
|
||||
return BRIDGES_NEED_MEEK.contains(countryCode);
|
||||
public BridgeType getBestBridgeType(String countryCode) {
|
||||
if (DEFAULT_OBFS4_BRIDGE_COUNTRIES.contains(countryCode)) {
|
||||
return DEFAULT_OBFS4;
|
||||
} else if (NON_DEFAULT_OBFS4_BRIDGE_COUNTRIES.contains(countryCode)) {
|
||||
return NON_DEFAULT_OBFS4;
|
||||
} else if (MEEK_COUNTRIES.contains(countryCode)) {
|
||||
return MEEK;
|
||||
} else {
|
||||
return DEFAULT_OBFS4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@IoExecutor
|
||||
public List<String> getBridges(boolean useMeek) {
|
||||
List<String> bridges = this.bridges;
|
||||
if (bridges != null) return new ArrayList<>(bridges);
|
||||
|
||||
InputStream is = getClass().getClassLoader()
|
||||
.getResourceAsStream(BRIDGE_FILE_NAME);
|
||||
public List<String> getBridges(BridgeType type) {
|
||||
InputStream is = requireNonNull(getClass().getClassLoader()
|
||||
.getResourceAsStream(BRIDGE_FILE_NAME));
|
||||
Scanner scanner = new Scanner(is);
|
||||
|
||||
bridges = new ArrayList<>();
|
||||
List<String> bridges = new ArrayList<>();
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
boolean isMeekBridge = line.startsWith("Bridge meek");
|
||||
if (useMeek && !isMeekBridge || !useMeek && isMeekBridge) continue;
|
||||
if (!line.startsWith("#")) bridges.add(line);
|
||||
boolean isDefaultObfs4 = line.startsWith("d ");
|
||||
boolean isNonDefaultObfs4 = line.startsWith("n ");
|
||||
boolean isMeek = line.startsWith("m ");
|
||||
if ((type == DEFAULT_OBFS4 && isDefaultObfs4) ||
|
||||
(type == NON_DEFAULT_OBFS4 && isNonDefaultObfs4) ||
|
||||
(type == MEEK && isMeek)) {
|
||||
bridges.add(line.substring(2));
|
||||
}
|
||||
}
|
||||
scanner.close();
|
||||
this.bridges = bridges;
|
||||
return bridges;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.briarproject.bramble.api.settings.event.SettingsUpdatedEvent;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
import org.briarproject.bramble.api.system.LocationUtils;
|
||||
import org.briarproject.bramble.api.system.ResourceProvider;
|
||||
import org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.EOFException;
|
||||
@@ -92,6 +93,7 @@ import static org.briarproject.bramble.api.plugin.TorConstants.PROP_ONION_V3;
|
||||
import static org.briarproject.bramble.api.plugin.TorConstants.REASON_BATTERY;
|
||||
import static org.briarproject.bramble.api.plugin.TorConstants.REASON_COUNTRY_BLOCKED;
|
||||
import static org.briarproject.bramble.api.plugin.TorConstants.REASON_MOBILE_DATA;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.MEEK;
|
||||
import static org.briarproject.bramble.plugin.tor.TorRendezvousCrypto.SEED_BYTES;
|
||||
import static org.briarproject.bramble.util.IoUtils.copyAndClose;
|
||||
import static org.briarproject.bramble.util.IoUtils.tryToClose;
|
||||
@@ -542,20 +544,20 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
controlConnection.setConf("DisableNetwork", enable ? "0" : "1");
|
||||
}
|
||||
|
||||
private void enableBridges(boolean enable, boolean needsMeek)
|
||||
private void enableBridges(boolean enable, BridgeType bridgeType)
|
||||
throws IOException {
|
||||
if (enable) {
|
||||
Collection<String> conf = new ArrayList<>();
|
||||
conf.add("UseBridges 1");
|
||||
File obfs4File = getObfs4ExecutableFile();
|
||||
if (needsMeek) {
|
||||
if (bridgeType == MEEK) {
|
||||
conf.add("ClientTransportPlugin meek_lite exec " +
|
||||
obfs4File.getAbsolutePath());
|
||||
} else {
|
||||
conf.add("ClientTransportPlugin obfs4 exec " +
|
||||
obfs4File.getAbsolutePath());
|
||||
}
|
||||
conf.addAll(circumventionProvider.getBridges(needsMeek));
|
||||
conf.addAll(circumventionProvider.getBridges(bridgeType));
|
||||
controlConnection.setConf(conf);
|
||||
} else {
|
||||
controlConnection.setConf("UseBridges", "0");
|
||||
@@ -844,7 +846,9 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
|
||||
int reasonsDisabled = 0;
|
||||
boolean enableNetwork = false, enableBridges = false;
|
||||
boolean useMeek = false, enableConnectionPadding = false;
|
||||
boolean enableConnectionPadding = false;
|
||||
BridgeType bridgeType =
|
||||
circumventionProvider.getBestBridgeType(country);
|
||||
|
||||
if (!online) {
|
||||
LOG.info("Disabling network, device is offline");
|
||||
@@ -873,14 +877,10 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
enableNetwork = true;
|
||||
if (network == PREF_TOR_NETWORK_WITH_BRIDGES ||
|
||||
(automatic && bridgesWork)) {
|
||||
if (ipv6Only ||
|
||||
circumventionProvider.needsMeek(country)) {
|
||||
LOG.info("Using meek bridges");
|
||||
enableBridges = true;
|
||||
useMeek = true;
|
||||
} else {
|
||||
LOG.info("Using obfs4 bridges");
|
||||
enableBridges = true;
|
||||
if (ipv6Only) bridgeType = MEEK;
|
||||
enableBridges = true;
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
LOG.info("Using bridge type " + bridgeType);
|
||||
}
|
||||
} else {
|
||||
LOG.info("Not using bridges");
|
||||
@@ -898,7 +898,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
|
||||
try {
|
||||
if (enableNetwork) {
|
||||
enableBridges(enableBridges, useMeek);
|
||||
enableBridges(enableBridges, bridgeType);
|
||||
enableConnectionPadding(enableConnectionPadding);
|
||||
useIpv6(ipv6Only);
|
||||
}
|
||||
|
||||
@@ -215,6 +215,23 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
m.getStreamContext(txn, tag)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamContext getStreamContextOnly(TransportId t, byte[] tag)
|
||||
throws DbException {
|
||||
return withManager(t, m ->
|
||||
db.transactionWithNullableResult(false, txn ->
|
||||
m.getStreamContextOnly(txn, tag)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markTagAsRecognised(TransportId t, byte[] tag)
|
||||
throws DbException {
|
||||
withManager(t, m -> {
|
||||
db.transaction(false, txn -> m.markTagAsRecognised(txn, tag));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eventOccurred(Event e) {
|
||||
if (e instanceof ContactRemovedEvent) {
|
||||
|
||||
@@ -48,4 +48,9 @@ interface TransportKeyManager {
|
||||
StreamContext getStreamContext(Transaction txn, byte[] tag)
|
||||
throws DbException;
|
||||
|
||||
@Nullable
|
||||
StreamContext getStreamContextOnly(Transaction txn, byte[] tag);
|
||||
|
||||
void markTagAsRecognised(Transaction txn, byte[] tag) throws DbException;
|
||||
|
||||
}
|
||||
|
||||
@@ -393,56 +393,82 @@ class TransportKeyManagerImpl implements TransportKeyManager {
|
||||
throws DbException {
|
||||
lock.lock();
|
||||
try {
|
||||
// Look up the incoming keys for the tag
|
||||
TagContext tagCtx = inContexts.remove(new Bytes(tag));
|
||||
if (tagCtx == null) return null;
|
||||
MutableIncomingKeys inKeys = tagCtx.inKeys;
|
||||
// Create a stream context
|
||||
StreamContext ctx = new StreamContext(tagCtx.contactId,
|
||||
tagCtx.pendingContactId, transportId,
|
||||
inKeys.getTagKey(), inKeys.getHeaderKey(),
|
||||
tagCtx.streamNumber, tagCtx.handshakeMode);
|
||||
// Update the reordering window
|
||||
ReorderingWindow window = inKeys.getWindow();
|
||||
Change change = window.setSeen(tagCtx.streamNumber);
|
||||
// Add tags for any stream numbers added to the window
|
||||
for (long streamNumber : change.getAdded()) {
|
||||
byte[] addTag = new byte[TAG_LENGTH];
|
||||
transportCrypto.encodeTag(addTag, inKeys.getTagKey(),
|
||||
PROTOCOL_VERSION, streamNumber);
|
||||
TagContext tagCtx1 = new TagContext(tagCtx.keySetId,
|
||||
tagCtx.contactId, tagCtx.pendingContactId, inKeys,
|
||||
streamNumber, tagCtx.handshakeMode);
|
||||
inContexts.put(new Bytes(addTag), tagCtx1);
|
||||
}
|
||||
// Remove tags for any stream numbers removed from the window
|
||||
for (long streamNumber : change.getRemoved()) {
|
||||
if (streamNumber == tagCtx.streamNumber) continue;
|
||||
byte[] removeTag = new byte[TAG_LENGTH];
|
||||
transportCrypto.encodeTag(removeTag, inKeys.getTagKey(),
|
||||
PROTOCOL_VERSION, streamNumber);
|
||||
inContexts.remove(new Bytes(removeTag));
|
||||
}
|
||||
// Write the window back to the DB
|
||||
db.setReorderingWindow(txn, tagCtx.keySetId, transportId,
|
||||
inKeys.getTimePeriod(), window.getBase(),
|
||||
window.getBitmap());
|
||||
// If the outgoing keys are inactive, activate them
|
||||
MutableTransportKeySet ks = keys.get(tagCtx.keySetId);
|
||||
MutableOutgoingKeys outKeys =
|
||||
ks.getKeys().getCurrentOutgoingKeys();
|
||||
if (!outKeys.isActive()) {
|
||||
LOG.info("Activating outgoing keys");
|
||||
outKeys.activate();
|
||||
considerReplacingOutgoingKeys(ks);
|
||||
db.setTransportKeysActive(txn, transportId, tagCtx.keySetId);
|
||||
}
|
||||
StreamContext ctx = streamContextFromTag(tag);
|
||||
if (ctx == null) return null;
|
||||
markTagAsRecognised(txn, tag);
|
||||
return ctx;
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamContext getStreamContextOnly(Transaction txn, byte[] tag) {
|
||||
lock.lock();
|
||||
try {
|
||||
return streamContextFromTag(tag);
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@GuardedBy("lock")
|
||||
@Nullable
|
||||
private StreamContext streamContextFromTag(byte[] tag) {
|
||||
// Look up the incoming keys for the tag
|
||||
TagContext tagCtx = inContexts.get(new Bytes(tag));
|
||||
if (tagCtx == null) return null;
|
||||
MutableIncomingKeys inKeys = tagCtx.inKeys;
|
||||
// Create a stream context
|
||||
return new StreamContext(tagCtx.contactId,
|
||||
tagCtx.pendingContactId, transportId,
|
||||
inKeys.getTagKey(), inKeys.getHeaderKey(),
|
||||
tagCtx.streamNumber, tagCtx.handshakeMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markTagAsRecognised(Transaction txn, byte[] tag)
|
||||
throws DbException {
|
||||
TagContext tagCtx = inContexts.remove(new Bytes(tag));
|
||||
if (tagCtx == null) return;
|
||||
MutableIncomingKeys inKeys = tagCtx.inKeys;
|
||||
// Update the reordering window
|
||||
ReorderingWindow window = inKeys.getWindow();
|
||||
Change change = window.setSeen(tagCtx.streamNumber);
|
||||
// Add tags for any stream numbers added to the window
|
||||
for (long streamNumber : change.getAdded()) {
|
||||
byte[] addTag = new byte[TAG_LENGTH];
|
||||
transportCrypto.encodeTag(addTag, inKeys.getTagKey(),
|
||||
PROTOCOL_VERSION, streamNumber);
|
||||
TagContext tagCtx1 = new TagContext(tagCtx.keySetId,
|
||||
tagCtx.contactId, tagCtx.pendingContactId, inKeys,
|
||||
streamNumber, tagCtx.handshakeMode);
|
||||
inContexts.put(new Bytes(addTag), tagCtx1);
|
||||
}
|
||||
// Remove tags for any stream numbers removed from the window
|
||||
for (long streamNumber : change.getRemoved()) {
|
||||
if (streamNumber == tagCtx.streamNumber) continue;
|
||||
byte[] removeTag = new byte[TAG_LENGTH];
|
||||
transportCrypto.encodeTag(removeTag, inKeys.getTagKey(),
|
||||
PROTOCOL_VERSION, streamNumber);
|
||||
inContexts.remove(new Bytes(removeTag));
|
||||
}
|
||||
// Write the window back to the DB
|
||||
db.setReorderingWindow(txn, tagCtx.keySetId, transportId,
|
||||
inKeys.getTimePeriod(), window.getBase(),
|
||||
window.getBitmap());
|
||||
// If the outgoing keys are inactive, activate them
|
||||
MutableTransportKeySet ks = keys.get(tagCtx.keySetId);
|
||||
MutableOutgoingKeys outKeys =
|
||||
ks.getKeys().getCurrentOutgoingKeys();
|
||||
if (!outKeys.isActive()) {
|
||||
LOG.info("Activating outgoing keys");
|
||||
outKeys.activate();
|
||||
considerReplacingOutgoingKeys(ks);
|
||||
db.setTransportKeysActive(txn, transportId, tagCtx.keySetId);
|
||||
}
|
||||
}
|
||||
|
||||
@DatabaseExecutor
|
||||
@Wakeful
|
||||
private void updateKeys(Transaction txn) throws DbException {
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
Bridge obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0
|
||||
Bridge obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0
|
||||
Bridge obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0
|
||||
Bridge obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0
|
||||
Bridge obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0
|
||||
Bridge obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0
|
||||
Bridge obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
|
||||
Bridge obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0
|
||||
Bridge obfs4 78.46.188.239:37356 5A2D2F4158D0453E00C7C176978D3F41D69C45DB cert=3c0SwxpOisbohNxEc4tb875RVW8eOu1opRTVXJhafaKA/PNNtI7ElQIVOVZg1AdL5bxGCw iat-mode=0
|
||||
Bridge meek_lite 192.0.2.2:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
||||
d Bridge obfs4 38.229.1.78:80 C8CBDB2464FC9804A69531437BCF2BE31FDD2EE4 cert=Hmyfd2ev46gGY7NoVxA9ngrPF2zCZtzskRTzoWXbxNkzeVnGFPWmrTtILRyqCTjHR+s9dg iat-mode=1
|
||||
d Bridge obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0
|
||||
d Bridge obfs4 85.31.186.98:443 011F2599C0E9B27EE74B353155E244813763C3E5 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=0
|
||||
d Bridge obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0
|
||||
d Bridge obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0
|
||||
d Bridge obfs4 193.11.166.194:27020 86AC7B8D430DAC4117E9F42C9EAED18133863AAF cert=0LDeJH4JzMDtkJJrFphJCiPqKx7loozKN7VNfuukMGfHO0Z8OGdzHVkhVAOfo1mUdv9cMg iat-mode=0
|
||||
d Bridge obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=ItvYZzW5tn6v3G4UnQa6Qz04Npro6e81AP70YujmK/KXwDFPTs3aHXcHp4n8Vt6w/bv8cA iat-mode=0
|
||||
d Bridge obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0
|
||||
d Bridge obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0
|
||||
d Bridge obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
|
||||
d Bridge obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0
|
||||
d Bridge obfs4 185.100.85.3:443 5B403DFE34F4872EB027059CECAE30B0C864B3A2 cert=bWUdFUe8io9U6JkSLoGAvSAUDcB779/shovCYmYAQb/pW/iEAMZtO/lCd94OokOF909TPA iat-mode=2
|
||||
n Bridge obfs4 46.226.107.197:10300 A38FD6BDFD902882F5F5B9B7CCC95602A20B0BC4 cert=t8tA9q2AeGlmp/dO6oW9bkY5RqqmvqjArCEM9wjJoDnk6XtnaejkF0JTA7VamdyOzcvuBg iat-mode=0
|
||||
n Bridge obfs4 74.104.165.202:9002 EF432018A6AA5D970B2F84E39CD30A147030141C cert=PhppfUusY85dHGvWtGTybZ1fED4DtbHmALkNMIOIYrAz1B4xN7/2a5gyiZe1epju1BOHVg iat-mode=0
|
||||
n Bridge obfs4 23.88.49.56:443 1CDA1660823AE2565D7F50DE8EB99DFDDE96074B cert=4bwNXedHutVD0ZqCm6ph90Vik9dRY4n9qnBHiLiqQOSsIvui4iHwuMFQK6oqiK8tyhVcDw iat-mode=0
|
||||
n Bridge obfs4 185.65.206.101:443 8A3E001D4C5105ED41060597DEEB21FF19CDC4D3 cert=Nd6XZ+f00sGKL1u6USmyvfqR34HN/pt7jEVbgMpXPF/yyGaLBiXRH/x0SIjX5TceYnd+Dg iat-mode=0
|
||||
m Bridge meek_lite 192.0.2.2:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
|
||||
@@ -13,7 +13,7 @@ import org.briarproject.bramble.api.sync.Message;
|
||||
import org.briarproject.bramble.api.sync.MessageContext;
|
||||
import org.briarproject.bramble.test.ValidatorTestCase;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.briarproject.bramble.api.transport.TransportConstants.MAX_CLOCK_DIFFERENCE;
|
||||
@@ -38,7 +38,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
|
||||
private final Metadata meta = new Metadata();
|
||||
|
||||
public BdfMessageValidatorTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidMessageException.class)
|
||||
|
||||
@@ -2197,6 +2197,55 @@ public abstract class JdbcDatabaseTest extends BrambleTestCase {
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResetRetransmissionTimes() throws Exception {
|
||||
long now = System.currentTimeMillis();
|
||||
AtomicLong time = new AtomicLong(now);
|
||||
Database<Connection> db =
|
||||
open(false, new TestMessageFactory(), new SettableClock(time));
|
||||
Connection txn = db.startTransaction();
|
||||
|
||||
// Add a contact, a shared group and a shared message
|
||||
db.addIdentity(txn, identity);
|
||||
assertEquals(contactId,
|
||||
db.addContact(txn, author, localAuthor.getId(), null, true));
|
||||
db.addGroup(txn, group);
|
||||
db.addGroupVisibility(txn, contactId, groupId, true);
|
||||
db.addMessage(txn, message, DELIVERED, true, false, null);
|
||||
|
||||
// Time: now
|
||||
// Retrieve the message from the database
|
||||
Collection<MessageId> ids = db.getMessagesToSend(txn, contactId,
|
||||
ONE_MEGABYTE, MAX_LATENCY);
|
||||
assertEquals(singletonList(messageId), ids);
|
||||
|
||||
// Time: now
|
||||
// Mark the message as sent
|
||||
db.updateExpiryTimeAndEta(txn, contactId, messageId, MAX_LATENCY);
|
||||
|
||||
// The message should expire after 2 * MAX_LATENCY
|
||||
assertEquals(now + MAX_LATENCY * 2, db.getNextSendTime(txn, contactId));
|
||||
|
||||
// Time: now + MAX_LATENCY * 2 - 1
|
||||
// The message should not yet be sendable
|
||||
time.set(now + MAX_LATENCY * 2 - 1);
|
||||
ids = db.getMessagesToSend(txn, contactId, ONE_MEGABYTE, MAX_LATENCY);
|
||||
assertTrue(ids.isEmpty());
|
||||
|
||||
// Reset the retransmission times
|
||||
db.resetUnackedMessagesToSend(txn, contactId);
|
||||
|
||||
// The message should have infinitely short expiry
|
||||
assertEquals(0, db.getNextSendTime(txn, contactId));
|
||||
|
||||
// The message should be sendable
|
||||
ids = db.getMessagesToSend(txn, contactId, ONE_MEGABYTE, MAX_LATENCY);
|
||||
assertFalse(ids.isEmpty());
|
||||
|
||||
db.commitTransaction(txn);
|
||||
db.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompactionTime() throws Exception {
|
||||
MessageFactory messageFactory = new TestMessageFactory();
|
||||
|
||||
@@ -11,9 +11,9 @@ import org.briarproject.bramble.api.keyagreement.PayloadEncoder;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.auto.Mock;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.jmock.integration.junit4.JUnitRuleMockery;
|
||||
import org.jmock.lib.concurrent.Synchroniser;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class KeyAgreementProtocolTest extends BrambleTestCase {
|
||||
@Rule
|
||||
public JUnitRuleMockery context = new JUnitRuleMockery() {{
|
||||
// So we can mock concrete classes like KeyAgreementTransport
|
||||
setImposteriser(ClassImposteriser.INSTANCE);
|
||||
setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
setThreadingPolicy(new Synchroniser());
|
||||
}};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.briarproject.bramble.api.record.RecordWriterFactory;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.CaptureArgumentAction;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -58,7 +58,7 @@ public class KeyAgreementTransportTest extends BrambleMockTestCase {
|
||||
private KeyAgreementTransport kat;
|
||||
|
||||
public KeyAgreementTransportTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
inputStream = context.mock(InputStream.class);
|
||||
outputStream = context.mock(OutputStream.class);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.bramble.mailbox;
|
||||
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxProperties;
|
||||
import org.briarproject.bramble.api.mailbox.MailboxSettingsManager;
|
||||
@@ -10,12 +11,15 @@ import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_KEY_ATTEMPTS;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_KEY_LAST_ATTEMPT;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_KEY_LAST_SUCCESS;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_KEY_ONION;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_KEY_TOKEN;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_NAMESPACE;
|
||||
import static org.briarproject.bramble.mailbox.MailboxSettingsManagerImpl.SETTINGS_UPLOADS_NAMESPACE;
|
||||
import static org.briarproject.bramble.util.StringUtils.getRandomString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
@@ -29,8 +33,12 @@ public class MailboxSettingsManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
private final MailboxSettingsManager manager =
|
||||
new MailboxSettingsManagerImpl(settingsManager);
|
||||
private final Random random = new Random();
|
||||
private final String onion = getRandomString(64);
|
||||
private final String token = getRandomString(64);
|
||||
private final ContactId contactId1 = new ContactId(random.nextInt());
|
||||
private final ContactId contactId2 = new ContactId(random.nextInt());
|
||||
private final ContactId contactId3 = new ContactId(random.nextInt());
|
||||
private final long now = System.currentTimeMillis();
|
||||
private final long lastAttempt = now - 1234;
|
||||
private final long lastSuccess = now - 2345;
|
||||
@@ -166,4 +174,52 @@ public class MailboxSettingsManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
manager.recordFailedConnectionAttempt(txn, now);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGettingPendingUploads() throws Exception {
|
||||
Transaction txn = new Transaction(null, true);
|
||||
Settings settings = new Settings();
|
||||
settings.put(String.valueOf(contactId1.getInt()), onion);
|
||||
settings.put(String.valueOf(contactId2.getInt()), token);
|
||||
settings.put(String.valueOf(contactId3.getInt()), "");
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
exactly(4).of(settingsManager)
|
||||
.getSettings(txn, SETTINGS_UPLOADS_NAMESPACE);
|
||||
will(returnValue(settings));
|
||||
}});
|
||||
|
||||
String filename1 = manager.getPendingUpload(txn, contactId1);
|
||||
assertEquals(onion, filename1);
|
||||
String filename2 = manager.getPendingUpload(txn, contactId2);
|
||||
assertEquals(token, filename2);
|
||||
String filename3 = manager.getPendingUpload(txn, contactId3);
|
||||
assertNull(filename3);
|
||||
String filename4 =
|
||||
manager.getPendingUpload(txn, new ContactId(random.nextInt()));
|
||||
assertNull(filename4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSettingPendingUploads() throws Exception {
|
||||
Transaction txn = new Transaction(null, false);
|
||||
|
||||
// setting a pending upload stores expected settings
|
||||
Settings expectedSettings1 = new Settings();
|
||||
expectedSettings1.put(String.valueOf(contactId1.getInt()), onion);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(settingsManager).mergeSettings(txn, expectedSettings1,
|
||||
SETTINGS_UPLOADS_NAMESPACE);
|
||||
}});
|
||||
manager.setPendingUpload(txn, contactId1, onion);
|
||||
|
||||
// nulling a pending upload empties stored settings
|
||||
Settings expectedSettings2 = new Settings();
|
||||
expectedSettings2.put(String.valueOf(contactId2.getInt()), "");
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(settingsManager).mergeSettings(txn, expectedSettings2,
|
||||
SETTINGS_UPLOADS_NAMESPACE);
|
||||
}});
|
||||
manager.setPendingUpload(txn, contactId2, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.ImmediateExecutor;
|
||||
import org.briarproject.bramble.test.RunAction;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class PollerImplTest extends BrambleMockTestCase {
|
||||
private PollerImpl poller;
|
||||
|
||||
public PollerImplTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
random = context.mock(SecureRandom.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.briarproject.bramble.plugin.tor;
|
||||
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BLOCKED;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BRIDGES;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.DEFAULT_OBFS4;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.MEEK;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.NON_DEFAULT_OBFS4;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.DEFAULT_OBFS4_BRIDGES;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.MEEK_BRIDGES;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.NON_DEFAULT_OBFS4_BRIDGES;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class CircumventionProviderTest extends BrambleTestCase {
|
||||
|
||||
private final CircumventionProvider provider =
|
||||
new CircumventionProviderImpl();
|
||||
|
||||
@Test
|
||||
public void testInvariants() {
|
||||
Set<String> blocked = new HashSet<>(asList(BLOCKED));
|
||||
Set<String> bridges = new HashSet<>(asList(BRIDGES));
|
||||
Set<String> defaultObfs4Bridges =
|
||||
new HashSet<>(asList(DEFAULT_OBFS4_BRIDGES));
|
||||
Set<String> nonDefaultObfs4Bridges =
|
||||
new HashSet<>(asList(NON_DEFAULT_OBFS4_BRIDGES));
|
||||
Set<String> meekBridges = new HashSet<>(asList(MEEK_BRIDGES));
|
||||
// BRIDGES should be a subset of BLOCKED
|
||||
assertTrue(blocked.containsAll(bridges));
|
||||
// BRIDGES should be the union of the bridge type sets
|
||||
Set<String> union = new HashSet<>(defaultObfs4Bridges);
|
||||
union.addAll(nonDefaultObfs4Bridges);
|
||||
union.addAll(meekBridges);
|
||||
assertEquals(bridges, union);
|
||||
// The bridge type sets should not overlap
|
||||
assertEmptyIntersection(defaultObfs4Bridges, nonDefaultObfs4Bridges);
|
||||
assertEmptyIntersection(defaultObfs4Bridges, meekBridges);
|
||||
assertEmptyIntersection(nonDefaultObfs4Bridges, meekBridges);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBestBridgeType() {
|
||||
for (String country : DEFAULT_OBFS4_BRIDGES) {
|
||||
assertEquals(DEFAULT_OBFS4, provider.getBestBridgeType(country));
|
||||
}
|
||||
for (String country : NON_DEFAULT_OBFS4_BRIDGES) {
|
||||
assertEquals(NON_DEFAULT_OBFS4,
|
||||
provider.getBestBridgeType(country));
|
||||
}
|
||||
for (String country : MEEK_BRIDGES) {
|
||||
assertEquals(MEEK, provider.getBestBridgeType(country));
|
||||
}
|
||||
assertEquals(DEFAULT_OBFS4, provider.getBestBridgeType("ZZ"));
|
||||
}
|
||||
|
||||
private <T> void assertEmptyIntersection(Set<T> a, Set<T> b) {
|
||||
Set<T> intersection = new HashSet<>(a);
|
||||
intersection.retainAll(b);
|
||||
assertTrue(intersection.isEmpty());
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,26 @@ public class TestFeatureFlagModule {
|
||||
public boolean shouldEnableDisappearingMessages() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableIntroductionsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnablePrivateGroupsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableForumsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableBlogsInCore() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,6 +393,76 @@ public class TransportKeyManagerImplTest extends BrambleMockTestCase {
|
||||
assertNull(transportKeyManager.getStreamContext(txn, tag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetStreamContextOnlyAndMarkTag() throws Exception {
|
||||
boolean alice = random.nextBoolean();
|
||||
TransportKeys transportKeys = createTransportKeys(1000, 0, true);
|
||||
Transaction txn = new Transaction(null, false);
|
||||
|
||||
// Keep a copy of the tags
|
||||
List<byte[]> tags = new ArrayList<>();
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(transportCrypto).deriveRotationKeys(transportId, rootKey,
|
||||
1000, alice, true);
|
||||
will(returnValue(transportKeys));
|
||||
// Get the current time (the start of time period 1000)
|
||||
oneOf(clock).currentTimeMillis();
|
||||
will(returnValue(timePeriodLength * 1000));
|
||||
// Encode the tags (3 sets)
|
||||
for (long i = 0; i < REORDERING_WINDOW_SIZE; i++) {
|
||||
exactly(3).of(transportCrypto).encodeTag(
|
||||
with(any(byte[].class)), with(tagKey),
|
||||
with(PROTOCOL_VERSION), with(i));
|
||||
will(new EncodeTagAction(tags));
|
||||
}
|
||||
// Updated the transport keys (the keys are unaffected)
|
||||
oneOf(transportCrypto).updateTransportKeys(transportKeys, 1000);
|
||||
will(returnValue(transportKeys));
|
||||
// Save the keys
|
||||
oneOf(db).addTransportKeys(txn, contactId, transportKeys);
|
||||
will(returnValue(keySetId));
|
||||
// Encode a new tag after sliding the window
|
||||
oneOf(transportCrypto).encodeTag(with(any(byte[].class)),
|
||||
with(tagKey), with(PROTOCOL_VERSION),
|
||||
with((long) REORDERING_WINDOW_SIZE));
|
||||
will(new EncodeTagAction(tags));
|
||||
// Save the reordering window (previous time period, base 1)
|
||||
oneOf(db).setReorderingWindow(txn, keySetId, transportId, 999,
|
||||
1, new byte[REORDERING_WINDOW_SIZE / 8]);
|
||||
}});
|
||||
|
||||
// The timestamp is at the start of time period 1000
|
||||
long timestamp = timePeriodLength * 1000;
|
||||
assertEquals(keySetId, transportKeyManager.addRotationKeys(
|
||||
txn, contactId, rootKey, timestamp, alice, true));
|
||||
assertTrue(transportKeyManager.canSendOutgoingStreams(contactId));
|
||||
// Use the first tag (previous time period, stream number 0)
|
||||
assertEquals(REORDERING_WINDOW_SIZE * 3, tags.size());
|
||||
byte[] tag = tags.get(0);
|
||||
// Repeated request should return same stream context
|
||||
StreamContext ctx = transportKeyManager.getStreamContextOnly(txn, tag);
|
||||
assertNotNull(ctx);
|
||||
assertEquals(contactId, ctx.getContactId());
|
||||
assertEquals(transportId, ctx.getTransportId());
|
||||
assertEquals(tagKey, ctx.getTagKey());
|
||||
assertEquals(headerKey, ctx.getHeaderKey());
|
||||
assertEquals(0L, ctx.getStreamNumber());
|
||||
ctx = transportKeyManager.getStreamContextOnly(txn, tag);
|
||||
assertNotNull(ctx);
|
||||
assertEquals(contactId, ctx.getContactId());
|
||||
assertEquals(transportId, ctx.getTransportId());
|
||||
assertEquals(tagKey, ctx.getTagKey());
|
||||
assertEquals(headerKey, ctx.getHeaderKey());
|
||||
assertEquals(0L, ctx.getStreamNumber());
|
||||
// Then mark tag as recognised
|
||||
transportKeyManager.markTagAsRecognised(txn, tag);
|
||||
// Another tag should have been encoded
|
||||
assertEquals(REORDERING_WINDOW_SIZE * 3 + 1, tags.size());
|
||||
// Finally ensure the used tag is not recognised again
|
||||
assertNull(transportKeyManager.getStreamContextOnly(txn, tag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testKeysAreUpdatedToCurrentPeriod() throws Exception {
|
||||
TransportKeys transportKeys = createTransportKeys(1000, 0, true);
|
||||
|
||||
@@ -15,6 +15,8 @@ dependencyVerification {
|
||||
'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava:listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:b372a037d4230aa57fbeffdef30fd6123f9c0c2db85d0aced00c91b974f33f99',
|
||||
'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:2994a7eb78f2710bd3d3bfb639b2c94e219cedac0d4d084d516e78c16dddecf6',
|
||||
'com.h2database:h2:1.4.192:h2-1.4.192.jar:225b22e9857235c46c93861410b60b8c81c10dc8985f4faf188985ba5445126c',
|
||||
'com.squareup.okhttp3:okhttp:3.12.13:okhttp-3.12.13.jar:508234e024ef7e270ab1a6d5b356f5b98e786511239ca986d684fd1e2cf7bc82',
|
||||
'com.squareup.okio:okio:1.15.0:okio-1.15.0.jar:693fa319a7e8843300602b204023b7674f106ebcb577f2dd5807212b66118bd2',
|
||||
'com.squareup:javapoet:1.13.0:javapoet-1.13.0.jar:4c7517e848a71b36d069d12bb3bf46a70fd4cda3105d822b0ed2e19c00b69291',
|
||||
'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f',
|
||||
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
|
||||
@@ -26,7 +28,7 @@ dependencyVerification {
|
||||
'net.ltgt.gradle.incap:incap:0.2:incap-0.2.jar:b625b9806b0f1e4bc7a2e3457119488de3cd57ea20feedd513db070a573a4ffd',
|
||||
'org.apache-extras.beanshell:bsh:2.0b6:bsh-2.0b6.jar:a17955976070c0573235ee662f2794a78082758b61accffce8d3f8aedcd91047',
|
||||
'org.bitlet:weupnp:0.1.4:weupnp-0.1.4.jar:88df7e6504929d00bdb832863761385c68ab92af945b04f0770b126270a444fb',
|
||||
'org.bouncycastle:bcprov-jdk15on:1.69:bcprov-jdk15on-1.69.jar:e469bd39f936999f256002631003ff022a22951da9d5bd9789c7abfa9763a292',
|
||||
'org.bouncycastle:bcprov-jdk15to18:1.70:bcprov-jdk15to18-1.70.jar:7df4c54f29ce2dd616dc3b198ca4db3dfcc79e3cb397c084a0aff97b85c0bf38',
|
||||
'org.briarproject:jtorctl:0.3:jtorctl-0.3.jar:f2939238a097898998432effe93b0334d97a787972ab3a91a8973a1d309fc864',
|
||||
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
|
||||
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
|
||||
|
||||
@@ -27,7 +27,6 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
|
||||
testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
}
|
||||
|
||||
@@ -6,12 +6,14 @@ import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||
import org.briarproject.bramble.api.event.EventBus;
|
||||
import org.briarproject.bramble.api.lifecycle.IoExecutor;
|
||||
import org.briarproject.bramble.api.network.NetworkManager;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.BackoffFactory;
|
||||
import org.briarproject.bramble.api.plugin.duplex.DuplexPlugin;
|
||||
import org.briarproject.bramble.api.system.Clock;
|
||||
import org.briarproject.bramble.api.system.LocationUtils;
|
||||
import org.briarproject.bramble.api.system.ResourceProvider;
|
||||
import org.briarproject.bramble.api.system.WakefulIoExecutor;
|
||||
import org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType;
|
||||
import org.briarproject.bramble.test.BrambleJavaIntegrationTestComponent;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.briarproject.bramble.test.DaggerBrambleJavaIntegrationTestComponent;
|
||||
@@ -34,11 +36,14 @@ import javax.inject.Inject;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.api.plugin.Plugin.State.ACTIVE;
|
||||
import static org.briarproject.bramble.api.plugin.TorConstants.DEFAULT_CONTROL_PORT;
|
||||
import static org.briarproject.bramble.api.plugin.TorConstants.DEFAULT_SOCKS_PORT;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.DEFAULT_OBFS4;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.MEEK;
|
||||
import static org.briarproject.bramble.plugin.tor.CircumventionProvider.BridgeType.NON_DEFAULT_OBFS4;
|
||||
import static org.briarproject.bramble.test.TestUtils.deleteTestDirectory;
|
||||
import static org.briarproject.bramble.test.TestUtils.getTestDirectory;
|
||||
import static org.briarproject.bramble.test.TestUtils.isOptionalTestEnabled;
|
||||
@@ -57,14 +62,21 @@ public class BridgeTest extends BrambleTestCase {
|
||||
.injectEagerSingletons(component);
|
||||
// Share a failure counter among all the test instances
|
||||
AtomicInteger failures = new AtomicInteger(0);
|
||||
List<String> bridges =
|
||||
component.getCircumventionProvider().getBridges(false);
|
||||
List<Params> states = new ArrayList<>(bridges.size());
|
||||
for (String bridge : bridges) states.add(new Params(bridge, failures));
|
||||
CircumventionProvider provider = component.getCircumventionProvider();
|
||||
List<Params> states = new ArrayList<>();
|
||||
for (String bridge : provider.getBridges(DEFAULT_OBFS4)) {
|
||||
states.add(new Params(bridge, DEFAULT_OBFS4, failures, false));
|
||||
}
|
||||
for (String bridge : provider.getBridges(NON_DEFAULT_OBFS4)) {
|
||||
states.add(new Params(bridge, NON_DEFAULT_OBFS4, failures, false));
|
||||
}
|
||||
for (String bridge : provider.getBridges(MEEK)) {
|
||||
states.add(new Params(bridge, MEEK, failures, true));
|
||||
}
|
||||
return states;
|
||||
}
|
||||
|
||||
private final static long TIMEOUT = SECONDS.toMillis(60);
|
||||
private final static long TIMEOUT = MINUTES.toMillis(5);
|
||||
private final static int NUM_FAILURES_ALLOWED = 1;
|
||||
|
||||
private final static Logger LOG = getLogger(BridgeTest.class.getName());
|
||||
@@ -93,14 +105,12 @@ public class BridgeTest extends BrambleTestCase {
|
||||
CryptoComponent crypto;
|
||||
|
||||
private final File torDir = getTestDirectory();
|
||||
private final String bridge;
|
||||
private final AtomicInteger failures;
|
||||
private final Params params;
|
||||
|
||||
private UnixTorPluginFactory factory;
|
||||
|
||||
public BridgeTest(Params params) {
|
||||
bridge = params.bridge;
|
||||
failures = params.failures;
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -120,6 +130,7 @@ public class BridgeTest extends BrambleTestCase {
|
||||
LocationUtils locationUtils = () -> "US";
|
||||
SocketFactory torSocketFactory = SocketFactory.getDefault();
|
||||
|
||||
@NotNullByDefault
|
||||
CircumventionProvider bridgeProvider = new CircumventionProvider() {
|
||||
@Override
|
||||
public boolean isTorProbablyBlocked(String countryCode) {
|
||||
@@ -132,13 +143,13 @@ public class BridgeTest extends BrambleTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsMeek(String countryCode) {
|
||||
return false;
|
||||
public BridgeType getBestBridgeType(String countryCode) {
|
||||
return params.bridgeType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBridges(boolean useMeek) {
|
||||
return singletonList(bridge);
|
||||
public List<String> getBridges(BridgeType bridgeType) {
|
||||
return singletonList(params.bridge);
|
||||
}
|
||||
};
|
||||
factory = new UnixTorPluginFactory(ioExecutor, wakefulIoExecutor,
|
||||
@@ -160,7 +171,7 @@ public class BridgeTest extends BrambleTestCase {
|
||||
assertNotNull(duplexPlugin);
|
||||
UnixTorPlugin plugin = (UnixTorPlugin) duplexPlugin;
|
||||
|
||||
LOG.warning("Testing " + bridge);
|
||||
LOG.warning("Testing " + params.bridge);
|
||||
try {
|
||||
plugin.start();
|
||||
long start = clock.currentTimeMillis();
|
||||
@@ -170,8 +181,11 @@ public class BridgeTest extends BrambleTestCase {
|
||||
}
|
||||
if (plugin.getState() != ACTIVE) {
|
||||
LOG.warning("Could not connect to Tor within timeout");
|
||||
if (failures.incrementAndGet() > NUM_FAILURES_ALLOWED) {
|
||||
fail(failures.get() + " bridges are unreachable");
|
||||
if (params.failures.incrementAndGet() > NUM_FAILURES_ALLOWED) {
|
||||
fail(params.failures.get() + " bridges are unreachable");
|
||||
}
|
||||
if (params.mustSucceed) {
|
||||
fail("essential bridge is unreachable");
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -182,11 +196,16 @@ public class BridgeTest extends BrambleTestCase {
|
||||
private static class Params {
|
||||
|
||||
private final String bridge;
|
||||
private final BridgeType bridgeType;
|
||||
private final AtomicInteger failures;
|
||||
private final boolean mustSucceed;
|
||||
|
||||
private Params(String bridge, AtomicInteger failures) {
|
||||
private Params(String bridge, BridgeType bridgeType,
|
||||
AtomicInteger failures, boolean mustSucceed) {
|
||||
this.bridge = bridge;
|
||||
this.bridgeType = bridgeType;
|
||||
this.failures = failures;
|
||||
this.mustSucceed = mustSucceed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 10401
|
||||
versionName "1.4.1"
|
||||
versionCode 10403
|
||||
versionName "1.4.3"
|
||||
applicationId "org.briarproject.briar.android"
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
@@ -131,17 +131,17 @@ dependencies {
|
||||
def espressoVersion = '3.3.0'
|
||||
testImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||
testImplementation project(path: ':bramble-core', configuration: 'testOutput')
|
||||
testImplementation 'androidx.test:runner:1.3.0'
|
||||
testImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
testImplementation 'androidx.fragment:fragment-testing:1.3.4'
|
||||
testImplementation 'androidx.test:runner:1.4.0'
|
||||
testImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
testImplementation 'androidx.fragment:fragment-testing:1.4.0'
|
||||
testImplementation "androidx.arch.core:core-testing:2.1.0"
|
||||
testImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
|
||||
testImplementation 'org.robolectric:robolectric:4.3.1'
|
||||
testImplementation 'org.robolectric:robolectric:4.4'
|
||||
testImplementation 'org.mockito:mockito-core:3.9.0'
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
||||
testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
androidTestImplementation project(path: ':bramble-api', configuration: 'testOutput')
|
||||
|
||||
@@ -56,6 +56,7 @@ import org.briarproject.briar.android.viewmodel.ViewModelModule;
|
||||
import org.briarproject.briar.api.android.AndroidNotificationManager;
|
||||
import org.briarproject.briar.api.android.DozeWatchdog;
|
||||
import org.briarproject.briar.api.android.LockManager;
|
||||
import org.briarproject.briar.api.android.NetworkUsageMetrics;
|
||||
import org.briarproject.briar.api.android.ScreenFilterMonitor;
|
||||
import org.briarproject.briar.api.test.TestAvatarCreator;
|
||||
|
||||
@@ -114,7 +115,7 @@ public class AppModule {
|
||||
@Inject
|
||||
ScreenFilterMonitor screenFilterMonitor;
|
||||
@Inject
|
||||
NetworkUsageLogger networkUsageLogger;
|
||||
NetworkUsageMetrics networkUsageMetrics;
|
||||
@Inject
|
||||
DozeWatchdog dozeWatchdog;
|
||||
@Inject
|
||||
@@ -287,11 +288,12 @@ public class AppModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
NetworkUsageLogger provideNetworkUsageLogger(
|
||||
@Singleton
|
||||
NetworkUsageMetrics provideNetworkUsageMetrics(
|
||||
LifecycleManager lifecycleManager) {
|
||||
NetworkUsageLogger networkUsageLogger = new NetworkUsageLogger();
|
||||
lifecycleManager.registerService(networkUsageLogger);
|
||||
return networkUsageLogger;
|
||||
NetworkUsageMetrics networkUsageMetrics = new NetworkUsageMetricsImpl();
|
||||
lifecycleManager.registerService(networkUsageMetrics);
|
||||
return networkUsageMetrics;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@@ -337,6 +339,26 @@ public class AppModule {
|
||||
public boolean shouldEnableDisappearingMessages() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableIntroductionsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnablePrivateGroupsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableForumsInCore() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldEnableBlogsInCore() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package org.briarproject.briar.android;
|
||||
|
||||
import android.net.TrafficStats;
|
||||
import android.os.Process;
|
||||
|
||||
import org.briarproject.bramble.api.lifecycle.Service;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
|
||||
class NetworkUsageLogger implements Service {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(NetworkUsageLogger.class.getName());
|
||||
|
||||
private volatile long startTime, rxBytes, txBytes;
|
||||
|
||||
@Override
|
||||
public void startService() {
|
||||
startTime = now();
|
||||
int uid = Process.myUid();
|
||||
rxBytes = TrafficStats.getUidRxBytes(uid);
|
||||
txBytes = TrafficStats.getUidTxBytes(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopService() {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
long sessionDuration = now() - startTime;
|
||||
int uid = Process.myUid();
|
||||
long rx = TrafficStats.getUidRxBytes(uid) - rxBytes;
|
||||
long tx = TrafficStats.getUidTxBytes(uid) - txBytes;
|
||||
LOG.info("Duration " + (sessionDuration / 1000) + " seconds");
|
||||
LOG.info("Received " + rx + " bytes");
|
||||
LOG.info("Sent " + tx + " bytes");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.briarproject.briar.android;
|
||||
|
||||
import android.net.TrafficStats;
|
||||
import android.os.Process;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.briar.api.android.NetworkUsageMetrics;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.bramble.util.LogUtils.now;
|
||||
|
||||
@NotNullByDefault
|
||||
class NetworkUsageMetricsImpl implements NetworkUsageMetrics {
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(NetworkUsageMetricsImpl.class.getName());
|
||||
|
||||
private volatile long startTime, rxBytes, txBytes;
|
||||
|
||||
@Override
|
||||
public void startService() {
|
||||
startTime = now();
|
||||
int uid = Process.myUid();
|
||||
rxBytes = TrafficStats.getUidRxBytes(uid);
|
||||
txBytes = TrafficStats.getUidTxBytes(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopService() {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
Metrics metrics = getMetrics();
|
||||
LOG.info("Duration " + (metrics.getSessionDurationMs() / 1000)
|
||||
+ " seconds");
|
||||
LOG.info("Received " + metrics.getRxBytes() + " bytes");
|
||||
LOG.info("Sent " + metrics.getTxBytes() + " bytes");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Metrics getMetrics() {
|
||||
long sessionDurationMs = now() - startTime;
|
||||
int uid = Process.myUid();
|
||||
long rx = TrafficStats.getUidRxBytes(uid) - rxBytes;
|
||||
long tx = TrafficStats.getUidTxBytes(uid) - txBytes;
|
||||
return new Metrics(sessionDurationMs, rx, tx);
|
||||
}
|
||||
}
|
||||
@@ -312,12 +312,19 @@ class HotspotManager {
|
||||
}
|
||||
GroupInfoListener groupListener = group -> {
|
||||
boolean valid = isGroupValid(group);
|
||||
// If the group is valid, set the hotspot to started. If we don't
|
||||
// have any attempts left, we try what we got
|
||||
if (valid || attempt >= MAX_GROUP_INFO_ATTEMPTS) {
|
||||
if (valid) {
|
||||
// the group is valid, set the hotspot to started.
|
||||
onHotspotStarted(group);
|
||||
} else if (attempt < MAX_GROUP_INFO_ATTEMPTS) {
|
||||
// we have attempts left, try again
|
||||
retryRequestingGroupInfo(attempt);
|
||||
} else if (group != null) {
|
||||
// no attempts left, but group is not null, try what we got
|
||||
onHotspotStarted(group);
|
||||
} else {
|
||||
retryRequestingGroupInfo(attempt);
|
||||
// no attempts left and group is null, fail
|
||||
releaseHotspotWithError(ctx.getString(
|
||||
R.string.hotspot_error_start_callback_no_group_info));
|
||||
}
|
||||
};
|
||||
try {
|
||||
@@ -366,13 +373,8 @@ class HotspotManager {
|
||||
private void retryRequestingGroupInfo(int attempt) {
|
||||
LOG.info("retrying to request group info");
|
||||
// On some devices we need to wait for the group info to become available
|
||||
if (attempt < MAX_GROUP_INFO_ATTEMPTS) {
|
||||
handler.postDelayed(() -> requestGroupInfo(attempt + 1),
|
||||
RETRY_DELAY_MILLIS);
|
||||
} else {
|
||||
releaseHotspotWithError(ctx.getString(
|
||||
R.string.hotspot_error_start_callback_no_group_info));
|
||||
}
|
||||
handler.postDelayed(() -> requestGroupInfo(attempt + 1),
|
||||
RETRY_DELAY_MILLIS);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
||||
@@ -28,6 +28,8 @@ import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.reporting.ReportData.MultiReportInfo;
|
||||
import org.briarproject.briar.android.reporting.ReportData.ReportItem;
|
||||
import org.briarproject.briar.android.reporting.ReportData.SingleReportInfo;
|
||||
import org.briarproject.briar.api.android.NetworkUsageMetrics;
|
||||
import org.briarproject.briar.api.android.NetworkUsageMetrics.Metrics;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
@@ -65,9 +67,11 @@ import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
class BriarReportCollector {
|
||||
|
||||
private final Context ctx;
|
||||
private final NetworkUsageMetrics networkUsageMetrics;
|
||||
|
||||
BriarReportCollector(Context ctx) {
|
||||
BriarReportCollector(Context ctx, NetworkUsageMetrics networkUsageMetrics) {
|
||||
this.ctx = ctx;
|
||||
this.networkUsageMetrics = networkUsageMetrics;
|
||||
}
|
||||
|
||||
ReportData collectReportData(@Nullable Throwable t, long appStartTime,
|
||||
@@ -81,6 +85,7 @@ class BriarReportCollector {
|
||||
.add(getMemory())
|
||||
.add(getStorage())
|
||||
.add(getConnectivity())
|
||||
.add(getNetworkUsage())
|
||||
.add(getBuildConfig())
|
||||
.add(getLogcat(logs))
|
||||
.add(getDeviceFeatures());
|
||||
@@ -298,6 +303,16 @@ class BriarReportCollector {
|
||||
connectivityInfo);
|
||||
}
|
||||
|
||||
private ReportItem getNetworkUsage() {
|
||||
Metrics metrics = networkUsageMetrics.getMetrics();
|
||||
MultiReportInfo networkUsage = new MultiReportInfo()
|
||||
.add("SessionDuration", metrics.getSessionDurationMs())
|
||||
.add("BytesReceived", metrics.getRxBytes())
|
||||
.add("BytesSent", metrics.getTxBytes());
|
||||
return new ReportItem("NetworkUsage", R.string.dev_report_network_usage,
|
||||
networkUsage);
|
||||
}
|
||||
|
||||
private ReportItem getBuildConfig() {
|
||||
MultiReportInfo buildConfig = new MultiReportInfo()
|
||||
.add("GitHash", BuildConfig.GitHash)
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.briarproject.briar.android.reporting.ReportData.MultiReportInfo;
|
||||
import org.briarproject.briar.android.reporting.ReportData.ReportItem;
|
||||
import org.briarproject.briar.android.viewmodel.LiveEvent;
|
||||
import org.briarproject.briar.android.viewmodel.MutableLiveEvent;
|
||||
import org.briarproject.briar.api.android.NetworkUsageMetrics;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.File;
|
||||
@@ -69,12 +70,13 @@ class ReportViewModel extends AndroidViewModel {
|
||||
|
||||
@Inject
|
||||
ReportViewModel(@NonNull Application application,
|
||||
NetworkUsageMetrics networkUsageMetrics,
|
||||
CachingLogHandler logHandler,
|
||||
LogDecrypter logDecrypter,
|
||||
DevReporter reporter,
|
||||
PluginManager pluginManager) {
|
||||
super(application);
|
||||
collector = new BriarReportCollector(application);
|
||||
collector = new BriarReportCollector(application, networkUsageMetrics);
|
||||
this.logHandler = logHandler;
|
||||
this.logDecrypter = logDecrypter;
|
||||
this.reporter = reporter;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.briarproject.briar.api.android;
|
||||
|
||||
import org.briarproject.bramble.api.lifecycle.Service;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface NetworkUsageMetrics extends Service {
|
||||
|
||||
Metrics getMetrics();
|
||||
|
||||
class Metrics {
|
||||
|
||||
private final long sessionDurationMs, rxBytes, txBytes;
|
||||
|
||||
public Metrics(long sessionDurationMs, long rxBytes,
|
||||
long txBytes) {
|
||||
this.sessionDurationMs = sessionDurationMs;
|
||||
this.rxBytes = rxBytes;
|
||||
this.txBytes = txBytes;
|
||||
}
|
||||
|
||||
public long getSessionDurationMs() {
|
||||
return sessionDurationMs;
|
||||
}
|
||||
|
||||
public long getRxBytes() {
|
||||
return rxBytes;
|
||||
}
|
||||
|
||||
public long getTxBytes() {
|
||||
return txBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -647,8 +647,6 @@
|
||||
<string name="transports_help_text">Briar може да се свърже с контактите ви през интернет, Wi-Fi или Bluetooth.\n\nЗа повече поверителност цялата връзка към интернет се пренасочва през мрежата на Tor.\n\nАко даден контакт може да бъде достъпен чрез няколко метода Briar ги използва успоредно.</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">Споделяне на приложението извън мрежа</string>
|
||||
<string name="hotspot_intro">Споделете приложението с някого около вас без достъп до интернет с използване на Wi-Fi на устройствата.
|
||||
\n\nВашето устройство създава безжична точка за достъп. Хората около вас биха могли да се свържат към нея и да изтеглят Briar от вашето устройство.</string>
|
||||
<string name="hotspot_button_start_sharing">Включване на безжична точка</string>
|
||||
<string name="hotspot_button_stop_sharing">Спиране на безжична точка</string>
|
||||
<string name="hotspot_progress_text_start">Настройване на безжична точка…</string>
|
||||
|
||||
@@ -692,6 +692,7 @@
|
||||
<string name="hotspot_help_wifi_title">Probleme bei der WLAN-Verbindung:</string>
|
||||
<string name="hotspot_help_wifi_1">Versuche, WLAN auf beiden Telefonen zu deaktivieren und wieder zu aktivieren, und versuche es dann erneut.</string>
|
||||
<string name="hotspot_help_wifi_2">Wenn dein Telefon meldet, dass das WLAN kein Internet hat, sag ihm, dass du trotzdem verbunden bleiben willst.</string>
|
||||
<string name="hotspot_help_wifi_3">Telefon neu starten, auf dem der WLAN-Hotspot läuft, danach Briar starten und erneut teilen.</string>
|
||||
<string name="hotspot_help_site_title">Probleme beim Besuch der lokalen Webseite:</string>
|
||||
<string name="hotspot_help_site_1">Überprüfe unbedingt, ob du die Adresse genau so wie angezeigt eingegeben hast. Ein kleiner Fehler kann dazu führen, dass der Versuch fehlschlägt.</string>
|
||||
<string name="hotspot_help_site_2">Vergewissere dich, dass dein Telefon immer noch mit dem richtigen WLAN verbunden ist (siehe oben), wenn du die Webseite aufrufen willst.</string>
|
||||
|
||||
@@ -609,6 +609,7 @@
|
||||
<string name="dev_report_memory">Memoria</string>
|
||||
<string name="dev_report_storage">Almacenamiento</string>
|
||||
<string name="dev_report_connectivity">Conectividad</string>
|
||||
<string name="dev_report_network_usage">Uso de red</string>
|
||||
<string name="dev_report_build_config">Configuración de compilación</string>
|
||||
<string name="dev_report_logcat">Registro de la aplicación</string>
|
||||
<string name="dev_report_device_features">Características del dispositivo</string>
|
||||
@@ -651,7 +652,7 @@
|
||||
<string name="transports_help_text">Briar puede conectar a tus contactos vía Internet, Wi-Fi o Bluetooth.\n\nTodas las conexiones a Internet van a través de la red Tor por privacidad.\n\nSi un contacto puede ser alcanzado por múltiples métodos, Briar los usa en paralelo.</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">Comparte esta aplicación fuera de línea</string>
|
||||
<string name="hotspot_intro">Comparte esta aplicación con alguien que esté cerca tuyo sin conexión a Internet, usando el Wi-Fi de tu teléfono.
|
||||
<string name="hotspot_intro">Comparte esta aplicación con alguien que esté cerca tuyo sin una conexión a Internet, usando el Wi-Fi de tu teléfono.
|
||||
\n\nTu teléfono iniciará un punto de acceso Wi-Fi. Las personas cercanas a tí pueden conectarse al punto de acceso y descargar la aplicación Briar desde tu teléfono.</string>
|
||||
<string name="hotspot_button_start_sharing">Iniciar punto de acceso</string>
|
||||
<string name="hotspot_button_stop_sharing">Detener punto de acceso</string>
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
|
||||
اخطار: هویت های شما، مخاطبان شما و پیام های شما برای همیشه از بین خواهند رفت.</string>
|
||||
<string name="startup_failed_activity_title">خطا در شروع Briar (برایر)</string>
|
||||
<string name="startup_failed_clock_error">Briar به دلیل این که ساعت دستگاه شما غلط است، اجرا نشد.\n\n لطفا ساعت دستگاه خود را تنظیم کرده و دوباره تلاش کنید.</string>
|
||||
<string name="startup_failed_db_error">Briar قادر به باز کردن پایگاه داده حاوی حساب کاربری، مخاطبین و پیامهای شما نشد.\n\n لطفا برنامه را به آخرین نسخه ارتقا داده، و یا هنگام وارد کردن رمز عبور، با انتخاب گزینه «رمز خود را فراموش کردهام» حساب جدیدی ایجاد کنید.</string>
|
||||
<string name="startup_failed_data_too_old_error">حساب کاربری شما با نسخه قدیمی این برنامه ساخته شده و در این نسخه قابل باز شدن نیست.\n\n شما یا باید نسخه قبلی را دوباره نصب کنید و یا هنگام وارد کردن رمز عبور، با انتخاب «رمز خود را فراموش کردهام» حساب جدیدی ایجاد کنید.</string>
|
||||
<string name="startup_failed_data_too_new_error">حساب کاربری شما با نسخه جدیدتر این برنامه ساخته شده و در این نسخه قابل باز شدن نیست.\n\n لطفا به آخرین نسخه ارتقا داده و دوباره امتحان کنید.</string>
|
||||
<string name="startup_failed_service_error">Briar قادر به آغاز اجزای مورد نیاز نیست.\n\n لطفا به آخرین نسخه برنامه ارتقا داده و دوباره امتحان کنید.</string>
|
||||
<plurals name="expiry_warning">
|
||||
<item quantity="one">این یک نسخه آزمایشی از Briar (برایر) می باشد. حساب کاربری شما در %d روز آینده به پایان می رسد و امکان تمدید آن وجود نخواهد داشت.</item>
|
||||
<item quantity="other">این یک نسخه آزمایشی از Briar (برایر) می باشد. حساب کاربری شما در %d روز آینده به پایان می رسد و امکان تمدید آن وجود نخواهد داشت.</item>
|
||||
@@ -329,9 +334,13 @@
|
||||
<!--Connect via Bluetooth-->
|
||||
<string name="menu_item_connect_via_bluetooth">اتصال از طریق بلوتوث</string>
|
||||
<string name="connect_via_bluetooth_title">اتصال از طریق بلوتوث</string>
|
||||
<string name="connect_via_bluetooth_intro">در صورتی که ارتباطات بلوتوث به صورت خودکار کار نکرد، میتوانید از این صفحه برای ارتباط دستی استفاده کنید.\n\n برای کار کردن این امکان، مخاطب شما باید نزدیک باشد.\n\n شما و مخاطبتان باید هر دو گزینه «آغاز» را همزمان بفشارید.</string>
|
||||
<string name="connect_via_bluetooth_already_discovering">در حال تلاش برای اتصال با بلوتوث. لطفا به زودی دوباره امتحان کنید.</string>
|
||||
<string name="connect_via_bluetooth_no_location_permission">امکان ادامه بدون اجازه مکانیابی وجود ندارد</string>
|
||||
<string name="connect_via_bluetooth_start">در حال اتصال از طریق بلوتوث</string>
|
||||
<string name="connect_via_bluetooth_success">ارتباط از طریق بلوتوث با موفقیت انجام شد</string>
|
||||
<string name="connect_via_bluetooth_error">اتصال از طریق بلوتوث امکان پذیر نیست.</string>
|
||||
<string name="connect_via_bluetooth_error_not_supported">بلوتوث توسط دستگاه پشتیبانی نمیشود.</string>
|
||||
<!--Private Groups-->
|
||||
<string name="groups_list_empty">هیچ گروهی برای نمایش وجود ندارد</string>
|
||||
<string name="groups_list_empty_action">برای ایجاد یک گروه روی آیکون + کلیک کنید، یا از مخاطبان خود بخواهید تا گروه های خود را با شما به اشتراک بگذارند</string>
|
||||
@@ -622,6 +631,7 @@
|
||||
<string name="link_warning_open_link">باز کردن پیوند</string>
|
||||
<!--Crash Reporter-->
|
||||
<string name="crash_report_title">گزارش خطای Briar (برایر)</string>
|
||||
<string name="briar_crashed">متاسفانه Briar از کار افتاد</string>
|
||||
<string name="not_your_fault">این تقصیر شما نیست.</string>
|
||||
<string name="please_send_report">لطفا با فرستادن گزارش خطا به ما کمک کنید تا Briar (برایر) را بهتر کنیم.</string>
|
||||
<string name="report_is_encrypted">به شما اطمینان می دهیم که گزارش شما رمزنگاری شده و به صورت امن فرستاده می شود.</string>
|
||||
@@ -639,6 +649,7 @@
|
||||
<string name="dev_report_memory">حافظه</string>
|
||||
<string name="dev_report_storage">حافظه</string>
|
||||
<string name="dev_report_connectivity">اتصال</string>
|
||||
<string name="dev_report_network_usage">استفاده از شبکه</string>
|
||||
<string name="dev_report_build_config">پیکربندی ساخت</string>
|
||||
<string name="dev_report_logcat">لاگ برنامه</string>
|
||||
<string name="dev_report_device_features">ویژگیهای دستگاه</string>
|
||||
@@ -692,18 +703,89 @@ Briar (برایر) موقعیت شما را ذخیره نمیکند و آن
|
||||
<!--Connections Screen-->
|
||||
<string name="transports_help_text">Briar (برایر) میتواند از طریق اینترنت، Wi-Fi و یا بلوتوث به مخاطبین شما متصل گردد.\n\nارتباط با اینترنت از طریق شبکهی تور صورت میپذیرد.\n\nاگر دسترسی به مخاطب شما از روشهای مختلفی ممکن باشد، Briar (برایر) به صورت موازی از آنها استفاده خواهد کرد.</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">این برنامه را به صورت آفلاین به اشتراک بگذارید</string>
|
||||
<string name="hotspot_intro">این برنامه را بدو ارتباط با اینترنت و فقط با Wi-Fi تلفن خود با فردی در نزدیکی خود به اشتراک بگذارید.
|
||||
\n\n تلفن شما با Wi-Fi hotspot آغاز میشود. افراد در نزدیکی شما میتوانند به hotspot متصل شده و برنامه Briar را از تلفن شما دانلود کنند.</string>
|
||||
<string name="hotspot_button_start_sharing">آغاز hotspot</string>
|
||||
<string name="hotspot_button_stop_sharing">توقف hotspot</string>
|
||||
<string name="hotspot_progress_text_start">در حال راه اندازی hotspot...</string>
|
||||
<string name="hotspot_notification_channel_title">Wi-Fi hotspot</string>
|
||||
<string name="hotspot_notification_title">اشتراکگذاری آفلاین Briar</string>
|
||||
<string name="hotspot_button_connected">بعد</string>
|
||||
<string name="permission_hotspot_location_request_body">برای ایجاد Wi-Fi hotspot، Briar به مجوز دسترسی مکانی شما نیاز دارد.\n\n Briar اطلاعات مکانی شما را ذخیره نکرده و با کسی به اشتراک نمیگذارد.</string>
|
||||
<string name="permission_hotspot_location_denied_body">شما دسترسی به مکان خود را رد کردهاید، در صورتی که Briar برای ایجاد Wi-Fi hotspot به این مجوز نیاز دارد.\n\n لطفا اجازه دسترسی را در نظر بگیرید.</string>
|
||||
<string name="wifi_settings_title">تنظیمات Wi-Fi</string>
|
||||
<string name="wifi_settings_request_enable_body">برای ایجاد Wi-Fi hotspot، Briar نیاز به استفاده از Wi-Fi دارد. لطفا آن را فعال کنید.</string>
|
||||
<string name="hotspot_tab_manual">دستی</string>
|
||||
<!--The placeholder to be inserted into the string 'hotspot_manual_wifi': People can connect by %s-->
|
||||
<string name="hotspot_scanning_a_qr_code">کد QR را اسکن کنید</string>
|
||||
<!--Wi-Fi setup-->
|
||||
<!--The %s placeholder will be replaced with the translation of 'hotspot_scanning_a_qr_code'-->
|
||||
<string name="hotspot_manual_wifi">تلفن شما Wi-Fi hotspot ارائه میکند. کسانی که قصد دانلود Briar را دارند، میتوانند با افزودن hotspot در تنظیمات Wi-Fi دستگاه خود، به آن متصل شده و یا %s. هنگامی که به hotspot متصل شدند، دکمه «بعد» را بفشارند.</string>
|
||||
<string name="hotspot_manual_wifi_ssid">نام شبکه</string>
|
||||
<string name="hotspot_qr_wifi">تلفن شما Wi-Fi hotspot ارائه میکند. کسانی که قصد دانلود Briar را دارند، میتوانند با اسکن این کد QR به hotspot متصل شوند. هنگامی که به hotspot متصل شدند، دکمه «بعد» را بفشارند.</string>
|
||||
<string name="hotspot_no_peers_connected">هیچ دستگاهی متصل نیست</string>
|
||||
<plurals name="hotspot_peers_connected">
|
||||
<item quantity="one">%s دستگاه متصل است</item>
|
||||
<item quantity="other">%s دستگاه متصل است</item>
|
||||
</plurals>
|
||||
<!--Download link-->
|
||||
<!--The %s placeholder will be replaced with the translation of 'hotspot_scanning_a_qr_code'-->
|
||||
<string name="hotspot_manual_site">تلفن شما Wi-Fi hotspot ارائه میکند. کسانی که به hotspot متصل هستند، میتوانند Briar را با تایپ لینک زیر در مرورگر خود دانلود کنند و یا %s.</string>
|
||||
<string name="hotspot_manual_site_address">آدرس (URL)</string>
|
||||
<string name="hotspot_qr_site">تلفن شما Wi-Fi hotspot ارائه میکند. کسانی که به hotspot متصل هستند، میتوانند Briar را با اسکن این کد QR دانلود کنند.</string>
|
||||
<!--e.g. Download Briar 1.2.20-->
|
||||
<string name="website_download_title">دانلود %s</string>
|
||||
<string name="website_download_intro">فردی در نزدیکی %s را با شما به اشتراک گذاشته است.</string>
|
||||
<string name="website_download_outro">پس از تکمیل دانلود، فایل دانلود شده را باز کرده و نصب کنید.</string>
|
||||
<string name="website_troubleshooting_title">◾️ عیب یابی</string>
|
||||
<string name="website_troubleshooting_1">اگر قادر به دانلود کردن برنامه نیستید، با مرورگر دیگری امتحان کنید.</string>
|
||||
<string name="website_troubleshooting_2_old">برای نصب برنامه دانلود شده، باید اجازه نصب برنامه از «منابع ناشناخته» را در تنظیمات سیستم بدهید. سپس ممکن است نیاز به دانلود دوباره برنامه داشته باشید. ما توصیه میکنیم که پس از نصب این برنامه، اجازه «منابع ناشناخته» را لغو کنید.</string>
|
||||
<string name="website_troubleshooting_2_new">برای نصب برنامه دانلود شده، ممکن است نیاز به ایجاد مجوز نصب برنامههای ناشناخته در مرورگر را داشته باشید. پس از نصب این برنامه، توصیه میکنیم مجوز نصب برنامههای ناشناخته را لغو کنید.</string>
|
||||
<string name="hotspot_help_wifi_title">مشکلات اتصال به Wi-Fi:</string>
|
||||
<string name="hotspot_help_wifi_1">Wi-Fi را در هر دو تلفن غیرفعال و دوباره فعال کنید.</string>
|
||||
<string name="hotspot_help_wifi_2">اگر تلفن پیامی مبنی بر عدم دسترسی Wi-Fi به اینترنت داد، از گزینه مربوط به متصل ماندن استفاده کنید.</string>
|
||||
<string name="hotspot_help_wifi_3">تلفنی که میزبان Wi-Fi hotspot است را دوباره راهاندازی کنید، سپس Briar را باز کرده و دوباره به اشتراک بگذارید.</string>
|
||||
<string name="hotspot_help_site_title">مشکلات بازدید از وبسایت محلی:</string>
|
||||
<string name="hotspot_help_site_1">مطمئن شوید که آدرسی که وارد میکنید، دقیقا آدرسی باشد که نمایش یافته. خطای کوچک منجر به ناموفق بودن پروسه خواهد شد.</string>
|
||||
<string name="hotspot_help_site_2">مطمئن شوید هنگامی که قصد دسترسی به سایت را دارید، تلفن شما هنوز به Wi-Fi صحیح متصل باشد (بالا را ببینید).</string>
|
||||
<string name="hotspot_help_site_3">اگر از برنامه فایروال استفاده میکنید، مطمئن باشید که دسترسی را مسدود نکرده است.</string>
|
||||
<string name="hotspot_help_site_4">اگر میتوانید سایت را باز کنید، ولی نمیتوانید برنامه Briar را دانلود کنید، از یک مرورگر دیگر استفاده کنید.</string>
|
||||
<string name="hotspot_help_fallback_title">هیچ چیز کار نمیکند؟</string>
|
||||
<string name="hotspot_help_fallback_intro">شما میتوانید با راههایی، برنامه را به صورت فایل .apk ذخیره و به اشتراک بگذارید. هنگامی که فایل به دستگاه دیگری انتقال یافت، میتواند برای نصب Briar مورد استفاده قرار گیرد.
|
||||
\n\nنکته: برای اشتراکگذاری از طریق بلوتوث، ممکن است نیاز به تغییر انتهای نام فایل به .zip داشته باشید.</string>
|
||||
<string name="hotspot_help_fallback_button">ذخیره برنامه</string>
|
||||
<!--error handling-->
|
||||
<string name="hotspot_error_intro">هنگام تلاش برای اشتراکگذاری برنامه از طریق Wi-Fi مشکلی رخ داد:</string>
|
||||
<string name="hotspot_error_no_wifi_direct">دستگاه از Wi-Fi Direct پشتیبانی نمیکند</string>
|
||||
<string name="hotspot_error_start_callback_failed">Hotspot قادر به راهاندازی نبود: خطای %s</string>
|
||||
<string name="hotspot_error_start_callback_failed_unknown">Hotspot با خطایی ناشناخته قادر به راهاندازی نبود، علت %d</string>
|
||||
<string name="hotspot_error_start_callback_no_group_info">Hotspot قادر به راهاندازی نبود: بدون اطلاعات گروه</string>
|
||||
<string name="hotspot_error_web_server_start">خطا در راهاندازی سرور وب</string>
|
||||
<string name="hotspot_error_web_server_serve">خطا در ارائه وبسایت.\n\n لطفا در صورت ادامه مشکل، بازخورد خود را (به همراه دادههای ناشناس) به برنامه Briar ارسال کنید.</string>
|
||||
<string name="hotspot_flag_test">هشدار: این برنامه با Android Studio نصب شده و قادر به نصب بر روی دستگاه دیگری نیست.</string>
|
||||
<string name="hotspot_error_framework_busy">مشکل در راهاندازی hotspot.\n\n اگر hotspot دیگری در دستگاه شما فعال است و اینترنت شما را با اتصال Wi-Fi به اشتراک میگذارد، لطفا آن را متوقف کرده و دوباره امتحان کنید.</string>
|
||||
<!--Transfer Data via Removable Drives-->
|
||||
<string name="removable_drive_menu_title">اتصال ار طریق حافظه قابل جابجایی</string>
|
||||
<string name="removable_drive_intro">اگر از طریق اینترنت، Wi-Fi و یا بلوتوث قادر به ارتباط با مخاطب خود نیستید، Briar قادر به جابجایی پیامها از طریق درایو قابل جابجایی مانند حافظه قلش و یا کارت SD است.</string>
|
||||
<string name="removable_drive_explanation">اگر از طریق اینترنت، Wi-Fi و یا بلوتوث قادر به ارتباط با مخاطب خود نیستید، Briar قادر به جابجایی پیامها از طریق درایو قابل جابجایی مانند حافظه قلش و یا کارت SD است.\n\nهنگامی که از گزینه «ارسال داده» استفاده میکنید، هر دادهای که منتظر ارسال به مخاطب شماست، بر روی حافظه قابل جابجایی ذخیره خواهد شد. این دادهها شامل پیامها، ضمائم، بلاگها، تالارها و گروههای خصوصی است.\n\nهمه دادهها قبل از ذخیره در حافظه قابل جابجایی، رمزگذاری خواهند شد.\n\nهنگامی که مخاطب شما حافظه قابل جابجایی را دریافت میکند، میتواند با استفاده از دکمه «دریافت داده» تمامی پیامها را به Briar وارد کند.</string>
|
||||
<string name="removable_drive_title_send">ارسال داده</string>
|
||||
<string name="removable_drive_title_receive">دریافت داده</string>
|
||||
<string name="removable_drive_send_intro">دکمه زیر را برای ایجاد فایل جدید حاوی پیامهای رمزگذاری شده بفشارید. شما میتوانید محل ذخیره فایل را تعیین کنید.\n\n اگر تمایل به ذخیره فایل بر روی حافظه قابل جابجایی دارید، آن را الآن متصل کنید.</string>
|
||||
<string name="removable_drive_send_no_data">در حال حاظر هیچ پیامی در انتظار ارسال به مخاطب نیست.</string>
|
||||
<string name="removable_drive_send_not_supported">این مخاطب از نسخه قدیمی Briar و یا از دستگاه قدیمی که این قابلیت را پشتیبانی نمیکند، استفاده میکند.</string>
|
||||
<string name="removable_drive_send_button">فایل را برای گرفتن خروجی انتخاب کنید</string>
|
||||
<string name="removable_drive_ongoing">لطفا تا تکمیل کار فعلی منتظر بمانید</string>
|
||||
<string name="removable_drive_receive_intro">برای انتخاب فایلی که مخاطب شما ارسال کرده است، دکمه زیر را بفشارید.\n\nاگر فایل بر روی حافظه قابل جابجایی است، آن را الآن متصل کنید.</string>
|
||||
<string name="removable_drive_receive_button">فایل را برای وارد کردن انتخاب کنید</string>
|
||||
<string name="removable_drive_success_send_title">خروجی با موفقیت گرفته شد</string>
|
||||
<string name="removable_drive_success_send_text">از دادهها با موفقیت خروجی گرفته شد. شما الآن ۲۸ روز تا انتقال فایل به مخاطب خود فرصت دارید.\n\nاگر فایل بر روی حافظه قابل جابجایی است، از پیام در نوار اعلانات برای خارج کردن آن استفاده کنید.</string>
|
||||
<string name="removable_drive_success_receive_title">درون برد موفق بود</string>
|
||||
<string name="removable_drive_success_receive_text">تمامی پیامهای رمزگذاریشده در این فایل دریافت شدند.</string>
|
||||
<string name="removable_drive_error_send_title">خطا حین گرفتن خروجی از داده</string>
|
||||
<string name="removable_drive_error_send_text">خطایی هنگام نوشتن دادهها در فایل رخ داد.\n\nاگر از حافظه قابل جابجایی استفاده میکنید، از اتصال صحیح آن مطمئن شوید.\n\nاگر خطا ادامه یافت، لطفا بازخورد خود را برای اطلاع تیم Briar از مشکل، به ما ارسال کنید.</string>
|
||||
<string name="removable_drive_error_receive_title">خطا حین وارد کردن داده</string>
|
||||
<string name="removable_drive_error_receive_text">فایل انتخاب شده چیز قابل شناسایی توسط Briar نداشت.\n\nلطفا از انتخاب فایل صحبح مطمئن شوید.\n\nاگر مخاطب شما فایل را بیش از ۲۸ روز قبل ساخته است، Briar قادر به شناسایی آن نخواهد بود.</string>
|
||||
<!--Screenshots-->
|
||||
<!--This is a name to be used in screenshots. Feel free to change it to a local name.-->
|
||||
<string name="screenshot_alice">آلیس</string>
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
<string name="dialog_title_lost_password">Mot de passe oublié</string>
|
||||
<string name="dialog_message_lost_password">Votre compte Briar est enregistré chiffré sur votre appareil, pas dans le nuage, et nous ne pouvons donc pas réinitialiser votre mot de passe. Voulez-vous supprimer votre compte et recommencer ?\n\nAttention : vos identités, contacts et messages seront perdus irrémédiablement.</string>
|
||||
<string name="startup_failed_activity_title">Échec de démarrage de Briar</string>
|
||||
<string name="startup_failed_clock_error">Briar n’a pas pu démarrer, car l’horloge de votre appareil n’est pas à l’heure.\n\nVeuillez mettre l’horloge de votre appareil à l’heure et réessayer.</string>
|
||||
<string name="startup_failed_db_error">Briar n’a pas pu ouvrir la base de données qui comprend votre compte, vos contacts et messages.\n\nVeuillez mettre l’appli à jour vers la version la plus récente et réessayer, ou créer un nouveau compte en choisissant « J’ai oublié mon mot de passe » à l’invite de mot de passe.</string>
|
||||
<string name="startup_failed_data_too_old_error">Votre compte a été créé avec une ancienne version de cette appli et ne peut pas être ouvert avec cette version.\n\nVous devez soit réinstaller l’ancienne version, soit créer un nouveau compte en choisissant « J’ai oublié mon mot de passe » à l’invite de mot de passe.</string>
|
||||
<string name="startup_failed_data_too_new_error">Votre compte a été créé avec une version plus récente de cette appli et ne peut être ouvert avec cette version.\n\nVeuillez mettre l’appli à jour vers la version la plus récente et réessayer.</string>
|
||||
<string name="startup_failed_service_error">Briar n\'a pas pu lancer un composant essentiel.\n\nVeuillez mettre l’appli à jour vers la version la plus récente et réessayer.</string>
|
||||
<plurals name="expiry_warning">
|
||||
<item quantity="one">Ceci est une version de test de Briar. Votre compte arrivera à expiration dans %d jour et ne peut pas être renouvelé.</item>
|
||||
<item quantity="other">Ceci est une version de test de Briar. Votre compte arrivera à expiration dans %d jours et ne pourra pas être renouvelé.</item>
|
||||
@@ -311,9 +316,13 @@
|
||||
<!--Connect via Bluetooth-->
|
||||
<string name="menu_item_connect_via_bluetooth">Se connecter par Bluetooth</string>
|
||||
<string name="connect_via_bluetooth_title">Se connecter par Bluetooth</string>
|
||||
<string name="connect_via_bluetooth_no_location_permission">Impossible de poursuivre sans la permission de position</string>
|
||||
<string name="connect_via_bluetooth_intro">Au cas où les connexions Bluetooth ne fonctionneraient pas automatiquement, vous pouvez utiliser cet écran pour vous connecter manuellement.\n\nPour que cela fonctionne, votre contact doit être à proximité.\n\nVotre contact et vous devriez appuyer sur « Commencer » en même temps.</string>
|
||||
<string name="connect_via_bluetooth_already_discovering">Une tentative de connexion par Bluetooth est en cours. Veuillez réessayer dans un moment.</string>
|
||||
<string name="connect_via_bluetooth_no_location_permission">Impossible de poursuivre sans autoriser la position.</string>
|
||||
<string name="connect_via_bluetooth_start">Connexion par Bluetooth…</string>
|
||||
<string name="connect_via_bluetooth_success">Connectée par Bluetooth avec succès</string>
|
||||
<string name="connect_via_bluetooth_success">La connexion par Bluetooth est réussie</string>
|
||||
<string name="connect_via_bluetooth_error">Impossible de se connecter par Bluetooth.</string>
|
||||
<string name="connect_via_bluetooth_error_not_supported">Bluetooth n’est pas pris en charge par l’appareil.</string>
|
||||
<!--Private Groups-->
|
||||
<string name="groups_list_empty">Aucun groupe à afficher</string>
|
||||
<string name="groups_list_empty_action">Touchez l’icône + pour créer un groupe ou pour demander à vos contacts de partager des groupes avec vous</string>
|
||||
@@ -584,6 +593,7 @@ copies des messages que vous envoyez.
|
||||
<string name="link_warning_open_link">Ouvrir le lien</string>
|
||||
<!--Crash Reporter-->
|
||||
<string name="crash_report_title">Rapport de plantage de Briar</string>
|
||||
<string name="briar_crashed">Désolé, Briar a planté</string>
|
||||
<string name="not_your_fault">Vous n’y êtes pour rien.</string>
|
||||
<string name="please_send_report">Veuillez nous aider à améliorer Briar en nous envoyant un rapport de plantage.</string>
|
||||
<string name="report_is_encrypted">Nous promettons que le rapport est chiffré et envoyé en toute sécurité. </string>
|
||||
@@ -642,10 +652,22 @@ copies des messages que vous envoyez.
|
||||
<!--Connections Screen-->
|
||||
<string name="transports_help_text">Briar peut se connecter à vos contacts par Internet, Wi-Fi ou Bluetooth.\n\nToutes les connections Internet passent par le réseau Tor afin de protéger les données.\n\nSi un contact peut être joint par plusieurs moyens, Briar les utilisera simultanément.</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">Partager cette appli hors ligne.</string>
|
||||
<string name="hotspot_intro">Partagez cette appli avec une personne à proximité sans connexion Internet en utilisant le Wi-Fi de votre téléphone.
|
||||
\n\nVotre téléphone démarrera un point d’accès Wi-Fi. Les personnes à proximité peuvent se connecter au point d’accès sans fil et télécharger l’appli Briar de votre téléphone.</string>
|
||||
<string name="hotspot_button_start_sharing">Démarrer le point d’accès sans fil</string>
|
||||
<string name="hotspot_button_stop_sharing">Arrêter le point d’accès sans fil</string>
|
||||
<string name="hotspot_progress_text_start">Configuration du point d’accès sans fil…</string>
|
||||
<string name="hotspot_notification_channel_title">Point d’accès Wi-Fi</string>
|
||||
<string name="hotspot_notification_title">Partage hors ligne de Briar</string>
|
||||
<string name="hotspot_button_connected">Suivant</string>
|
||||
<string name="permission_hotspot_location_request_body">Pour créer un point d’accès Wi-Fi, Briar a besoin de l’autorisation Position.\n\nBriar ne stocke pas votre position et ne la partage avec personne.</string>
|
||||
<string name="permission_hotspot_location_denied_body">Vous avez refusé l’accès à votre position, mais Briar en a besoin pour créer un point d’accès Wi-Fi.\n\nNous vous invitons à y accorder l’accès.</string>
|
||||
<string name="wifi_settings_title">Paramètre Wi-Fi</string>
|
||||
<string name="wifi_settings_request_enable_body">Pour créer un point d’accès Wi-Fi, Briar a besoin d’utiliser le Wi-Fi. Veuillez l’activer.</string>
|
||||
<string name="hotspot_tab_manual">Manuel</string>
|
||||
<!--The placeholder to be inserted into the string 'hotspot_manual_wifi': People can connect by %s-->
|
||||
<string name="hotspot_scanning_a_qr_code">balayant un code QR</string>
|
||||
<!--Wi-Fi setup-->
|
||||
<!--The %s placeholder will be replaced with the translation of 'hotspot_scanning_a_qr_code'-->
|
||||
<!--Download link-->
|
||||
|
||||
@@ -609,6 +609,7 @@
|
||||
<string name="dev_report_memory">Memoria</string>
|
||||
<string name="dev_report_storage">Spazio</string>
|
||||
<string name="dev_report_connectivity">Connettività</string>
|
||||
<string name="dev_report_network_usage">Utilizzo della rete</string>
|
||||
<string name="dev_report_build_config">Configurazione build</string>
|
||||
<string name="dev_report_logcat">Registro app</string>
|
||||
<string name="dev_report_device_features">Caratteristiche dispositivo</string>
|
||||
|
||||
@@ -613,8 +613,6 @@
|
||||
<string name="transports_help_text">Briarは、インターネット、Wi-Fi、Bluetoothを介して連絡先に接続することができます。\n\nすべてのインターネット接続は、プライバシー保護のためにTorネットワークを経由します。\n\n複数の方法で連絡が取れる場合、Briarはそれらを並行して使用します。</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">このアプリをオフラインで共有</string>
|
||||
<string name="hotspot_intro">あなたの電話機のWi-Fiを使用して、インターネット接続なしで、近くの誰かとこのアプリを共有します。
|
||||
\n\nあなたの電話機はWi-Fiホットスポットになります。近くの人はホットスポットへ接続し、あなたの電話機からBriarアプリをダウンロードできます。</string>
|
||||
<string name="hotspot_button_start_sharing">ホットスポットを開始</string>
|
||||
<string name="hotspot_button_stop_sharing">ホットスポットを停止</string>
|
||||
<string name="hotspot_progress_text_start">ホットスポットを設定する…</string>
|
||||
@@ -652,7 +650,8 @@
|
||||
<string name="website_troubleshooting_2_new">ダウンロードしたアプリをインストールするには、ブラウザに不明なアプリのインストールを許可する必要がある場合があります。アプリをインストールした後は、ブラウザの不明なアプリのインストール許可を解除することをお勧めします。</string>
|
||||
<string name="hotspot_help_wifi_title">W-Fi接続の問題:</string>
|
||||
<string name="hotspot_help_wifi_1">双方の電話機でWi-Fiを無効にして、再び有効にするのを試してください。</string>
|
||||
<string name="hotspot_help_wifi_2">もし携帯電話が「Wi-Fiにはインターネットがない」と不満を訴えてきたら、「とにかく接続していたい」と伝えてください。</string>
|
||||
<string name="hotspot_help_wifi_2">もし電話機が「Wi-Fiにはインターネットがない」と不満を訴えてきたら、「とにかく接続していたい」と伝えてください。</string>
|
||||
<string name="hotspot_help_wifi_3">Wi-Fiホットスポットが実行中の電話機を再起動して、Briarの起動と共有を再び試してください。</string>
|
||||
<string name="hotspot_help_site_title">ローカルのウェブサイト訪問の問題:</string>
|
||||
<string name="hotspot_help_site_1">表示されている通りにアドレスを入力したかどうかを再確認してください。小さなミスで失敗することがあります。</string>
|
||||
<string name="hotspot_help_site_2">サイトにアクセスする際に、電話機が正しいWi-Fi(上記を参照)に接続されていることを確認してください。</string>
|
||||
|
||||
@@ -635,6 +635,7 @@
|
||||
<string name="dev_report_memory">Atmintis</string>
|
||||
<string name="dev_report_storage">Saugykla</string>
|
||||
<string name="dev_report_connectivity">Jungiamumas</string>
|
||||
<string name="dev_report_network_usage">Tinklo naudojimas</string>
|
||||
<string name="dev_report_build_config">Darinio konfigūracija</string>
|
||||
<string name="dev_report_logcat">Programėlės žurnalas</string>
|
||||
<string name="dev_report_device_features">Įrenginio ypatybės</string>
|
||||
|
||||
@@ -664,8 +664,8 @@ De asemenea, contactul dvs. poate modifica această setare pentru amândoi.</str
|
||||
<string name="transports_help_text">Briar se poate conecta la contactele dumneavoastră prin Internet, Wi-Fi sau Bluetooth.\n\nToate conexiunile la internet trec prin rețeaua Tor din motive de confidențialitate.\n\nDacă un contact poate fi accesat prin metode multiple, Briar le va folosi în mod paralel.</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">Partajează această aplicație fără Internet</string>
|
||||
<string name="hotspot_intro">Partajați această aplicație cu cineva din apropiere fără Internet folosind conexiunea Wi-Fi a dispozitivului.
|
||||
\n\nDispozitivul dumneavoastră va porni un hotspot Wi-Fi. Persoanele din apropiere se pot conecta la hotspot și pot descărca aplicația Briar de pe dispozitivul dumneavoastră.</string>
|
||||
<string name="hotspot_intro">Împărtășiți acest app cu o persoană din apropiere fără conexiune la internet, utilizând Wi-Fi-ul telefonului dumneavoastră.
|
||||
\n\nTelefonul dumneavoastră va porni un hotspot Wi-Fi. Persoanele din apropiere se pot conecta la hotspot și pot descărca aplicația Briar de pe telefonul vostru.</string>
|
||||
<string name="hotspot_button_start_sharing">Pornește hotspot</string>
|
||||
<string name="hotspot_button_stop_sharing">Oprește hotspot</string>
|
||||
<string name="hotspot_progress_text_start">Configurare hotspot...</string>
|
||||
|
||||
@@ -720,6 +720,7 @@
|
||||
<string name="hotspot_help_wifi_title">Проблемы с подключением к Wi-Fi:</string>
|
||||
<string name="hotspot_help_wifi_1">Попробуйте отключить и снова включить Wi-Fi на обоих телефонах и повторить попытку.</string>
|
||||
<string name="hotspot_help_wifi_2">Если ваш телефон сообщит, что в сети Wi-Fi нет доступа к интернету, подтвердите, что вы все равно хотите подключиться к этой сети.</string>
|
||||
<string name="hotspot_help_wifi_3">Перезагрузите телефон, на котором работает точка доступа Wi-Fi, затем запустите Briar и повторите попытку обмена.</string>
|
||||
<string name="hotspot_help_site_title">Проблемы с доступом к локальному веб-сайту:</string>
|
||||
<string name="hotspot_help_site_1">Дважды убедитесь, что вы ввели адрес точно так, как показано. Небольшая ошибка может привести к сбою.</string>
|
||||
<string name="hotspot_help_site_2">Убедитесь, что ваш телефон все еще подключен к правильной сети Wi-Fi (см. выше), прежде чем попытаться зайти на этот сайт.</string>
|
||||
|
||||
@@ -610,6 +610,7 @@ Këtë rregullim mund ta ndryshojë edhe kontakti juaj, për të dy ju.</string>
|
||||
<string name="dev_report_memory">Kujtesë</string>
|
||||
<string name="dev_report_storage">Depozitim</string>
|
||||
<string name="dev_report_connectivity">Aftësi lidhjeje</string>
|
||||
<string name="dev_report_network_usage">Përdorim rrjeti</string>
|
||||
<string name="dev_report_build_config">Formësim montimi</string>
|
||||
<string name="dev_report_logcat">Regjistër aplikacioni</string>
|
||||
<string name="dev_report_device_features">Veçori Pajisjeje</string>
|
||||
|
||||
@@ -609,6 +609,7 @@
|
||||
<string name="dev_report_memory">Bellek</string>
|
||||
<string name="dev_report_storage">Depo</string>
|
||||
<string name="dev_report_connectivity">Bağlanabilirlik</string>
|
||||
<string name="dev_report_network_usage">Ağ Kullanımı</string>
|
||||
<string name="dev_report_build_config">Derleme yapılandırması</string>
|
||||
<string name="dev_report_logcat">Uygulama günlüğü</string>
|
||||
<string name="dev_report_device_features">Aygıt Seçenekleri</string>
|
||||
@@ -692,6 +693,7 @@
|
||||
<string name="hotspot_help_wifi_title">Kablosuz ağa bağlanma sorunları:</string>
|
||||
<string name="hotspot_help_wifi_1">Her iki telefonda da kablosuz ağı devre dışı bırakıp tekrar etkinleştirin ve yeniden deneyin.</string>
|
||||
<string name="hotspot_help_wifi_2">Eğer telefonunuz kablosuz ağda İnternet olmadığını söylüyorsa yine de bağlı kalmasını söyleyin.</string>
|
||||
<string name="hotspot_help_wifi_3">Wi-Fi bağlantı noktasını sağlayan telefonu yeniden başlatın, daha sonra Briar\'ı başlatın ve paylaşmayı yeniden deneyin.</string>
|
||||
<string name="hotspot_help_site_title">Yerel web sitesini ziyaret etme sorunları:</string>
|
||||
<string name="hotspot_help_site_1">Adresi tam gösterildiği şekilde girdiğinizden emin olun. Çok küçük bir hata sorun olabilir.</string>
|
||||
<string name="hotspot_help_site_2">Siteye erişmeye çalışırken telefonunuzun doğru kablosuz ağa bağlı olduğundan emin olun (Bkz. önceki kısım).</string>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<string name="setup_xiaomi_text">要在后台运行,需将 Briar 锁定在最近的应用列表中。</string>
|
||||
<string name="setup_xiaomi_button">保护 Briar</string>
|
||||
<string name="setup_xiaomi_help">如果未将 Briar 锁定到最近的应用列表,它将无法在后台运行。</string>
|
||||
<string name="setup_xiaomi_dialog_body_old">1. 打开最近的应用列表(也称为应用切换器)\n\n2. 向下滑动Briar的图像,显示挂锁图标\n\n3.如果挂锁没有被锁上,轻敲以锁定它</string>
|
||||
<string name="setup_xiaomi_dialog_body_new">1. 打开最近的应用列表(也称为应用切换器)\n\n2. 按住Briar的图像,直到挂锁按钮出现\n\n3. 如果挂锁没有被锁上,轻敲以锁定它</string>
|
||||
<string name="setup_xiaomi_dialog_body_old">1. 打开最近的应用列表(也称为应用切换器)\n\n2. 向下滑动 Briar 的图像,显示挂锁图标\n\n3.如果挂锁没有被锁上,轻按锁定它</string>
|
||||
<string name="setup_xiaomi_dialog_body_new">1. 打开最近的应用列表(也称为应用切换器)\n\n2. 按住 Briar 的图像,直到挂锁按钮出现\n\n3. 如果挂锁没有被锁上,轻按锁定它</string>
|
||||
<string name="warning_dozed">%s 无法在后台运行</string>
|
||||
<!--Login-->
|
||||
<string name="enter_password">密码</string>
|
||||
@@ -170,7 +170,7 @@
|
||||
<item quantity="other">%d分钟</item>
|
||||
</plurals>
|
||||
<plurals name="duration_hours">
|
||||
<item quantity="other">%d小时消</item>
|
||||
<item quantity="other">%d小时</item>
|
||||
</plurals>
|
||||
<plurals name="duration_days">
|
||||
<item quantity="other">%d天</item>
|
||||
@@ -596,6 +596,7 @@
|
||||
<string name="dev_report_memory">内存</string>
|
||||
<string name="dev_report_storage">存储</string>
|
||||
<string name="dev_report_connectivity">连通性</string>
|
||||
<string name="dev_report_network_usage">网络使用</string>
|
||||
<string name="dev_report_build_config">编译配置</string>
|
||||
<string name="dev_report_logcat">应用程序日志</string>
|
||||
<string name="dev_report_device_features">设备特性</string>
|
||||
@@ -638,8 +639,8 @@
|
||||
<string name="transports_help_text">Briar 可以通过互联网、Wi-Fi 或蓝牙来连接到您的联系人。\n\n为了保护隐私,本应用会通过 Tor 网络进行所有的互联网连接。\n\n如果一个联系人可以通过多种方法联系到,Briar 会并行地使用它们。</string>
|
||||
<!--Share app offline-->
|
||||
<string name="hotspot_title">离线分享此应用</string>
|
||||
<string name="hotspot_intro">使用手机的Wi-Fi与附近没有网络的人分享这款应用。
|
||||
\n\n你的手机会启动一个 Wi-Fi 热点。附近的人可以连接热点,从你的手机下载 Briar 应用。</string>
|
||||
<string name="hotspot_intro">使用手机的 Wi-Fi 与附近没有网络的人分享这款应用。
|
||||
\n\n你的手机将启动一个 Wi-Fi 热点。附近的人可以连接至这个热点,从你的手机下载 Briar 应用。</string>
|
||||
<string name="hotspot_button_start_sharing">启动热点</string>
|
||||
<string name="hotspot_button_stop_sharing">停止热点</string>
|
||||
<string name="hotspot_progress_text_start">设置热点中…</string>
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
<string name="duplicate_link_dialog_text_1">You already have a pending contact with this link: %s</string>
|
||||
<string name="duplicate_link_dialog_text_1_contact">You already have a contact with this link: %s</string>
|
||||
<!-- This is a question asking whether two nicknames refer to the same person -->
|
||||
<string name="duplicate_link_dialog_text_2">Are %s and %s the same person?</string>
|
||||
<string name="duplicate_link_dialog_text_2">Are %1$s and %2$s the same person?</string>
|
||||
<!-- This is a button for answering that two nicknames do indeed refer to the same person. This
|
||||
string will be used in a dialog button, so if the translation of this string is longer than 20
|
||||
characters, please use "Yes" instead, and use "No" for the "Different Person" button -->
|
||||
@@ -306,7 +306,7 @@
|
||||
will be used in a dialog button, so if the translation of this string longer than 20 characters,
|
||||
please use "No" instead, and use "Yes" for the "Same Person" button -->
|
||||
<string name="different_person_button">Different Person</string>
|
||||
<string name="duplicate_link_dialog_text_3">%s and %s sent you the same link.\n\nOne of them may be trying to discover who your contacts are.\n\nDon\'t tell them you received the same link from someone else.</string>
|
||||
<string name="duplicate_link_dialog_text_3">%1$s and %2$s sent you the same link.\n\nOne of them may be trying to discover who your contacts are.\n\nDon\'t tell them you received the same link from someone else.</string>
|
||||
<string name="pending_contact_updated_toast">Pending contact updated</string>
|
||||
|
||||
<!-- Introductions -->
|
||||
@@ -649,6 +649,7 @@
|
||||
<string name="dev_report_memory">Memory</string>
|
||||
<string name="dev_report_storage">Storage</string>
|
||||
<string name="dev_report_connectivity">Connectivity</string>
|
||||
<string name="dev_report_network_usage">Network usage</string>
|
||||
<string name="dev_report_build_config">Build configuration</string>
|
||||
<string name="dev_report_logcat">App log</string>
|
||||
<string name="dev_report_device_features">Device Features</string>
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.ImmediateExecutor;
|
||||
import org.briarproject.briar.android.account.SetupViewModel.State;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SetupViewModelTest extends BrambleMockTestCase {
|
||||
private final DozeHelper dozeHelper;
|
||||
|
||||
public SetupViewModelTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
app = context.mock(Application.class);
|
||||
appContext = context.mock(Context.class);
|
||||
accountManager = context.mock(AccountManager.class);
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.briarproject.briar.api.attachment.Attachment;
|
||||
import org.briarproject.briar.api.attachment.AttachmentHeader;
|
||||
import org.briarproject.briar.api.attachment.AttachmentReader;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -36,7 +36,7 @@ public class AttachmentRetrieverTest extends BrambleMockTestCase {
|
||||
private final AttachmentRetriever retriever;
|
||||
|
||||
public AttachmentRetrieverTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
AttachmentReader attachmentReader =
|
||||
context.mock(AttachmentReader.class);
|
||||
imageSizeCalculator = context.mock(ImageSizeCalculator.class);
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import static android.os.Looper.getMainLooper;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertFalse;
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
@@ -33,6 +34,7 @@ import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.robolectric.Shadows.shadowOf;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(sdk = 21)
|
||||
@@ -117,6 +119,7 @@ public class ChangePasswordActivityTest {
|
||||
verify(viewModel, times(1)).changePassword(eq(curPass), eq(safePass));
|
||||
// Return the result
|
||||
result.postEvent(SUCCESS);
|
||||
shadowOf(getMainLooper()).idle();
|
||||
assertTrue(changePasswordActivity.isFinishing());
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.briarproject.briar.api.privategroup.event.GroupDissolvedEvent;
|
||||
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationItem;
|
||||
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationManager;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -36,8 +36,8 @@ import java.util.concurrent.Executor;
|
||||
|
||||
import androidx.arch.core.executor.testing.InstantTaskExecutorRule;
|
||||
|
||||
import static edu.emory.mathcs.backport.java.util.Collections.emptyList;
|
||||
import static edu.emory.mathcs.backport.java.util.Collections.singletonList;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.briarproject.bramble.test.TestUtils.getAuthor;
|
||||
import static org.briarproject.bramble.test.TestUtils.getContact;
|
||||
import static org.briarproject.bramble.test.TestUtils.getGroup;
|
||||
@@ -95,7 +95,7 @@ public class GroupListViewModelTest extends BrambleMockTestCase {
|
||||
new GroupItem(privateGroup2, authorInfo2, groupCount2, false);
|
||||
|
||||
public GroupListViewModelTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
Application app = context.mock(Application.class);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(eventBus).addListener(with(any(EventListener.class)));
|
||||
|
||||
@@ -6,7 +6,7 @@ import android.content.res.Resources;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.briar.R;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
@@ -24,7 +24,7 @@ public class UiUtilsFormatDurationTest extends BrambleMockTestCase {
|
||||
private final int strDays = R.plurals.duration_days;
|
||||
|
||||
public UiUtilsFormatDurationTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
ctx = context.mock(Context.class);
|
||||
r = context.mock(Resources.class);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
dependencyVerification {
|
||||
verify = [
|
||||
'androidx.activity:activity-ktx:1.2.2:activity-ktx-1.2.2.aar:9829e13d6a6b045b03b21a330512e091dc76eb5b3ded0d88d1ab0509cf84a50e',
|
||||
'androidx.activity:activity-ktx:1.2.3:activity-ktx-1.2.3.aar:423c0226e237e08de245cf66f8ccaf103854bc19a584d971a4a075fd15d70df1',
|
||||
'androidx.activity:activity:1.2.2:activity-1.2.2.aar:e165fb20f006b77894d349572cc3acd2760baa8416ae4d33cb8de6a84dd6730c',
|
||||
'androidx.activity:activity:1.2.4:activity-1.2.4.aar:ae8e9c7de57e387d2ad90e73f3a5a5dfd502bd4f034c1dccfdb3506d1d2df81a',
|
||||
'androidx.annotation:annotation-experimental:1.0.0:annotation-experimental-1.0.0.aar:b219d2b568e7e4ba534e09f8c2fd242343df6ccbdfbbe938846f5d740e6b0b11',
|
||||
'androidx.annotation:annotation:1.1.0:annotation-1.1.0.jar:d38d63edb30f1467818d50aaf05f8a692dea8b31392a049bfa991b159ad5b692',
|
||||
'androidx.appcompat:appcompat-resources:1.2.0:appcompat-resources-1.2.0.aar:c470297c03ff3de1c3d15dacf0be0cae63abc10b52f021dd07ae28daa3100fe5',
|
||||
@@ -15,7 +16,7 @@ dependencyVerification {
|
||||
'androidx.constraintlayout:constraintlayout-solver:2.0.4:constraintlayout-solver-2.0.4.jar:9ca19f5448709301c7563488ef941be9dfa55c83538ca7a059b2113e83527b46',
|
||||
'androidx.constraintlayout:constraintlayout:2.0.4:constraintlayout-2.0.4.aar:307a79a4a1ccff44249c72a2bf7f47da09fa1b6b1fab2a25808ca889382b738e',
|
||||
'androidx.coordinatorlayout:coordinatorlayout:1.1.0:coordinatorlayout-1.1.0.aar:44a9e30abf56af1025c52a0af506fee9c4131aa55efda52f9fd9451211c5e8cb',
|
||||
'androidx.core:core-ktx:1.1.0:core-ktx-1.1.0.aar:070cc5f8864f449128a2f4b25ca5b67aa3adca3ee1bd611e2eaf1a18fad83178',
|
||||
'androidx.core:core-ktx:1.2.0:core-ktx-1.2.0.aar:dcb74d510d552b35eff73b0dd27b829649535f3902e5b5a1f26040383c10a940',
|
||||
'androidx.core:core:1.3.1:core-1.3.1.aar:e92ea65a37d589943d405a6a54d1be9d12a225948f26c4e41e511dd55e81efb6',
|
||||
'androidx.cursoradapter:cursoradapter:1.0.0:cursoradapter-1.0.0.aar:a81c8fe78815fa47df5b749deb52727ad11f9397da58b16017f4eb2c11e28564',
|
||||
'androidx.customview:customview:1.0.0:customview-1.0.0.aar:20e5b8f6526a34595a604f56718da81167c0b40a7a94a57daa355663f2594df2',
|
||||
@@ -23,9 +24,10 @@ dependencyVerification {
|
||||
'androidx.drawerlayout:drawerlayout:1.0.0:drawerlayout-1.0.0.aar:9402442cdc5a43cf62fb14f8cf98c63342d4d9d9b805c8033c6cf7e802749ac1',
|
||||
'androidx.dynamicanimation:dynamicanimation:1.0.0:dynamicanimation-1.0.0.aar:ce005162c229bf308d2d5b12fb6cad0874069cbbeaccee63a8193bd08d40de04',
|
||||
'androidx.exifinterface:exifinterface:1.3.2:exifinterface-1.3.2.aar:8770c180103e0b8c04a07eb4c59153af639b09eca25deae9bdcdaf869d1e5b6b',
|
||||
'androidx.fragment:fragment-ktx:1.3.4:fragment-ktx-1.3.4.aar:7b33342737f2503437782d5276700ef82e8481a182dc8b37d369cf4c62bd7209',
|
||||
'androidx.fragment:fragment-testing:1.3.4:fragment-testing-1.3.4.aar:e6d19df625138876682b7788bff8908964dd279847073616d1c062da07998389',
|
||||
'androidx.fragment:fragment-ktx:1.4.0:fragment-ktx-1.4.0.aar:439873b250461eb2245e393fe6683dceb567e7a18d9d6cf4538de9befa4ed1b0',
|
||||
'androidx.fragment:fragment-testing:1.4.0:fragment-testing-1.4.0.aar:1f874b83919c69f2e0df6de0ba2ad87a0d61cc7840d90b481ee0d4db85c2385b',
|
||||
'androidx.fragment:fragment:1.3.4:fragment-1.3.4.aar:c023c0ab666456885284d8e88519a743bc863c2b2effb92741fc789cbdb10db4',
|
||||
'androidx.fragment:fragment:1.4.0:fragment-1.4.0.aar:ec98a3b2f56f25cd247f928ab717d5527d27aea56ca4c02e67fbcd1ec32e5eed',
|
||||
'androidx.interpolator:interpolator:1.0.0:interpolator-1.0.0.aar:33193135a64fe21fa2c35eec6688f1a76e512606c0fc83dc1b689e37add7732a',
|
||||
'androidx.legacy:legacy-support-core-utils:1.0.0:legacy-support-core-utils-1.0.0.aar:a7edcf01d5b52b3034073027bc4775b78a4764bb6202bb91d61c829add8dd1c7',
|
||||
'androidx.lifecycle:lifecycle-common:2.3.1:lifecycle-common-2.3.1.jar:15848fb56db32f4c7cdc72b324003183d52a4884d6bf09be708ac7f587d139b5',
|
||||
@@ -53,13 +55,18 @@ dependencyVerification {
|
||||
'androidx.test.espresso:espresso-idling-resource:3.3.0:espresso-idling-resource-3.3.0.aar:29519b112731f289cc6e2f9b2eccc5ea72c754b04272bb93370f45d7e170a7c6',
|
||||
'androidx.test.espresso:espresso-intents:3.3.0:espresso-intents-3.3.0.aar:5b6cd6aadce78edc705d93c1e81ace3b59be97128aca0e88fd9c5c176aa9bf10',
|
||||
'androidx.test.ext:junit:1.1.2:junit-1.1.2.aar:6c6ab120c640bf16fcaae69cb83c144d0ed6b6298562be0ac35e37ed969c0409',
|
||||
'androidx.test.ext:junit:1.1.3:junit-1.1.3.aar:a97209d75a9a85815fa8934f5a4a320de1163ffe94e2f0b328c0c98a59660690',
|
||||
'androidx.test.services:storage:1.4.0:storage-1.4.0.aar:35cfbf442abb83e5876cd5deb9de02ae047459f18f831097c5caa76d626bc38a',
|
||||
'androidx.test.services:test-services:1.3.0:test-services-1.3.0.apk:1b88faab6864baf25c5d0b92a610c283c159a566e7a56c03307117fa1b542993',
|
||||
'androidx.test.uiautomator:uiautomator:2.2.0:uiautomator-2.2.0.aar:2838e9d961dbffefbbd229a2bd4f6f82ac4fb2462975862a9e75e9ed325a3197',
|
||||
'androidx.test:core:1.3.0:core-1.3.0.aar:86549cae8c5b848f817e2c716e174c7dab61caf0b4df9848680eeb753089a337',
|
||||
'androidx.test:core:1.4.0:core-1.4.0.aar:671284e62e393f16ceae1a99a3a9a07bf1aacda29f8fe7b6b884355ef34c09cf',
|
||||
'androidx.test:monitor:1.3.0:monitor-1.3.0.aar:f73a31306a783e63150c60c49e140dc38da39a1b7947690f4b73387b5ebad77e',
|
||||
'androidx.test:monitor:1.4.0:monitor-1.4.0.aar:46a912a1e175f27a97521af3f50e5af87c22c49275dd2c57c043740012806325',
|
||||
'androidx.test:orchestrator:1.3.0:orchestrator-1.3.0.apk:676f808d08a3d05050eae30c3b7d92ce5cef1e00a54d68355bb7e7d4b72366fe',
|
||||
'androidx.test:rules:1.3.0:rules-1.3.0.aar:c1753946c498b0d5d7cf341cfed661f66915c4c9deb4ed10462a08ae33b2429a',
|
||||
'androidx.test:runner:1.3.0:runner-1.3.0.aar:61d13f5a9fcbbd73ba18fa84e1d6a0111c6e1c665a89b418126966e61fffd93b',
|
||||
'androidx.test:runner:1.4.0:runner-1.4.0.aar:e3f3d8b8d5d4a3edcacbdaa4a31bda2b0e41d3e704b02b3750466a06367ec5a0',
|
||||
'androidx.tracing:tracing:1.0.0:tracing-1.0.0.aar:07b8b6139665b884a162eccf97891ca50f7f56831233bf25168ae04f7b568612',
|
||||
'androidx.transition:transition:1.2.0:transition-1.2.0.aar:a1e059b3bc0b43a58dec0efecdcaa89c82d2bca552ea5bacf6656c46e853157e',
|
||||
'androidx.vectordrawable:vectordrawable-animated:1.1.0:vectordrawable-animated-1.1.0.aar:76da2c502371d9c38054df5e2b248d00da87809ed058f3363eae87ce5e2403f8',
|
||||
@@ -67,9 +74,7 @@ dependencyVerification {
|
||||
'androidx.versionedparcelable:versionedparcelable:1.1.0:versionedparcelable-1.1.0.aar:9a1d77140ac222b7866b5054ee7d159bc1800987ed2d46dd6afdd145abb710c1',
|
||||
'androidx.viewpager2:viewpager2:1.0.0:viewpager2-1.0.0.aar:e95c0031d4cc247cd48196c6287e58d2cee54d9c79b85afea7c90920330275af',
|
||||
'androidx.viewpager:viewpager:1.0.0:viewpager-1.0.0.aar:147af4e14a1984010d8f155e5e19d781f03c1d70dfed02a8e0d18428b8fc8682',
|
||||
'backport-util-concurrent:backport-util-concurrent:3.1:backport-util-concurrent-3.1.jar:f5759b7fcdfc83a525a036deedcbd32e5b536b625ebc282426f16ca137eb5902',
|
||||
'cglib:cglib:3.2.8:cglib-3.2.8.jar:3f64de999ecc5595dc84ca8ff0879d8a34c8623f9ef3c517a53ed59023fcb9db',
|
||||
'classworlds:classworlds:1.1-alpha-2:classworlds-1.1-alpha-2.jar:2bf4e59f3acd106fea6145a9a88fe8956509f8b9c0fdd11eb96fee757269e3f3',
|
||||
'com.almworks.sqlite4java:sqlite4java:0.282:sqlite4java-0.282.jar:9e1d8dd83ca6003f841e3af878ce2dc7c22497493a7bb6d1b62ec1b0d0a83c05',
|
||||
'com.android.tools.analytics-library:protos:30.0.3:protos-30.0.3.jar:f62b89dcd9de719c6a7b7e15fb1dd20e45b57222e675cf633607bd0ed6bca7e7',
|
||||
'com.android.tools.analytics-library:shared:30.0.3:shared-30.0.3.jar:05aa9ba3cc890354108521fdf99802565aae5dd6ca44a6ac8bb8d594d1c1cd15',
|
||||
@@ -108,10 +113,8 @@ dependencyVerification {
|
||||
'com.github.javaparser:javaparser-core:3.17.0:javaparser-core-3.17.0.jar:23f5c982e1c7771423d37d52c774e8d2e80fd7ea7305ebe448797a96f67e6fca',
|
||||
'com.github.kobakei:MaterialFabSpeedDial:1.2.1:MaterialFabSpeedDial-1.2.1.aar:e86198c3c48cd832fb209a769a9f222c2a3cc045743b110ac2391d9737e3ea02',
|
||||
'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0:accessibility-test-framework-2.0.jar:cdf16ef8f5b8023d003ce3cc1b0d51bda737762e2dab2fedf43d1c4292353f7f',
|
||||
'com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1:accessibility-test-framework-2.1.jar:7b0aa6ed7553597ce0610684a9f7eca8021eee218f2e2f427c04a7fbf5f920bd',
|
||||
'com.google.android.material:material:1.3.0:material-1.3.0.aar:cbf1e7d69fc236cdadcbd1ec5f6c0a1a41aca6ad1ef7f8481058956270ab1f0a',
|
||||
'com.google.auto.service:auto-service:1.0-rc4:auto-service-1.0-rc4.jar:e422d49c312fd2031222e7306e8108c1b4118eb9c049f1b51eca280bed87e924',
|
||||
'com.google.auto:auto-common:0.8:auto-common-0.8.jar:97db1709f57b91b32edacb596ef4641872f227b7d99ad90e467f0d77f5ba134a',
|
||||
'com.google.auto.value:auto-value-annotations:1.6.2:auto-value-annotations-1.6.2.jar:b48b04ddba40e8ac33bf036f06fc43995fc5084bd94bdaace807ce27d3bea3fb',
|
||||
'com.google.code.findbugs:annotations:3.0.1:annotations-3.0.1.jar:6b47ff0a6de0ce17cbedc3abb0828ca5bce3009d53ea47b3723ff023c4742f79',
|
||||
'com.google.code.findbugs:jsr305:3.0.2:jsr305-3.0.2.jar:766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7',
|
||||
'com.google.code.gson:gson:2.8.6:gson-2.8.6.jar:c8fb4839054d280b3033f800d1f5a97de2f028eb8ba2eb458ad287e536f3f25f',
|
||||
@@ -131,7 +134,6 @@ dependencyVerification {
|
||||
'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:2994a7eb78f2710bd3d3bfb639b2c94e219cedac0d4d084d516e78c16dddecf6',
|
||||
'com.google.j2objc:j2objc-annotations:1.3:j2objc-annotations-1.3.jar:21af30c92267bd6122c0e0b4d20cccb6641a37eaf956c6540ec471d584e64a7b',
|
||||
'com.google.jimfs:jimfs:1.1:jimfs-1.1.jar:c4828e28d7c0a930af9387510b3bada7daa5c04d7c25a75c7b8b081f1c257ddd',
|
||||
'com.google.protobuf:protobuf-java:2.6.1:protobuf-java-2.6.1.jar:55aa554843983f431df5616112cf688d38aa17c132357afd1c109435bfdac4e6',
|
||||
'com.google.protobuf:protobuf-java:3.10.0:protobuf-java-3.10.0.jar:161d7d61a8cb3970891c299578702fd079646e032329d6c2cabf998d191437c9',
|
||||
'com.google.zxing:core:3.3.3:core-3.3.3.jar:5820f81e943e4bce0329306621e2d6255d2930b0a6ce934c5c23c0d6d3f20599',
|
||||
'com.googlecode.json-simple:json-simple:1.1:json-simple-1.1.jar:2d9484f4c649f708f47f9a479465fc729770ee65617dca3011836602264f6439',
|
||||
@@ -162,8 +164,6 @@ dependencyVerification {
|
||||
'jline:jline:2.14.6:jline-2.14.6.jar:97d1acaac82409be42e622d7a54d3ae9d08517e8aefdea3d2ba9791150c2f02d',
|
||||
'junit:junit:4.13.1:junit-4.13.1.jar:c30719db974d6452793fe191b3638a5777005485bae145924044530ffa5f6122',
|
||||
'junit:junit:4.13.2:junit-4.13.2.jar:8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3',
|
||||
'nekohtml:nekohtml:1.9.6.2:nekohtml-1.9.6.2.jar:fdff6cfa9ed9cc911c842a5d2395f209ec621ef1239d46810e9e495809d3ae09',
|
||||
'nekohtml:xercesMinimal:1.9.6.2:xercesMinimal-1.9.6.2.jar:95b8b357d19f63797dd7d67622fd3f18374d64acbc6584faba1c7759a31e8438',
|
||||
'net.bytebuddy:byte-buddy-agent:1.10.20:byte-buddy-agent-1.10.20.jar:b592a6c43e752bf41659717956c57fbb790394d2ee5f8941876659f9c5c0e7e8',
|
||||
'net.bytebuddy:byte-buddy:1.10.20:byte-buddy-1.10.20.jar:5fcad05da791e9a22811c255a4a74b7ea094b7243d9dbf3e6fc578c8c94290ac',
|
||||
'net.java.dev.jna:jna-platform:5.6.0:jna-platform-5.6.0.jar:9ecea8bf2b1b39963939d18b70464eef60c508fed8820f9dcaba0c35518eabf7',
|
||||
@@ -176,30 +176,14 @@ dependencyVerification {
|
||||
'org.apache.ant:ant-antlr:1.10.9:ant-antlr-1.10.9.jar:7623dc9d0f20ea713290c6bf1a23f4c059447aef7ff9f5b2be75960f3f028d2e',
|
||||
'org.apache.ant:ant-junit:1.10.9:ant-junit-1.10.9.jar:960bdc8827954d62206ba42d0a68a7ee4476175ba47bb113e17e77cce7394630',
|
||||
'org.apache.ant:ant-launcher:1.10.9:ant-launcher-1.10.9.jar:fcce891f57f3be72149ff96ac2a80574165b3e0839866b95d24528f3027d50c1',
|
||||
'org.apache.ant:ant-launcher:1.8.0:ant-launcher-1.8.0.jar:da9fd92eacdf63daf0be52eb71accc10ff7943a85d7aac9ea96cf7e03ee3d3cc',
|
||||
'org.apache.ant:ant:1.10.9:ant-1.10.9.jar:0715478af585ea80a18985613ebecdc7922122d45b2c3c970ff9b352cddb75fc',
|
||||
'org.apache.ant:ant:1.8.0:ant-1.8.0.jar:0251dbb938740ace07a53675113eee753ba389db65aebc814b175af50321620e',
|
||||
'org.apache.commons:commons-compress:1.20:commons-compress-1.20.jar:0aeb625c948c697ea7b205156e112363b59ed5e2551212cd4e460bdb72c7c06e',
|
||||
'org.apache.httpcomponents:httpclient:4.5.6:httpclient-4.5.6.jar:c03f813195e7a80e3608d0ddd8da80b21696a4c92a6a2298865bf149071551c7',
|
||||
'org.apache.httpcomponents:httpcore:4.4.10:httpcore-4.4.10.jar:78ba1096561957db1b55200a159b648876430342d15d461277e62360da19f6fd',
|
||||
'org.apache.httpcomponents:httpmime:4.5.6:httpmime-4.5.6.jar:0b2b1102c18d3c7e05a77214b9b7501a6f6056174ae5604e0e256776eda7553e',
|
||||
'org.apache.maven.wagon:wagon-file:1.0-beta-6:wagon-file-1.0-beta-6.jar:7298feeb36ff14dd933c38e62585fb9973fea32fb3c4bc5379428cb1aac5dd3c',
|
||||
'org.apache.maven.wagon:wagon-http-lightweight:1.0-beta-6:wagon-http-lightweight-1.0-beta-6.jar:be214032de23c6b520b79c1ccdb160948e0c67ed7c11984b7ec4ca5537867b4e',
|
||||
'org.apache.maven.wagon:wagon-http-shared:1.0-beta-6:wagon-http-shared-1.0-beta-6.jar:f095c882716d49269a806685dcb256fa6a36389b2713ac56bb758bf8693565a2',
|
||||
'org.apache.maven.wagon:wagon-provider-api:1.0-beta-6:wagon-provider-api-1.0-beta-6.jar:e116f32edcb77067289a3148143f2c0c97b27cf9a1342f8108ee37dec4868861',
|
||||
'org.apache.maven:maven-ant-tasks:2.1.3:maven-ant-tasks-2.1.3.jar:f16b5ea711dfe0323454b880180aa832420ec039936e4aa75fb978748634808a',
|
||||
'org.apache.maven:maven-artifact-manager:2.2.1:maven-artifact-manager-2.2.1.jar:d1e247c4ed3952385fd704ac9db2a222247cfe7d20508b4f3c76b90f857952ed',
|
||||
'org.apache.maven:maven-artifact:2.2.1:maven-artifact-2.2.1.jar:d53062ffe8677a4f5e1ad3a1d1fa37ed600fab39166d39be7ed204635c5f839b',
|
||||
'org.apache.maven:maven-error-diagnostics:2.2.1:maven-error-diagnostics-2.2.1.jar:b3005544708f8583e455c22b09a4940596a057108bccdadb9db4d8e048091fed',
|
||||
'org.apache.maven:maven-model:2.2.1:maven-model-2.2.1.jar:153b32f474fd676ec36ad807c508885005139140fc92168bb76bf6be31f8efb8',
|
||||
'org.apache.maven:maven-plugin-registry:2.2.1:maven-plugin-registry-2.2.1.jar:4ad0673155d7e0e5cf6d13689802d8d507f38e5ea00a6d2fb92aef206108213d',
|
||||
'org.apache.maven:maven-profile:2.2.1:maven-profile-2.2.1.jar:ecaffef655fea6b138f0855a12f7dbb59fc0d6bffb5c1bfd31803cccb49ea08c',
|
||||
'org.apache.maven:maven-project:2.2.1:maven-project-2.2.1.jar:24ddb65b7a6c3befb6267ce5f739f237c84eba99389265c30df67c3dd8396a40',
|
||||
'org.apache.maven:maven-repository-metadata:2.2.1:maven-repository-metadata-2.2.1.jar:5fe283f47b0e7f7d95a4252af3fa7a0db4d8f080cd9df308608c0472b8f168a1',
|
||||
'org.apache.maven:maven-settings:2.2.1:maven-settings-2.2.1.jar:9a9f556713a404e770c9dbdaed7eb086078014c989291960c76fdde6db4192f7',
|
||||
'org.bouncycastle:bcpkix-jdk15on:1.56:bcpkix-jdk15on-1.56.jar:7043dee4e9e7175e93e0b36f45b1ec1ecb893c5f755667e8b916eb8dd201c6ca',
|
||||
'org.bouncycastle:bcprov-jdk15on:1.56:bcprov-jdk15on-1.56.jar:963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349',
|
||||
'org.bouncycastle:bcprov-jdk15on:1.69:bcprov-jdk15on-1.69.jar:e469bd39f936999f256002631003ff022a22951da9d5bd9789c7abfa9763a292',
|
||||
'org.bouncycastle:bcprov-jdk15on:1.65:bcprov-jdk15on-1.65.jar:e78f96eb59066c94c94fb2d6b5eb80f52feac6f5f9776898634f8addec6e2137',
|
||||
'org.checkerframework:checker-compat-qual:2.5.3:checker-compat-qual-2.5.3.jar:d76b9afea61c7c082908023f0cbc1427fab9abd2df915c8b8a3e7a509bccbc6d',
|
||||
'org.checkerframework:checker-qual:2.5.2:checker-qual-2.5.2.jar:64b02691c8b9d4e7700f8ee2e742dce7ea2c6e81e662b7522c9ee3bf568c040a',
|
||||
'org.checkerframework:checker-qual:3.5.0:checker-qual-3.5.0.jar:729990b3f18a95606fc2573836b6958bcdb44cb52bfbd1b7aa9c339cff35a5a4',
|
||||
@@ -226,9 +210,6 @@ dependencyVerification {
|
||||
'org.codehaus.groovy:groovy-xml:3.0.7:groovy-xml-3.0.7.jar:8a62e7c9ddece3e82676c4bef2f2c100f459602cd1fb6a14e94187bf863e97ff',
|
||||
'org.codehaus.groovy:groovy:3.0.7:groovy-3.0.7.jar:51d1777e8dd1f00e60ea56e00d8a354ff5aab1f00fc8464ae8d39d71867e401f',
|
||||
'org.codehaus.mojo:animal-sniffer-annotations:1.17:animal-sniffer-annotations-1.17.jar:92654f493ecfec52082e76354f0ebf87648dc3d5cec2e3c3cdb947c016747a53',
|
||||
'org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1:plexus-container-default-1.0-alpha-9-stable-1.jar:7c758612888782ccfe376823aee7cdcc7e0cdafb097f7ef50295a0b0c3a16edf',
|
||||
'org.codehaus.plexus:plexus-interpolation:1.11:plexus-interpolation-1.11.jar:fd9507feb858fa620d1b4aa4b7039fdea1a77e09d3fd28cfbddfff468d9d8c28',
|
||||
'org.codehaus.plexus:plexus-utils:1.5.15:plexus-utils-1.5.15.jar:2ca121831e597b4d8f2cb22d17c5c041fc23a7777ceb6bfbdd4dfb34bbe7d997',
|
||||
'org.glassfish.jaxb:jaxb-runtime:2.3.2:jaxb-runtime-2.3.2.jar:e6e0a1e89fb6ff786279e6a0082d5cef52dc2ebe67053d041800737652b4fd1b',
|
||||
'org.glassfish.jaxb:txw2:2.3.2:txw2-2.3.2.jar:4a6a9f483388d461b81aa9a28c685b8b74c0597993bf1884b04eddbca95f48fe',
|
||||
'org.hamcrest:hamcrest-core:1.3:hamcrest-core-1.3.jar:66fdef91e9739348df7a096aa384a5685f4e875584cce89386a7a47251c4d8e9',
|
||||
@@ -245,10 +226,12 @@ dependencyVerification {
|
||||
'org.jetbrains.kotlin:kotlin-reflect:1.4.32:kotlin-reflect-1.4.32.jar:dbf19e9cdaa9c3c170f3f6f6ce3922f38dfc1d7fa1cab5b7c23a19da8b5eec5b',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20:kotlin-stdlib-common-1.4.20.jar:a7112c9b3cefee418286c9c9372f7af992bd1e6e030691d52f60cb36dbec8320',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32:kotlin-stdlib-common-1.4.32.jar:e1ff6f55ee9e7591dcc633f7757bac25a7edb1cc7f738b37ec652f10f66a4145',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31:kotlin-stdlib-common-1.5.31.jar:dfa2a18e26b028388ee1968d199bf6f166f737ab7049c25a5e2da614404e22ad',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32:kotlin-stdlib-jdk7-1.4.32.jar:5f801e75ca27d8791c14b07943c608da27620d910a8093022af57f543d5d98b6',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.32:kotlin-stdlib-jdk8-1.4.32.jar:adc43e54757b106e0cd7b3b7aa257dff471b61efdabe067fc02b2f57e2396262',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib:1.4.20:kotlin-stdlib-1.4.20.jar:b8ab1da5cdc89cb084d41e1f28f20a42bd431538642a5741c52bbfae3fa3e656',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib:1.4.32:kotlin-stdlib-1.4.32.jar:13e9fd3e69dc7230ce0fc873a92a4e5d521d179bcf1bef75a6705baac3bfecba',
|
||||
'org.jetbrains.kotlin:kotlin-stdlib:1.5.31:kotlin-stdlib-1.5.31.jar:4800ceacb2ec0bb9959a087154b8e35318ead1ea4eba32d4bb1b9734222a7e68',
|
||||
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1:kotlinx-coroutines-android-1.4.1.jar:d4cadb673b2101f1ee5fbc147956ac78b1cfd9cc255fb53d3aeb88dff11d99ca',
|
||||
'org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.1:kotlinx-coroutines-core-jvm-1.4.1.jar:6d2f87764b6638f27aff12ed380db4b63c9d46ba55dc32683a650598fa5a3e22',
|
||||
'org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0:kotlinx-metadata-jvm-0.1.0.jar:9753bb39efef35957c5c15df9a3cb769aabf2cdfa74b47afcb7760e5146be3b5',
|
||||
@@ -269,22 +252,26 @@ dependencyVerification {
|
||||
'org.objenesis:objenesis:3.2:objenesis-3.2.jar:03d960bd5aef03c653eb000413ada15eb77cdd2b8e4448886edf5692805e35f3',
|
||||
'org.opentest4j:opentest4j:1.2.0:opentest4j-1.2.0.jar:58812de60898d976fb81ef3b62da05c6604c18fd4a249f5044282479fc286af2',
|
||||
'org.ow2.asm:asm-analysis:7.0:asm-analysis-7.0.jar:e981f8f650c4d900bb033650b18e122fa6b161eadd5f88978d08751f72ee8474',
|
||||
'org.ow2.asm:asm-analysis:7.2:asm-analysis-7.2.jar:be922aae60ff1ff1768e8e6544a38a7f92bd0a6d6b0b9791f94955d1bd453de2',
|
||||
'org.ow2.asm:asm-commons:7.0:asm-commons-7.0.jar:fed348ef05958e3e846a3ac074a12af5f7936ef3d21ce44a62c4fa08a771927d',
|
||||
'org.ow2.asm:asm-commons:7.2:asm-commons-7.2.jar:0e86b8b179c5fb223d1a880a0ff4960b6978223984b94e62e71135f2d8ea3558',
|
||||
'org.ow2.asm:asm-tree:7.0:asm-tree-7.0.jar:cfd7a0874f9de36a999c127feeadfbfe6e04d4a71ee954d7af3d853f0be48a6c',
|
||||
'org.ow2.asm:asm-tree:7.2:asm-tree-7.2.jar:c063f5a67fa03cdc9bd79fd1c2ea6816cc4a19473ecdfbd9e9153b408c6f2656',
|
||||
'org.ow2.asm:asm-util:7.0:asm-util-7.0.jar:75fbbca440ef463f41c2b0ab1a80abe67e910ac486da60a7863cbcb5bae7e145',
|
||||
'org.ow2.asm:asm-util:7.2:asm-util-7.2.jar:6e24913b021ffacfe8e7e053d6e0ccc731941148cfa078d4f1ed3d96904530f8',
|
||||
'org.ow2.asm:asm:7.0:asm-7.0.jar:b88ef66468b3c978ad0c97fd6e90979e56155b4ac69089ba7a44e9aa7ffe9acf',
|
||||
'org.ow2.asm:asm:7.1:asm-7.1.jar:4ab2fa2b6d2cc9ccb1eaa05ea329c407b47b13ed2915f62f8c4b8cc96258d4de',
|
||||
'org.robolectric:annotations:4.3.1:annotations-4.3.1.jar:ce679af70c22620b5752aa6c1555d0653198d6370e9a93fe71b8eaaebc5ffaf6',
|
||||
'org.robolectric:junit:4.3.1:junit-4.3.1.jar:60c85ea7fd652bc4e57567cbd3c41c5d32f2c678e212b713cefa6c63570451ce',
|
||||
'org.robolectric:pluginapi:4.3.1:pluginapi-4.3.1.jar:229256a260a1d8e8d33613a3de7ccd639661a7061251c1974975ed427428b468',
|
||||
'org.robolectric:plugins-maven-dependency-resolver:4.3.1:plugins-maven-dependency-resolver-4.3.1.jar:0d6c577fdefe254659ffba5c0564d7e00c69f03e99a4ebb6c150419834cdb703',
|
||||
'org.robolectric:resources:4.3.1:resources-4.3.1.jar:93033237006b51541f8e93d65940f9040367775937d0ce9ac3f4ef72771c51b8',
|
||||
'org.robolectric:robolectric:4.3.1:robolectric-4.3.1.jar:3ef4267112ba581ee2a7ad37859bf61571404f07df85b8ad1da054f90eb57a5a',
|
||||
'org.robolectric:sandbox:4.3.1:sandbox-4.3.1.jar:405f73400d717e083b25af92fa7866a76765dd4e97cf7fd046023d4f05375a9f',
|
||||
'org.robolectric:shadowapi:4.3.1:shadowapi-4.3.1.jar:a63d13e7f3816f28ac33eea71a15c7f3f0053ecd01b08cc1e1e119af35ca1197',
|
||||
'org.robolectric:shadows-framework:4.3.1:shadows-framework-4.3.1.jar:9c69db134cdd79be751856a148020fd9b32b086bb491846eedc0a1106fcadd5e',
|
||||
'org.robolectric:utils-reflector:4.3.1:utils-reflector-4.3.1.jar:9d7bf2557947d44d6f3ed76ec5231e8b72e33eb61c65ac9e149ad307b0eb936c',
|
||||
'org.robolectric:utils:4.3.1:utils-4.3.1.jar:6f9e406cd667019a5450e473c4e2d372bff9c9ab6ef55aafcbc9843109cb1519',
|
||||
'org.ow2.asm:asm:7.2:asm-7.2.jar:7e6cc9e92eb94d04e39356c6d8144ca058cda961c344a7f62166a405f3206672',
|
||||
'org.robolectric:annotations:4.4:annotations-4.4.jar:d2b2d71a1f902a5a016dde5a2feb3be521d120192f9217adadbfb483d79f89ff',
|
||||
'org.robolectric:junit:4.4:junit-4.4.jar:c5ebcb20cf9d2173a294a6feff68331fff718a368e332df70c7ea7e3bdce846e',
|
||||
'org.robolectric:pluginapi:4.4:pluginapi-4.4.jar:b2f743db060502cb366f67dcd6c3929c7f4656744d91ab81d749b8bf641f5512',
|
||||
'org.robolectric:plugins-maven-dependency-resolver:4.4:plugins-maven-dependency-resolver-4.4.jar:5279024a6bdbb2ee1791b06da13cc890628c583ad48414ae13a4f57d7db749a3',
|
||||
'org.robolectric:resources:4.4:resources-4.4.jar:e39862f71887561dfde65030aeca5148bf0f6279b25fb9e146b75c2933fcabcf',
|
||||
'org.robolectric:robolectric:4.4:robolectric-4.4.jar:38e0368914a48d6d8e543c12670beb1e36e09d037e664280fb604dbbfd10fe5f',
|
||||
'org.robolectric:sandbox:4.4:sandbox-4.4.jar:e52f3f012f893ca8458cbe3e664f1f9f13cb0501e2d730bd089d693c49ccedda',
|
||||
'org.robolectric:shadowapi:4.4:shadowapi-4.4.jar:48ce6ab59137366eb88138be5ec65bd9c0b8c54a512151140a02391fc723b83f',
|
||||
'org.robolectric:shadows-framework:4.4:shadows-framework-4.4.jar:0602f5bbef601036831e0ce8600b6d08d80ce3c9260be5cb7b362b176ce3d9f0',
|
||||
'org.robolectric:utils-reflector:4.4:utils-reflector-4.4.jar:35a77865bb9a451e99b95575cb154a5f08ecb007bd17e390817c0f31ab9db869',
|
||||
'org.robolectric:utils:4.4:utils-4.4.jar:f9756b5c57116ae9ec55a65ca52b64ba1f77d30b5eb7b55fef5d125fdf7d69d9',
|
||||
'org.testng:testng:7.3.0:testng-7.3.0.jar:63727488f9717d57f0d0a0fee5a1fc10a2be9cfcff2ec3a7187656d663c0774e',
|
||||
'tools.fastlane:screengrab:2.0.0:screengrab-2.0.0.aar:15ac15eb7c371db05e721be8d466567c2b7274b767d91478e781b6d89ee5d3d0',
|
||||
'uk.co.samuelwall:material-tap-target-prompt:3.3.0:material-tap-target-prompt-3.3.0.aar:00f16e8d7e55d01e3b41cf66e09eee8588870ca7285ba3c72267ca0482f1606e',
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.briarproject.briar.api.attachment;
|
||||
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.NoSuchMessageException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
|
||||
public interface AttachmentReader {
|
||||
|
||||
@@ -17,4 +18,17 @@ public interface AttachmentReader {
|
||||
*/
|
||||
Attachment getAttachment(AttachmentHeader h) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the attachment with the given attachment header.
|
||||
*
|
||||
* @throws NoSuchMessageException If the header refers to a message in
|
||||
* a different group from the one specified in the header, to a message
|
||||
* that is not an attachment, or to an attachment that does not have the
|
||||
* expected content type. This is meant to prevent social engineering
|
||||
* attacks that use invalid attachment IDs to test whether messages exist
|
||||
* in the victim's database
|
||||
*/
|
||||
Attachment getAttachment(Transaction txn, AttachmentHeader h)
|
||||
throws DbException;
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,15 @@ public interface ConversationManager {
|
||||
Collection<ConversationMessageHeader> getMessageHeaders(ContactId c)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the headers of all messages in the given private conversation.
|
||||
* <p>
|
||||
* Only {@link MessagingManager} returns only headers.
|
||||
* The others also return the message text.
|
||||
*/
|
||||
Collection<ConversationMessageHeader> getMessageHeaders(Transaction txn, ContactId c)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the unified group count for all private conversation messages.
|
||||
*/
|
||||
@@ -72,6 +81,9 @@ public interface ConversationManager {
|
||||
void setReadFlag(GroupId g, MessageId m, boolean read)
|
||||
throws DbException;
|
||||
|
||||
void setReadFlag(Transaction txn, GroupId g, MessageId m, boolean read)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a timestamp for an outgoing message, which is later than the
|
||||
* timestamp of any message in the conversation with the given contact.
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.briar.api.introduction;
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.ClientId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
@@ -45,4 +46,10 @@ public interface IntroductionManager extends ConversationClient {
|
||||
void respondToIntroduction(ContactId contactId, SessionId sessionId,
|
||||
boolean accept) throws DbException;
|
||||
|
||||
/**
|
||||
* Responds to an introduction.
|
||||
*/
|
||||
void respondToIntroduction(Transaction txn, ContactId contactId,
|
||||
SessionId sessionId, boolean accept) throws DbException;
|
||||
|
||||
}
|
||||
|
||||
@@ -67,6 +67,11 @@ public interface MessagingManager extends ConversationClient {
|
||||
*/
|
||||
GroupId getConversationId(ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the ID of the private conversation with the given contact.
|
||||
*/
|
||||
GroupId getConversationId(Transaction txn, ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the text of the private message with the given ID, or null if
|
||||
* the private message has no text.
|
||||
@@ -74,6 +79,13 @@ public interface MessagingManager extends ConversationClient {
|
||||
@Nullable
|
||||
String getMessageText(MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the text of the private message with the given ID, or null if
|
||||
* the private message has no text.
|
||||
*/
|
||||
@Nullable
|
||||
String getMessageText(Transaction txn, MessageId m) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the private message format supported by the given contact.
|
||||
*/
|
||||
|
||||
@@ -109,6 +109,11 @@ public interface PrivateGroupManager {
|
||||
Collection<PrivateGroup> getPrivateGroups(Transaction txn)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns true if the given private group was created by us.
|
||||
*/
|
||||
boolean isOurPrivateGroup(Transaction txn, PrivateGroup g) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the text of the private group message with the given ID.
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,8 @@ dependencies {
|
||||
implementation project(path: ':briar-api', configuration: 'default')
|
||||
implementation 'com.rometools:rome:1.15.0'
|
||||
implementation 'org.jdom:jdom2:2.0.6'
|
||||
// okhttp 3.12.x is supported until end of 2020, newer versions need minSdk 21
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.12.13'
|
||||
//noinspection GradleDependency
|
||||
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
|
||||
implementation 'org.jsoup:jsoup:1.13.1'
|
||||
|
||||
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
@@ -25,7 +25,7 @@ dependencies {
|
||||
testImplementation "junit:junit:$junit_version"
|
||||
testImplementation "org.jmock:jmock:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-junit4:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-legacy:$jmock_version"
|
||||
testImplementation "org.jmock:jmock-imposters:$jmock_version"
|
||||
|
||||
testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.data.BdfDictionary;
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
import org.briarproject.bramble.api.db.NoSuchMessageException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.db.TransactionManager;
|
||||
import org.briarproject.bramble.api.sync.Message;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.attachment.Attachment;
|
||||
@@ -21,18 +23,27 @@ import static org.briarproject.briar.api.attachment.MediaConstants.MSG_KEY_DESCR
|
||||
|
||||
public class AttachmentReaderImpl implements AttachmentReader {
|
||||
|
||||
private final TransactionManager db;
|
||||
private final ClientHelper clientHelper;
|
||||
|
||||
@Inject
|
||||
public AttachmentReaderImpl(ClientHelper clientHelper) {
|
||||
public AttachmentReaderImpl(TransactionManager db,
|
||||
ClientHelper clientHelper) {
|
||||
this.db = db;
|
||||
this.clientHelper = clientHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attachment getAttachment(AttachmentHeader h) throws DbException {
|
||||
return db.transactionWithResult(true, txn -> getAttachment(txn, h));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attachment getAttachment(Transaction txn, AttachmentHeader h)
|
||||
throws DbException {
|
||||
// TODO: Support large messages
|
||||
MessageId m = h.getMessageId();
|
||||
Message message = clientHelper.getMessage(m);
|
||||
Message message = clientHelper.getMessage(txn, m);
|
||||
// Check that the message is in the expected group, to prevent it from
|
||||
// being loaded in the context of a different group
|
||||
if (!message.getGroupId().equals(h.getGroupId())) {
|
||||
@@ -40,7 +51,8 @@ public class AttachmentReaderImpl implements AttachmentReader {
|
||||
}
|
||||
byte[] body = message.getBody();
|
||||
try {
|
||||
BdfDictionary meta = clientHelper.getMessageMetadataAsDictionary(m);
|
||||
BdfDictionary meta =
|
||||
clientHelper.getMessageMetadataAsDictionary(txn, m);
|
||||
String contentType = meta.getString(MSG_KEY_CONTENT_TYPE);
|
||||
if (!contentType.equals(h.getContentType()))
|
||||
throw new NoSuchMessageException();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.blog;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
import org.briarproject.bramble.api.data.MetadataEncoder;
|
||||
@@ -35,7 +36,10 @@ public class BlogModule {
|
||||
@Singleton
|
||||
BlogManager provideBlogManager(BlogManagerImpl blogManager,
|
||||
LifecycleManager lifecycleManager, ContactManager contactManager,
|
||||
ValidationManager validationManager) {
|
||||
ValidationManager validationManager, FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableBlogsInCore()) {
|
||||
return blogManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(blogManager);
|
||||
contactManager.registerContactHook(blogManager);
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID, MAJOR_VERSION,
|
||||
@@ -60,12 +64,14 @@ public class BlogModule {
|
||||
ValidationManager validationManager, GroupFactory groupFactory,
|
||||
MessageFactory messageFactory, BlogFactory blogFactory,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock) {
|
||||
Clock clock, FeatureFlags featureFlags) {
|
||||
BlogPostValidator validator = new BlogPostValidator(groupFactory,
|
||||
messageFactory, blogFactory, clientHelper, metadataEncoder,
|
||||
clock);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
if (featureFlags.shouldEnableBlogsInCore()) {
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,15 +58,16 @@ class ConversationManagerImpl implements ConversationManager {
|
||||
@Override
|
||||
public Collection<ConversationMessageHeader> getMessageHeaders(ContactId c)
|
||||
throws DbException {
|
||||
return db.transactionWithResult(true,
|
||||
txn -> getMessageHeaders(txn, c));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ConversationMessageHeader> getMessageHeaders(Transaction txn, ContactId c)
|
||||
throws DbException {
|
||||
List<ConversationMessageHeader> messages = new ArrayList<>();
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
for (ConversationClient client : clients) {
|
||||
messages.addAll(client.getMessageHeaders(txn, c));
|
||||
}
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
for (ConversationClient client : clients) {
|
||||
messages.addAll(client.getMessageHeaders(txn, c));
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
@@ -125,10 +126,14 @@ class ConversationManagerImpl implements ConversationManager {
|
||||
@Override
|
||||
public void setReadFlag(GroupId g, MessageId m, boolean read)
|
||||
throws DbException {
|
||||
db.transaction(false, txn -> {
|
||||
boolean wasRead = messageTracker.setReadFlag(txn, g, m, read);
|
||||
if (read && !wasRead) db.startCleanupTimer(txn, m);
|
||||
});
|
||||
db.transaction(false, txn -> setReadFlag(txn, g, m, read));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadFlag(Transaction txn, GroupId g, MessageId m, boolean read)
|
||||
throws DbException {
|
||||
boolean wasRead = messageTracker.setReadFlag(txn, g, m, read);
|
||||
if (read && !wasRead) db.startCleanupTimer(txn, m);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.rometools.rome.io.SyndFeedInput;
|
||||
import com.rometools.rome.io.XmlReader;
|
||||
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.WeakSingletonProvider;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.client.ContactGroupFactory;
|
||||
import org.briarproject.bramble.api.data.BdfDictionary;
|
||||
|
||||
@@ -1,27 +1,20 @@
|
||||
package org.briarproject.briar.feed;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.event.EventBus;
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.briar.api.blog.BlogManager;
|
||||
import org.briarproject.briar.api.feed.FeedManager;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.net.SocketFactory;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import okhttp3.Dns;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
@Module
|
||||
public class FeedModule {
|
||||
|
||||
private static final int CONNECT_TIMEOUT = 60_000; // Milliseconds
|
||||
|
||||
public static class EagerSingletons {
|
||||
@Inject
|
||||
FeedManager feedManager;
|
||||
@@ -31,7 +24,10 @@ public class FeedModule {
|
||||
@Singleton
|
||||
FeedManager provideFeedManager(FeedManagerImpl feedManager,
|
||||
LifecycleManager lifecycleManager, EventBus eventBus,
|
||||
BlogManager blogManager) {
|
||||
BlogManager blogManager, FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableBlogsInCore()) {
|
||||
return feedManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(feedManager);
|
||||
eventBus.addListener(feedManager);
|
||||
blogManager.registerRemoveBlogHook(feedManager);
|
||||
@@ -42,26 +38,4 @@ public class FeedModule {
|
||||
FeedFactory provideFeedFactory(FeedFactoryImpl feedFactory) {
|
||||
return feedFactory;
|
||||
}
|
||||
|
||||
// Share an HTTP client instance between requests where possible, while
|
||||
// allowing the client to be garbage-collected between requests. The
|
||||
// provider keeps a weak reference to the last client instance and reuses
|
||||
// the instance until it gets garbage-collected. See
|
||||
// https://medium.com/@leandromazzuquini/if-you-are-using-okhttp-you-should-know-this-61d68e065a2b
|
||||
@Provides
|
||||
@Singleton
|
||||
WeakSingletonProvider<OkHttpClient> provideOkHttpClientProvider(
|
||||
SocketFactory torSocketFactory, Dns noDnsLookups) {
|
||||
return new WeakSingletonProvider<OkHttpClient>() {
|
||||
@Override
|
||||
@Nonnull
|
||||
public OkHttpClient createInstance() {
|
||||
return new OkHttpClient.Builder()
|
||||
.socketFactory(torSocketFactory)
|
||||
.dns(noDnsLookups) // Don't make local DNS lookups
|
||||
.connectTimeout(CONNECT_TIMEOUT, MILLISECONDS)
|
||||
.build();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.forum;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.data.MetadataEncoder;
|
||||
import org.briarproject.bramble.api.sync.validation.ValidationManager;
|
||||
@@ -30,7 +31,11 @@ public class ForumModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
ForumManager provideForumManager(ForumManagerImpl forumManager,
|
||||
ValidationManager validationManager) {
|
||||
ValidationManager validationManager,
|
||||
FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableForumsInCore()) {
|
||||
return forumManager;
|
||||
}
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID, MAJOR_VERSION,
|
||||
forumManager);
|
||||
return forumManager;
|
||||
@@ -51,11 +56,14 @@ public class ForumModule {
|
||||
@Singleton
|
||||
ForumPostValidator provideForumPostValidator(
|
||||
ValidationManager validationManager, ClientHelper clientHelper,
|
||||
MetadataEncoder metadataEncoder, Clock clock) {
|
||||
MetadataEncoder metadataEncoder, Clock clock,
|
||||
FeatureFlags featureFlags) {
|
||||
ForumPostValidator validator = new ForumPostValidator(clientHelper,
|
||||
metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
if (featureFlags.shouldEnableForumsInCore()) {
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -377,6 +377,12 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
respondToIntroduction(contactId, sessionId, accept, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respondToIntroduction(Transaction txn, ContactId contactId,
|
||||
SessionId sessionId, boolean accept) throws DbException {
|
||||
respondToIntroduction(txn, contactId, sessionId, accept, false);
|
||||
}
|
||||
|
||||
private void respondToIntroduction(ContactId contactId, SessionId sessionId,
|
||||
boolean accept, boolean isAutoDecline) throws DbException {
|
||||
db.transaction(false,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.introduction;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.cleanup.CleanupManager;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
@@ -35,12 +36,14 @@ public class IntroductionModule {
|
||||
@Singleton
|
||||
IntroductionValidator provideValidator(ValidationManager validationManager,
|
||||
MessageEncoder messageEncoder, MetadataEncoder metadataEncoder,
|
||||
ClientHelper clientHelper, Clock clock) {
|
||||
ClientHelper clientHelper, Clock clock, FeatureFlags featureFlags) {
|
||||
IntroductionValidator introductionValidator =
|
||||
new IntroductionValidator(messageEncoder, clientHelper,
|
||||
metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
introductionValidator);
|
||||
if (featureFlags.shouldEnableIntroductionsInCore()) {
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
introductionValidator);
|
||||
}
|
||||
return introductionValidator;
|
||||
}
|
||||
|
||||
@@ -52,7 +55,11 @@ public class IntroductionModule {
|
||||
ConversationManager conversationManager,
|
||||
ClientVersioningManager clientVersioningManager,
|
||||
IntroductionManagerImpl introductionManager,
|
||||
CleanupManager cleanupManager) {
|
||||
CleanupManager cleanupManager,
|
||||
FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableIntroductionsInCore()) {
|
||||
return introductionManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(introductionManager);
|
||||
contactManager.registerContactHook(introductionManager);
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID,
|
||||
|
||||
@@ -389,14 +389,13 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
||||
|
||||
@Override
|
||||
public GroupId getConversationId(ContactId c) throws DbException {
|
||||
Contact contact;
|
||||
Transaction txn = db.startTransaction(true);
|
||||
try {
|
||||
contact = db.getContact(txn, c);
|
||||
db.commitTransaction(txn);
|
||||
} finally {
|
||||
db.endTransaction(txn);
|
||||
}
|
||||
return db.transactionWithResult(true,
|
||||
txn -> getConversationId(txn, c));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupId getConversationId(Transaction txn, ContactId c) throws DbException {
|
||||
Contact contact = db.getContact(txn, c);
|
||||
return getContactGroup(contact).getId();
|
||||
}
|
||||
|
||||
@@ -466,8 +465,14 @@ class MessagingManagerImpl implements MessagingManager, IncomingMessageHook,
|
||||
|
||||
@Override
|
||||
public String getMessageText(MessageId m) throws DbException {
|
||||
return db.transactionWithNullableResult(true, txn ->
|
||||
getMessageText(txn, m));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageText(Transaction txn, MessageId m) throws DbException {
|
||||
try {
|
||||
BdfList body = clientHelper.getMessageAsList(m);
|
||||
BdfList body = clientHelper.getMessageAsList(txn, m);
|
||||
if (body.size() == 1) return body.getString(0); // Legacy format
|
||||
else return body.getOptionalString(1);
|
||||
} catch (FormatException e) {
|
||||
|
||||
@@ -287,6 +287,13 @@ class PrivateGroupManagerImpl extends BdfIncomingMessageHook
|
||||
return privateGroups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOurPrivateGroup(Transaction txn, PrivateGroup g)
|
||||
throws DbException {
|
||||
LocalAuthor localAuthor = identityManager.getLocalAuthor(txn);
|
||||
return localAuthor.getId().equals(g.getCreator().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PrivateGroup> getPrivateGroups() throws DbException {
|
||||
return db.transactionWithResult(true, this::getPrivateGroups);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.privategroup;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.data.MetadataEncoder;
|
||||
import org.briarproject.bramble.api.sync.validation.ValidationManager;
|
||||
@@ -32,7 +33,11 @@ public class PrivateGroupModule {
|
||||
@Singleton
|
||||
PrivateGroupManager provideGroupManager(
|
||||
PrivateGroupManagerImpl groupManager,
|
||||
ValidationManager validationManager) {
|
||||
ValidationManager validationManager,
|
||||
FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnablePrivateGroupsInCore()) {
|
||||
return groupManager;
|
||||
}
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID, MAJOR_VERSION,
|
||||
groupManager);
|
||||
return groupManager;
|
||||
@@ -56,12 +61,14 @@ public class PrivateGroupModule {
|
||||
PrivateGroupFactory privateGroupFactory,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock, GroupInvitationFactory groupInvitationFactory,
|
||||
ValidationManager validationManager) {
|
||||
ValidationManager validationManager, FeatureFlags featureFlags) {
|
||||
GroupMessageValidator validator = new GroupMessageValidator(
|
||||
privateGroupFactory, clientHelper, metadataEncoder, clock,
|
||||
groupInvitationFactory);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
if (featureFlags.shouldEnablePrivateGroupsInCore()) {
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,15 +128,59 @@ class GroupInvitationManagerImpl extends ConversationClientImpl
|
||||
// Attach the contact ID to the group
|
||||
clientHelper.setContactId(txn, g.getId(), c.getId());
|
||||
// If the contact belongs to any private groups, create a peer session
|
||||
for (Group pg : db.getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
// or sessions in LEFT state for creator/invitee.
|
||||
for (Group group : db.getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION)) {
|
||||
if (privateGroupManager.isMember(txn, pg.getId(), c.getAuthor()))
|
||||
addingMember(txn, pg.getId(), c);
|
||||
if (privateGroupManager
|
||||
.isMember(txn, group.getId(), c.getAuthor())) {
|
||||
PrivateGroup pg =
|
||||
privateGroupManager.getPrivateGroup(txn, group.getId());
|
||||
recreateSession(txn, c, pg, g.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void recreateSession(Transaction txn, Contact c,
|
||||
PrivateGroup pg, GroupId contactGroupId) throws DbException {
|
||||
boolean isOur = privateGroupManager.isOurPrivateGroup(txn, pg);
|
||||
boolean isTheirs =
|
||||
c.getAuthor().getId().equals(pg.getCreator().getId());
|
||||
if (isOur || isTheirs) {
|
||||
// we are creator or invitee, create a left session for each role
|
||||
MessageId storageId = createStorageId(txn, contactGroupId);
|
||||
Session<?> session;
|
||||
if (isOur) {
|
||||
session = new CreatorSession(contactGroupId, pg.getId(), null,
|
||||
null, 0, 0, CreatorState.LEFT);
|
||||
} else {
|
||||
session = new InviteeSession(contactGroupId, pg.getId(), null,
|
||||
null, 0, 0, InviteeState.LEFT);
|
||||
}
|
||||
try {
|
||||
storeSession(txn, storageId, session);
|
||||
} catch (FormatException e) {
|
||||
throw new DbException(e);
|
||||
}
|
||||
} else {
|
||||
// we are neither creator nor invitee, create peer session
|
||||
addingMember(txn, pg.getId(), c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removingContact(Transaction txn, Contact c) throws DbException {
|
||||
// mark private groups created by that contact as dissolved
|
||||
for (Group g : db.getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION)) {
|
||||
if (privateGroupManager.isMember(txn, g.getId(), c.getAuthor())) {
|
||||
PrivateGroup pg =
|
||||
privateGroupManager.getPrivateGroup(txn, g.getId());
|
||||
// check if contact to be removed is creator of the group
|
||||
if (c.getAuthor().getId().equals(pg.getCreator().getId())) {
|
||||
privateGroupManager.markGroupDissolved(txn, g.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove the contact group (all messages will be removed with it)
|
||||
db.removeGroup(txn, getContactGroup(c));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.privategroup.invitation;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.cleanup.CleanupManager;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
@@ -43,7 +44,10 @@ public class GroupInvitationModule {
|
||||
PrivateGroupManager privateGroupManager,
|
||||
ConversationManager conversationManager,
|
||||
ClientVersioningManager clientVersioningManager,
|
||||
CleanupManager cleanupManager) {
|
||||
CleanupManager cleanupManager, FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnablePrivateGroupsInCore()) {
|
||||
return groupInvitationManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(groupInvitationManager);
|
||||
validationManager.registerIncomingMessageHook(CLIENT_ID, MAJOR_VERSION,
|
||||
groupInvitationManager);
|
||||
@@ -69,12 +73,15 @@ public class GroupInvitationModule {
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock, PrivateGroupFactory privateGroupFactory,
|
||||
MessageEncoder messageEncoder,
|
||||
ValidationManager validationManager) {
|
||||
ValidationManager validationManager,
|
||||
FeatureFlags featureFlags) {
|
||||
GroupInvitationValidator validator = new GroupInvitationValidator(
|
||||
clientHelper, metadataEncoder, clock, privateGroupFactory,
|
||||
messageEncoder);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
if (featureFlags.shouldEnablePrivateGroupsInCore()) {
|
||||
validationManager.registerMessageValidator(CLIENT_ID, MAJOR_VERSION,
|
||||
validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.briar.sharing;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.cleanup.CleanupManager;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.contact.ContactManager;
|
||||
@@ -60,12 +61,15 @@ public class SharingModule {
|
||||
BlogSharingValidator provideBlogSharingValidator(
|
||||
ValidationManager validationManager, MessageEncoder messageEncoder,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock, BlogFactory blogFactory) {
|
||||
Clock clock, BlogFactory blogFactory, FeatureFlags featureFlags) {
|
||||
BlogSharingValidator validator = new BlogSharingValidator(
|
||||
messageEncoder, clientHelper, metadataEncoder, clock,
|
||||
blogFactory);
|
||||
validationManager.registerMessageValidator(BlogSharingManager.CLIENT_ID,
|
||||
BlogSharingManager.MAJOR_VERSION, validator);
|
||||
if (featureFlags.shouldEnableBlogsInCore()) {
|
||||
validationManager.registerMessageValidator(
|
||||
BlogSharingManager.CLIENT_ID,
|
||||
BlogSharingManager.MAJOR_VERSION, validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
@@ -77,7 +81,10 @@ public class SharingModule {
|
||||
ConversationManager conversationManager, BlogManager blogManager,
|
||||
ClientVersioningManager clientVersioningManager,
|
||||
BlogSharingManagerImpl blogSharingManager,
|
||||
CleanupManager cleanupManager) {
|
||||
CleanupManager cleanupManager, FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableBlogsInCore()) {
|
||||
return blogSharingManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(blogSharingManager);
|
||||
contactManager.registerContactHook(blogSharingManager);
|
||||
validationManager.registerIncomingMessageHook(
|
||||
@@ -122,13 +129,15 @@ public class SharingModule {
|
||||
ForumSharingValidator provideForumSharingValidator(
|
||||
ValidationManager validationManager, MessageEncoder messageEncoder,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock, ForumFactory forumFactory) {
|
||||
Clock clock, ForumFactory forumFactory, FeatureFlags featureFlags) {
|
||||
ForumSharingValidator validator = new ForumSharingValidator(
|
||||
messageEncoder, clientHelper, metadataEncoder, clock,
|
||||
forumFactory);
|
||||
validationManager.registerMessageValidator(
|
||||
ForumSharingManager.CLIENT_ID,
|
||||
ForumSharingManager.MAJOR_VERSION, validator);
|
||||
if (featureFlags.shouldEnableForumsInCore()) {
|
||||
validationManager.registerMessageValidator(
|
||||
ForumSharingManager.CLIENT_ID,
|
||||
ForumSharingManager.MAJOR_VERSION, validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
@@ -140,7 +149,10 @@ public class SharingModule {
|
||||
ConversationManager conversationManager, ForumManager forumManager,
|
||||
ClientVersioningManager clientVersioningManager,
|
||||
ForumSharingManagerImpl forumSharingManager,
|
||||
CleanupManager cleanupManager) {
|
||||
CleanupManager cleanupManager, FeatureFlags featureFlags) {
|
||||
if (!featureFlags.shouldEnableForumsInCore()) {
|
||||
return forumSharingManager;
|
||||
}
|
||||
lifecycleManager.registerOpenDatabaseHook(forumSharingManager);
|
||||
contactManager.registerContactHook(forumSharingManager);
|
||||
validationManager.registerIncomingMessageHook(
|
||||
|
||||
@@ -3,13 +3,16 @@ package org.briarproject.briar.attachment;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.data.BdfDictionary;
|
||||
import org.briarproject.bramble.api.data.BdfEntry;
|
||||
import org.briarproject.bramble.api.db.DatabaseComponent;
|
||||
import org.briarproject.bramble.api.db.NoSuchMessageException;
|
||||
import org.briarproject.bramble.api.db.Transaction;
|
||||
import org.briarproject.bramble.api.db.TransactionManager;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.Message;
|
||||
import org.briarproject.bramble.test.BrambleMockTestCase;
|
||||
import org.briarproject.bramble.test.DbExpectations;
|
||||
import org.briarproject.briar.api.attachment.Attachment;
|
||||
import org.briarproject.briar.api.attachment.AttachmentHeader;
|
||||
import org.jmock.Expectations;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -25,6 +28,7 @@ import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
public class AttachmentReaderImplTest extends BrambleMockTestCase {
|
||||
|
||||
private final TransactionManager db = context.mock(DatabaseComponent.class);
|
||||
private final ClientHelper clientHelper = context.mock(ClientHelper.class);
|
||||
|
||||
private final GroupId groupId = new GroupId(getRandomId());
|
||||
@@ -34,7 +38,7 @@ public class AttachmentReaderImplTest extends BrambleMockTestCase {
|
||||
message.getId(), contentType);
|
||||
|
||||
private final AttachmentReaderImpl attachmentReader =
|
||||
new AttachmentReaderImpl(clientHelper);
|
||||
new AttachmentReaderImpl(db, clientHelper);
|
||||
|
||||
@Test(expected = NoSuchMessageException.class)
|
||||
public void testWrongGroup() throws Exception {
|
||||
@@ -42,8 +46,11 @@ public class AttachmentReaderImplTest extends BrambleMockTestCase {
|
||||
AttachmentHeader wrongGroup = new AttachmentHeader(wrongGroupId,
|
||||
message.getId(), contentType);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(clientHelper).getMessage(message.getId());
|
||||
Transaction txn = new Transaction(null, true);
|
||||
|
||||
context.checking(new DbExpectations() {{
|
||||
oneOf(db).transactionWithResult(with(true), withDbCallable(txn));
|
||||
oneOf(clientHelper).getMessage(txn, message.getId());
|
||||
will(returnValue(message));
|
||||
}});
|
||||
|
||||
@@ -74,10 +81,14 @@ public class AttachmentReaderImplTest extends BrambleMockTestCase {
|
||||
}
|
||||
|
||||
private void testInvalidMetadata(BdfDictionary meta) throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(clientHelper).getMessage(message.getId());
|
||||
Transaction txn = new Transaction(null, true);
|
||||
|
||||
context.checking(new DbExpectations() {{
|
||||
oneOf(db).transactionWithResult(with(true), withDbCallable(txn));
|
||||
oneOf(clientHelper).getMessage(txn, message.getId());
|
||||
will(returnValue(message));
|
||||
oneOf(clientHelper).getMessageMetadataAsDictionary(message.getId());
|
||||
oneOf(clientHelper)
|
||||
.getMessageMetadataAsDictionary(txn, message.getId());
|
||||
will(returnValue(meta));
|
||||
}});
|
||||
|
||||
@@ -95,10 +106,14 @@ public class AttachmentReaderImplTest extends BrambleMockTestCase {
|
||||
byte[] expectedData = new byte[body.length - descriptorLength];
|
||||
arraycopy(body, descriptorLength, expectedData, 0, expectedData.length);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(clientHelper).getMessage(message.getId());
|
||||
Transaction txn = new Transaction(null, true);
|
||||
|
||||
context.checking(new DbExpectations() {{
|
||||
oneOf(db).transactionWithResult(with(true), withDbCallable(txn));
|
||||
oneOf(clientHelper).getMessage(txn, message.getId());
|
||||
will(returnValue(message));
|
||||
oneOf(clientHelper).getMessageMetadataAsDictionary(message.getId());
|
||||
oneOf(clientHelper)
|
||||
.getMessageMetadataAsDictionary(txn, message.getId());
|
||||
will(returnValue(meta));
|
||||
}});
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.briar.feed;
|
||||
import com.rometools.rome.feed.synd.SyndEntry;
|
||||
import com.rometools.rome.feed.synd.SyndEntryImpl;
|
||||
|
||||
import org.briarproject.bramble.api.WeakSingletonProvider;
|
||||
import org.briarproject.bramble.api.client.ClientHelper;
|
||||
import org.briarproject.bramble.api.client.ContactGroupFactory;
|
||||
import org.briarproject.bramble.api.data.BdfDictionary;
|
||||
@@ -71,7 +72,7 @@ public class FeedManagerImplTest extends BrambleMockTestCase {
|
||||
new WeakSingletonProvider<OkHttpClient>() {
|
||||
@Override
|
||||
@Nonnull
|
||||
OkHttpClient createInstance() {
|
||||
public OkHttpClient createInstance() {
|
||||
return client;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -709,6 +709,41 @@ public class GroupInvitationIntegrationTest
|
||||
assertTrue(deleteMessages0From1(emptySet()).allDeleted());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvitationAfterReAddingContacts() throws Exception {
|
||||
// sync invitation and response back
|
||||
sendInvitation(c0.getClock().currentTimeMillis(), null);
|
||||
sync0To1(1, true);
|
||||
groupInvitationManager1
|
||||
.respondToInvitation(contactId0From1, privateGroup, true);
|
||||
sync1To0(1, true);
|
||||
|
||||
// sync group join messages
|
||||
sync0To1(2, true); // + one invitation protocol join message
|
||||
sync1To0(1, true);
|
||||
|
||||
// inviting again is not possible
|
||||
assertFalse(groupInvitationManager0
|
||||
.isInvitationAllowed(contact1From0, privateGroup.getId()));
|
||||
|
||||
// contacts remove each other
|
||||
removeAllContacts();
|
||||
|
||||
// group gets dissolved for invitee automatically, but not creator
|
||||
assertFalse(groupManager0.isDissolved(privateGroup.getId()));
|
||||
assertTrue(groupManager1.isDissolved(privateGroup.getId()));
|
||||
|
||||
// contacts re-add each other
|
||||
addDefaultContacts();
|
||||
|
||||
// creator can still not invite again
|
||||
assertFalse(groupInvitationManager0
|
||||
.isInvitationAllowed(contact1From0, privateGroup.getId()));
|
||||
|
||||
// finally invitee can remove group without issues
|
||||
groupManager1.removePrivateGroup(privateGroup.getId());
|
||||
}
|
||||
|
||||
private Collection<ConversationMessageHeader> getMessages1From0()
|
||||
throws DbException {
|
||||
return db0.transactionWithResult(true, txn -> groupInvitationManager0
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.briarproject.briar.api.privategroup.invitation.GroupInvitationRequest
|
||||
import org.briarproject.briar.api.privategroup.invitation.GroupInvitationResponse;
|
||||
import org.jmock.AbstractExpectations;
|
||||
import org.jmock.Expectations;
|
||||
import org.jmock.lib.legacy.ClassImposteriser;
|
||||
import org.jmock.imposters.ByteBuddyClassImposteriser;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -45,6 +45,8 @@ import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static junit.framework.TestCase.fail;
|
||||
import static org.briarproject.bramble.api.sync.Group.Visibility.SHARED;
|
||||
import static org.briarproject.bramble.api.sync.validation.IncomingMessageHook.DeliveryAction.ACCEPT_DO_NOT_SHARE;
|
||||
@@ -106,7 +108,9 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
private final ContactId contactId = contact.getId();
|
||||
private final Group localGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final Group contactGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final Group privateGroup = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final Group group = getGroup(CLIENT_ID, MAJOR_VERSION);
|
||||
private final PrivateGroup privateGroup = new PrivateGroup(group,
|
||||
getRandomString(5), getAuthor(), getRandomBytes(32));
|
||||
private final BdfDictionary meta = BdfDictionary.of(new BdfEntry("m", "e"));
|
||||
private final Message message = getMessage(contactGroup.getId());
|
||||
private final BdfList body = BdfList.of("body");
|
||||
@@ -122,7 +126,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
|
||||
public GroupInvitationManagerImplTest() {
|
||||
context.setImposteriser(ClassImposteriser.INSTANCE);
|
||||
context.setImposteriser(ByteBuddyClassImposteriser.INSTANCE);
|
||||
creatorEngine = context.mock(CreatorProtocolEngine.class);
|
||||
inviteeEngine = context.mock(InviteeProtocolEngine.class);
|
||||
peerEngine = context.mock(PeerProtocolEngine.class);
|
||||
@@ -160,9 +164,9 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
will(returnValue(false));
|
||||
oneOf(db).addGroup(txn, localGroup);
|
||||
oneOf(db).getContacts(txn);
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
}});
|
||||
expectAddingContact(contact);
|
||||
expectAddingContact(contact, emptyList());
|
||||
groupInvitationManager.onDatabaseOpened(txn);
|
||||
}
|
||||
|
||||
@@ -178,7 +182,8 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
groupInvitationManager.onDatabaseOpened(txn);
|
||||
}
|
||||
|
||||
private void expectAddingContact(Contact c) throws Exception {
|
||||
private void expectAddingContact(Contact c, Collection<Group> groups)
|
||||
throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, c);
|
||||
@@ -193,12 +198,8 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
.setContactId(txn, contactGroup.getId(), contactId);
|
||||
oneOf(db).getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION);
|
||||
will(returnValue(Collections.singletonList(privateGroup)));
|
||||
oneOf(privateGroupManager).isMember(txn, privateGroup.getId(),
|
||||
c.getAuthor());
|
||||
will(returnValue(true));
|
||||
will(returnValue(groups));
|
||||
}});
|
||||
expectAddingMember(privateGroup.getId(), c);
|
||||
}
|
||||
|
||||
private void expectAddingMember(GroupId g, Contact c) throws Exception {
|
||||
@@ -252,13 +253,99 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
@Test
|
||||
public void testAddingContact() throws Exception {
|
||||
expectAddingContact(contact);
|
||||
expectAddingContact(contact, singletonList(group));
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(privateGroupManager)
|
||||
.isMember(txn, privateGroup.getId(), contact.getAuthor());
|
||||
will(returnValue(true));
|
||||
oneOf(privateGroupManager)
|
||||
.getPrivateGroup(txn, privateGroup.getId());
|
||||
will(returnValue(privateGroup));
|
||||
oneOf(privateGroupManager).isOurPrivateGroup(txn, privateGroup);
|
||||
will(returnValue(false));
|
||||
}});
|
||||
// creates PEER session
|
||||
expectAddingMember(privateGroup.getId(), contact);
|
||||
|
||||
groupInvitationManager.addingContact(txn, contact);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemovingContact() throws Exception {
|
||||
public void testAddingContactWhoCreatedGroup() throws Exception {
|
||||
PrivateGroup privateGroup = new PrivateGroup(group,
|
||||
getRandomString(5), contact.getAuthor(), getRandomBytes(32));
|
||||
|
||||
expectAddingContact(contact, singletonList(group));
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(privateGroupManager)
|
||||
.isMember(txn, privateGroup.getId(), contact.getAuthor());
|
||||
will(returnValue(true));
|
||||
oneOf(privateGroupManager)
|
||||
.getPrivateGroup(txn, privateGroup.getId());
|
||||
will(returnValue(privateGroup));
|
||||
oneOf(privateGroupManager).isOurPrivateGroup(txn, privateGroup);
|
||||
will(returnValue(false));
|
||||
}});
|
||||
expectCreateStorageId();
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(sessionEncoder)
|
||||
.encodeSession(with(any(InviteeSession.class)));
|
||||
will(returnValue(meta));
|
||||
oneOf(clientHelper)
|
||||
.mergeMessageMetadata(txn, storageMessage.getId(), meta);
|
||||
}});
|
||||
|
||||
groupInvitationManager.addingContact(txn, contact);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemovingContactWithoutCommonGroups() throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION);
|
||||
will(returnValue(emptyList()));
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
oneOf(db).removeGroup(txn, contactGroup);
|
||||
}});
|
||||
groupInvitationManager.removingContact(txn, contact);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemovingContactWithCommonGroups() throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION);
|
||||
will(returnValue(singletonList(group)));
|
||||
oneOf(privateGroupManager).isMember(txn, group.getId(), author);
|
||||
will(returnValue(true));
|
||||
oneOf(privateGroupManager).getPrivateGroup(txn, group.getId());
|
||||
will(returnValue(privateGroup));
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
oneOf(db).removeGroup(txn, contactGroup);
|
||||
}});
|
||||
groupInvitationManager.removingContact(txn, contact);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemovingContactWhoIsCreatorOfCommonGroup()
|
||||
throws Exception {
|
||||
PrivateGroup privateGroup = new PrivateGroup(group,
|
||||
getRandomString(5), contact.getAuthor(), getRandomBytes(32));
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).getGroups(txn, PrivateGroupManager.CLIENT_ID,
|
||||
PrivateGroupManager.MAJOR_VERSION);
|
||||
will(returnValue(singletonList(group)));
|
||||
oneOf(privateGroupManager).isMember(txn, group.getId(), author);
|
||||
will(returnValue(true));
|
||||
oneOf(privateGroupManager).getPrivateGroup(txn, group.getId());
|
||||
will(returnValue(privateGroup));
|
||||
oneOf(privateGroupManager).markGroupDissolved(txn, group.getId());
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
@@ -355,8 +442,8 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
BdfDictionary bdfSession) throws Exception {
|
||||
expectParseMessageMetadata();
|
||||
expectGetSession(oneResult, sessionId, contactGroup.getId());
|
||||
Session<?> session =
|
||||
expectHandleMessage(role, messageMetadata, bdfSession, type);
|
||||
Session<?> session = expectHandleMessage(role, messageMetadata,
|
||||
bdfSession, type);
|
||||
expectStoreSession(session, storageMessage.getId());
|
||||
}
|
||||
|
||||
@@ -569,7 +656,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
@Test
|
||||
public void testAcceptInvitationWithGroupId() throws Exception {
|
||||
PrivateGroup pg = new PrivateGroup(privateGroup,
|
||||
PrivateGroup pg = new PrivateGroup(group,
|
||||
getRandomString(MAX_GROUP_NAME_LENGTH), author,
|
||||
getRandomBytes(GROUP_SALT_LENGTH));
|
||||
|
||||
@@ -579,7 +666,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
@Test
|
||||
public void testDeclineInvitationWithGroupId() throws Exception {
|
||||
PrivateGroup pg = new PrivateGroup(privateGroup,
|
||||
PrivateGroup pg = new PrivateGroup(group,
|
||||
getRandomString(MAX_GROUP_NAME_LENGTH), author,
|
||||
getRandomBytes(GROUP_SALT_LENGTH));
|
||||
|
||||
@@ -670,7 +757,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
privateGroup.getId(), time1, "name", author,
|
||||
new byte[0], null, new byte[0], NO_AUTO_DELETE_TIMER);
|
||||
PrivateGroup pg =
|
||||
new PrivateGroup(privateGroup, invite.getGroupName(),
|
||||
new PrivateGroup(group, invite.getGroupName(),
|
||||
invite.getCreator(), invite.getSalt());
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
@@ -738,7 +825,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
new InviteMessage(message2.getId(), contactGroup.getId(),
|
||||
privateGroup.getId(), time2, groupName, author, salt,
|
||||
null, getRandomBytes(5), NO_AUTO_DELETE_TIMER);
|
||||
PrivateGroup pg = new PrivateGroup(privateGroup, groupName,
|
||||
PrivateGroup pg = new PrivateGroup(group, groupName,
|
||||
author, salt);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
@@ -747,7 +834,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
oneOf(db).startTransaction(true);
|
||||
will(returnValue(txn));
|
||||
oneOf(db).getContacts(txn);
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
oneOf(contactGroupFactory).createContactGroup(CLIENT_ID,
|
||||
MAJOR_VERSION, contact);
|
||||
will(returnValue(contactGroup));
|
||||
@@ -839,7 +926,7 @@ public class GroupInvitationManagerImplTest extends BrambleMockTestCase {
|
||||
expectAddingMember(privateGroup.getId(), contact);
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).getContactsByAuthorId(txn, author.getId());
|
||||
will(returnValue(Collections.singletonList(contact)));
|
||||
will(returnValue(singletonList(contact)));
|
||||
}});
|
||||
groupInvitationManager.addingMember(txn, privateGroup.getId(), author);
|
||||
}
|
||||
|
||||
@@ -291,10 +291,10 @@ public abstract class BriarIntegrationTest<C extends BriarIntegrationTestCompone
|
||||
contactManager0.removeContact(contactId2From0);
|
||||
contactManager1.removeContact(contactId0From1);
|
||||
contactManager2.removeContact(contactId0From2);
|
||||
assertNotNull(contactId2From1);
|
||||
contactManager1.removeContact(contactId2From1);
|
||||
assertNotNull(contactId1From2);
|
||||
contactManager2.removeContact(contactId1From2);
|
||||
if (contactId2From1 != null)
|
||||
contactManager1.removeContact(contactId2From1);
|
||||
if (contactId1From2 != null)
|
||||
contactManager2.removeContact(contactId1From2);
|
||||
}
|
||||
|
||||
protected void setAutoDeleteTimer(BriarIntegrationTestComponent component,
|
||||
|
||||
@@ -58,6 +58,7 @@ void jarFactory(Jar jarTask, jarArchitecture) {
|
||||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
||||
}
|
||||
{
|
||||
it.duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
||||
String[] architectures = ["linux-aarch64", "linux-armhf", "linux-x86_64"]
|
||||
for (String arch : architectures) {
|
||||
if (arch != jarArchitecture) {
|
||||
@@ -111,6 +112,10 @@ task x86LinuxJar(type: Jar) {
|
||||
jarFactory(it, 'linux-x86_64')
|
||||
}
|
||||
|
||||
task linuxJars {
|
||||
dependsOn(aarch64LinuxJar, armhfLinuxJar, x86LinuxJar)
|
||||
}
|
||||
|
||||
// At the moment for non-Android projects we need to explicitly mark the code generated by kapt
|
||||
// as 'generated source code' for correct highlighting and resolve in IDE.
|
||||
idea {
|
||||
|
||||
@@ -107,5 +107,9 @@ internal class HeadlessModule(private val appDir: File) {
|
||||
override fun shouldEnableImageAttachments() = false
|
||||
override fun shouldEnableProfilePictures() = false
|
||||
override fun shouldEnableDisappearingMessages() = false
|
||||
override fun shouldEnableIntroductionsInCore() = false
|
||||
override fun shouldEnablePrivateGroupsInCore() = false
|
||||
override fun shouldEnableForumsInCore() = true
|
||||
override fun shouldEnableBlogsInCore() = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ buildscript {
|
||||
}
|
||||
ext {
|
||||
dagger_version = "2.33"
|
||||
// okhttp 3.12.x is supported until end of 2021, newer versions need minSdk 21
|
||||
okhttp_version = "3.12.13"
|
||||
tor_version = "0.3.5.17"
|
||||
obfs4proxy_version = "0.0.12-dev-40245c4a"
|
||||
junit_version = "4.13.2"
|
||||
|
||||
Reference in New Issue
Block a user