First PoC Ouinet integration
This commit is contained in:
parent
219f0e9873
commit
9311f90fc9
|
@ -14,13 +14,16 @@ if (keyPropsFile.exists()) {
|
||||||
keyProps.load(new FileInputStream(keyPropsFile))
|
keyProps.load(new FileInputStream(keyPropsFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Properties localProperties = new Properties()
|
||||||
|
localProperties.load(rootProject.file('local.properties').newDataInputStream())
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk 32
|
compileSdk 33
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "me.ash.reader"
|
applicationId "me.ash.reader"
|
||||||
minSdk 26
|
minSdk 26
|
||||||
targetSdk 32
|
targetSdk 33
|
||||||
versionCode 15
|
versionCode 15
|
||||||
versionName "0.9.1"
|
versionName "0.9.1"
|
||||||
|
|
||||||
|
@ -37,6 +40,11 @@ android {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buildConfigField "String", "CACHE_PUB_KEY", localProperties['CACHE_PUB_KEY']
|
||||||
|
buildConfigField "String", "INJECTOR_CREDENTIALS", localProperties['INJECTOR_CREDENTIALS']
|
||||||
|
buildConfigField "String", "INJECTOR_TLS_CERT", localProperties['INJECTOR_TLS_CERT']
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "channel"
|
flavorDimensions "channel"
|
||||||
|
@ -186,4 +194,8 @@ dependencies {
|
||||||
testImplementation "junit:junit:4.13.2"
|
testImplementation "junit:junit:4.13.2"
|
||||||
androidTestImplementation "androidx.test.ext:junit:1.1.3"
|
androidTestImplementation "androidx.test.ext:junit:1.1.3"
|
||||||
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
|
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
|
||||||
|
|
||||||
|
// OuiNet integration
|
||||||
|
implementation 'ie.equalit.ouinet:ouinet-x86_64:0.21.3'
|
||||||
|
implementation 'com.getkeepsafe.relinker:relinker:1.4.4'
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ import androidx.profileinstaller.ProfileInstallerInitializer
|
||||||
import coil.ImageLoader
|
import coil.ImageLoader
|
||||||
import coil.compose.LocalImageLoader
|
import coil.compose.LocalImageLoader
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import ie.equalit.ouinet.Ouinet
|
||||||
|
import ie.equalit.ouinet.Config
|
||||||
import me.ash.reader.data.dao.AccountDao
|
import me.ash.reader.data.dao.AccountDao
|
||||||
import me.ash.reader.data.model.preference.AccountSettingsProvider
|
import me.ash.reader.data.model.preference.AccountSettingsProvider
|
||||||
import me.ash.reader.data.model.preference.LanguagesPreference
|
import me.ash.reader.data.model.preference.LanguagesPreference
|
||||||
|
@ -23,6 +25,7 @@ import javax.inject.Inject
|
||||||
*/
|
*/
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
private lateinit var ouinet: Ouinet
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var imageLoader: ImageLoader
|
lateinit var imageLoader: ImageLoader
|
||||||
|
@ -41,6 +44,21 @@ class MainActivity : ComponentActivity() {
|
||||||
it.setLocale(this)
|
it.setLocale(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable OuiNet client
|
||||||
|
val config = Config.ConfigBuilder(this)
|
||||||
|
.setCacheType("bep5-http")
|
||||||
|
.setCacheHttpPubKey(BuildConfig.CACHE_PUB_KEY)
|
||||||
|
.setInjectorCredentials(BuildConfig.INJECTOR_CREDENTIALS)
|
||||||
|
.setInjectorTlsCert(BuildConfig.INJECTOR_TLS_CERT)
|
||||||
|
.setTlsCaCertStorePath("file:///android_asset/cacert.pem")
|
||||||
|
.setDisableOriginAccess(true)
|
||||||
|
//.setDisableProxyAccess(true)
|
||||||
|
//.setDisableInjectorAccess(true)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
ouinet = Ouinet(this, config)
|
||||||
|
ouinet.start()
|
||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalImageLoader provides imageLoader,
|
LocalImageLoader provides imageLoader,
|
||||||
|
|
|
@ -31,6 +31,8 @@ import okhttp3.Cache
|
||||||
import okhttp3.Interceptor
|
import okhttp3.Interceptor
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import java.net.Proxy
|
||||||
|
import java.net.InetSocketAddress
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.security.KeyManagementException
|
import java.security.KeyManagementException
|
||||||
import java.security.NoSuchAlgorithmException
|
import java.security.NoSuchAlgorithmException
|
||||||
|
@ -67,7 +69,8 @@ fun cachingHttpClient(
|
||||||
connectTimeoutSecs: Long = 30L,
|
connectTimeoutSecs: Long = 30L,
|
||||||
readTimeoutSecs: Long = 30L,
|
readTimeoutSecs: Long = 30L,
|
||||||
): OkHttpClient {
|
): OkHttpClient {
|
||||||
val builder: OkHttpClient.Builder = OkHttpClient.Builder()
|
val ouinetService = Proxy(Proxy.Type.HTTP, InetSocketAddress("127.0.0.1", 8077))
|
||||||
|
val builder: OkHttpClient.Builder = OkHttpClient.Builder().proxy(ouinetService)
|
||||||
|
|
||||||
if (cacheDirectory != null) {
|
if (cacheDirectory != null) {
|
||||||
builder.cache(Cache(cacheDirectory, cacheSize))
|
builder.cache(Cache(cacheDirectory, cacheSize))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user